Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt : How to add a widget to right of QStatusBar

Tags:

qt

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?

like image 942
s4eed Avatar asked Mar 17 '13 16:03

s4eed


People also ask

How do I add a status bar to QT?

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.

What is status bar in Qt?

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.

Which function is used to reset the timeout block if the message is displayed on the status bar?

Window clearTimeout() document. getElementById("demo").


1 Answers

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.

like image 183
b2Wc0EKKOvLPn Avatar answered Sep 24 '22 22:09

b2Wc0EKKOvLPn