A bar for displaying non-blocking messages to the user.
QgsMessageBar is a reusable widget which allows for providing feedback to users in a non-intrusive way. Messages are shown in a horizontal bar widget, which is styled automatically to reflect the severity ("message level") of the displayed message (e.g. warning messages are styled in an orange color scheme, critical errors are shown in red, etc).
The message bar supports automatic stacking of multiple messages, so that only the most recent message is shown to users. Users can then manually dismiss individual messages to remove them from the stack, causing the next-most-recent message to be shown. If no messages are available to show then the message bar automatically hides.
The class also supports pushing custom widgets to the notification stack via the pushWidget() method.
Definition at line 60 of file qgsmessagebar.h.
void QgsMessageBar::pushMessage |
( |
const QString & |
text, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = -1 |
|
) |
| |
A convenience method for pushing a message with the specified text to the bar.
The level argument specifies the desired message level (severity) of the message, which controls how the message bar is styled.
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 405 of file qgsmessagebar.cpp.
void QgsMessageBar::pushMessage |
( |
const QString & |
title, |
|
|
const QString & |
text, |
|
|
const QString & |
showMore, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = -1 |
|
) |
| |
A convenience method for pushing a message with the specified title and text to the bar.
Additional message content specified via showMore will be shown when the user presses a "more" button.
The level argument specifies the desired message level (severity) of the message, which controls how the message bar is styled.
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 348 of file qgsmessagebar.cpp.
void QgsMessageBar::pushMessage |
( |
const QString & |
title, |
|
|
const QString & |
text, |
|
|
Qgis::MessageLevel |
level = Qgis::MessageLevel::Info , |
|
|
int |
duration = -1 |
|
) |
| |
A convenience method for pushing a message with the specified title and text to the bar.
The level argument specifies the desired message level (severity) of the message, which controls how the message bar is styled.
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 335 of file qgsmessagebar.cpp.