Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.1
-
None
-
Qt 5.9.1
Generic Linux (Ubuntu 16.04.2 LTS)
Generic Android (Android 6.0.1 on a Samsung Galaxy S5 Neo)
-
63d08003cf06b84b871618ba800a7079ae6bf702
Description
When using QTreeView, there appears to be no way to set the size of the disclosure widget (the rotating triangle at the left that shows whether branches are expanded or collapsed), at least in the Fusion style.
The result is that the triangles can appear very small on high-DPI touchscreens, and so be very hard to touch accurately. Attached is a screenshot from Linux at 96 DPI (fine) and Android at 216 DPI (tiny) - the font sizes are corrected for DPI, and in both cases the arrow is about 9 px high, so that's about 2.4mm on the 96dpi monitor (when it doesn't really matter because the user has a mouse) and about 1mm on the 216dpi touchscreen, when it really does.
The arrow is set by
arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation);
at line 531 of qfusionstyle.cpp.
This section doesn't call its proxy(), so there's no way that I can see to use a QProxyStyle to alter this behaviour. Indeed, if you apply a proxy style whose drawPrimitive() function does nothing when its element is one of QStyle::PE_IndicatorArrowUp, QStyle::PE_IndicatorArrowDown, QStyle::PE_IndicatorArrowRight, or QStyle::PE_IndicatorArrowLeft, it is called occasionally but never, it seems, in a critical way (because doing nothing doesn't prevent the arrows being drawn). Nor is there any call to the style's proxy() in the preceding drawPrimitive call with PE_IndicatorBranch, which decides which version of the arrow to draw.
Moreover, the arrow size is forced to the minimum of the image size and the available space, if I read it right, around lines 535-542 of qfusionstyle.cpp.
Nor does setting a custom delegate on the QTreeView appear to provide anything useful.
I would like to be able to set the arrow programmatically (from C++, not stylesheets), as the DPI setting is known only at runtime. Am I missing something? Thank you!
Attachments
Issue Links
- relates to
-
QTBUG-40277 Adapt styles to High DPI
- Closed