Difference between revisions of "Style a QToolBoxs Page with QSS"

From Qt Wiki
Jump to: navigation, search
 
Line 1: Line 1:
=Style a QToolBoxs Page with <span class="caps">QSS</span>=
+
[[Category:HowTo]]
  
==Solution==
+
= Style a QToolBoxs Page with QSS =
  
==Why?==
+
== Solution ==
  
[http://doc.qt.io/qt-5.0/qtwidgets/qtoolbox.html QToolBox] ''[qt.io]'' creates a new [http://doc.qt.io/qt-5.0/qtwidgets/qscrollarea.html QScrollArea] ''[qt.io]'' for every page as a container to provide scrollbars if necessary. Additionally '''QScrollArea''' also creates another widget as a viewPort. So our [http://doc.qt.io/qt-5.0/qtwidgets/qwidget.html QWidget] ''[qt.io]'' page will be the direct child of that '''viewPort'''.
+
Targeting a QToolBox's page widget with QSS selectors can be tricky. Our intuitive mind would try <code>QToolBox &gt; QWidget { }<code> But that won't work. '''The correct way to do it is''' <code>QToolBox &gt; QScrollArea &gt; QWidget &gt; QWidget { }<code>
  
===Categories:===
+
== Why? ==
 
 
* [[:Category:HowTo|HowTo]]
 

Revision as of 10:23, 24 February 2015


Style a QToolBoxs Page with QSS

Solution

Targeting a QToolBox's page widget with QSS selectors can be tricky. Our intuitive mind would try QToolBox > QWidget { } But that won't work. The correct way to do it is QToolBox > QScrollArea > QWidget > QWidget { }

Why?