examples/widgets/stylesheet/qss/pagefold.qss
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /* Customize any plain widget that is a child of a QMainWindow. */
       
     2 QMainWindow > .QWidget {
       
     3     background-color: gainsboro;
       
     4     background-image: url(:/images/pagefold.png);
       
     5     background-position: top right;
       
     6     background-repeat: no-repeat
       
     7 }
       
     8 
       
     9 /* Provide a padding for the layout inside the frame. The frame
       
    10    exists only to provide a padding for the top-right image, so we
       
    11    explicitly disable the border. */
       
    12 #mainFrame {
       
    13     padding-right: 30px;
       
    14     border-style: none;
       
    15     border-image: none; /* since we set a border-image below */
       
    16 }
       
    17 
       
    18 /* mainFrame won't have this border-image since we have
       
    19    explicitly set it to 'none' using a more specific selector. */
       
    20 QFrame, QLineEdit, QComboBox[editable="true"], QSpinBox {
       
    21     border-image: url(:/images/frame.png) 4;
       
    22     border-width: 3;
       
    23 }
       
    24 
       
    25 QLabel {
       
    26     border: none;
       
    27     border-image: none;
       
    28     padding: 0;
       
    29     background: none;
       
    30 }
       
    31 
       
    32 /* Make text in message boxes selectable. */
       
    33 QMessageBox {
       
    34     /* LinksAccessibleByMouse | TextSelectableByMouse */
       
    35     messagebox-text-interaction-flags: 5;
       
    36 }
       
    37    
       
    38 /* Set the selection colors for all widgets. */
       
    39 QWidget {
       
    40     selection-color: black;
       
    41     selection-background-color: Silver;
       
    42     color: black;
       
    43 }
       
    44 
       
    45 /* Make the entire row selected in item views. */
       
    46 QAbstractItemView {
       
    47     show-decoration-selected: 1;
       
    48 }
       
    49 
       
    50 /* Nice WindowsXP-style password character for password line edits. */
       
    51 QLineEdit[echoMode="2"] {
       
    52     lineedit-password-character: 9679;
       
    53 }
       
    54 
       
    55 /* Customize tooltips. */
       
    56 QToolTip {
       
    57     background-color: rgb(200,200,255);
       
    58     border-color: darkslategray;
       
    59     border-width: 1px;
       
    60     border-style: solid;
       
    61     padding: 3px;
       
    62     font: bold;
       
    63     border-radius: 3px;
       
    64     opacity: 200;
       
    65 }
       
    66 
       
    67 /* Customize radio buttons. */
       
    68 
       
    69 QRadioButton {
       
    70     spacing: 5px;
       
    71 }
       
    72 
       
    73 QRadioButton::indicator {
       
    74     width: 13px;
       
    75     height: 13px;
       
    76 }
       
    77 
       
    78 QRadioButton::indicator::unchecked {
       
    79     image: url(:/images/radiobutton_unchecked.png);
       
    80 }
       
    81 
       
    82 QRadioButton::indicator:unchecked:hover {
       
    83     image: url(:/images/radiobutton_unchecked_hover.png);
       
    84 }
       
    85 
       
    86 QRadioButton::indicator:unchecked:pressed {
       
    87     image: url(:/images/radiobutton_unchecked_pressed.png);
       
    88 }
       
    89 
       
    90 QRadioButton::indicator::checked {
       
    91     image: url(:/images/radiobutton_checked.png);
       
    92 }
       
    93 
       
    94 QRadioButton::indicator:checked:hover {
       
    95     image: url(:/images/radiobutton_checked_hover.png);
       
    96 }
       
    97 
       
    98 QRadioButton::indicator:checked:pressed {
       
    99     image: url(:/images/radiobutton_checked_pressed.png);
       
   100 }
       
   101 
       
   102 /* Customize arrows. */
       
   103 
       
   104 *::down-arrow, *::menu-indicator {
       
   105     image: url(:/images/down_arrow.png);
       
   106     width: 7px;
       
   107     height: 7px;
       
   108 }
       
   109 
       
   110 *::down-arrow:disabled, *::down-arrow:off {
       
   111    image: url(:/images/down_arrow_disabled.png);
       
   112 }
       
   113 
       
   114 *::up-arrow {
       
   115     image: url(:/images/up_arrow.png);
       
   116     width: 7px;
       
   117     height: 7px;
       
   118 }
       
   119 
       
   120 *::up-arrow:disabled, *::up-arrow:off {
       
   121    image: url(:/images/up_arrow_disabled.png);
       
   122 }
       
   123 
       
   124 /* Customize push buttons and comboboxes. Our read-only combobox
       
   125    is very similar to a push button, so they share the same border image. */
       
   126 
       
   127 QPushButton {
       
   128     min-width: 4em;
       
   129 }
       
   130 
       
   131 QPushButton, QComboBox[editable="false"],
       
   132 QComboBox[editable="true"]::drop-down {
       
   133     border-image: url(:/images/pushbutton.png) 5;
       
   134     border-width: 5;
       
   135 }
       
   136 
       
   137 QPushButton:hover, QComboBox[editable="false"]:hover,
       
   138 QComboBox[editable="true"]::drop-down:hover, QMenuBar::item:hover {
       
   139     border-image: url(:/images/pushbutton_hover.png) 5;
       
   140     border-width: 5;
       
   141 }
       
   142 
       
   143 QPushButton:pressed, QComboBox[editable="false"]:on,
       
   144 QComboBox[editable="true"]::drop-down:on, QMenuBar::item:on {
       
   145     border-image: url(:/images/pushbutton_pressed.png) 5;
       
   146     border-width: 5;
       
   147 }
       
   148 
       
   149 /* Customize read-only comboboxes. */
       
   150 
       
   151 QComboBox[editable="false"] {
       
   152     padding-left: 3px;
       
   153     padding-right: 20px; /* space for the arrow */
       
   154 }
       
   155 
       
   156 QComboBox[editable="false"]::drop-down {
       
   157     subcontrol-origin: padding;
       
   158     subcontrol-position: top right;
       
   159     width: 15px;
       
   160     border-left-style: solid;
       
   161     border-left-color: darkgray;
       
   162     border-left-width: 1px;
       
   163 }
       
   164 
       
   165 QComboBox[editable="false"]::down-arrow {
       
   166     subcontrol-origin: content;
       
   167     subcontrol-position: center;
       
   168     position: relative;
       
   169     left: 1px; /* 1 pixel dropdown border */
       
   170 }
       
   171 
       
   172 /* The combobox arrow is on when the popup is open. */
       
   173 QComboBox[editable="false"]::down-arrow:on {
       
   174     position: relative;
       
   175     top: 1px;
       
   176     left: 2px;
       
   177 }
       
   178 
       
   179 /* Customize editable comboboxes. */
       
   180 
       
   181 QComboBox[editable="true"] {
       
   182     padding-right: 16px;
       
   183 }
       
   184 
       
   185 QComboBox[editable="true"]::drop-down {
       
   186     subcontrol-origin: border;
       
   187     subcontrol-position: top right;
       
   188     width: 13px;
       
   189     position: absolute;
       
   190     top: 2px;
       
   191     bottom: 2px;
       
   192     right: 2px;
       
   193 }
       
   194 
       
   195 QComboBox[editable="true"]::drop-down,
       
   196 QComboBox[editable="true"]::drop-down:hover,
       
   197 QComboBox[editable="true"]::drop-down:on {
       
   198     border-width: 0px;  
       
   199     border-left-width: 3px; /* we need only left and center part */
       
   200 }
       
   201 
       
   202 /* Shift the arrow when it's open. */
       
   203 QComboBox[editable="true"]::down-arrow:on {
       
   204     position: relative;
       
   205     top: 1px;
       
   206     left: 1px;
       
   207 }
       
   208 
       
   209 /* Customize check boxes. */
       
   210 QCheckBox {
       
   211     spacing: 5px;
       
   212 }
       
   213 
       
   214 QCheckBox::indicator {
       
   215     width: 13px;
       
   216     height: 13px;
       
   217 }
       
   218 
       
   219 QCheckBox::indicator:unchecked {
       
   220     image: url(:/images/checkbox_unchecked.png);
       
   221 }
       
   222 
       
   223 QCheckBox::indicator:unchecked:hover {
       
   224     image: url(:/images/checkbox_unchecked_hover.png);
       
   225 }
       
   226 
       
   227 QCheckBox::indicator:unchecked:pressed {
       
   228     image: url(:/images/checkbox_unchecked_pressed.png);
       
   229 }
       
   230 
       
   231 QCheckBox::indicator:checked {
       
   232     image: url(:/images/checkbox_checked.png);
       
   233 }
       
   234 
       
   235 QCheckBox::indicator:checked:hover {
       
   236     image: url(:/images/checkbox_checked_hover.png);
       
   237 }
       
   238 
       
   239 QCheckBox::indicator:checked:pressed {
       
   240     image: url(:/images/checkbox_checked_pressed.png);
       
   241 }
       
   242 
       
   243 /* Customize the size grip. */
       
   244 QSizeGrip {
       
   245     image: url(:/images/sizegrip.png);
       
   246     width: 16px;
       
   247     height: 16px;
       
   248 }
       
   249 
       
   250 /* Customize the menu bar. */
       
   251 QMenuBar {
       
   252     border-image: none;
       
   253     border-style: none;
       
   254     border-width: 1px;
       
   255     border-bottom-style: solid;
       
   256     border-bottom-color: darkslategray;
       
   257     padding: 2px;
       
   258 }
       
   259 
       
   260 /* Customize spin boxes. */
       
   261 
       
   262 QSpinBox { 
       
   263     padding-right: 15px;
       
   264 }
       
   265 
       
   266 QSpinBox::up-button {
       
   267     subcontrol-origin: border;
       
   268     subcontrol-position: top right;
       
   269 
       
   270     width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */
       
   271     border-image: url(:/images/spinup.png) 1;
       
   272     border-width: 1px;
       
   273 }
       
   274 
       
   275 QSpinBox::up-button:hover {
       
   276     border-image: url(:/images/spinup_hover.png) 1;
       
   277 }
       
   278 
       
   279 QSpinBox::up-button:pressed {
       
   280     border-image: url(:/images/spinup_pressed.png) 1;
       
   281 }
       
   282 
       
   283 QSpinBox::down-button {
       
   284     subcontrol-origin: border;
       
   285     subcontrol-position: bottom right;
       
   286 
       
   287     width: 16px;
       
   288     border-image: url(:/images/spindown.png) 1;
       
   289     border-width: 1px;
       
   290     border-top-width: 0;
       
   291 }
       
   292 
       
   293 QSpinBox::down-button:hover {
       
   294     border-image: url(:/images/spindown_hover.png) 1;
       
   295 }
       
   296 
       
   297 QSpinBox::down-button:pressed {
       
   298     border-image: url(:/images/spindown_pressed.png) 1;
       
   299 }