Skip to content
  • 0 Votes
    2 Posts
    387 Views
    eyllanescE

    Well unfortunately you will have to create an "effect"" for each widget

  • 0 Votes
    3 Posts
    2k Views
    P

    Tanks ....
    Compiler accept only this way ...... ;-)

    #ifdef QT_NO_GRAPHICSEFFECT QImage applyEffectToPics(QImage src, QGraphicsEffect *effect, int extent = 0) { if(src.isNull()) return QImage(); //No need to do anything else! if(!effect) return src; //No need to do anything else! QGraphicsScene scene; QGraphicsPixmapItem item; item.setPixmap(QPixmap::fromImage(src)); item.setGraphicsEffect(effect); scene.addItem(&item); QImage res(src.size()+QSize(extent*2, extent*2), QImage::Format_ARGB32); res.fill(Qt::transparent); QPainter ptr(&res); scene.render(&ptr, QRectF(), QRectF( -extent, -extent, src.width()+extent*2, src.height()+extent*2 ) ); return res; } #endif
  • 0 Votes
    26 Posts
    10k Views
    JoeCFDJ

    @SGaist Thanks for your reply. The random crash may be caused by corrupt memory. Will use valgrind to check the code out.

  • 0 Votes
    21 Posts
    7k Views
    O

    @mrjj Thank you for your time. I'll investigate further and report if I find any. If anyone else knows anything of this inconsistent behavior please do reply.

  • 0 Votes
    3 Posts
    3k Views
    A

    Thanks for the reply. I wasn't using QtQuick so I couldn't use that as you suggested but I tried using the C++ equivalent and it acted the same as the property animation. After all the QPropertyAnimation pretty much just works on the QGraphicsOpacityEffect directly which is probably exactly what QtQuick uses under the hood to do it's opacity.

    Sorry for the delay in response I didn't realize the new forum system didn't email me when I got a response to a thread and I was busy enough with work not to check it. :)

    Also, I figured out what was causing it. It seems that I was using a QLabel with setAutoFillBackground(true) and the opacity effect couldn't handle that for some reason. When I removed that (I'll find another way to draw the background) it fades out properly. Just in case anyone else gets here from google.