Important: Please read the Qt Code of Conduct -

QGraphicsOpacityEffect screenshot problem

  • Good Morning everybody,
    I have a QLabel with image animated with a QGraphicsOpacityEffect and QPropertyAnimator
    to perform an image switching with fade out/in effect; everything is inside a QWidget that is than added
    to a container widget.
    Now, i make screenshots of parent widget with:

    QImage bitmap(rect.size(), QImage::Format_ARGB32);
    QPainter painter(&bitmap);
    widget->render(&painter, QPoint(), rect, QWidget::DrawChildren);

    since i need to save an image with alpha channel of screen.

    The widget with QGraphicsOpacityEffect is never shown in screenshots and the area of the widget always result in fully transparent rectangle.
    Futhermore if i use grabWidget sometimes i see the widget but most of the times not and when visible
    it is always in wrong position with respect to screen. It seems to depend upon the effect because if disabled everything is perfectly rendered

    Maybe i'm missing something.

    Any help would be much appreciated.