Results 1 to 7 of 7

Thread: How to remove status bar from Qt 4 "Main Window" form?

  1. #1
    Join Date
    Jan 2006
    Location
    11 N 78 E
    Posts
    110
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to remove status bar from Qt 4 "Main Window" form?

    I select "Main Window" at the "New Form" dialog in Qt 4 and I got a main window with a menubar and statusbar present by default. To remove the menubar I just right-click it and say "remove menubar". How do I remove the statusbar?
    Penguin #395953 using Qt for open-source development on X11 using C++ and
    Python via PyQt

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Jan 2006
    Location
    11 N 78 E
    Posts
    110
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    Quote Originally Posted by axeljaeger
    Obtain a pointer to the statusbar and hide it
    Thanks, but this seems a roundabout way. I think Trolltech should provide a way to do this directly, and will file a bug issue. (Why can't Qt issues be browsed, the way KDE bugs can be?)
    Penguin #395953 using Qt for open-source development on X11 using C++ and
    Python via PyQt

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    Quote Originally Posted by jamadagni
    Why can't Qt issues be browsed, the way KDE bugs can be?
    Have you seen this?

  5. #5
    Join Date
    Jan 2006
    Location
    New Malden (near London)
    Posts
    32
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    Quote Originally Posted by jamadagni
    Thanks, but this seems a roundabout way. I think Trolltech should provide a way to do this directly, and will file a bug issue. (Why can't Qt issues be browsed, the way KDE bugs can be?)
    All operations on the status bar can be done through the QMainWindow class's statusBar() method, which returns a pointer to QStatusBar object, namely the window's status bar. If the window so far does not have one, it acquires one when statusBar() is called.

    To display a message on the status bar, for example, you do this:

    statusBar()->showMessage( "The job failed.", 2000 );

    (2000 refers to the milliseconds for which the message is to appear, so 2000 represents two seconds.)

    QStatusBar is a subclass of QWidget, so it inherits setVisible( bool ) and hide() from QWidget. So all you need do is:

    statusBar()->hide();

    or

    statusBar()->setVisible( false );

    See, it's not that complicated, is it?

  6. #6
    Join Date
    Jan 2006
    Location
    11 N 78 E
    Posts
    110
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    Quote Originally Posted by Matt Smith
    All operations on the status bar can be done through the QMainWindow class's statusBar() method, it's not that complicated, is it
    I quite agree, and as a programmer becomes more and more advanced there is not a thing s/he can't do through direct coding. I was just commenting that the designer did not have a way to do this while it should.
    Penguin #395953 using Qt for open-source development on X11 using C++ and
    Python via PyQt

  7. #7
    Join Date
    Feb 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to remove status bar from Qt 4 "Main Window" form?

    With the previous two ways to make invisible the status bar,
    statusBar()->hide();
    or
    statusBar()->setVisible( false );

    two other ways are possible :
    if ( statusBar() )
    delete statusBar;
    or
    statusBar->setMaximumHeight(0);

    And, yes, what a pity that Creator (or design product) doesn't offer a simply way to avoid the status bar.


    Added after 49 minutes:


    The "without coding" way is, in QT creator 2.7.0, to delete the status bar item by right clicking on it, in the Object list of the design tool.
    Last edited by kolph; 13th February 2014 at 13:35.

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.