PDA

View Full Version : need help with the status bar



filmfreak
14th February 2006, 20:54
Hello, I'm working on a Main Application in Qt Designer 3.2.1, and I am trying to figure out how to work with the status bar. I know that the following will display the word "message" for two seconds.

statusBar()->message("message", 2000);

There's two things I'd like to do:
1) Display another message after the two seconds. I attempted this, but when I executed the program, the status bar instantly switched to the second message rather than waiting two seconds.

2) Be able to display multiple items at once, including integers. For example, I'd like to be able to display the word "In", followed by the value of an integer variable, followed by the word "Out", followed by the value of another integer variable.

I would appreciate any help you could give me. Thanks!

jacek
14th February 2006, 20:59
1) Display another message after the two seconds. I attempted this, but when I executed the program, the status bar instantly switched to the second message rather than waiting two seconds.
You will have to queue messages and use QTimer or QStatusBar::messageChanged() to change them.


2) Be able to display multiple items at once, including integers. For example, I'd like to be able to display the word "In", followed by the value of an integer variable, followed by the word "Out", followed by the value of another integer variable.
Just put everything in one string.

Also check out QStatusBar::addWidget() method.

Cesar
15th February 2006, 09:34
2) Be able to display multiple items at once, including integers. For example, I'd like to be able to display the word "In", followed by the value of an integer variable, followed by the word "Out", followed by the value of another integer variable.



statusBar()->message(QString("In: %1 | Out: %2").arg(inValue).arg(outValue));