Results 1 to 3 of 3

Thread: QToolBar paintEvent

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QToolBar paintEvent

    Hi,

    I'm trying to show an image into a QToolBar. To do this I redefined the paintEvent method.
    QToolBar shows what you can see on the attached image.ToolBar.PNG
    The problem is that when I change the paintEvent, it is not shown. Maybe I have to tell base class to paint before my image painting? How I have to do this?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QToolBar paintEvent

    Qt Code:
    1. class MyToolbar : public QToolbar
    2. {
    3. ...
    4. };
    5.  
    6. void
    7. MyToolbar::paintEvent(... event)
    8. {
    9. QToolbar::paintEvent(event);
    10.  
    11. // do your own stuff.
    12. }
    To copy to clipboard, switch view to plain text mode 

    what do you mean by 'change the paint event' ?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

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

    ^NyAw^ (10th May 2012)

  4. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QToolBar paintEvent

    Hi,

    Thanks, it works. "change the paint event" means "redefine the paint event". It's a litteral translation of my thinking language. :P
    Òscar Llarch i Galán

Similar Threads

  1. qt paintEvent
    By lzpmail in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2011, 13:13
  2. paintEvent help
    By seltra in forum Newbie
    Replies: 11
    Last Post: 18th September 2010, 19:24
  3. paintEvent problem
    By di_zou in forum Newbie
    Replies: 5
    Last Post: 2nd September 2009, 16:13
  4. Paintevent and update
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 25th March 2008, 07:09
  5. Replies: 12
    Last Post: 5th February 2006, 10:34

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.