Qt Stylesheet mystery -
my desktop qt app has large stylesheet applied. it's applied qapplication derived class using:
this->applystylesheet(":/qss/default.qss");
it works qwidget objects define , use. (using *.ui files).
my problem begins when promote 1 of qwidgets in *.ui file i'm using 1 of own qwidget derived classes.
when widget qwidget, the following worked , changed background image:
qwidget#mywidget { background: transparent; background-image: url(:/images/bg_img.png); background-repeat: repeat-x; }
when promoted element custom qwidget derived class , changed to:
qmyderivedclass#mywidget { background: transparent; background-image: url(:/images/bg_img.png); background-repeat: repeat-x; }
i no longer see background image. missing something. it... hope 1 of knows.
my bad. posting people similar problem can find solution:
i did not add "paintevent" custom class. (which in case draws nothing enables stylesheet adherence).
void customwidget::paintevent (qpaintevent *) { qstyleoption opt; opt.init (this); qpainter p (this); style ()->drawprimitive (qstyle::pe_widget, &opt, &p, this); }
Comments
Post a Comment