[Development] Proposal to deprecate the amazing QApplication::globalStrut

Uwe Rathmann Uwe.Rathmann at tigertal.de
Thu Dec 5 09:14:48 CET 2019


On 12/4/19 4:07 PM, Volker Hilsheimer wrote:

> That’s cool! Sadly, many of our widgets (for instance, none of the 
> item views), and none of our quick controls respect the globalStrut 
> property.

QApplication is about widgets, while Qt/Quick is usually QGuiApplication
and should be no argument here. Adjusting the itemViews to respect the
globalStrut should be no big deal - IIRC I did this once by overloading
QItemDelegate::sizeHint.

> Application UIs are anyway designed for touch if they are for 
> devices; trying to make desktop UI concepts and widget sets work for 
> touch UIs is fortunately a thing of the past.

I agree, that not many projects will start on embedded devices with
Qt/Widgets nowadays - the only motivation I can imagine might be
avoiding QML.

But there is a lot of legacy code and migrating it to a more recent
version of Qt is not the past.

F.e our previous generation of terminals is done by tweaking the windows
style and is also using globalStrut. Without it things would be harder -
probably not possible without patching the implementation of the windows
style.

> So, even if it were done more thoroughly, I think a toolkit-specific 
> “strut configuration” is no longer a sensible approach.

Unfortunately the session about styles at the QtCS (
https://wiki.qt.io/Qt_Contributors_Summit_2019_Program#Future_of_QStyle_for_widgets_and_controls
) had been moved to a time slot where I had already left.

One thing I had planned to mention is that I consider the whole styling
concept you have in Qt today as a thing of the past for embedded UIs.
All user interfaces I have worked on in the recent years consist to
30-50% of custom controls - and the requirement of being able to style
them is beyond the concept of QStyle and friends.

F.e think about QPalette - what is even used for QC2. This might have
been good enough for desktop applications and its limited set of
widgets, but not for the variety of fancy controls you find on embedded UIs.

But the problem of how to make 3rd party controls "stylable" goes back
to the very beginning of QStyle - I never had a solution for my Qwt widgets.

Uwe





More information about the Development mailing list