: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` ``GtkStringSorter`` is a ``GtkSorter`` that compares strings. It does the comparison in a linguistically correct way using the current locale by normalizing Unicode strings and possibly case-folding them before performing the comparison. To obtain the strings to compare, this sorter evaluates a :obj:`~gi.repository.Gtk.Expression`\. 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 type of the None singleton. .. versionadded:: 4.10 .. attribute:: props.expression :type: ~gi.repository.Gtk.Expression The type of the None singleton. .. attribute:: props.ignore_case :type: bool The type of the None singleton.