Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsOpacityEffect sets the value to 1 when update prints errors and does not display
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 255 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 0 Offline
    0 Offline
    0ices
    wrote on last edited by
    #1

    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
    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
    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
    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
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved