:right-sidebar: True StringSorter =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: StringSorter(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Sorter`, :class:`~gi.repository.GObject.Object` :Constructors: :: StringSorter(**properties) new(expression:Gtk.Expression=None) -> Gtk.StringSorter Constructors ------------ .. rst-class:: interim-class .. class:: StringSorter :no-index: .. classmethod:: new(expression: ~gi.repository.Gtk.Expression | None = None) -> ~gi.repository.Gtk.StringSorter Creates a new string sorter that compares items using the given ``expression``. Unless an expression is set on it, this sorter will always compare items as invalid. :param expression: The expression to evaluate Methods ------- .. rst-class:: interim-class .. class:: StringSorter :no-index: .. method:: get_collation() -> ~gi.repository.Gtk.Collation Gets which collation method the sorter uses. .. versionadded:: 4.10 .. method:: get_expression() -> ~gi.repository.Gtk.Expression | None Gets the expression that is evaluated to obtain strings from items. .. method:: get_ignore_case() -> bool Gets whether the sorter ignores case differences. .. method:: set_collation(collation: ~gi.repository.Gtk.Collation) -> None Sets the collation method to use for sorting. .. versionadded:: 4.10 :param collation: the collation method .. method:: set_expression(expression: ~gi.repository.Gtk.Expression | None = None) -> None Sets the expression that is evaluated to obtain strings from items. The expression must have the type :obj:`str`. :param expression: a ``GtkExpression`` .. method:: set_ignore_case(ignore_case: bool) -> None Sets whether the sorter will ignore case differences. :param ignore_case: :const:`True` to ignore case differences Properties ---------- .. rst-class:: interim-class .. class:: StringSorter :no-index: .. attribute:: props.collation :type: ~gi.repository.Gtk.Collation The collation method to use for sorting. The ``GTK_COLLATION_NONE`` value is useful when the expression already returns collation keys, or strings that need to be compared byte-by-byte. The default value, ``GTK_COLLATION_UNICODE``, compares strings according to the `Unicode collation algorithm `_. .. versionadded:: 4.10 .. attribute:: props.expression :type: ~gi.repository.Gtk.Expression The expression to evaluate on item to get a string to compare with. .. attribute:: props.ignore_case :type: bool If sorting is case sensitive.