improved sorting of WorkspaceWidget

Create issue
Issue #104 resolved
M. Gronle created an issue

If a workspaceWidget displays a list with more than 10 items, they are sorted in a wrong order: [1,10,11,12,2,3,4,5,6,7,8,9] for 12 items.

This can be improved by deriving from QTreeWidgetItem and overloading the comparison operator< (see https://stackoverflow.com/questions/363200/is-it-possible-to-sort-numbers-in-a-qtreewidget-column). Then create an instance of this derived class in workspaceWidget.cpp, line 279.

In the overloaded operator<, test if both texts of element A and B can be converted to int/float. If so, compare their numbers, else use the default string-based comparison.

Comments (1)

  1. M. Gronle reporter

    fixes issue #104: corrected ascending or descending sorting of elements in the workspaceWidget if values in variable name column are numbers, represented as texts. Therefore "10" should follow "2" instead of the text-based comparison.

    → <<cset 91b90a6e6d61>>

  2. Log in to comment