In a QDockWidget
derived class I enable style sheet support as follows:
void CDockWidget::paintEvent(QPaintEvent *event)
{
QStyleOption opt;
opt.initFrom(this);
QPainter p(this);
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
// call QDockWidget::paintEvent(event) here ???????
// I have called QDockWidget::paintEvent(event) here, but did not notice any difference
}
Question: Do I have to call the parent class paintEvent
or is this wrong (if so please elaborate). In the original code example the parent function is NOT called, but I wonder if this is correct? It would miss any functionality there, wouldn't it?
Remark: The above code allows to use style sheets with derived classes as described in: Qt stylesheet in derived class in C++ namespace (selector)
This is what the QDockWidget does internally. It looks like your layout management won't happen in your current code. I'd expect that you could see the problem by resizing your window or something similar that would adjust the layout.
https://qt.gitorious.org/qt/qt/source/a71e6490b5415f24e38681015ae05326a004a7b7:src/gui/widgets/qdockwidget.cpp#LNaN-NaN