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?
The status bar can be retrieved using the QMainWindow::statusBar() function, and replaced using the QMainWindow::setStatusBar() function. In this example, we'll start from MainWindow class. We need to add menu actions. In this example, we'll add just one menu (MyMenuAction) to trigger action.
QMainWindow object reserves a horizontal bar at the bottom as the status bar. It is used to display either permanent or contextual status information. There are three types of status indicators − Temporary − Briefly occupies most of the status bar. For example, used to explain tool tip texts or menu entries.
Window clearTimeout() document. getElementById("demo").
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With