Results 1 to 11 of 11

Thread: How to paint a widget outside paintEvent()

Threaded View

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

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

    Quote Originally Posted by jacek View Post
    QPaintEvent doesn't have any flags field or anything you could use to do that. You could try to subclass QPaintEvent and then use dynamic_cast, but that might not be reliable.
    if i declare a class-wide flag named "bDrawAnimatedCaption",

    Qt Code:
    1. void on_AnimationTimer_timeout()
    2. {
    3. do some animation work here
    4. ... ...
    5.  
    6. bDrawAnimatedCaption = true;
    7. update(currentIndex()); //it will trigger paintEvent to update current index
    8. }
    9.  
    10. void paintEvent(QPaintEvent *event)
    11. {
    12. if(bDrawAnimatedCaption)
    13. {
    14. paint animated cation here
    15. ... ...
    16. bDrawAnimatedCaption = false;
    17. }
    18. else
    19. {
    20. QListView:: paintEvent(event);
    21. }
    22. }
    To copy to clipboard, switch view to plain text mode 

    Are these reliable ?

    or is there another solution?
    ^_^, it just a test, but I hope it can work like this, because i can control the animation more easyer on MyListView side than delegate side.
    thank you.
    Last edited by wesley; 21st February 2008 at 06:34.

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.