Class: QgsMessageBarItem¶
- class qgis.gui.QgsMessageBarItem(text: str, level: Qgis.MessageLevel = Qgis.Info, duration: int = 0, parent: QWidget = None)¶
Bases:
PyQt5.QtWidgets.QWidget
Constructor for
QgsMessageBarItem
, containing a message with the specifiedtext
to be displayed on the bar.The
level
argument specifies the desired message level (severity) of the message, which controls how the message bar is styled when the item is displayed.The optional
duration
argument can be used to specify the message timeout in seconds. Ifduration
is set to 0, then the message must be manually dismissed by the user.QgsMessageBarItem(title: str, text: str, level: Qgis.MessageLevel = Qgis.Info, duration: int = 0, parent: QWidget = None) Constructor for
QgsMessageBarItem
, containing atitle
and message with the specifiedtext
to be displayed on the bar.The
level
argument specifies the desired message level (severity) of the message, which controls how the message bar is styled when the item is displayed.The optional
duration
argument can be used to specify the message timeout in seconds. Ifduration
is set to 0, then the message must be manually dismissed by the user.QgsMessageBarItem(title: str, text: str, widget: QWidget, level: Qgis.MessageLevel = Qgis.Info, duration: int = 0, parent: QWidget = None) Constructor for
QgsMessageBarItem
, containing atitle
, message with the specifiedtext
, and a customwidget
to be displayed on the bar.The
level
argument specifies the desired message level (severity) of the message, which controls how the message bar is styled when the item is displayed.The optional
duration
argument can be used to specify the message timeout in seconds. Ifduration
is set to 0, then the message must be manually dismissed by the user.QgsMessageBarItem(widget: QWidget, level: Qgis.MessageLevel = Qgis.Info, duration: int = 0, parent: QWidget = None) Constructor for
QgsMessageBarItem
, containing a customwidget
to be displayed on the bar.The
level
argument specifies the desired message level (severity) of the message, which controls how the message bar is styled when the item is displayed.The optional
duration
argument can be used to specify the message timeout in seconds. Ifduration
is set to 0, then the message must be manually dismissed by the user.Represents an item shown within a
QgsMessageBar
widget.QgsMessageBarItem
represents a single item (or message) which can be shown in aQgsMessageBar
widget.Methods
Dismisses the item, removing it from the message bar and deleting it.
Returns the duration (in seconds) of the message.
Returns the styleSheet which should be used to style a
QgsMessageBar
object when this item is displayed.Returns the icon for the message.
Returns the message level for the message.
Sets the
duration
(in seconds) to show the message for.Sets the
icon
associated with the message.Sets the message
level
for the item, which controls how the message bar is styled when the item is displayed.Sets the message
text
to show in the item.Sets the
title
for in the item.Sets a custom
widget
to show in the item.Returns the text for the message.
Returns the title for the message.
Returns the widget for the message.
Signals
Emitted when the item's message level has changed and the message bar style will need to be updated as a result.
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dismiss(self)¶
Dismisses the item, removing it from the message bar and deleting it. Calling this on items which have not been added to a message bar has no effect.
New in version 3.4.
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- duration(self) int ¶
Returns the duration (in seconds) of the message.
If the duration is 0 then the message will not automatically timeout and instead must be manually dismissed by the user.
See also
- Return type
int
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- getStyleSheet(self) str ¶
Returns the styleSheet which should be used to style a
QgsMessageBar
object when this item is displayed.- Return type
str
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- level(self) Qgis.MessageLevel ¶
Returns the message level for the message.
See also
- Return type
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- resizeEvent(self, QResizeEvent)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setDuration(self, duration: int) QgsMessageBarItem ¶
Sets the
duration
(in seconds) to show the message for. Ifduration
is 0 then the message will not automatically timeout and instead must be manually dismissed by the user.See also
- Parameters
duration (int) –
- Return type
- setIcon(self, icon: QIcon) QgsMessageBarItem ¶
Sets the
icon
associated with the message.See also
- Parameters
icon (QIcon) –
- Return type
- setLevel(self, level: Qgis.MessageLevel) QgsMessageBarItem ¶
Sets the message
level
for the item, which controls how the message bar is styled when the item is displayed.See also
- Parameters
level (Qgis.MessageLevel) –
- Return type
- setText(self, text: str) QgsMessageBarItem ¶
Sets the message
text
to show in the item.See also
- Parameters
text (str) –
- Return type
- setTitle(self, title: str) QgsMessageBarItem ¶
Sets the
title
for in the item.See also
- Parameters
title (str) –
- Return type
- setWidget(self, widget: QWidget) QgsMessageBarItem ¶
Sets a custom
widget
to show in the item.See also
- Parameters
widget (QWidget) –
- Return type
- showEvent(self, QShowEvent)¶
- styleChanged¶
Emitted when the item’s message level has changed and the message bar style will need to be updated as a result. [signal]
- Parameters
styleSheet (str) –
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- title(self) str ¶
Returns the title for the message.
See also
- Return type
str
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶
- widget(self) QWidget ¶
Returns the widget for the message.
See also
- Return type
QWidget