QStatusBar¶
The
QStatusBar
class provides a horizontal bar suitable for presenting status information. More…
Synopsis¶
Functions¶
def
addPermanentWidget
(widget[, stretch=0])def
addWidget
(widget[, stretch=0])def
currentMessage
()def
hideOrShow
()def
insertPermanentWidget
(index, widget[, stretch=0])def
insertWidget
(index, widget[, stretch=0])def
isSizeGripEnabled
()def
reformat
()def
removeWidget
(widget)def
setSizeGripEnabled
(arg__1)
Slots¶
def
clearMessage
()def
showMessage
(text[, timeout=0])
Signals¶
def
messageChanged
(text)
Detailed Description¶
Each status indicator falls into one of three categories:
Temporary - briefly occupies most of the status bar. Used to explain tool tip texts or menu entries, for example.
Normal - occupies part of the status bar and may be hidden by temporary messages. Used to display the page and line number in a word processor, for example.
Permanent - is never hidden. Used for important mode indications, for example, some applications put a Caps Lock indicator in the status bar.
QStatusBar
lets you display all three types of indicators.Typically, a request for the status bar functionality occurs in relation to a
QMainWindow
object.QMainWindow
provides a main application window, with a menu bar, tool bars, dock widgets and a status bar around a large central widget. The status bar can be retrieved using thestatusBar()
function, and replaced using thesetStatusBar()
function.Use the
showMessage()
slot to display a temporary message:def createStatusBar(self): statusBar().showMessage(tr("Ready"))To remove a temporary message, use the
clearMessage()
slot, or set a time limit when callingshowMessage()
. For example:def print(self) document = textEdit.document() printer = QPrinter() dlg = QPrintDialog(&printer, self) if dlg.exec() != QDialog.Accepted: return document.print(printer) statusBar().showMessage(tr("Ready"), 2000)Use the
currentMessage()
function to retrieve the temporary message currently shown. TheQStatusBar
class also provide themessageChanged()
signal which is emitted whenever the temporary status message changes.Normal and Permanent messages are displayed by creating a small widget (
QLabel
,QProgressBar
or evenQToolButton
) and then adding it to the status bar using theaddWidget()
or theaddPermanentWidget()
function. Use theremoveWidget()
function to remove such messages from the status bar.statusBar().addWidget(MyReadWriteIndication())By default
QStatusBar
provides aQSizeGrip
in the lower-right corner. You can disable it using thesetSizeGripEnabled()
function. Use theisSizeGripEnabled()
function to determine the current status of the size grip.
-
class
QStatusBar
([parent=None])¶ - param parent
Constructs a status bar with a size grip and the given
parent
.See also
-
PySide2.QtWidgets.QStatusBar.
addPermanentWidget
(widget[, stretch=0])¶ - Parameters
widget –
QWidget
stretch –
int
Adds the given
widget
permanently to this status bar, reparenting the widget if it isn’t already a child of thisQStatusBar
object. Thestretch
parameter is used to compute a suitable size for the givenwidget
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.
-
PySide2.QtWidgets.QStatusBar.
addWidget
(widget[, stretch=0])¶ - Parameters
widget –
QWidget
stretch –
int
Adds the given
widget
to this status bar, reparenting the widget if it isn’t already a child of thisQStatusBar
object. Thestretch
parameter is used to compute a suitable size for the givenwidget
as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.The widget is located to the far left of the first permanent widget (see
addPermanentWidget()
) and may be obscured by temporary messages.
-
PySide2.QtWidgets.QStatusBar.
clearMessage
()¶ Removes any temporary message being shown.
See also
-
PySide2.QtWidgets.QStatusBar.
currentMessage
()¶ - Return type
unicode
Returns the temporary message currently shown, or an empty string if there is no such message.
See also
-
PySide2.QtWidgets.QStatusBar.
hideOrShow
()¶ Ensures that the right widgets are visible.
Used by the
showMessage()
andclearMessage()
functions.
-
PySide2.QtWidgets.QStatusBar.
insertPermanentWidget
(index, widget[, stretch=0])¶ - Parameters
index –
int
widget –
QWidget
stretch –
int
- Return type
int
Inserts the given
widget
at the givenindex
permanently to this status bar, reparenting the widget if it isn’t already a child of thisQStatusBar
object. Ifindex
is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).The
stretch
parameter is used to compute a suitable size for the givenwidget
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.
-
PySide2.QtWidgets.QStatusBar.
insertWidget
(index, widget[, stretch=0])¶ - Parameters
index –
int
widget –
QWidget
stretch –
int
- Return type
int
Inserts the given
widget
at the givenindex
to this status bar, reparenting the widget if it isn’t already a child of thisQStatusBar
object. Ifindex
is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).The
stretch
parameter is used to compute a suitable size for the givenwidget
as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.The widget is located to the far left of the first permanent widget (see
addPermanentWidget()
) and may be obscured by temporary messages.
-
PySide2.QtWidgets.QStatusBar.
isSizeGripEnabled
()¶ - Return type
bool
-
PySide2.QtWidgets.QStatusBar.
messageChanged
(text)¶ - Parameters
text – unicode
-
PySide2.QtWidgets.QStatusBar.
reformat
()¶ Changes the status bar’s appearance to account for item changes.
Special subclasses may need this function, but geometry management will usually take care of any necessary rearrangements.
-
PySide2.QtWidgets.QStatusBar.
removeWidget
(widget)¶ - Parameters
widget –
QWidget
Removes the specified
widget
from the status bar.Note
This function does not delete the widget but hides it. To add the widget again, you must call both the
addWidget()
andshow()
functions.
-
PySide2.QtWidgets.QStatusBar.
setSizeGripEnabled
(arg__1)¶ - Parameters
arg__1 –
bool
See also
-
PySide2.QtWidgets.QStatusBar.
showMessage
(text[, timeout=0])¶ - Parameters
text – unicode
timeout –
int
Hides the normal status indications and displays the given
message
for the specified number of milli-seconds (timeout
). Iftimeout
is 0 (default), themessage
remains displayed until theclearMessage()
slot is called or until the slot is called again to change the message.Note that is called to show temporary explanations of tool tip texts, so passing a
timeout
of 0 is not sufficient to display apermanent message
.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.