Results 1 to 5 of 5

Thread: QWidget paintEvent update in time

  1. #1
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default QWidget paintEvent update in time

    I draw a qpixmap in paintEvent of QWidget. When I resize QWidget, the qpixmap will be changed.
    On linux, it is changed in time. But on windows, it is changed when I release mouse.
    I want to change it in time on windows. I don't know how to reslove this.
    Any help will be appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWidget paintEvent update in time

    How do you trigger the repainting?
    Do you call update()? If yes, have you tried calling repaint()?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default Re: QWidget paintEvent update in time

    I send a signal in resizeEvent, and then paintEvent will be called. And QPainter::drawPixmap() is be executed. I've tried to add update() or repaint() in resizeEvent(), but it no use.

  4. #4
    Join Date
    Oct 2014
    Posts
    20
    Thanks
    2

    Default Re: QWidget paintEvent update in time

    I know why this happend. I need to add Qt:irectConnection to QOjbect::connect().
    Thanks.

    I know why this happend. I need to add Qt:irectConnection to QOjbect::connect().
    Thanks.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget paintEvent update in time

    Quote Originally Posted by ugiwgh View Post
    I know why this happend. I need to add Qt:irectConnection to QOjbect::connect().
    Thanks.
    Are you using threads in your application? resizeEvent() will be called in the application thread so there is no need for Qt:irectConnection unless the object you are trying to call the slot on lives in a different thread. In which case you should simply move your slot to another class.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. update and paintevent
    By yuzhouzhiwai in forum Qt Programming
    Replies: 4
    Last Post: 15th July 2013, 13:57
  2. Newbie-Question: update does not trigger paintEvent
    By janitor in forum Qt Programming
    Replies: 5
    Last Post: 24th January 2013, 17:59
  3. Replies: 0
    Last Post: 29th April 2010, 05:44
  4. Paintevent and update
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 25th March 2008, 07:09
  5. Calling update() from paintEvent()
    By wonder.mice in forum Qt Programming
    Replies: 8
    Last Post: 11th January 2008, 13: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.