[Qt-interest] Stylesheet + QScrollBar + Arrows
techsgin
techsgin at gmail.com
Wed Feb 25 21:22:23 CET 2009
Hi Martin
This is a known problem when first time using style sheet. (run to it my
self when I started.)
You can notice this behavior also if you just change the background color of
the global namespace. (I think it's a bug)
Vertical:
What you need to do is to adjust the top/bottom margin of the scroll bar to
20px or what ever, and set the "add & sub lines" height to the same value.
This will position them in the right place.
Horizontal:
What you need to do is to adjust the left/right margin of the scroll bar to
20px or what ever, and set the "add & sub lines" width to the same value.
This will position them in the right place.
Or just use what I am using: (change the colors as you wish)
QScrollBar:vertical {
border: 0px solid black;
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,
stop: 0 #323232, stop: 1 #323232);
margin: 20px 0 20px 0;
max-width: 10px;
}
QScrollBar::handle:vertical {
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
min-height: 20px;
}
QScrollBar::add-line:vertical {
border: 0px solid black;
background-color: qlineargradient(x1: 1, y1: 0, x2: 0, y2: 0,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
height: 19px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 0px solid black;
background-color: qlineargradient(x1: 1, y1: 0, x2: 0, y2: 0,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
height: 19px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
border: 0px solid black;
width: 5px;
height: 5px;
background-color: white;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background-color: white;
}
QScrollBar:horizontal {
border: 0px solid black;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #323232, stop: 1 #323232);
margin: 0px 20px 0px 20px;
max-height: 10px;
}
QScrollBar::handle:horizontal {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
min-width: 20px;
}
QScrollBar::add-line:horizontal {
border: 1px solid black;
background-color: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
width: 20px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid black;
background-color: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0,
stop: 0 #323232, stop: 0.8 #CECECE, stop: 1 #323232);
width: 20px;
subcontrol-position: right;
subcontrol-origin: margin;
}
Regards
TechSgin
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of martin
Sent: Wednesday, February 25, 2009 22:07 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Stylesheet + QScrollBar + Arrows
Hi,
I'm having trouble with style sheet and QScrollBar. All I want to do is
change
the color for the normal "gray" to blue. When starting to define a new
background color etc to QScrollBar, the arrows on the buttons disappear. Is
there any way to keep those and just change to background color?
Regards
Martin
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list