QGIS API Documentation
3.28.0-Firenze (ed3ad0430f)
src
gui
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 "
qgis.h
"
22
#include <QList>
23
#include <QWidget>
24
#include <QMimeData>
25
#include <QString>
26
#include <QMenu>
27
28
class
QgsDataItem
;
29
class
QgsMessageBar
;
30
class
QgsLayerItem
;
31
class
QgsBrowserTreeView
;
32
41
class
GUI_EXPORT
QgsDataItemGuiContext
42
{
43
public
:
44
48
QgsDataItemGuiContext
() =
default
;
49
57
QgsMessageBar
*messageBar()
const
;
58
66
void
setMessageBar(
QgsMessageBar
*bar );
67
74
QgsBrowserTreeView
*view()
const
;
75
82
void
setView(
QgsBrowserTreeView
*view );
83
84
private
:
85
86
QgsMessageBar
*mMessageBar =
nullptr
;
87
88
QgsBrowserTreeView
*mView =
nullptr
;
89
};
90
91
Q_DECLARE_METATYPE
(
QgsDataItemGuiContext
);
92
104
class
GUI_EXPORT
QgsDataItemGuiProvider
105
{
106
public
:
107
108
virtual
~QgsDataItemGuiProvider
() =
default
;
109
113
virtual
QString
name
() = 0;
114
139
virtual
void
populateContextMenu(
QgsDataItem
*item, QMenu *menu,
140
const
QList<QgsDataItem *> &selectedItems,
QgsDataItemGuiContext
context );
141
153
virtual
int
precedenceWhenPopulatingMenus()
const
;
154
164
virtual
bool
rename(
QgsDataItem
*item,
const
QString &name,
QgsDataItemGuiContext
context );
165
176
virtual
bool
deleteLayer(
QgsLayerItem
*item,
QgsDataItemGuiContext
context );
177
183
virtual
bool
handleDoubleClick(
QgsDataItem
*item,
QgsDataItemGuiContext
context );
184
190
virtual
bool
acceptDrop(
QgsDataItem
*item,
QgsDataItemGuiContext
context );
191
198
virtual
bool
handleDrop(
QgsDataItem
*item,
QgsDataItemGuiContext
context,
const
QMimeData *data, Qt::DropAction action );
199
209
virtual
QWidget *createParamWidget(
QgsDataItem
*item,
QgsDataItemGuiContext
context )
SIP_FACTORY
;
210
222
static
void
notify(
const
QString &title,
const
QString &message,
QgsDataItemGuiContext
context,
Qgis::MessageLevel
level = Qgis::MessageLevel::Info,
int
duration = -1, QWidget *parent =
nullptr
);
223
};
224
225
#endif
// QGSDATAITEMGUIPROVIDER_H
Qgis::MessageLevel
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition:
qgis.h:115
QgsBrowserTreeView
The QgsBrowserTreeView class extends QTreeView with save/restore tree state functionality.
Definition:
qgsbrowsertreeview.h:41
QgsDataItemGuiContext
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
Definition:
qgsdataitemguiprovider.h:42
QgsDataItemGuiContext::QgsDataItemGuiContext
QgsDataItemGuiContext()=default
Constructor for QgsDataItemGuiContext.
QgsDataItemGuiProvider
Abstract base class for providers which affect how QgsDataItem items behave within the application GU...
Definition:
qgsdataitemguiprovider.h:105
QgsDataItemGuiProvider::~QgsDataItemGuiProvider
virtual ~QgsDataItemGuiProvider()=default
QgsDataItemGuiProvider::name
virtual QString name()=0
Returns the provider's name.
QgsDataItem
Base class for all items in the model.
Definition:
qgsdataitem.h:46
QgsLayerItem
Item that represents a layer that can be opened with one of the providers.
Definition:
qgslayeritem.h:31
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition:
qgsmessagebar.h:61
qgis.h
qgis_sip.h
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsDataItemGuiContext)
Generated on Sat Oct 22 2022 16:10:47 for QGIS API Documentation by
1.9.4