QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgszipitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgszipitem.h
3  -------------------
4  begin : 2011-04-01
5  copyright : (C) 2011 Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSZIPITEM_H
18 #define QGSZIPITEM_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsdatacollectionitem.h"
24 
29 class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
30 {
31  Q_OBJECT
32 
33  protected:
34  QString mFilePath;
35  QString mVsiPrefix;
36  QStringList mZipFileList;
37 
38  public:
40  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &path );
41 
43  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &filePath, const QString &path, const QString &providerKey = QString() );
44 
45 #ifdef SIP_RUN
46  SIP_PYOBJECT __repr__();
47  % MethodCode
48  QString str = QStringLiteral( "<QgsZipItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
49  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
50  % End
51 #endif
52 
53  QVector<QgsDataItem *> createChildren() override;
54  QStringList getZipFileList();
55 
56  bool hasDragEnabled() const override;
57  QgsMimeDataUtils::UriList mimeUris() const override;
58 
60  static QVector<dataItem_t *> sDataItemPtr SIP_SKIP;
61  static QStringList sProviderNames;
62 
63  static QString vsiPrefix( const QString &uri ) { return qgsVsiPrefix( uri ); }
64 
68  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &path, const QString &name ) SIP_FACTORY;
69 
74  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY SIP_PYNAME( itemFromFilePath );
75 
76  static QIcon iconZip();
77 
78  private:
79  void init();
80 };
81 
82 
83 
84 #endif // QGSZIPITEM_H
85 
86 
A Collection: logical collection of layers or subcollections, e.g.
Base class for all items in the model.
Definition: qgsdataitem.h:46
virtual QVector< QgsDataItem * > createChildren()
Create children.
virtual bool hasDragEnabled() const
Returns true if the item may be dragged.
Definition: qgsdataitem.h:253
virtual QgsMimeDataUtils::UriList mimeUris() const
Returns mime URIs for the data item, most data providers will only return a single URI but some data ...
QList< QgsMimeDataUtils::Uri > UriList
A zip file: contains layers, using GDAL/OGR VSIFILE mechanism.
Definition: qgszipitem.h:30
QStringList mZipFileList
Definition: qgszipitem.h:36
QString mFilePath
Definition: qgszipitem.h:34
QString mVsiPrefix
Definition: qgszipitem.h:35
static QString vsiPrefix(const QString &uri)
Definition: qgszipitem.h:63
static QStringList sProviderNames
Definition: qgszipitem.h:61
#define str(x)
Definition: qgis.cpp:37
QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:192
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
#define SIP_FACTORY
Definition: qgis_sip.h:76