Display mixed information on label



  • Hi,

    I would like to display on a label something like in C++ classic:
    @cout << "Result = " << s << " Total number = " << tn; @
    I know to display on label with @ui.label->setText(); @ but I don't know how to display a long message like above.
    By the way, is there an easy way to display message on GUI in a similar-to-console style, for ex:

    1. Preparing...
    2. Running...
    3. Verifying...
      Only two line displayed at the same time: line 1 and 2, then line 2 and 3 (line 1 replaced by line 2, line 2 replaced by line 3). Could anyone please help me? Thanks!


  • Code example:
    @
    QLabel label(QString("Result = %1 Total number = %2")
    .arg(s)
    .arg(tn));
    @



  • Another example:
    @
    QString msg;
    QTextStream out(&msg);
    out << "Result = " << s << " Total number = " << tn;
    out.flush();
    QLabel label(msg);
    @



  • To display the messages, you can use the class "QMessageBox":http://qt-project.org/doc/qt-5.0/qtwidgets/qmessagebox.html:
    @
    QMessageBox::information(0, "Title", "Message");
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.