QGIS API Documentation  3.13.0-Master (740be229cb)
qgsdataitemguiprovider.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdataitemguiprovider.cpp
3  --------------------------------------
4  Date : October 2018
5  Copyright : (C) 2018 by Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsdataitemguiprovider.h"
17 
18 //
19 // QgsDataItemGuiContext
20 //
21 
23 {
24  return mMessageBar;
25 }
26 
28 {
29  mMessageBar = messageBar;
30 }
31 
32 //
33 // QgsDataItemGuiProvider
34 //
35 
36 void QgsDataItemGuiProvider::populateContextMenu( QgsDataItem *, QMenu *, const QList<QgsDataItem *> &, QgsDataItemGuiContext )
37 {
38 }
39 
41 {
42  return false;
43 }
44 
46 {
47  return false;
48 }
49 
51 {
52  return false;
53 }
54 
56 {
57  return false;
58 }
59 
60 bool QgsDataItemGuiProvider::handleDrop( QgsDataItem *, QgsDataItemGuiContext, const QMimeData *, Qt::DropAction )
61 {
62  return false;
63 }
64 
66 {
67  return nullptr;
68 }
QgsMessageBar * messageBar() const
Returns 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...
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:45
virtual bool deleteLayer(QgsLayerItem *item, QgsDataItemGuiContext context)
Tries to permanently delete map layer representing the given item.
virtual bool acceptDrop(QgsDataItem *item, QgsDataItemGuiContext context)
Providers should return true if the drops are allowed (handleDrop() should be implemented in that cas...
Base class for all items in the model.
Definition: qgsdataitem.h:49
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
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 handleDoubleClick(QgsDataItem *item, QgsDataItemGuiContext context)
Called when a user double clicks on an item.
void setMessageBar(QgsMessageBar *bar)
Sets the associated message bar.
virtual QWidget * createParamWidget(QgsDataItem *item, QgsDataItemGuiContext context)
Creates source widget from data item for QgsBrowserPropertiesWidget By default it returns nullptr...
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:492
virtual bool handleDrop(QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action)
Called when a user drops on an item.