Results 1 to 3 of 3

Thread: Problem with code (probably repaintinng label)

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with code (probably repaintinng label)

    Hello all, i would like to tell me what's wrong with this code
    Qt Code:
    1. for(int a=9;a>=0;a--)
    2. {
    3. ui->label->setText((QString)a);
    4. ui->label->repaint();
    5. sleep(1);
    6. }
    To copy to clipboard, switch view to plain text mode 

    where sleep(const int) is the function from the iostream library and waits const int seconds till the next step.
    The label isn't repainted :/
    So, actually it is a label that must change its value every second. Thanks


    Added after 39 minutes:


    For anybody following this thread, the solution is to use a QTimer
    Last edited by hakermania; 8th January 2011 at 10:39.
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Problem with code (probably repaintinng label)

    Quote Originally Posted by hakermania View Post
    i would like to tell me what's wrong
    nice

    By the way: if there is no special reason always use update() not repaint(). Further a follow up lecture: http://doc.trolltech.org/qq/qq27-responsive-guis.html

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

    Default Re: Problem with code (probably repaintinng label)

    I would say that casting int to QString is the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt - Using Blur Behind (label problem)
    By Sven in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2012, 16:37
  2. label - pixmap - problem
    By qwrhiobasdbgghoasdf in forum Newbie
    Replies: 5
    Last Post: 16th September 2010, 00:29
  3. Replies: 3
    Last Post: 12th May 2010, 23:53
  4. Replies: 1
    Last Post: 1st June 2009, 20:58
  5. child label alignment problem
    By ht1 in forum Qt Programming
    Replies: 9
    Last Post: 21st November 2007, 20:50

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.