Qt : How to add a widget to right of QStatusBar

qt

Solution

You'll need to use QStatusBar.addPermanentWidget() to that effect. This is the documentation of that method:

`void QStatusBar::addPermanentWidget ( QWidget * widget, int stretch = 0 )`

Adds the given widget permanently to this status bar, reparenting the widget if it isn't already a child of this QStatusBar object. The stretch parameter is used to compute a suitable size for the given widget as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space. Permanently means that the widget may not be obscured by temporary messages. It is is located at the far right of the status bar.

Problem

When I add new widget to status bar using `addWidget` function of `QStatusBar` class this new widget will be added to the left of the status bar but I'm going to add it to the right. Is it possible without changing the direction of the main window?

Original source