Qt QMainWindow.statusBar(): don’t use it

Don’t use the QMainWindow’s builtin QStatusBar (created and accessed using the statusBar() method.)

That status bar has problems on the OSX platform.  In other words, while Qt is generally cross-platform, this particular status bar is not.   But even if you don’t support that platform, its a bad idea…

That status bar is always at the bottom of the window.  That’s bad because it constrains the user.   Also its bad as UI because it divides the user’s attention among:

  • the top of the window (the menubar)
  • the bottom of the window (the statusbar)
  • the middle of the window (where most action occurs

This is well known.  The Apple HIG discusses it.  Thats why the QMainWindow’s status bar is problematic on the OSX platform.

In the Apple HIG they call a status bar at the bottom of a window a Placard, and say:

Note: Placards are not recommended for use in apps that run in OS X v10.7 and later.

A status bar itself is not always a good idea, no matter where it is or how you implement it.  See a discussion in the GUI Design Handbook.

But the status bar at the top of the screen  is often a good idea on a phone: see the iOS HIG.

If you must have a status bar in a Qt app, a better approach is to put a QStatusBar widget as a child of the toolbar area of a QMainWindow.  Briefly (in Python):

toolbar = mainWindow.addToolbar("Foo")
statusBar = QStatusBar()
toolbar.addWidget(statusBar)

Then:

  • the user can move it (to any edge of the parent main window)
  • the user can float it (to a separate window)
  • tooltips for context menus go to it

while it still is a status bar in the sense “displays a running stream of status.”

Advertisements

One thought on “Qt QMainWindow.statusBar(): don’t use it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s