QGIS API Documentation  3.13.0-Master (788156190c)
qgsdataitemguiprovider.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdataitemguiprovider.h
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 #ifndef QGSDATAITEMGUIPROVIDER_H
17 #define QGSDATAITEMGUIPROVIDER_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include <QList>
22 #include <QWidget>
23 #include <QMimeData>
24 #include <QString>
25 #include <QMenu>
26 
27 class QgsDataItem;
28 class QgsMessageBar;
29 class QgsLayerItem;
30 
39 class GUI_EXPORT QgsDataItemGuiContext
40 {
41  public:
42 
46  QgsDataItemGuiContext() = default;
47 
55  QgsMessageBar *messageBar() const;
56 
64  void setMessageBar( QgsMessageBar *bar );
65 
66  private:
67 
68  QgsMessageBar *mMessageBar = nullptr;
69 };
70 
72 
84 class GUI_EXPORT QgsDataItemGuiProvider
85 {
86  public:
87 
88  virtual ~QgsDataItemGuiProvider() = default;
89 
93  virtual QString name() = 0;
94 
119  virtual void populateContextMenu( QgsDataItem *item, QMenu *menu,
120  const QList<QgsDataItem *> &selectedItems, QgsDataItemGuiContext context );
121 
131  virtual bool rename( QgsDataItem *item, const QString &name, QgsDataItemGuiContext context );
132 
143  virtual bool deleteLayer( QgsLayerItem *item, QgsDataItemGuiContext context );
144 
150  virtual bool handleDoubleClick( QgsDataItem *item, QgsDataItemGuiContext context );
151 
157  virtual bool acceptDrop( QgsDataItem *item, QgsDataItemGuiContext context );
158 
165  virtual bool handleDrop( QgsDataItem *item, QgsDataItemGuiContext context, const QMimeData *data, Qt::DropAction action );
166 
176  virtual QWidget *createParamWidget( QgsDataItem *item, QgsDataItemGuiContext context ) SIP_FACTORY;
177 };
178 
179 #endif // QGSDATAITEMGUIPROVIDER_H
QgsDataItemGuiProvider
Definition: qgsdataitemguiprovider.h:84
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsDataItemGuiContext)
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgis_sip.h
QgsMessageBar
Definition: qgsmessagebar.h:45
QgsDataItemGuiContext
Definition: qgsdataitemguiprovider.h:39
QgsLayerItem
Definition: qgsdataitem.h:492
QgsDataItem
Definition: qgsdataitem.h:49