styling parent but not child?
Is it possible to style the parent of a widget, but prevent child widgets from inheriting the parent's style?
Say I have a QListView, which can have 2 scrollbars. If I set the background style of the QListView to say, background:red, the scrollbars will likewise color red, but I'd like them to assume the system default color.
Re: styling parent but not child?
My current solution is this:
- setAttribute(Qt::WA_NoSystemBackground) on the view,
- override view's paintEvent() and repaint the background manually, but differently for the "main" area and the areas of the scrollbars, if they are visible.
Re: styling parent but not child?
Quote:
Originally Posted by
ugluk
Say I have a QListView, which can have 2 scrollbars. If I set the background style of the QListView to say, background:red, the scrollbars will likewise color red, but I'd like them to assume the system default color.
Code:
view->setPalette(p);
Re: styling parent but not child?