17#ifndef QGSMESSAGEBAR_H
18#define QGSMESSAGEBAR_H
173 QList<QgsMessageBarItem *>
items();
217 void pushSuccess(
const QString &title,
const QString &message );
226 void pushInfo(
const QString &title,
const QString &message );
235 void pushWarning(
const QString &title,
const QString &message );
244 void pushCritical(
const QString &title,
const QString &message );
253 QList<QgsMessageBarItem *> mItems;
254 QMenu *mCloseMenu =
nullptr;
255 QToolButton *mCloseBtn =
nullptr;
256 QGridLayout *mLayout =
nullptr;
257 QLabel *mItemCount =
nullptr;
258 QAction *mActionCloseAll =
nullptr;
259 QTimer *mCountdownTimer =
nullptr;
260 QProgressBar *mCountProgress =
nullptr;
261 QString mCountStyleSheet;
264 static constexpr int MAX_ITEMS = 100;
266 void removeLowestPriorityOldestItem();
270 void updateItemCount();
273 void updateCountdown();
274 void resetCountdown();
MessageLevel
Level for messages This will be used both for message log and message bar in application.
@ Info
Information message.
Represents an item shown within a QgsMessageBar widget.
static int defaultMessageTimeout(Qgis::MessageLevel level=Qgis::MessageLevel::NoLevel)
Returns the default timeout in seconds for timed messages of the specified level.
bool popWidget(QgsMessageBarItem *item)
Remove the specified item from the bar, and display the next most recent one in the stack.
void 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.
void pushItem(QgsMessageBarItem *item)
Display a message item on the bar, after hiding the currently visible one and putting it in a stack.
void widgetAdded(QgsMessageBarItem *item)
Emitted whenever an item is added to the bar.
QgsMessageBarItem * currentItem()
Returns the current visible item, or nullptr if no item is shown.
void widgetRemoved(QgsMessageBarItem *item)
Emitted whenever an item was removed from the bar.
QgsMessageBarItem * pushWidget(QWidget *widget, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=0)
Display a widget as a message on the bar, after hiding the currently visible one and putting it in a ...
static QgsMessageBarItem * createMessage(const QString &text, QWidget *parent=nullptr)
Creates message bar item widget containing a message text to be displayed on the bar.
void pushSuccess(const QString &title, const QString &message)
Pushes a success message with default timeout to the message bar.
QgsMessageBar(QWidget *parent=nullptr)
Constructor for QgsMessageBar.
void pushCritical(const QString &title, const QString &message)
Pushes a critical warning message that must be manually dismissed by the user.
QList< QgsMessageBarItem * > items()
Returns a list of all items currently visible or queued for the bar.
bool clearWidgets()
Removes all items from the bar.
friend class TestQgsMessageBar
void pushInfo(const QString &title, const QString &message)
Pushes a information message with default timeout to the message bar.
void mousePressEvent(QMouseEvent *e) override
void pushWarning(const QString &title, const QString &message)
Pushes a warning message that must be manually dismissed by the user.