Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

Using QStylesheet in Custom Style -> wrong palette.

$
0
0
Hello all, I use Qt4.8.4 to build an desktop application. I want to use QStyleSheet to apply a custom look and feel to my application. However I also need to draw custom ui elements in a MyStyle (which inherits from QWindowsVistaStyle). I want to style them with the values from my QStyleSheet. What works: I set the QStyleSheet to my QApplication, it gets correctly applied on my QWidgets as long as I paint default elements through MyStyle. But requesting the palette and painting i.e. a rectangle by my self I still get the default style configuration. QStyleSheet QWidget {     background: #e18918; } Some draw. void MyStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *opt,                                 QPainter *p, const QWidget *w) const {     QWindowsVistaStyle::drawPrimitive(element,opt,p,w);       qDebug() << opt->palette.background().color;     } Painting the item with the default element provides me the correct orange color, however the background color in opt is still default gray. How can I read / get the correct value from the QStyleSheet? Thanks, Jeremias

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>