QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Represents an item shown within a QgsMessageBar widget. More...
#include <qgsmessagebaritem.h>
Public Slots | |
void | dismiss () |
Dismisses the item, removing it from the message bar and deleting it. More... | |
Signals | |
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... | |
Public Member Functions | |
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... | |
Friends | |
class | QgsMessageBar |
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::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::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::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::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.
|
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.
Definition at line 280 of file qgsmessagebaritem.cpp.
|
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.
Definition at line 179 of file qgsmessagebaritem.h.
|
inline |
Returns the styleSheet which should be used to style a QgsMessageBar object when this item is displayed.
Definition at line 185 of file qgsmessagebaritem.h.
QIcon QgsMessageBarItem::icon | ( | ) | const |
Returns the icon for the message.
Definition at line 268 of file qgsmessagebaritem.cpp.
Qgis::MessageLevel QgsMessageBarItem::level | ( | ) | const |
Returns the message level for the message.
Definition at line 236 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setDuration | ( | int | duration | ) |
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.
Definition at line 274 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setIcon | ( | const QIcon & | icon | ) |
Sets the icon associated with the message.
Definition at line 262 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * 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.
Definition at line 224 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setText | ( | const QString & | text | ) |
Sets the message text to show in the item.
Definition at line 200 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setTitle | ( | const QString & | title | ) |
Sets the title for in the item.
Definition at line 212 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setWidget | ( | QWidget * | widget | ) |
Sets a custom widget to show in the item.
Definition at line 241 of file qgsmessagebaritem.cpp.
|
signal |
Emitted when the item's message level has changed and the message bar style will need to be updated as a result.
QString QgsMessageBarItem::text | ( | ) | const |
Returns the text for the message.
Definition at line 207 of file qgsmessagebaritem.cpp.
QString QgsMessageBarItem::title | ( | ) | const |
Returns the title for the message.
Definition at line 219 of file qgsmessagebaritem.cpp.
QWidget * QgsMessageBarItem::widget | ( | ) | const |
Returns the widget for the message.
Definition at line 257 of file qgsmessagebaritem.cpp.
|
friend |
Definition at line 225 of file qgsmessagebaritem.h.