Results 1 to 7 of 7

Thread: why override paint just to drawPrimitive(PE_Widget)?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default why override paint just to drawPrimitive(PE_Widget)?

    Why would someone override paintEvent to just do this:


    Qt Code:
    1. opt.init(this);
    2. QPainter p(this);
    3. style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: why override paint just to drawPrimitive(PE_Widget)?

    Because paintEvent gets called whenever painting - or re-painting - is required. Stick an output statement in paintEvent and start dragging windows partially offscreen, obscuring them with other windows, hiding and showing them and other activities; watch your console fill up with output.

Similar Threads

  1. Can't override the closeEvent()
    By scot_hansen in forum Newbie
    Replies: 7
    Last Post: 5th October 2010, 22:47
  2. How to override ShowEvent() etc
    By marcvanriet in forum Newbie
    Replies: 1
    Last Post: 22nd September 2010, 10:13
  3. Shortcut override ?
    By fenerista in forum Qt Programming
    Replies: 6
    Last Post: 23rd May 2010, 12:02
  4. Implementing WndProc Override
    By bbdaffy in forum Qt Programming
    Replies: 2
    Last Post: 12th March 2010, 20:37
  5. Override a signal
    By daviddoria in forum Newbie
    Replies: 4
    Last Post: 9th February 2010, 18:18

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.