[Interest] Vertical QSlider groove filled incorrectly in Android Qt 5.4

Victor Romero romerosanchezv at gmail.com
Thu Apr 23 20:24:50 CEST 2015


Hi.

Lately I've been working on an Android application using the native Android
style available in Qt 5.4 as described in:
http://blog.qt.io/blog/2014/12/03/native-android-style-in-qt-5-4/

Everything has been working fine with the exception of QSlider.
When using a QSlider horizontally the groove is filled from left to right
with the minimum value on the left and the maximum value on the right, like
this:

0 =========[]-------- 100

And that's fine.

But when you set the QSlider to vertical position the groove is filled from
top to bottom; this is really counter-intuitive for the user, as you would
expect the groove to be filled from the minimum to the maximum.

 100  #
      #
      #
      #
     [ ]
      |
      |
      |
   0  |


This seems to only happen when using the Android style, as I have
cross-compiled the code to work as a windows applications and there the
slider is drawn correctly.
I have attached pictures of the same code running on Windows and Android
where you can appreciate the behavior.

I have tried using the function setInvertedAppearance() but that doesn't
have the required effect.
Also I have tried overriding the paintEvent() function and using
QStylePainter::drawComplexControl to draw the slider using a custom
QStyleOptionSlider object (changing its upsideDown and direction
properties) but that didn't work either.

Does anyone know what causes this to happen? Or how could I make it so that
the QSliders appear in Android like they do in Windows?

---
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150423/45e14757/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsliders-android.png
Type: image/png
Size: 28882 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150423/45e14757/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qsliders-windows.png
Type: image/png
Size: 24178 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150423/45e14757/attachment-0001.png>


More information about the Interest mailing list