Results 1 to 4 of 4

Thread: Calling paintEvent when I want to

  1. #1
    Join Date
    Sep 2009
    Posts
    60
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Calling paintEvent when I want to

    I have a paintEvent function. However, I don't want this function to be called when the widget is created. I want to control when it is called. I know update() will let me call the paintEvent function, but how do I prevent paintEvent from being called at start up?

  2. #2
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Calling paintEvent when I want to

    create a bool variable and check it in your paint function
    at the creation time set it to false and later when you want the paintevent todraw set it to true.

  3. #3
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Calling paintEvent when I want to

    This famous boolean seems to be already in the widget and can be managed by QWidget::setUpdatesEnabled

  4. #4
    Join Date
    Oct 2009
    Location
    Rennes, France
    Posts
    20
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Calling paintEvent when I want to

    Hi
    hide the widget after creation.
    Normally, paintevent will not be called.
    Contributor from the French Qt community from developpez.com
    * Forum
    * FAQ Qt ( > 100 QR)
    * Advanced and Beginner Tutorials

Similar Threads

  1. calling paintEvent() of the super class
    By Cruz in forum Newbie
    Replies: 2
    Last Post: 24th March 2021, 20:29
  2. Calling update() from paintEvent()
    By wonder.mice in forum Qt Programming
    Replies: 8
    Last Post: 11th January 2008, 13:41
  3. Replies: 3
    Last Post: 27th November 2006, 09:56

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.