Class: QgsStatusBar¶
A proxy widget for QStatusBar.
Unlike QStatusBar, QgsStatusBar allows finer control of
widget placement, including the option to locate permanent widgets on
the left side of the bar.
QgsStatusBar is designed to be embedded into an existing
window’s QStatusBar, as a permanent widget. This allows reuse of the
special QStatusBar handling for resize grips and other platform specific
status bar tweaks.
Instead of adding child widgets and showing messages directly in the
window’s status bar, these widgets (and messages) should instead be
added into the embedded QgsStatusBar.
Class Hierarchy¶
Base classes¶
Methods
Adds the given widget permanently to this status bar, reparenting the widget if it isn't already a child of this object. |
|
Removes any temporary message being shown. |
|
Returns the current message shown in the status bar. |
|
Removes a widget from the status bar. |
|
Sets the parent status bar. |
|
Displays the given message for the specified number of milli-seconds (timeout). |
Attributes
- class qgis.gui.QgsStatusBar[source]¶
Bases:
QWidget- __init__(parent: QWidget | None = None)
Constructor for QgsStatusBar.
- Parameters:
parent (Optional[QWidget] = None)
- class Anchor¶
Bases:
int
- AnchorLeft = 0¶
- AnchorRight = 1¶
- addPermanentWidget(self, widget: QWidget | None, stretch: int = 0, anchor: QgsStatusBar.Anchor = QgsStatusBar.AnchorRight)[source]¶
Adds the given
widgetpermanently to this status bar, reparenting the widget if it isn’t already a child of this object.The
stretchparameter 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.The
anchorparameter controls which side of the status bar the widget should be anchored to.- Parameters:
widget (Optional[QWidget])
stretch (int = 0)
anchor (QgsStatusBar.Anchor = QgsStatusBar.AnchorRight)
- currentMessage(self) str[source]¶
Returns the current message shown in the status bar.
See also
- Return type:
str
- removeWidget(self, widget: QWidget | None)[source]¶
Removes a
widgetfrom the status bar. Ownership of the widget remains unchanged, and the widget itself is not deleted.- Parameters:
widget (Optional[QWidget])
- setParentStatusBar(self, statusBar: QStatusBar | None)[source]¶
Sets the parent status bar. Messages that are shown on the parent status bar will be intercepted and shown on this status bar too.
Added in version 3.8.
- Parameters:
statusBar (Optional[QStatusBar])
- showMessage(self, message: str | None, timeout: int = 0)[source]¶
Displays the given
messagefor the specified number of milli-seconds (timeout). Iftimeoutis 0 (default), the message remains displayed until theclearMessage()slot is called or until theshowMessage()slot is called again to change the message.See also
See also
- Parameters:
message (Optional[str])
timeout (int = 0)