Results 1 to 8 of 8

Thread: how to get QPainter object for QLabel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: how to get QPainter object for QLabel

    In my opinion it would be simple and better to go for subclassing the QLabel and doing your drawing in the paintEvent() function.
    Something as suggested above -
    Qt Code:
    1. void myLabel::paintEvent ( QPaintEvent * event )
    2. {
    3. QPainter painter(this);
    4. ....... // do your drawing..
    5. QLabel::paintEvent(event); // Pass to base class if needed.
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by aamer4yu; 15th March 2010 at 09:57.

Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Help with Q_PROPERTY with object pointer
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 17:31
  3. Open a QMainWindow Object in QDialog Object
    By chuengchuenghq in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2008, 06:33
  4. Replies: 7
    Last Post: 20th March 2006, 20:03
  5. passing a QPainter object to widgets
    By vratojr in forum Qt Programming
    Replies: 9
    Last Post: 11th January 2006, 15:27

Tags for this Thread

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.