QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
22 #include <QMessageBox>
80 case Qgis::MessageLevel::Info:
81 case Qgis::MessageLevel::None:
83 if (
auto *lMessageBar = context.
messageBar() )
85 lMessageBar->pushInfo( title, message );
89 QMessageBox::information(
nullptr, title, message );
93 case Qgis::MessageLevel::Warning:
95 if (
auto *lMessageBar = context.
messageBar() )
97 lMessageBar->pushWarning( title, message );
101 QMessageBox::warning(
nullptr, title, message );
105 case Qgis::MessageLevel::Critical:
107 if (
auto *lMessageBar = context.
messageBar() )
109 lMessageBar->pushCritical( title, message );
113 QMessageBox::critical(
nullptr, title, message );
117 case Qgis::MessageLevel::Success:
119 if (
auto *lMessageBar = context.
messageBar() )
121 lMessageBar->pushSuccess( title, message );
126 QMessageBox::information(
nullptr, title, message );
QgsMessageBar * messageBar() const
Returns the associated message bar.
static void notify(const QString &title, const QString &message, QgsDataItemGuiContext context, Qgis::MessageLevel level=Qgis::Info)
Notify the user showing a message with title and level If the context has a message bar the message w...
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 handleDrop(QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action)
Called when a user drops on an item.
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.
A bar for displaying non-blocking messages to the user.
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
void setMessageBar(QgsMessageBar *bar)
Sets the associated message bar.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
virtual bool acceptDrop(QgsDataItem *item, QgsDataItemGuiContext context)
Providers should return true if the drops are allowed (handleDrop() should be implemented in that cas...
Item that represents a layer that can be opened with one of the providers.
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...
Base class for all items in the model.
virtual bool deleteLayer(QgsLayerItem *item, QgsDataItemGuiContext context)
Tries to permanently delete map layer representing the given item.