Represents an item shown within a QgsMessageBar widget.
More...
#include <qgsmessagebaritem.h>
|
void | dismiss () |
| Dismisses the item, removing it from the message bar and deleting it. More...
|
|
|
void | styleChanged (const QString &styleSheet) |
| Emitted when the item's message level has changed and the message bar style will need to be updated as a result. More...
|
|
|
| QgsMessageBarItem (const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=0, QWidget *parent=nullptr) |
| Constructor for QgsMessageBarItem, containing a message with the specified text to be displayed on the bar. More...
|
|
| QgsMessageBarItem (const QString &title, const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=0, QWidget *parent=nullptr) |
| Constructor for QgsMessageBarItem, containing a title and message with the specified text to be displayed on the bar. More...
|
|
| QgsMessageBarItem (const QString &title, const QString &text, QWidget *widget, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=0, QWidget *parent=nullptr) |
| Constructor for QgsMessageBarItem, containing a title, message with the specified text, and a custom widget to be displayed on the bar. More...
|
|
| QgsMessageBarItem (QWidget *widget, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=0, QWidget *parent=nullptr) |
| Constructor for QgsMessageBarItem, containing a custom widget to be displayed on the bar. More...
|
|
int | duration () const |
| Returns the duration (in seconds) of the message. More...
|
|
QString | getStyleSheet () |
| Returns the styleSheet which should be used to style a QgsMessageBar object when this item is displayed. More...
|
|
QIcon | icon () const |
| Returns the icon for the message. More...
|
|
Qgis::MessageLevel | level () const |
| Returns the message level for the message. More...
|
|
QgsMessageBarItem * | setDuration (int duration) |
| Sets the duration (in seconds) to show the message for. More...
|
|
QgsMessageBarItem * | setIcon (const QIcon &icon) |
| Sets the icon associated with the message. More...
|
|
QgsMessageBarItem * | setLevel (Qgis::MessageLevel level) |
| Sets the message level for the item, which controls how the message bar is styled when the item is displayed. More...
|
|
QgsMessageBarItem * | setText (const QString &text) |
| Sets the message text to show in the item. More...
|
|
QgsMessageBarItem * | setTitle (const QString &title) |
| Sets the title for in the item. More...
|
|
QgsMessageBarItem * | setWidget (QWidget *widget) |
| Sets a custom widget to show in the item. More...
|
|
QString | text () const |
| Returns the text for the message. More...
|
|
QString | title () const |
| Returns the title for the message. More...
|
|
QWidget * | widget () const |
| Returns the widget for the message. More...
|
|
Represents an item shown within a QgsMessageBar widget.
QgsMessageBarItem represents a single item (or message) which can be shown in a QgsMessageBar widget.
Definition at line 38 of file qgsmessagebaritem.h.
◆ QgsMessageBarItem() [1/4]
QgsMessageBarItem::QgsMessageBarItem |
( |
const QString & |
text, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = 0 , |
|
|
QWidget * |
parent = nullptr |
|
) |
| |
Constructor for QgsMessageBarItem, containing a message with the specified text 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. If duration is set to 0, then the message must be manually dismissed by the user. Since QGIS 3.18, a duration of -1 indicates that the default timeout for the message level should be used.
Definition at line 29 of file qgsmessagebaritem.cpp.
◆ QgsMessageBarItem() [2/4]
QgsMessageBarItem::QgsMessageBarItem |
( |
const QString & |
title, |
|
|
const QString & |
text, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = 0 , |
|
|
QWidget * |
parent = nullptr |
|
) |
| |
Constructor for QgsMessageBarItem, containing a title and message with the specified text 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. If duration is set to 0, then the message must be manually dismissed by the user. Since QGIS 3.18, a duration of -1 indicates that the default timeout for the message level should be used.
Definition at line 38 of file qgsmessagebaritem.cpp.
◆ QgsMessageBarItem() [3/4]
QgsMessageBarItem::QgsMessageBarItem |
( |
const QString & |
title, |
|
|
const QString & |
text, |
|
|
QWidget * |
widget, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = 0 , |
|
|
QWidget * |
parent = nullptr |
|
) |
| |
Constructor for QgsMessageBarItem, containing a title, message with the specified text, and a custom widget 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. If duration is set to 0, then the message must be manually dismissed by the user. Since QGIS 3.18, a duration of -1 indicates that the default timeout for the message level should be used.
Definition at line 48 of file qgsmessagebaritem.cpp.
◆ QgsMessageBarItem() [4/4]
QgsMessageBarItem::QgsMessageBarItem |
( |
QWidget * |
widget, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = 0 , |
|
|
QWidget * |
parent = nullptr |
|
) |
| |
Constructor for QgsMessageBarItem, containing a custom widget 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. If duration is set to 0, then the message must be manually dismissed by the user. Since QGIS 3.18, a duration of -1 indicates that the default timeout for the message level should be used.
Definition at line 61 of file qgsmessagebaritem.cpp.
◆ dismiss
void QgsMessageBarItem::dismiss |
( |
| ) |
|
|
slot |
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.
- Since
- QGIS 3.4
Definition at line 280 of file qgsmessagebaritem.cpp.
◆ duration()
int QgsMessageBarItem::duration |
( |
| ) |
const |
|
inline |
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
- setDuration()
Definition at line 179 of file qgsmessagebaritem.h.
◆ getStyleSheet()
QString QgsMessageBarItem::getStyleSheet |
( |
| ) |
|
|
inline |
◆ icon()
QIcon QgsMessageBarItem::icon |
( |
| ) |
const |
◆ level()
◆ setDuration()
Sets the duration (in seconds) to show the message for.
If duration is 0 then the message will not automatically timeout and instead must be manually dismissed by the user.
- See also
- duration()
Definition at line 274 of file qgsmessagebaritem.cpp.
◆ setIcon()
◆ setLevel()
Sets the message level for the item, which controls how the message bar is styled when the item is displayed.
- See also
- level()
Definition at line 224 of file qgsmessagebaritem.cpp.
◆ setText()
◆ setTitle()
◆ setWidget()
◆ styleChanged
void QgsMessageBarItem::styleChanged |
( |
const QString & |
styleSheet | ) |
|
|
signal |
Emitted when the item's message level has changed and the message bar style will need to be updated as a result.
◆ text()
QString QgsMessageBarItem::text |
( |
| ) |
const |
◆ title()
QString QgsMessageBarItem::title |
( |
| ) |
const |
◆ widget()
QWidget * QgsMessageBarItem::widget |
( |
| ) |
const |
◆ QgsMessageBar
The documentation for this class was generated from the following files: