{"id":6558,"date":"2016-10-07T15:04:48","date_gmt":"2016-10-07T15:04:48","guid":{"rendered":"http:\/\/notmart.org\/blog\/?p=6558"},"modified":"2016-10-07T15:04:48","modified_gmt":"2016-10-07T15:04:48","slug":"qtquickcontrols2-and-desktop-apps","status":"publish","type":"post","link":"https:\/\/notmart.org\/blog\/2016\/10\/qtquickcontrols2-and-desktop-apps\/","title":{"rendered":"QtQuickControls2 and Desktop apps"},"content":{"rendered":"<p>In the screenshot below, the desktop\/Breeze-looking scrollbar it&#8217;s actually a control coming from QtQuickControls2.<br \/>\n<a href=\"http:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179-300x192.png\" alt=\"spectacle-c13179\" width=\"300\" height=\"192\" class=\"aligncenter size-medium wp-image-6559\" srcset=\"https:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179-300x192.png 300w, https:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179-768x491.png 768w, https:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179-624x399.png 624w, https:\/\/notmart.org\/blog\/wp-content\/uploads\/2016\/10\/Spectacle.c13179.png 972w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Since one of the goals of Kirigami is to support <strong>also<\/strong> 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.<br \/>\nUnfortunately, 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.<\/p>\n<p>Luckily, theming QQC2 is easy, so I&#8217;ve started a QtQuickControls2 style that integrates with desktop QStyle-based widgets (actually, based upon the QtQuickControls1 QStyle painter machinery).<\/p>\n<p>If we are serious in using QtQuickControls2 in applications shipped together Plasma, we also must make sure they integrate well with the Plasma desktop&#8217;s Breeze look and feel.<\/p>\n<p>I started by theming the scrollbar because I felt it was one of the hardest controls to do.<br \/>\nin QtQuickControls2 the scrollbars are supposed to be an attached property of flickables..<br \/>\nThis is pretty simple for the mobile use case, turns out it&#8217;s a nightmare to create scrollbars that behave like we are used to in the desktop (unless you&#8217;re on mac, which insists to look more and more like iOS), which need to be<\/p>\n<ul>\n<li>always visible<\/li>\n<li>have optional little arrow buttons for increment\/decrenent<\/li>\n<li>be besides the flickable, not overlapping the contents, because again, they&#8217;re always visible<\/li>\n<li>use the global desktop theme<\/li>\n<\/ul>\n<p>I&#8217;ve been able to do all of the following, tough it&#8217;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.<br \/>\nHopefully, you&#8217;ll be soon able to build an application with QtQuickcontrols2 and Kirigami2 that feels right at home in a Plasma desktop.<br \/>\nWhat about Plasma-themed QQC2 controls for plasmoids? that will come too, of course!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the screenshot below, the desktop\/Breeze-looking scrollbar it&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,16],"tags":[2,159,7,18,166],"class_list":["post-6558","post","type-post","status-publish","format-standard","hentry","category-graphics","category-software","tag-kde","tag-kirigami","tag-plasma","tag-qml","tag-qtquickcontrols2"],"_links":{"self":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts\/6558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/comments?post=6558"}],"version-history":[{"count":2,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts\/6558\/revisions"}],"predecessor-version":[{"id":6561,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts\/6558\/revisions\/6561"}],"wp:attachment":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/media?parent=6558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/categories?post=6558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/tags?post=6558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}