PDA

View Full Version : "Normal" Status Bar Message doesn't look right...



codeslicer
19th January 2009, 21:40
Hello,

I have a little problem with the GUI of my application. In my QMainWindow, made in Designer, I have a status bar. When the mouse highlights different menu items, the value of the status bar changes from blank to the statusTip that I set. However, I want to have a "default" statusTip. In the Qt Docs, it says that I have to use addWidget() on the status bar, and add a QLabel. I did that, and it works fine, except... this is how it looks like:

(1st attached image),

whereas here is how a "temporary" statusTip looks like:

(2nd attached image)

Whatever I do I can't seem to change how it looks, whether it's using all this or not:


msg->setFrameShape(QFrame::NoFrame);
msg->setFrameShadow(QFrame::Plain);
msg->setLineWidth(0);
msg->setStyleSheet("border: none;");

Please help!

Thanks in advance,
codeslicer :)

wysota
19th January 2009, 22:09
Widgets embedded into a status bar always look sunken. The temporary message uses a different mechanism. This is how a status bar should behave so you shouldn't try to change it. If you want something different, simply place a label inside a regular layout of the central widget of the main window.

codeslicer
19th January 2009, 23:09
Thank you for your reply, wysota.

So, there is no way to somehow have a default statusBar message? Because although I can use showMessage() in the constructor, when the user goes into the menu, a different messsage is shown. However, when the cursor returns back to the main form, the statusBar message is blank. I just want it to be "Ready." by default.

Many thanks for a solution.

wysota
20th January 2009, 00:31
So, there is no way to somehow have a default statusBar message?
No, not directly. You can only embed a widget into the status bar, place a label over the status bar or install an event filter or a similar mechanism on the status bar and catch some event that surely is delivered after a message timeouts and set the default message there. I think it should work but it requires some coding and possibly reading Qt sources.

codeslicer
20th January 2009, 00:50
I don't have time now, but I'm thinking of making a global variable, "defaultMessage", that will represent the default message of the status bar. After that, I'll connect the QStatusBar::messageChanged(QString message) signal to a slot that will change it back to the default message if the message variable is empty.

Hopefully it will work, and thanks for your help. :p