Results 1 to 3 of 3

Thread: Which widget to select in QT designer to display a number

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,349
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Which widget to select in QT designer to display a number

    I'm not sure which widget to select for my display.
    You have two choices: use a QLabel or a QLineEdit (with editing disabled: QLineEdit::setReadOnly()). It depends on how you want the output to appear. If you use a standard QLabel, it will look like plain old text on the background of your main UI widget. If you use QLineEdit, it will look like an edit box (with a frame around the text).

    In either case, you should user QString::number() to format the text the way you want it to appear, then use the appropriate setText() call to display it in the result widget.

    The translation from C++ syntax to Python syntax is straightforwward.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Jul 2017
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Which widget to select in QT designer to display a number

    Thanks very much. I've got the UI done now to complete the rest of the script.

Similar Threads

  1. Replies: 1
    Last Post: 28th April 2016, 16:37
  2. Mapping QScreen to X11 display number
    By nurtsi in forum Qt Programming
    Replies: 5
    Last Post: 11th January 2016, 09:10
  3. display the number of every node in 3d surfaceplot
    By panagiotisss in forum Newbie
    Replies: 0
    Last Post: 8th October 2012, 12:31
  4. display number on label
    By aj2903 in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2009, 07:24
  5. Display row Number in QMessageBox
    By arunvv in forum Newbie
    Replies: 6
    Last Post: 1st May 2008, 23:24

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.