Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Set style for QScrollArea's viewport

$
0
0
I’m trying to style the viewport of a custom QScrollArea as follows: setStyleSheet("QScrollArea > QWidget > QWidget{background:transparent;}"); Which successfully styles the vieport, but also the scroll bar (which I don’t want to do). So I tried the following to only style the viewport and not the bar: setStyleSheet("QScrollArea > QWidget > .QWidget{background:transparent;}"); But that didn’t do anything at all. So I tried to style the viewport directly: viewport()->setStyleSheet("QWidget{background:transparent;}"); Which works, but it also styles all the child widgets in the viewport, so I tried: viewport()->setStyleSheet(".QWidget{background:transparent;}"); Which again didn’t style it at all. So my question: is the viewport actually a QWidget or is it one of QWidget’s subclasses, since I’m unable to style it by using .QWidget. If it is a QWidget, what am I doing wrong, why doesn’t the viewport style (without affecting the child widgets and the scroll bar).

Viewing all articles
Browse latest Browse all 13965

Trending Articles