QGIS API Documentation 3.41.0-Master (cea29feecf2)
|
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
int | duration () const |
Returns the duration (in seconds) of the message. | |
QString | getStyleSheet () |
Returns the styleSheet which should be used to style a QgsMessageBar object when this item is displayed. | |
QIcon | icon () const |
Returns the icon for the message. | |
Qgis::MessageLevel | level () const |
Returns the message level for the message. | |
QgsMessageBarItem * | setDuration (int duration) |
Sets the duration (in seconds) to show the message for. | |
QgsMessageBarItem * | setIcon (const QIcon &icon) |
Sets the icon associated with the message. | |
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. | |
QgsMessageBarItem * | setText (const QString &text) |
Sets the message text to show in the item. | |
QgsMessageBarItem * | setTitle (const QString &title) |
Sets the title for in the item. | |
QgsMessageBarItem * | setWidget (QWidget *widget) |
Sets a custom widget to show in the item. | |
QString | text () const |
Returns the text for the message. | |
QString | title () const |
Returns the title for the message. | |
QWidget * | widget () const |
Returns the widget for the message. | |
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 30 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 39 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 49 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 62 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 281 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 178 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 184 of file qgsmessagebaritem.h.
QIcon QgsMessageBarItem::icon | ( | ) | const |
Returns the icon for the message.
Definition at line 269 of file qgsmessagebaritem.cpp.
Qgis::MessageLevel QgsMessageBarItem::level | ( | ) | const |
Returns the message level for the message.
Definition at line 237 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 275 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setIcon | ( | const QIcon & | icon | ) |
Sets the icon associated with the message.
Definition at line 263 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 225 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setText | ( | const QString & | text | ) |
Sets the message text to show in the item.
Definition at line 201 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setTitle | ( | const QString & | title | ) |
Sets the title for in the item.
Definition at line 213 of file qgsmessagebaritem.cpp.
QgsMessageBarItem * QgsMessageBarItem::setWidget | ( | QWidget * | widget | ) |
Sets a custom widget to show in the item.
Definition at line 242 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 208 of file qgsmessagebaritem.cpp.
QString QgsMessageBarItem::title | ( | ) | const |
Returns the title for the message.
Definition at line 220 of file qgsmessagebaritem.cpp.
QWidget * QgsMessageBarItem::widget | ( | ) | const |
Returns the widget for the message.
Definition at line 258 of file qgsmessagebaritem.cpp.
|
friend |
Definition at line 224 of file qgsmessagebaritem.h.