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
↧