In the screenshot below, the desktop/Breeze-looking scrollbar it’s actually a control coming from QtQuickControls2.
Since one of the goals of Kirigami is to support also desktop applications, while working on Kirigami 2 (that is mostly porting it to be based on top of QtQuickControls2) I had the need for it to continue to integrate with desktop applications as well.
Unfortunately, desktops are not the primary target for QtQuickcontrls2, and while in Qt 5.9 some much needed desktop-related features, such as mouseover effects are getting back in, being as unrecognizable as possible with QWidget-based applications is definitely not in the roadmap.
Luckily, theming QQC2 is easy, so I’ve started a QtQuickControls2 style that integrates with desktop QStyle-based widgets (actually, based upon the QtQuickControls1 QStyle painter machinery).
If we are serious in using QtQuickControls2 in applications shipped together Plasma, we also must make sure they integrate well with the Plasma desktop’s Breeze look and feel.
I started by theming the scrollbar because I felt it was one of the hardest controls to do.
in QtQuickControls2 the scrollbars are supposed to be an attached property of flickables..
This is pretty simple for the mobile use case, turns out it’s a nightmare to create scrollbars that behave like we are used to in the desktop (unless you’re on mac, which insists to look more and more like iOS), which need to be
- always visible
- have optional little arrow buttons for increment/decrenent
- be besides the flickable, not overlapping the contents, because again, they’re always visible
- use the global desktop theme
I’ve been able to do all of the following, tough it’s necessary to reintroduce the QtQuickcontrols1 component called ScrollView (which imo was a mistake to remove in QtQuickControls2) which can correctly lay out and size the Flickable relative to its ScrollBar.
Hopefully, you’ll be soon able to build an application with QtQuickcontrols2 and Kirigami2 that feels right at home in a Plasma desktop.
What about Plasma-themed QQC2 controls for plasmoids? that will come too, of course!
I wish you it really was the hardest one and the rest will be easier. Nice work!
I wonder, whether having scrollbars always visible makes sense… The “mobile” behaviour (i.e. show the scrollbar only when scrolling, or in desktop mode also on hover) seems cleaner to me. OTOH I guess this is not the right place to discuss this 🙂
Anyway, your screenshot really looks nice, great work!
Pingback: Links 10/10/2016: GNOME 3.24 With ownCloud Integration, Bodhi Linux 4.0.0 Beta | Techrights
Hi Marco,
We’ve been building QQC2 from the bottom up. It’s too early to say that anything would have been removed. While we’re getting the basic building blocks better and better covered, the abstraction level moves higher and higher up.
After what happened with ScrollView in QQC1, it was clear that we needed to start with simple scrollbars that were usable as standalone controls. Putting these simple standalone building blocks together to build more complex composite types is far less problematic than trying to untangle something like the monolithic QCC1 ScrollView implementation, right? By the way, have you thought about contributing your ScrollView implementation to QQC2? There are so many things we’d like to have, but the team has limited capacity.
What comes to the style, would it be possible to implement it in a way that is more compatible with the Qt Quick scene graph? I mean, without QStyle, using Qt Quick primitives. It could share the same theming engine with the widgets style.
> By the way, have you thought about contributing your ScrollView implementation to QQC2?
So far, it’s just a small private class, so I don’t know yet if would really be worth it…
The main thing that it does, is to resize the Flickable to leave room for scrollbars and move the scrollbars in that empty area. Then, our designers are not 100% sure if they still want this scrollbar layout even on desktops, so will have to wait.. If it ends up being something that we feel is really central, I’ll submit it to QtQuickControls2 for sure 🙂
> What comes to the style, would it be possible to implement it in a way that is more compatible with the Qt Quick scene graph? I mean, without QStyle, using Qt Quick primitives. It could share the same theming engine with the widgets style.
Thing is, on one hand our widget style is still purely qstyle/qpainter based, so the theming engine is the qstyle (that is still the most efficient way for qwidgets) on the other hand, we still want to support people using different qstyles in their desktop, so it needs to integrate with them at least to a certain extent.
The QStyleItem done for QtQuickControls 1 is maybe not the most efficient thing in the world (as after all being qstyle is still based on qpainter, but not really expecting of doing things like animating the resize of a button…) and still requires a QApplication, but for desktop apps that as far i understand a QApplication would still be needed anyways for the new platform types such as menubar, color picker etc.
So all considered, I still think for the time being we still needa style based on qstyle for applications within Plasma desktop, not a beauty queen but the best option for the immediate future
Hi
this is not the post for it, but it will serve it’s purpose 🙂
After Thomas mentioning it at
https://sessellift.wordpress.com/2014/04/02/choose-your-own-experience-this-time-its-for-real/#comment-1766
I would like to thank you for developing the Look and Feel feature for Plasma 5.8. It’s a GREAT ADDICTION!!!