QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsfilebaseddataitemprovider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfilebaseddataitemprovider.h
3 --------------------------------------
4 Date : July 2021
5 Copyright : (C) 2021 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 QGSFILEBASEDDATAITEMPROVIDER_H
17#define QGSFILEBASEDDATAITEMPROVIDER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgsdataitemprovider.h"
23#include "qgslayeritem.h"
26#include <QString>
27#include <QVector>
28
30
31#define SIP_NO_FILE
32
33class QgsDataItem;
34
45class CORE_EXPORT QgsProviderSublayerItem final: public QgsLayerItem
46{
47 Q_OBJECT
48 public:
49
57 QgsProviderSublayerItem( QgsDataItem *parent, const QString &name, const QgsProviderSublayerDetails &details, const QString &filePath );
58 QString layerName() const override;
59 QVector<QgsDataItem *> createChildren() override;
61
67 QgsProviderSublayerDetails sublayerDetails() const;
68
69 private:
70
71 static Qgis::BrowserLayerType layerTypeFromSublayer( const QgsProviderSublayerDetails &sublayer );
72
74
75};
76
77
85{
86 Q_OBJECT
87 public:
88
95 QgsFileDataCollectionGroupItem( QgsDataItem *parent, const QString &groupName, const QString &path );
96
100 void appendSublayer( const QgsProviderSublayerDetails &sublayer );
101
102 bool hasDragEnabled() const override;
103 QgsMimeDataUtils::UriList mimeUris() const override;
104
105 private:
106
107 QList< QgsProviderSublayerDetails > mSublayers;
108};
109
120{
121 Q_OBJECT
122 public:
123
133 QgsFileDataCollectionItem( QgsDataItem *parent, const QString &name, const QString &path, const QList< QgsProviderSublayerDetails> &sublayers );
134
135 QVector<QgsDataItem *> createChildren() override;
136 bool hasDragEnabled() const override;
137
153 bool canAddVectorLayers() const;
154
155 QgsMimeDataUtils::UriList mimeUris() const override;
157
164 QgsAbstractDatabaseProviderConnection::Capabilities databaseConnectionCapabilities() const;
165
172 Qgis::DatabaseProviderConnectionCapabilities2 databaseConnectionCapabilities2() const;
173
174 private:
175
176 QList< QgsProviderSublayerDetails> mSublayers;
177 mutable bool mHasCachedCapabilities = false;
178 mutable QgsAbstractDatabaseProviderConnection::Capabilities mCachedCapabilities;
179 mutable Qgis::DatabaseProviderConnectionCapabilities2 mCachedCapabilities2;
180 mutable bool mHasCachedDropSupport = false;
181 mutable bool mCachedSupportsDrop = false;
182};
183
184
195{
196 public:
197
198 QString name() override;
199 int capabilities() const override;
200 QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override SIP_FACTORY;
201 bool handlesDirectoryPath( const QString &path ) override;
202};
203
204#endif // QGSFILEBASEDDATAITEMPROVIDER_H
BrowserLayerType
Browser item layer types.
Definition qgis.h:660
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
A Collection: logical collection of layers or subcollections, e.g.
This is the interface for those who want to add custom data items to the browser tree.
Base class for all items in the model.
Definition qgsdataitem.h:46
virtual QVector< QgsDataItem * > createChildren()
Create children.
QString name() const
Returns the name of the item (the displayed text for the item).
A data item provider for file based data sources.
A data collection item for grouping of the content in file based data collections (e....
A data collection item for file based data collections (e.g.
Item that represents a layer that can be opened with one of the providers.
QgsAbstractDatabaseProviderConnection * databaseConnection() const override
For data items that represent a DB connection or one of its children, this method returns a connectio...
bool hasDragEnabled() const override
Returns true if the item may be dragged.
QgsMimeDataUtils::UriList mimeUris() const override
Returns mime URIs for the data item, most data providers will only return a single URI but some data ...
virtual QString layerName() const
QList< QgsMimeDataUtils::Uri > UriList
Contains details about a sub layer available from a dataset.
A generic data item for file based layers.
#define SIP_FACTORY
Definition qgis_sip.h:76