-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
When I call update or the program calls paintEvent it will report an error and not display, I did not override paintEvent. There is no problem if the value set is not 1 but a decimal. The widget contains another widget that uses QGraphicsOpacityEffect. When I disable the QGraphicsOpacityEffect of the internal widget, there will be no error, but I need to set the transparency of the internal widget, what should I do?
code:
ButtonArea::ButtonArea(QWidget *parent) : QWidget(parent) {
Button button(this);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(&button);
setLayout(layout);
opacity_effect = new QGraphicsOpacityEffect;
opacity_effect->setOpacity(1);
setGraphicsEffect(opacity_effect);
update();
}
Button::Button(QWidget *parent): QPushButton(parent) {
opacity_effect = new QGraphicsOpacityEffect;
opacity_effect->setOpacity(0.1);
setGraphicsEffect(opacity_effect);
}
warning:
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::translate: Painter not active
QPainter::worldTransform: Painter not active
QWidgetEffectSourcePrivate::pixmap: Painter not active
QPainter::save: Painter not active
QPainter::setOpacity: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::restore: Unbalanced save/restore