在QDockWidget
派生类中我enable style sheet支持如下:在派生类中调用父类的绘画事件?
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
}
问:我必须调用父类paintEvent
或这是错的(如果是的话请详细说明)。在原始code example父函数是不是调用,但我想知道这是否正确?它会错过任何功能,不是吗?
注:上述代码允许如所描述的使用样式表与派生类: Qt stylesheet in derived class in C++ namespace (selector)
我不知道,但我认为你应该画一个'将QStyle :: PE_FrameDockWidget'代替'将QStyle :: PE_Widget'的。试试看并检查。 – Iuliu 2014-11-24 12:28:40