Kimmo
3rd April 2010, 14:06
Simply put, how can I customize the visible down arrow, up arrow, the handle etc. of a QScrollBar using style sheets? I've read the documentation, but it isn't quite sufficient enough for me.
I was able to change the background color of a QTextEdit, the color of a QPushButton. I was also able to change the arrow image of a QComboBox (QComboBox::drop-down subcontrol) as shown in the documentation. But I cannot seem to be able to affect the QScrollBar subcontrols inside the QTextEdit. I was able to change the background-color of the scroll bar inside the text edit, so I guess I should be close, but... The documentation states that if one wants to customize one subcontrol, one has to customize them all. So here's the style sheet I was trying out. If someone could post a simple, complete style sheet that visibly changes one sub-control of a QScrollBar, I'd be grateful.
QPushButton
{
background: red;
}
QTextEdit
{
background: black;
}
QComboBox::drop-down
{
image: url(:/icon/arrow_down);
}
QScrollBar
{
}
QScrollBar::up-arrow
{
}
QScrollBar::down-arrow
{
image: url(:/icon/arrow_down);
}
QScrollBar::left-arrow
{
}
QScrollBar::right-arrow
{
}
QScrollBar::add-line
{
}
QScrollBar::add-page
{
}
QScrollBar::down-button
{
image: url(:/icon/arrow_down);
}
QScrollBar::handle
{
}
QScrollBar::sub-line
{
}
QScrollBar::sub-page
{
}
I was able to change the background color of a QTextEdit, the color of a QPushButton. I was also able to change the arrow image of a QComboBox (QComboBox::drop-down subcontrol) as shown in the documentation. But I cannot seem to be able to affect the QScrollBar subcontrols inside the QTextEdit. I was able to change the background-color of the scroll bar inside the text edit, so I guess I should be close, but... The documentation states that if one wants to customize one subcontrol, one has to customize them all. So here's the style sheet I was trying out. If someone could post a simple, complete style sheet that visibly changes one sub-control of a QScrollBar, I'd be grateful.
QPushButton
{
background: red;
}
QTextEdit
{
background: black;
}
QComboBox::drop-down
{
image: url(:/icon/arrow_down);
}
QScrollBar
{
}
QScrollBar::up-arrow
{
}
QScrollBar::down-arrow
{
image: url(:/icon/arrow_down);
}
QScrollBar::left-arrow
{
}
QScrollBar::right-arrow
{
}
QScrollBar::add-line
{
}
QScrollBar::add-page
{
}
QScrollBar::down-button
{
image: url(:/icon/arrow_down);
}
QScrollBar::handle
{
}
QScrollBar::sub-line
{
}
QScrollBar::sub-page
{
}