22 #include <QMessageBox>
80 bar->pushMessage( title, message, level, duration );
86 case Qgis::MessageLevel::Info:
87 case Qgis::MessageLevel::NoLevel:
89 QMessageBox::information( parent, title, message );
92 case Qgis::MessageLevel::Warning:
94 QMessageBox::warning( parent, title, message );
97 case Qgis::MessageLevel::Critical:
99 QMessageBox::critical( parent, title, message );
102 case Qgis::MessageLevel::Success:
105 QMessageBox::information( parent, title, message );
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
QgsMessageBar * messageBar() const
Returns the associated message bar.
void setMessageBar(QgsMessageBar *bar)
Sets the associated message bar.
virtual void populateContextMenu(QgsDataItem *item, QMenu *menu, const QList< QgsDataItem * > &selectedItems, QgsDataItemGuiContext context)
Called when the given context menu is being populated for the given item, allowing the provider to ad...
virtual bool handleDrop(QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action)
Called when a user drops on an item.
static void notify(const QString &title, const QString &message, QgsDataItemGuiContext context, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=-1, QWidget *parent=nullptr)
Notify the user showing a message with title and level If the context has a message bar the message w...
virtual bool acceptDrop(QgsDataItem *item, QgsDataItemGuiContext context)
Providers should return true if the drops are allowed (handleDrop() should be implemented in that cas...
virtual bool handleDoubleClick(QgsDataItem *item, QgsDataItemGuiContext context)
Called when a user double clicks on an item.
virtual QWidget * createParamWidget(QgsDataItem *item, QgsDataItemGuiContext context)
Creates source widget from data item for QgsBrowserPropertiesWidget By default it returns nullptr.
virtual bool rename(QgsDataItem *item, const QString &name, QgsDataItemGuiContext context)
Sets a new name for the item, and returns true if the item was successfully renamed.
virtual bool deleteLayer(QgsLayerItem *item, QgsDataItemGuiContext context)
Tries to permanently delete map layer representing the given item.
Base class for all items in the model.
Item that represents a layer that can be opened with one of the providers.
A bar for displaying non-blocking messages to the user.