View Full Version : QStatusBar Resizes

17th February 2011, 17:38
I have a QStatusBar at the bottom of my form, and want it to perform similar to KDE's dolphin when a notification is displayed that a file or folder could not be found. It looks like it displays a text label along with a push button to acknowledge the notification. Once the notification has been acknowledged, it goes away, and are left with the default status bar.

My problem is when I invoke QStatusBar::showMessage, the status bar is a different size than when I do QStatusBar::addWidget with a QLabel. Also different, is when I perform a QStatusBar::addWidget with a QPushButton. I want the small size of the default QStatusBar without it resizing based on the contents. I have tried adding a stylesheet to keep the borders, padding, and margins to zero; tried to change sizes for the widgets; even tried to set the spacing on the widget to zero. The only thing that could get the status bar smaller was to change the layout margins from a four, to a zero (since I created a widget in Qt Designer with a QLabel, a spacer, and a QPushButton). This shrunk the widget to a smaller size. However, it wasn't small enough. Dynamically adding/removing the custom widget to/from the status bar results in the contents above the status bar to shrink/expand. I want a uniform size that is small, just like the default status bar. I can make the status bar the same size throughout the life of the application by just adding the widgets, then hiding/showing them, but I would REALLY like to have the smaller footprint.

Any ideas?