Important: Please read the Qt Code of Conduct -

[SOLVED] how to print a int and string to the status bar?

  • how to print a int and string to the status bar. I would like to display in the status bar, the name of the user and the max connections of the program. something like. User: Fred | Connections: 3. How can i do this. thank you.

  • i found it. what i was looking for is ui->statusBar->showMessage. but i discovered a another small problem that i am not able to fix. when I display a statusTip or tooltip somewhere else, the original message of user / connections message is gone. how to display that message after i leave the tips? the mouseMoveEvent does not work.

  • "QStatusBar::showMessage()":
    [quote]Hides the normal status indications and displays the given message for the specified number of milli-seconds (timeout). If timeout is 0 (default), the message remains displayed until the clearMessage() slot is called or until the showMessage() slot is called again to change the message.

    Note that showMessage() is called to show temporary explanations of tool tip texts, so passing a timeout of 0 is not sufficient to display a permanent message.[/quote]
    [quote]Normal and Permanent messages are displayed by creating a small widget (QLabel, QProgressBar or even QToolButton) and then adding it to the status bar using the addWidget() or the addPermanentWidget() function. Use the removeWidget() function to remove such messages from the status bar.[/quote]

  • thank you Lukas Geyer

Log in to reply