Results 1 to 5 of 5

Thread: display number on label

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: display number on label

    I think like this
    Qt Code:
    1. int num;
    2. QString qstr = QString::number(num);
    3. if (num <= 9 && num >= 0)
    4. qstr.insert(0, "0");
    5. else if (num >= -9 && num <= 0)
    6. qstr.insert(1, "0");
    7. ui.label->setText(qstr);
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. The following user says thank you to spirit for this useful post:

    aj2903 (12th March 2009)

Similar Threads

  1. Display row Number in QMessageBox
    By arunvv in forum Newbie
    Replies: 6
    Last Post: 1st May 2008, 23:24
  2. how to display micro(mu) symbol in label
    By babu198649 in forum Newbie
    Replies: 2
    Last Post: 7th March 2008, 10:59
  3. Display a Label on top of a QGlWidget
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2008, 16:11
  4. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  5. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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.