Results 1 to 5 of 5

Thread: How to run a widget's PaintEvent on another QThread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2015
    Posts
    35
    Thanks
    20
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default How to run a widget's PaintEvent on another QThread

    Hi,

    I change the pictures on my app background with Qtimer by using opacity (like Blend transaction).
    It works well.

    void MyDesktop:: paintEvent (QPaintEvent * ) {

    QPainter BPainter1(this);
    myBPix = QPixmap(fileName1);
    BPainter1.setOpacity(1.0-_qBOpacity);
    BPainter1.drawPixmap(1,1,this->width(),this->height(),myBPix);

    QPainter Bpainter2(this);
    myBPix2 = QPixmap(fileName2);
    Bpainter2.setOpacity(_qBOpacity);
    Bpainter2.drawPixmap(1,1,this->width(),this->height(),myBPix2);

    }
    Then I also move labels with Qtimer when I pressed a key.
    Moving labels is ok but delay while background picture is changing.
    So I want to run background picture changing on another Qthread.
    To change picture opacity I use paintEvent on a widget.
    How can I run a widget's paintEvent from another Qthread?
    or Other Way?

    Thanks.
    Last edited by binary001; 2nd April 2015 at 17:28.

Similar Threads

  1. Replies: 1
    Last Post: 9th May 2012, 08:58
  2. Replies: 1
    Last Post: 11th March 2011, 19:34
  3. How to paint a widget outside paintEvent()
    By wesley in forum Qt Programming
    Replies: 10
    Last Post: 27th February 2008, 03:19
  4. painting a widget outside a paintEvent
    By jayw710 in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 23:18
  5. New thread to handle paintEvent
    By bitChanger in forum Qt Programming
    Replies: 1
    Last Post: 9th March 2006, 21:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.