Bug 297807

Summary: Sorting arrows are upside down everywhere
Product: [Plasma] Oxygen Reporter: aditsu <aditsu>
Component: styleAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Severity: wishlist CC: cfeck, hugo.pereira.da.costa, null
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description aditsu 2012-04-09 23:08:00 UTC
In all kde programs I've ever seen, the most obvious example being dolphin, a down arrow is used to indicate ascending order and an up arrow is used to indicate descending order. That is obviously wrong - it should be the opposite way.
Now I understand that many people prefer it this way, and many other people got used to it, but even after 5 years of using only Linux and KDE, it still pisses me off to no end. Therefore I am requesting a system-wide option (disabled by default) to reverse the arrows.
Comment 1 Christoph Feck 2012-04-09 23:50:17 UTC
Do you see the same issue with pure Qt applications? Does settings the widget style to Plastique or another style make any difference?
Comment 2 aditsu 2012-04-10 00:06:24 UTC
It's the same for example in qtoctave. But wow, setting the widget style to Plastique seems to fix the arrow direction. Strange, I don't remember it being correct in kde 3.5.
So does that mean one can potentially modify the Oxygen style to reverse the arrows?
Comment 3 Christoph Feck 2012-04-11 10:48:50 UTC
Originally, the arrow for the sort order was showing the graphical direction in which the entries are ordered. For example, when using alphabetical order, the arrow was pointing from A (the topmost entry) down to Z (at the bottom).

Then someone was confused about that graphical direction, and changed it to mean the linguistic direction. We say "ascending" order when we mean A to Z, and accordingly, the arrow now points up under that meaning.

Due to this confusion, there are actually bugs in many Qt applications. The Qt API uses both "ascending/descending" as well as "up/down" ways to describe the sort order or arrow direction, leading to bugs such as applications initally showing the wrong sort order.

The Qt style has the final say about how the arrow should look, and some styles, such as Plastique, use the "linguistic" meaning, some others (Oxygen, Skulpture), use the "geometric" meaning.

Due to this confusion, I agree that the arrow direction should be configurable, but Oxygen maintainers have the final word.
Comment 4 aditsu 2012-04-12 12:39:03 UTC
Thanks for the analysis. The linguistic direction also has a graphical meaning: if the arrow is wider at the top, the items larger in the sort order are listed at the top, and vice-versa.
I hope some sort of solution can be found to satisfy both preferences.
In the meantime, could you give me some guidance how to go about modifying the oxygen style to swap the sorting icons? Mainly where to find the related files. Recompiling code (if needed) is not a problem.
Comment 5 Hugo Pereira Da Costa 2012-04-27 13:12:07 UTC
Well, to be honest, Oxygen follows Qt  Guidelines here
in drawPrimitive( PE_IndicatorHeaderArrow ): 

if( flags&State_UpArrow || ( headerOpt && headerOpt->sortIndicator==QStyleOptionHeader::SortUp ) ) orientation = ArrowUp;
else if( flags&State_DownArrow || ( headerOpt && headerOpt->sortIndicator==QStyleOptionHeader::SortDown ) ) orientation = ArrowDown;

So. There is no mention of ascending/descending in the options (from flags nor options); just about Up and Down, and we draw, well, ArrowUp and ArrowDown.

Since Qt uses (in for instance QHeaderView::setSortOrder, the Qt::AscendingOrder/Qt::DescendingOrder, 
I figure it takes the responsibility to convert it into the Up and Down above. 

Although technically it is doable to add an option to invert the order about, I'm not really convinced of the relevance of the use case ... Maybe I can add a hidden option to do this (to add manually inside oxygenrc), but I do not want to clutter the Settings UI with this ... 
(especially if on top of this there are inconsistencies between applications anyway)

Christoph ? Aditsu ? Opinions ?
Comment 6 Hugo Pereira Da Costa 2012-04-27 13:12:34 UTC
Btw, not even sure how I should call the option.
Comment 7 Christoph Feck 2012-04-27 16:21:12 UTC
Hugo, if you want to take Qt as a reference, check qcommonstyle.cpp, line 432+. It renders an arrow pointing *down* for "QStyleOptionHeader::SortUp" (and vice versa), so all unthemed Qt styles render it differently than Oxygen.

I do not want to argue which is right or wrong, but you should be aware the Windows changed the direction of the arrow since XP, and (parts of) Qt followed since then, so most users that migrate to KDE might be confused with Oxygen's current representation.

The fact that Skulpture also uses the old representation simply means I refused to make the change, but I never had someone complaining that it is different in other Qt styles, probably because it was same in pre-XP days.
Comment 8 Christoph Feck 2012-04-27 16:35:17 UTC
Regarding the option name, I would use


and users can change it to false when they are not used to the traditional meaning.
Comment 9 aditsu 2012-04-27 17:53:58 UTC
(In reply to comment #7)
> Windows changed the direction of the arrow since XP

I was really surprised by this, so I searched for some windows explorer images to verify. It looks like 95 and 98 didn't have sorting arrows, and 2000 used the same direction as XP: http://rubenerd.com/uploads/screenie.win2k.drives.png and http://withfriendship.com/images/e/24235/back-to-windows-file-explorer.gif
Do you have some contrary evidence?

(In reply to comment #5)
About the option to invert the order, I guess I'm happy with a hidden option, as long as I can change it without too much effort. I'm not sure what it should be named, I was thinking "ReverseSortingIcons" or something like that, or perhaps "UseUpArrowForAscendingOrder". I don't mind "TraditionalSortIndicator" either.
Comment 10 aditsu 2012-04-27 17:54:49 UTC
Another point is about the icons themselves: we're talking about arrows, but they're seldom actual arrows. They're usually triangles, or in the case of Oxygen, angles. If they were really arrows, it would be harder to make the "wider at the top/bottom" argument, and easier to make the "direction" argument.

For the record, Mozilla and GTK apps seem to use [by default] the same direction as Oxygen (which looks wrong to me), while Eclipse and Yahoo Mail use the other direction.
Comment 11 Christoph Feck 2012-04-28 01:42:43 UTC
See also discussions here:
which links to:

Since I do not want to read comments about this "bug" for the next 8(!) years, I really suggest to add an option, ideally exposed in the UI. Maybe even change the default to match what the Windows/Mac world is doing?

> Do you have some contrary evidence?

No, I just remember that I was highly confused about the "wrong" arrow direction when I first used an XP system. Either it was different before, or not present at all. Additionally, I remember the commits to Qt, that changed the behavior "to match XP" (without reflecting the changes in the API). Unfortunately, the current git repository does not contain the logs for those commits, it only starts with Qt 4.5 history.
Comment 12 Hugo Pereira Da Costa 2012-04-29 09:40:03 UTC
To Christoph
Agreed. I was planning to check what gtk, OSX, Windows was doing, adopt the majority, and add the option.
Will do next week. Easy enough.
Comment 13 aditsu 2012-04-29 23:40:22 UTC
(In reply to comment #11)
> I do not want to read comments about this "bug" for the next 8(!) years

Haha, that's the way they seem to do things at Mozilla. KDE people are generally more responsive (except a few projects), kudos :)
Anyway, flexibility and customizability are very much in the spirit of KDE.
One point to consider - if you change the default icon direction, it will likely alienate a lot of existing users (at least until they find the option to reverse). Proceed with caution.
Comment 14 Hugo Pereira Da Costa 2012-04-30 17:46:19 UTC
Git commit f3c8f68f2d60803d7c0d855f5fed03617cb36e3a by Hugo Pereira Da Costa.
Committed on 30/04/2012 at 10:20.
Pushed by hpereiradacosta into branch 'gtk3'.

added option "ViewInvertSortIndicator" to inverse the tree view sort indicator arrow direction.

M  +4    -0    src/oxygenqtsettings.cpp
M  +7    -0    src/oxygenqtsettings.h
M  +19   -13   src/oxygenthemingengine.cpp

Comment 15 Hugo Pereira Da Costa 2012-04-30 17:46:34 UTC
Git commit d9647a0884d584bb552e123d11b1d20ba0ddf606 by Hugo Pereira Da Costa.
Committed on 30/04/2012 at 10:20.
Pushed by hpereiradacosta into branch 'master'.

added option "ViewInvertSortIndicator" to inverse the tree view sort indicator arrow direction.

M  +4    -0    src/oxygenqtsettings.cpp
M  +7    -0    src/oxygenqtsettings.h
M  +17   -11   src/oxygenstylewrapper.cpp

Comment 16 Hugo Pereira Da Costa 2012-04-30 17:46:56 UTC
Git commit 51846759afca343af79604d28fd40982b2c0b0e3 by Hugo Pereira Da Costa.
Committed on 30/04/2012 at 09:46.
Pushed by hpereiradacosta into branch 'master'.

added option "ViewInvertSortIndicator" to inverse the tree view sort indicator arrow direction.

M  +4    -0    kstyles/oxygen/oxygen.kcfg
M  +3    -0    kstyles/oxygen/oxygenstyle.cpp

Comment 17 Hugo Pereira Da Costa 2012-04-30 17:50:48 UTC
Soo ...
in the end, I decided not to change the default arrow orientation (the current one), because gtk uses the same
(see thunderbird on linux for instance)

I added an hidden option for advanced user to change it though.
Just add "ViewInvertSortIndicator=true"
to your $HOME/.kde/share/config/oxygenrc (under [Style] section), and done.

Also updated oxygen-gtk and oxygen-gtk3 to read this setting.
This will only be released with KDE 4.9 though.

Cheers and thanks for posting,

Comment 18 aditsu 2013-02-23 12:50:50 UTC
Thank you, I can confirm that the new option works for Oxygen. What if I want the same thing for another style, such as Cleanlooks?
Comment 19 aditsu 2013-02-23 14:50:33 UTC
To answer my own question: I filed a bug report at qt-project.org
Comment 20 Christoph Feck 2015-12-05 14:45:07 UTC
*** Bug 356305 has been marked as a duplicate of this bug. ***