Skip to content

tree_items

_tree_items

Tree widget items with natural sorting.

Classes:

Name Description
FXSortedTreeWidgetItem

Custom QTreeWidgetItem that provides natural sorting for strings

Classes

FXSortedTreeWidgetItem

Bases: QTreeWidgetItem


              flowchart TD
              fxgui.fxwidgets._tree_items.FXSortedTreeWidgetItem[FXSortedTreeWidgetItem]

              

              click fxgui.fxwidgets._tree_items.FXSortedTreeWidgetItem href "" "fxgui.fxwidgets._tree_items.FXSortedTreeWidgetItem"
            

Custom QTreeWidgetItem that provides natural sorting for strings containing numbers. This is useful for sorting items like version numbers or other strings where numeric parts should be ordered numerically.

For example, this class will sort the following strings in the correct human-friendly order:

  • "something1"
  • "something9"
  • "something17"
  • "something25"

Instead of the default sorting order:

  • "something1"
  • "something17"
  • "something25"
  • "something9"

Methods:

Name Description
__lt__

Override the less-than operator to provide a custom sorting logic.

Functions
__lt__

Override the less-than operator to provide a custom sorting logic.

Parameters:

Name Type Description Default
other FXSortedTreeWidgetItem

Another instance of FXSortedTreeWidgetItem to compare with.

required

Returns:

Type Description
bool

True if the current item is less than the other item according to

bool

the natural sort order, False otherwise.