QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
SIP_PYNAME
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
QgsDataCollectionItem
A Collection: logical collection of layers or subcollections, e.g. GRASS location/mapset,...
Definition: qgsdatacollectionitem.h:28
QgsZipItem
A zip file: contains layers, using GDAL/OGR VSIFILE mechanism.
Definition: qgszipitem.h:29
qgis.h
QgsMimeDataUtils::UriList
QList< QgsMimeDataUtils::Uri > UriList
Definition: qgsmimedatautils.h:164
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgis_sip.h
QgsDataItem::hasDragEnabled
virtual bool hasDragEnabled() const
Returns true if the item may be dragged.
Definition: qgsdataitem.h:253
qgsVsiPrefix
QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:192
str
#define str(x)
Definition: qgis.cpp:37
qgsdatacollectionitem.h
QgsDataItem::mimeUris
virtual QgsMimeDataUtils::UriList mimeUris() const
Returns mime URIs for the data item, most data providers will only return a single URI but some data ...
Definition: qgsdataitem.cpp:523
QgsDataItem
Base class for all items in the model.
Definition: qgsdataitem.h:45
QgsDataItem::createChildren
virtual QVector< QgsDataItem * > createChildren()
Create children.
Definition: qgsdataitem.cpp:184