Important: Please read the Qt Code of Conduct -

Which output (display) widget are available.

  • Hi,
    sorry to ask a really simple question: but what if I want to display in a widget a float number produced in my code?
    The only thing I find for this is a LCD_display that i don't like much.
    Is not there something like a QtLineEdit (same fonts) that does not accept
    mouse focus, or keystrokes? (maybe with a grayed out background, but not essential)
    Thank you!
    I use QtCreator 2.5.2, Qt version is 4.8.6, last one that works in Scientific Linux 6. Going forward from this is quite painful because of upgrading gcc.

  • @ACalcaterra If your just want to show the value, take a QLabel and format the float value as string.

    QLabel *myLabel = new QLabel(this);
    myLabel->setText(QString::number(myFloat, 'f', 2));

  • Moderators

    You probably want QLabel. It's simplistic, but it's the simplest display widget out there. You can also use a QLineEdit that has its readOnly property set.

    Kind regards.

Log in to reply