Results 1 to 2 of 2

Thread: (Solved) QLCDNumber simple problem

  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default (Solved) QLCDNumber simple problem

    I have a widget with a QLCDNumber that I can't get to display anything. The form was created using Creator and in the constructor for the form, I want to initialize the number. I have read throught the forum and documentation and it should work...not sure why. From what I read, I think that QLCDNumber can take a double or string value. I tried several variations just to get it to work and none of them worked.

    here is the code
    Qt Code:
    1. Timer::Timer(QWidget *parent) :
    2. QWidget(parent),
    3. ui(new Ui::Timer)
    4. {
    5. ui->setupUi(this);
    6. ui->lcdDisplay->display(2345);
    7. //ui->lcdDisplay->display("2345");
    8. //ui->lcdDisplay->display(1234.5);
    9. }
    To copy to clipboard, switch view to plain text mode 
    I was looking at this too long...I had a function call later on in the code for initializing everything and it set the number to 0...
    Last edited by poporacer; 7th January 2011 at 06:03.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: (Solved) QLCDNumber simple problem

    Can you explain what you mean by "can't get to display anything"? You cannot see the QLCDNumber widget at all (it has a frame that is always there), or the number is visible but 0, or something else?

    This small program works fine here:
    Qt Code:
    1. #include <QtGui>
    2. #include <QDebug>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. lcd.display(2345);
    9. // These work too
    10. // lcd.display(2345.0);
    11. // lcd.display("2345");
    12. lcd.show();
    13.  
    14. return app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 


    Edit: OK, you found the problem. Ignore this.
    Last edited by ChrisW67; 7th January 2011 at 06:12. Reason: updated contents

Similar Threads

  1. QLCDNumber problem
    By ale301168 in forum Newbie
    Replies: 1
    Last Post: 11th November 2009, 21:16
  2. QLCDNumber display
    By jhearon in forum Qt Programming
    Replies: 0
    Last Post: 26th October 2008, 23:53
  3. QLCDNumber justify
    By davisjamesf in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2007, 10:02
  4. Backgroundcolor QLCDNumber in Windows?
    By Teuniz in forum Qt Programming
    Replies: 4
    Last Post: 30th August 2006, 15:09
  5. QLabel and QLCDNumber
    By mickey in forum Newbie
    Replies: 5
    Last Post: 17th March 2006, 08:12

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.