Bug 321872

Summary: CPU Load Column Sort is backwards
Product: [Unmaintained] ksysguard Reporter: John Andersen <jsamyth>
Component: ksysguardAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: cfeck, richard.llom
Priority: NOR    
Version First Reported In: 4.10.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description John Andersen 2013-07-02 19:52:32 UTC
Sorting CPU load from smallest to highest (up arrow shown in column header) actually shows usage sorted from highest on top to lowest at bottom).  
Column headers are simple reversed.

Reproducible: Always

Steps to Reproduce:
1. Launch ksusguard
2. click CPU load column header till Down Arrow shows requesting largest load on top to smallest load at bottom
3.
Actual Results:  
Highest load items are not sorted to top

Expected Results:  
Highest load items should be on top
Comment 1 Christoph Feck 2013-07-02 21:07:42 UTC
I guess that's intentional and expected. If you click on a column, for example the column to sort by memory size, you are usually interested to see the processes consuming most memory on the top.

So the default sort order is the "expected" order, and clicking on the column header twice instead of once makes it sort in the "reverse" order.
Comment 2 John Andersen 2013-07-02 21:13:58 UTC
The Arrow (sort order indicator) in the column header should indicate the sort order regardless of what one feels the user might be interested in.  This has nothing at all to do with what is the default order.  Its all about the indicators in the column headings.

The Arrow (sort order indicator) for the Name column and the User column work properly.
The sort order indicators for the numeric columns (CPU, Memory and shared Memory) are reversed.
Comment 3 Christoph Feck 2013-07-03 01:40:56 UTC
That's a limitation by the Qt library. If you click on a column once, it always sets the sorting to ascending order. If you want descending order as the default (primary) order, the programmer has to reverse the comparisons internally.
Comment 4 John Andersen 2013-07-03 01:54:04 UTC
It is not a limitation of the library. It is simply programmer forgetfulness.

Which is exactly why I filed the bug report, so that the programmer can be clued in to the need to do this.  Dolphin gets it right, there is no reason System Monitor can't get it right.

Its a minor bug, which certainly doesn't need to be cleaned up right away.  But by the same token we don't need people saying its a limitation of the library.

It is clear you do not understand the issue here.  I urge you to re-read the bug report.
When the column sort order says it is ascending, it is actually descending and vise versa.
Comment 5 Christoph Feck 2013-07-03 02:23:39 UTC
Dolphin does not use QHeaderView, but has a custom class.
Comment 6 Christoph Feck 2013-07-03 02:27:03 UTC
(... but I don't see Dolphin doing it differently, clicking on a section header it sorts with arrow pointing down, regardless of which column you click. If you click a second time, the arrow points up, and you get the reverse order.)
Comment 7 Christoph Feck 2013-07-03 02:31:52 UTC
Actually, by your reasoning, Dolphin has the same bug.

Clicking on the size column (once), it sorts numerically from smaller to larger numbers.

Clicking on the date column, it sorts from newest to olders, i.e. numerically from larger to smaller numbers, but this has been done because it is the expected behavior. Otherwise would have to click twice on the date column.
Comment 8 Christoph Feck 2013-07-03 02:34:28 UTC
Scratch the last comment, that's because of my local patch in kdelibs, making newest to oldest the default sorting order.
Comment 9 Christoph Feck 2013-07-03 02:58:37 UTC
You are right, since Qt 4.8 the library no longer has this limitation. Actually, John (current maintainer of KSysguard) contributed to the new Qt::InitialSortOrderRole to be able to fix this bug.

See http://qt.gitorious.org/qt/qt/merge_requests/814
Comment 10 Richard Llom 2019-03-11 18:26:29 UTC
The Arrow (sort order indicator) correctly display the sorting in v 5.15.

Closing as FIXED