QScrollArea removes the space between the content of the area and the scrollbar.
I have a problem with QScrollArea.
In particular, I cannot find the correct QSS rule to remove the 3px space between the QSrollArea QFrame and the QScroll.
The space I would like to remove is the one that the red arrow points to in the picture. I also added a blue border to the inner QFrame QSrollArea, but it seems to end up correctly.
The image can be found here: http://i58.tinypic.com/2h71a2c.png
I am using QT 4.8.5 on SLED 11 SP2 (under GNOME).
My QSS looks like this:
QScrollArea {
background: transparent;
}
QScrollArea > QWidget > QWidget
{
background: transparent;
border: 1px solid black;
margin: 0px 0px 0px 0px;
}
QScrollBar:horizontal
{
border: 1px solid #999999;
background:white;
height:7px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
QScrollBar::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 rgb(32, 47, 130), stop: 0.5 rgb(32, 47, 130), stop:1 rgb(32, 47, 130));
min-width: 20px;
}
QScrollBar::add-line:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 rgb(32, 47, 130), stop: 0.5 rgb(32, 47, 130), stop:1 rgb(32, 47, 130));
height: 0px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 rgb(32, 47, 130), stop: 0.5 rgb(32, 47, 130), stop:1 rgb(32, 47, 130));
height: 0px;
subcontrol-position: left;
subcontrol-origin: margin;
}
Any ideas?
Thank.
Is it necessary to do this only with QSS
and QSS
? I think that changing layoutBottomMargin
scrollAreaWidgetContents
(i.e. the widget inside QScrollArea
) will fix the problem.