Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-98245

QGraphicsOpacityEffect sets the value to 1 when update prints errors and does not display

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Widgets: GraphicsView
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      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

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            bibr Andreas Aardal Hanssen
            Reporter:
            0ices zero ices
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes