Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.8.0
-
None
Description
The following code fails to render the label correctly (it is not visible for me.. for larger apps, there are also render artefacts, like flickering). This happens with any embedded widget that has an effect installed on the QWidget directly, rather than on its proxy widget (which happens with existing widgets, that weren't developed with QGraphicsView in mind - use-case par excellence for QGraphicsProxyWidget).
#include <QGraphicsProxyWidget> #include <QGraphicsOpacityEffect> #include <QGraphicsView> #include <QGraphicsScene> #include <QApplication> #include <QLabel> int main(int argc, char **argv) { QApplication qapp(argc, argv); QLabel *label = new QLabel("hello folks"); QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(); eff->setOpacity(0.5); label->setGraphicsEffect(eff); label->show(); QGraphicsView qgv; QGraphicsScene qgs; qgv.setScene(&qgs); qgs.addWidget(label); qgv.show(); return qapp.exec(); }
The problem has existed since at least the Qt4.8 days.