Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24

Thread: Promoting QLabel

  1. #21
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Promoting QLabel

    Quote Originally Posted by wysota View Post
    You should have received a warning in the console.
    No, At this time I am not receiving any warning.
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Promoting QLabel

    If you opened the painter on a wrong object you should have received a warning. Take my code and change "viewport()" to "this", run the application and look at the console.

  3. #23
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Promoting QLabel

    Yes, You are saying true in this regard; but I am telling about the below mentioned code.
    Qt Code:
    1. void paintEvent ( QPaintEvent * event )
    2. {
    3. QTextEdit::paintEvent(event);
    4. QPainter painter(viewport());
    5. painter.setPen(Qt::blue);
    6. painter.drawLine(rect().topLeft(),rect().bottomRight());
    7. }
    To copy to clipboard, switch view to plain text mode 
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  4. #24
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Promoting QLabel

    You said you "forgot to call viewport()". I understood that you didn't open a painter on it.

Similar Threads

  1. empty pixmap as a QLabel
    By tommy in forum Qt Programming
    Replies: 16
    Last Post: 11th December 2007, 21:15
  2. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  3. QLabel links?
    By gfunk in forum Qt Programming
    Replies: 3
    Last Post: 23rd December 2006, 00:42
  4. QScrollArea display custom QLabel
    By spawnwj in forum Qt Programming
    Replies: 6
    Last Post: 6th December 2006, 03:38
  5. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 19:57

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.