Results 1 to 5 of 5

Thread: "Normal" Status Bar Message doesn't look right...

  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile "Normal" Status Bar Message doesn't look right...

    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:

    Qt Code:
    1. msg->setFrameShape(QFrame::NoFrame);
    2. msg->setFrameShadow(QFrame::Plain);
    3. msg->setLineWidth(0);
    4. msg->setStyleSheet("border: none;");
    To copy to clipboard, switch view to plain text mode 

    Please help!

    Thanks in advance,
    codeslicer
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: "Normal" Status Bar Message doesn't look right...

    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.

  3. The following user says thank you to wysota for this useful post:

    codeslicer (19th January 2009)

  4. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: "Normal" Status Bar Message doesn't look right...

    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.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: "Normal" Status Bar Message doesn't look right...

    Quote Originally Posted by codeslicer View Post
    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.

  6. #5
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: "Normal" Status Bar Message doesn't look right...

    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.

Similar Threads

  1. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  2. treewidget and a message system
    By alisami in forum Qt Programming
    Replies: 7
    Last Post: 27th July 2008, 18:05
  3. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 23:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.