Results 1 to 3 of 3

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

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

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

    I'm building a GUI using the QT designer 5.9. This GUI will be used to get a float value from the user then two radio buttons to ask what conversion they need to perform then display the result. I'm not sure which widget to select for my display. Does this really matter much or would I need to use a very specific widget?

    For information this UI will be converted to python as that's what my conversion tool is written in.

    Thank you for any information or help and sorry for the n00b question.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    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.

  3. #3
    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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.