Skip to content

Collator

Qt Base Class: QCollator

Signature: QCollator(self) -> None QCollator(self, arg__1: PySide6.QtCore.QCollator) -> None QCollator(self, locale: Union[PySide6.QtCore.QLocale, PySide6.QtCore.QLocale.Language]) -> None

Base classes

Name Children Inherits
QCollator
PySide6.QtCore
QCollator(self) -> None

⋔ Inheritance diagram

graph TD
  1473299913600["core.Collator"]
  1473288972048["QtCore.QCollator"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473288972048 --> 1473299913600
  1473291690208 --> 1473288972048
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QCollator

Compares strings according to a localized collation algorithm.

Source code in prettyqt\core\collator.py
class Collator(core.QCollator):
    """Compares strings according to a localized collation algorithm."""

    def __repr__(self):
        return get_repr(self, self.get_locale())

    def get_locale(self) -> core.Locale:
        return core.Locale(self.locale())

    def set_case_sensitive(self, state: bool):
        """Set case sensitivity.

        Args:
            state: case sensitive

        """
        sensitivity = (
            constants.CaseSensitivity.CaseSensitive
            if state
            else constants.CaseSensitivity.CaseInsensitive
        )
        self.setCaseSensitivity(sensitivity)

    def is_case_sensitive(self) -> bool:
        """Return case sensitivity.

        Returns:
            case sensitivity
        """
        return bool(self.caseSensitivity())

    def get_sort_key(self, string: str) -> core.CollatorSortKey:
        return core.CollatorSortKey(self.sortKey(string))

is_case_sensitive() -> bool

Return case sensitivity.

Source code in prettyqt\core\collator.py
def is_case_sensitive(self) -> bool:
    """Return case sensitivity.

    Returns:
        case sensitivity
    """
    return bool(self.caseSensitivity())

set_case_sensitive(state: bool)

Set case sensitivity.

Parameters:

Name Type Description Default
state bool

case sensitive

required
Source code in prettyqt\core\collator.py
def set_case_sensitive(self, state: bool):
    """Set case sensitivity.

    Args:
        state: case sensitive

    """
    sensitivity = (
        constants.CaseSensitivity.CaseSensitive
        if state
        else constants.CaseSensitivity.CaseInsensitive
    )
    self.setCaseSensitivity(sensitivity)