QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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"
25#include <QString>
26#include <QVector>
27
29
30#define SIP_NO_FILE
31
32class QgsDataItem;
33
44class CORE_EXPORT QgsProviderSublayerItem final: public QgsLayerItem
45{
46 Q_OBJECT
47 public:
48
56 QgsProviderSublayerItem( QgsDataItem *parent, const QString &name, const QgsProviderSublayerDetails &details, const QString &filePath );
57 QString layerName() const override;
58 QVector<QgsDataItem *> createChildren() override;
60
66 QgsProviderSublayerDetails sublayerDetails() const;
67
68 private:
69
70 static Qgis::BrowserLayerType layerTypeFromSublayer( const QgsProviderSublayerDetails &sublayer );
71
73
74};
75
76
84{
85 Q_OBJECT
86 public:
87
94 QgsFileDataCollectionGroupItem( QgsDataItem *parent, const QString &groupName, const QString &path );
95
99 void appendSublayer( const QgsProviderSublayerDetails &sublayer );
100
101 bool hasDragEnabled() const override;
102 QgsMimeDataUtils::UriList mimeUris() const override;
103
104 private:
105
106 QList< QgsProviderSublayerDetails > mSublayers;
107};
108
119{
120 Q_OBJECT
121 public:
122
132 QgsFileDataCollectionItem( QgsDataItem *parent, const QString &name, const QString &path, const QList< QgsProviderSublayerDetails> &sublayers );
133
134 QVector<QgsDataItem *> createChildren() override;
135 bool hasDragEnabled() const override;
136 QgsMimeDataUtils::UriList mimeUris() const override;
138
139 private:
140
141 QList< QgsProviderSublayerDetails> mSublayers;
142};
143
144
155{
156 public:
157
158 QString name() override;
159 int capabilities() const override;
160 QgsDataItem *createDataItem( const QString &path, QgsDataItem *parentItem ) override SIP_FACTORY;
161 bool handlesDirectoryPath( const QString &path ) override;
162};
163
164#endif // QGSFILEBASEDDATAITEMPROVIDER_H
BrowserLayerType
Browser item layer types.
Definition: qgis.h:403
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).
Definition: qgsdataitem.h:345
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.
Definition: qgslayeritem.h:31
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.
Definition: qgslayeritem.h:53
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
Definition: qgslayeritem.h:143
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