Results 1 to 11 of 11

Thread: How to paint a widget outside paintEvent()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Question Re: How to paint a widget outside paintEvent()

    Quote Originally Posted by jacek View Post
    Qt tends to merge multiple paint events into one, but this might be not enough. IMO it's better to assume that you don't know when the paint even arrives and avoid changing the state in paintEvent().

    Instead of a flag, you could use some variable that denotes the scroll amount. This way you don't have to care how many times and when paintEvent() was called.

    Firsy of all, thanks for all your help.

    But, there is a big problem if we use a flag or a scroll amount in a paintEvent(), we can not differentiate that it is call by we update(currentIndex()) or Qt Server sometimes.


    one more question: Qt normally erases the widget's area before the paintEvent() call, now,
    How can i disable Qt to erase the content? some times I don't want to clear the content when I call update(), like this task to scroll focus item text.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to paint a widget outside paintEvent()

    Quote Originally Posted by wesley View Post
    But, there is a big problem if we use a flag or a scroll amount in a paintEvent(), we can not differentiate that it is call by we update(currentIndex()) or Qt Server sometimes.
    Why do you need to differentiate them? The scroll amount depends on time --- who and when caused the repaint doesn't matter.

    Quote Originally Posted by wesley View Post
    How can i disable Qt to erase the content?
    You can set the Qt::WA_OpaquePaintEvent widget attribute.

  3. The following user says thank you to jacek for this useful post:

    wesley (27th February 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: How to paint a widget outside paintEvent()

    this thread is end. thanks for every one.

Similar Threads

  1. Drawing a widget in QItemDelegate's paint method
    By darkadept in forum Qt Programming
    Replies: 17
    Last Post: 11th August 2009, 05:15
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. painting a widget outside a paintEvent
    By jayw710 in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 23:18
  4. paint central widget of a QMainWindow???
    By Shuchi Agrawal in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 08:02
  5. 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
  •  
Qt is a trademark of The Qt Company.