QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdataitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdataitem.h - Items representing data
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 QGSDATAITEM_H
18 #define QGSDATAITEM_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_core.h"
22 #include <QFileSystemWatcher>
23 #include <QFutureWatcher>
24 #include <QIcon>
25 #include <QObject>
26 #include <QPixmap>
27 #include <QString>
28 #include <QTreeWidget>
29 #include <QVector>
30 #include <QDateTime>
31 
32 #include "qgsmaplayer.h"
34 #include "qgsmimedatautils.h"
35 #include "qgswkbtypes.h"
37 
38 class QgsDataProvider;
39 class QgsDataItem;
40 class QgsAnimatedIcon;
41 class QgsBookmarkManager;
42 
43 typedef QgsDataItem *dataItem_t( QString, QgsDataItem * ) SIP_SKIP;
44 
50 class CORE_EXPORT QgsDataItem : public QObject
51 {
52 
53 #ifdef SIP_RUN
55  if ( qobject_cast<QgsLayerItem *>( sipCpp ) )
56  sipType = sipType_QgsLayerItem;
57  else if ( qobject_cast<QgsErrorItem *>( sipCpp ) )
58  sipType = sipType_QgsErrorItem;
59  else if ( qobject_cast<QgsDirectoryItem *>( sipCpp ) )
60  sipType = sipType_QgsDirectoryItem;
61  else if ( qobject_cast<QgsFavoritesItem *>( sipCpp ) )
62  sipType = sipType_QgsFavoritesItem;
63  else if ( qobject_cast<QgsZipItem *>( sipCpp ) )
64  sipType = sipType_QgsZipItem;
65  else if ( qobject_cast<QgsDataCollectionItem *>( sipCpp ) )
66  sipType = sipType_QgsDataCollectionItem;
67  else if ( qobject_cast<QgsProjectItem *>( sipCpp ) )
68  sipType = sipType_QgsProjectItem;
69  else
70  sipType = 0;
71  SIP_END
72 #endif
73 
74  Q_OBJECT
75 
76  public:
77  enum Type
78  {
88  };
89 
90  Q_ENUM( Type )
91 
92 
103  QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path, const QString &providerKey = QString() );
104 
105  ~QgsDataItem() override;
106 
107  bool hasChildren();
108 
114  virtual bool layerCollection() const;
115 
116  int rowCount();
117 
122  virtual QVector<QgsDataItem *> createChildren() SIP_FACTORY;
123 
124  enum State
125  {
128  Populated
129  };
130  Q_ENUM( State )
131 
132 
133  State state() const;
134 
140  virtual void setState( State state );
141 
148  virtual void addChildItem( QgsDataItem *child SIP_TRANSFER, bool refresh = false );
149 
155  virtual void deleteChildItem( QgsDataItem *child );
156 
162  virtual QgsDataItem *removeChildItem( QgsDataItem *child ) SIP_TRANSFERBACK;
163 
167  virtual bool equal( const QgsDataItem *other );
168 
176  Q_DECL_DEPRECATED virtual QWidget *paramWidget() SIP_FACTORY SIP_DEPRECATED { return nullptr; }
177 
185  virtual QList<QAction *> actions( QWidget *parent );
186 
195  virtual QList<QMenu *> menus( QWidget *parent );
196 
205  Q_DECL_DEPRECATED virtual bool acceptDrop() SIP_DEPRECATED { return false; }
206 
215  Q_DECL_DEPRECATED virtual bool handleDrop( const QMimeData * /*data*/, Qt::DropAction /*action*/ ) SIP_DEPRECATED { return false; }
216 
223  virtual bool handleDoubleClick();
224 
232  virtual bool hasDragEnabled() const { return false; }
233 
241 
243  {
244  NoCapabilities = 0,
245  SetCrs = 1 << 0,
246  Fertile = 1 << 1,
247  Fast = 1 << 2,
248  Collapse = 1 << 3,
249  Rename = 1 << 4,
250  Delete = 1 << 5,
251  };
252  Q_DECLARE_FLAGS( Capabilities, Capability )
253 
254 
260  Q_DECL_DEPRECATED virtual bool setCrs( const QgsCoordinateReferenceSystem &crs ) SIP_DEPRECATED
261  {
262  Q_UNUSED( crs )
263  return false;
264  }
265 
278  Q_DECL_DEPRECATED virtual bool rename( const QString &name ) SIP_DEPRECATED;
279 
280  // ### QGIS 4 - rename to capabilities()
281 
287  virtual Capabilities capabilities2() const { return mCapabilities; }
288 
294  virtual void setCapabilities( Capabilities capabilities ) { mCapabilities = capabilities; }
295 
296  // static methods
297 
298  // Find child index in vector of items using '==' operator
299  static int findItem( QVector<QgsDataItem *> items, QgsDataItem *item );
300 
301  // members
302 
303  Type type() const { return mType; }
304 
309  QgsDataItem *parent() const { return mParent; }
310 
315  void setParent( QgsDataItem *parent );
316  QVector<QgsDataItem *> children() const { return mChildren; }
317  virtual QIcon icon();
318 
324  QString name() const { return mName; }
325 
331  void setName( const QString &name );
332 
333  QString path() const { return mPath; }
334  void setPath( const QString &path ) { mPath = path; }
335 
344  QString providerKey() const;
345 
354  void setProviderKey( const QString &value );
355 
357  static QString pathComponent( const QString &component );
358 
369  virtual QVariant sortKey() const;
370 
376  void setSortKey( const QVariant &key );
377 
378 
379  // Because QIcon (QPixmap) must not be used in outside the GUI thread, it is
380  // not possible to set mIcon in constructor. Either use mIconName/setIconName()
381  // or implement icon().
382  void setIcon( const QIcon &icon ) { mIcon = icon; }
383  void setIconName( const QString &iconName ) { mIconName = iconName; }
384 
385  void setToolTip( const QString &msg ) { mToolTip = msg; }
386  QString toolTip() const { return mToolTip; }
387 
388  // deleteLater() items and clear the vector
389  static void deleteLater( QVector<QgsDataItem *> &items );
390 
392  void moveToThread( QThread *targetThread );
393 
394  protected:
395  virtual void populate( const QVector<QgsDataItem *> &children );
396 
400  virtual void refresh( const QVector<QgsDataItem *> &children );
401 
410  bool deferredDelete() { return mDeferredDelete; }
411 
413  Capabilities mCapabilities;
414  QgsDataItem *mParent = nullptr;
415  QVector<QgsDataItem *> mChildren; // easier to have it always
417  QString mName;
418  QString mProviderKey;
419  // Path is slash ('/') separated chain of item identifiers which are usually item names, but may be different if it is
420  // necessary to distinguish paths of two providers to the same source (e.g GRASS location and standard directory have the same
421  // name but different paths). Identifiers in path must not contain '/' characters.
422  // The path is used to identify item in tree.
423  QString mPath;
424  QString mToolTip;
425  QString mIconName;
426  QIcon mIcon;
427  QMap<QString, QIcon> mIconMap;
428 
430  QVariant mSortKey;
431 
432  public slots:
433 
443  virtual void deleteLater();
444 
445  // Populate children using children vector created by createChildren()
446  // \param foreground run createChildren in foreground
447  virtual void populate( bool foreground = false );
448 
450  virtual void depopulate();
451 
452  virtual void refresh();
453 
460  virtual void refreshConnections( const QString &providerKey = QString() );
461 
462  virtual void childrenCreated();
463 
464  signals:
465  void beginInsertItems( QgsDataItem *parent, int first, int last );
467  void beginRemoveItems( QgsDataItem *parent, int first, int last );
469  void dataChanged( QgsDataItem *item );
470  void stateChanged( QgsDataItem *item, QgsDataItem::State oldState );
471 
479  void connectionsChanged( const QString &providerKey = QString() );
480 
481  protected slots:
482 
488  void updateIcon();
489 
490  private:
491  static QVector<QgsDataItem *> runCreateChildren( QgsDataItem *item );
492 
493  // Set to true if object has to be deleted when possible (nothing running in threads)
494  bool mDeferredDelete;
495  QFutureWatcher< QVector <QgsDataItem *> > *mFutureWatcher;
496  // number of items currently in loading (populating) state
497  static QgsAnimatedIcon *sPopulatingIcon;
498 };
499 
500 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsDataItem::Capabilities )
501 
502 
506 class CORE_EXPORT QgsLayerItem : public QgsDataItem
507 {
508  Q_OBJECT
509 
510  public:
512  {
524  VectorTile
525  };
526 
527  Q_ENUM( LayerType )
528 
529  QgsLayerItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &uri, LayerType layerType, const QString &providerKey );
530 
531  // --- reimplemented from QgsDataItem ---
532 
533  bool equal( const QgsDataItem *other ) override;
534 
535  bool hasDragEnabled() const override { return true; }
536 
537  QgsMimeDataUtils::Uri mimeUri() const override;
538 
539  // --- New virtual methods for layer item derived classes ---
540 
542  QgsMapLayerType mapLayerType() const;
543 
548  static LayerType typeFromMapLayer( QgsMapLayer *layer );
549 
551  QString uri() const { return mUri; }
552 
554  QString providerKey() const { return mProviderKey; }
555 
560  QStringList supportedCrs() const { return mSupportedCRS; }
561 
566  QStringList supportedFormats() const { return mSupportFormats; }
567 
572  virtual QString comments() const { return QString(); }
573 
578  static QString layerTypeAsString( LayerType layerType );
579 
584  static QString iconName( LayerType layerType );
585 
592  Q_DECL_DEPRECATED virtual bool deleteLayer() SIP_DEPRECATED;
593 
594  protected:
596  QString mUri;
598  LayerType mLayerType;
600  QStringList mSupportedCRS;
602  QStringList mSupportFormats;
603 
604  public:
605  static QIcon iconPoint();
606  static QIcon iconLine();
607  static QIcon iconPolygon();
608  static QIcon iconTable();
609  static QIcon iconRaster();
610  static QIcon iconDefault();
612  static QIcon iconMesh();
614  static QIcon iconVectorTile();
615 
617  virtual QString layerName() const { return name(); }
618 };
619 
620 
625 class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
626 {
627  Q_OBJECT
628  public:
629 
641  QgsDataCollectionItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path = QString(), const QString &providerKey = QString() );
642 
643  ~QgsDataCollectionItem() override;
644 
645  void addChild( QgsDataItem *item SIP_TRANSFER ) { mChildren.append( item ); }
646 
651  static QIcon iconDir();
652 
657  static QIcon iconDataCollection();
658 
659  protected:
660 
665  static QIcon openDirIcon();
666 
671  static QIcon homeDirIcon();
672 };
673 
674 
681 {
682  Q_OBJECT
683  public:
684 
696  QgsDatabaseSchemaItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path = QString(), const QString &providerKey = QString() );
697 
698  ~QgsDatabaseSchemaItem() override;
699 
700 
705  static QIcon iconDataCollection();
706 
707 };
708 
709 
710 
717 {
718  Q_OBJECT
719  public:
720 
732  QgsConnectionsRootItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path = QString(), const QString &providerKey = QString() );
733 
734  ~QgsConnectionsRootItem() override = default;
735 };
736 
737 
742 class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
743 {
744  Q_OBJECT
745  public:
746 
757  QgsDirectoryItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path );
758 
759 
760  // TODO QGIS 4.0 -- rename "name" to "title" or "text" or something more descriptive, and "path" to something
761  // else to clarify the role of dirPath vs path
762 
779  QgsDirectoryItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &dirPath, const QString &path, const QString &providerKey = QString() );
780 
781  void setState( State state ) override;
782 
783  QVector<QgsDataItem *> createChildren() override;
784 
788  QString dirPath() const { return mDirPath; }
789 
790  bool equal( const QgsDataItem *other ) override;
791  QIcon icon() override;
792  Q_DECL_DEPRECATED QWidget *paramWidget() override SIP_FACTORY SIP_DEPRECATED;
793  bool hasDragEnabled() const override { return true; }
794  QgsMimeDataUtils::Uri mimeUri() const override;
795 
797  static bool hiddenPath( const QString &path );
798 
799  public slots:
800  void childrenCreated() override;
801  void directoryChanged();
802 
803  protected:
804  void init();
805  QString mDirPath;
806 
807  private:
808  QFileSystemWatcher *mFileSystemWatcher = nullptr;
809  bool mRefreshLater;
810  QDateTime mLastScan;
811 };
812 
817 class CORE_EXPORT QgsProjectItem : public QgsDataItem
818 {
819  Q_OBJECT
820  public:
821 
829  QgsProjectItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey = QString() );
830 
831  bool hasDragEnabled() const override { return true; }
832 
833  QgsMimeDataUtils::Uri mimeUri() const override;
834 
835 };
836 
841 class CORE_EXPORT QgsErrorItem : public QgsDataItem
842 {
843  Q_OBJECT
844  public:
845 
846  QgsErrorItem( QgsDataItem *parent, const QString &error, const QString &path );
847 
848 };
849 
850 // ---------
851 
852 // TODO: move to qgis_gui for QGIS 4
853 
860 class CORE_EXPORT QgsDirectoryParamWidget : public QTreeWidget
861 {
862  Q_OBJECT
863 
864  public:
865  QgsDirectoryParamWidget( const QString &path, QWidget *parent SIP_TRANSFERTHIS = nullptr );
866 
867  protected:
868  void mousePressEvent( QMouseEvent *event ) override;
869 
870  public slots:
871  void showHideColumn();
872 };
873 
879 class CORE_EXPORT QgsFavoritesItem : public QgsDataCollectionItem
880 {
881  Q_OBJECT
882  public:
883 
888  QgsFavoritesItem( QgsDataItem *parent, const QString &name, const QString &path = QString() );
889 
890  QVector<QgsDataItem *> createChildren() override;
891 
900  void addDirectory( const QString &directory, const QString &name = QString() );
901 
906  void removeDirectory( QgsDirectoryItem *item );
907 
911  void renameFavorite( const QString &path, const QString &name );
912 
914  static QIcon iconFavorites();
915 
916  QVariant sortKey() const override;
917 
918  private:
919  QVector<QgsDataItem *> createChildren( const QString &favDir, const QString &name );
920 };
921 
926 class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
927 {
928  Q_OBJECT
929 
930  protected:
931  QString mFilePath;
932  QString mVsiPrefix;
933  QStringList mZipFileList;
934 
935  public:
937  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &path );
938 
940  QgsZipItem( QgsDataItem *parent, const QString &name, const QString &filePath, const QString &path, const QString &providerKey = QString() );
941 
942  QVector<QgsDataItem *> createChildren() override;
943  QStringList getZipFileList();
944 
946  static QVector<dataItem_t *> sDataItemPtr SIP_SKIP;
947  static QStringList sProviderNames;
948 
949  static QString vsiPrefix( const QString &uri ) { return qgsVsiPrefix( uri ); }
950 
954  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &path, const QString &name ) SIP_FACTORY;
955 
960  static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY SIP_PYNAME( itemFromFilePath );
961 
962  static QIcon iconZip();
963 
964  private:
965  void init();
966 };
967 
968 
976 class CORE_EXPORT QgsFieldsItem : public QgsDataItem
977 {
978  Q_OBJECT
979 
980  public:
981 
993  const QString &path,
994  const QString &connectionUri,
995  const QString &providerKey,
996  const QString &schema,
997  const QString &tableName );
998 
999  ~QgsFieldsItem() override;
1000 
1001  QVector<QgsDataItem *> createChildren() override;
1002 
1003  QIcon icon() override;
1004 
1008  QString schema() const;
1009 
1013  QString tableName() const;
1014 
1018  QString connectionUri() const;
1019 
1023  QgsVectorLayer *layer() SIP_FACTORY;
1024 
1030 
1031  private:
1032 
1033  QString mSchema;
1034  QString mTableName;
1035  QString mConnectionUri;
1036  std::unique_ptr<QgsAbstractDatabaseProviderConnection::TableProperty> mTableProperty;
1037 
1038 };
1039 
1040 
1048 class CORE_EXPORT QgsFieldItem : public QgsDataItem
1049 {
1050  Q_OBJECT
1051  public:
1052 
1058  const QgsField &field );
1059 
1060  ~QgsFieldItem() override;
1061 
1062  QIcon icon() override;
1063 
1064  //QgsField field() const;
1065 
1066 
1067  private:
1068 
1069  const QgsField mField;
1070 
1071 };
1072 
1073 
1074 
1076 #ifndef SIP_RUN
1077 
1083 class CORE_EXPORT QgsProjectHomeItem : public QgsDirectoryItem
1084 {
1085  Q_OBJECT
1086 
1087  public:
1088 
1089  QgsProjectHomeItem( QgsDataItem *parent, const QString &name, const QString &dirPath, const QString &path );
1090 
1091  QIcon icon() override;
1092  QVariant sortKey() const override;
1093 
1094 };
1095 
1101 Q_NOWARN_DEPRECATED_PUSH // rename is deprecated
1102 class CORE_EXPORT QgsFavoriteItem : public QgsDirectoryItem
1103 {
1104  Q_OBJECT
1105 
1106  public:
1107 
1108  QgsFavoriteItem( QgsFavoritesItem *parent, const QString &name, const QString &dirPath, const QString &path );
1109 
1110  bool rename( const QString &name ) override;
1111 
1112  private:
1113 
1114  QgsFavoritesItem *mFavorites = nullptr;
1115 };
1117 
1118 #endif
1119 
1121 #endif // QGSDATAITEM_H
1122 
1123 
QgsDataItem::setIconName
void setIconName(const QString &iconName)
Definition: qgsdataitem.h:383
QgsLayerItem::TableLayer
@ TableLayer
Definition: qgsdataitem.h:519
SIP_PYNAME
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
QgsDataItem::mIconMap
QMap< QString, QIcon > mIconMap
Definition: qgsdataitem.h:427
QgsLayerItem::Point
@ Point
Definition: qgsdataitem.h:516
QgsLayerItem::Mesh
@ Mesh
Added in 3.2.
Definition: qgsdataitem.h:523
QgsDataItem::icon
virtual QIcon icon()
Definition: qgsdataitem.cpp:401
QgsDataItem::mIcon
QIcon mIcon
Definition: qgsdataitem.h:426
QgsDataCollectionItem
A Collection: logical collection of layers or subcollections, e.g.
Definition: qgsdataitem.h:626
QgsDataItem::Favorites
@ Favorites
Represents a favorite item.
Definition: qgsdataitem.h:83
QgsDataCollectionItem::addChild
void addChild(QgsDataItem *item)
Definition: qgsdataitem.h:645
QgsDataItem::path
QString path() const
Definition: qgsdataitem.h:333
QgsZipItem::mZipFileList
QStringList mZipFileList
Definition: qgsdataitem.h:933
QgsDataItem::setIcon
void setIcon(const QIcon &icon)
Definition: qgsdataitem.h:382
QgsDataProvider
Abstract base class for spatial data provider implementations.
Definition: qgsdataprovider.h:42
QgsDataItem::mType
Type mType
Definition: qgsdataitem.h:412
QgsDataItem::capabilities2
virtual Capabilities capabilities2() const
Returns the capabilities for the data item.
Definition: qgsdataitem.h:287
QgsZipItem::mFilePath
QString mFilePath
Definition: qgsdataitem.h:931
QgsZipItem
A zip file: contains layers, using GDAL/OGR VSIFILE mechanism.
Definition: qgsdataitem.h:927
QgsDataCollectionItem::iconDataCollection
static QIcon iconDataCollection()
Returns the standard browser data collection icon.
Definition: qgsdataitem.cpp:94
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:51
QgsMapLayerType
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgsmaplayer.h:68
QgsDataItem::sortKey
virtual QVariant sortKey() const
Returns the sorting key for the item.
Definition: qgsdataitem.cpp:340
QgsLayerItem::NoType
@ NoType
Definition: qgsdataitem.h:513
QgsLayerItem::Vector
@ Vector
Definition: qgsdataitem.h:514
QgsDataItem::setToolTip
void setToolTip(const QString &msg)
Definition: qgsdataitem.h:385
QgsDirectoryItem::icon
QIcon icon() override
Definition: qgsdataitem.cpp:1044
QgsBookmarkManager
Manages storage of a set of bookmarks.
Definition: qgsbookmarkmanager.h:145
QgsDataItem::name
QString name() const
Returns the name of the item (the displayed text for the item).
Definition: qgsdataitem.h:324
QgsDataItem::Error
@ Error
Definition: qgsdataitem.h:82
QgsFieldItem
A layer field item, information about the connection URI, the schema and the table as well as the lay...
Definition: qgsdataitem.h:1049
QgsDataItem::dataChanged
void dataChanged(QgsDataItem *item)
QgsDataItem::toolTip
QString toolTip() const
Definition: qgsdataitem.h:386
qgsmimedatautils.h
field
const QgsField & field
Definition: qgsfield.h:456
QgsDataItem::mSortKey
QVariant mSortKey
Custom sort key. If invalid, name() will be used for sorting instead.
Definition: qgsdataitem.h:430
QgsFieldsItem
A collection of field items with some internal logic to retrieve the fields and a the vector layer in...
Definition: qgsdataitem.h:977
QgsDataItem::mIconName
QString mIconName
Definition: qgsdataitem.h:425
QgsDataItem::beginRemoveItems
void beginRemoveItems(QgsDataItem *parent, int first, int last)
QgsDataItem::Directory
@ Directory
Definition: qgsdataitem.h:80
QgsDataItem::mToolTip
QString mToolTip
Definition: qgsdataitem.h:424
QgsDataItem::equal
virtual bool equal(const QgsDataItem *other)
Returns true if this item is equal to another item (by testing item type and path).
Definition: qgsdataitem.cpp:735
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsAbstractDatabaseProviderConnection::TableProperty
The TableProperty class represents a database table or view.
Definition: qgsabstractdatabaseproviderconnection.h:82
QgsDirectoryItem::dirPath
QString dirPath() const
Returns the full path to the directory the item represents.
Definition: qgsdataitem.h:788
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:797
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
QgsDataItem::mState
State mState
Definition: qgsdataitem.h:416
QgsDataItem::endRemoveItems
void endRemoveItems()
QgsZipItem::mVsiPrefix
QString mVsiPrefix
Definition: qgsdataitem.h:932
QgsDataItem::type
Type type() const
Definition: qgsdataitem.h:303
QgsDataItem::mimeUri
virtual QgsMimeDataUtils::Uri mimeUri() const
Returns mime URI for the data item.
Definition: qgsdataitem.h:240
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsDataItem::rename
virtual Q_DECL_DEPRECATED bool rename(const QString &name)
Sets a new name for the item, and returns true if the item was successfully renamed.
Definition: qgsdataitem.cpp:752
dataItem_t
QgsDataItem * dataItem_t(QString, QgsDataItem *)
Definition: qgsdataitem.h:43
QgsProjectItem
Data item that can be used to represent QGIS projects.
Definition: qgsdataitem.h:818
QgsDirectoryItem
A directory: contains subdirectories and layers.
Definition: qgsdataitem.h:743
QgsLayerItem::Database
@ Database
Definition: qgsdataitem.h:520
QgsDataItem::parent
QgsDataItem * parent() const
Gets item parent.
Definition: qgsdataitem.h:309
QgsLayerItem::Line
@ Line
Definition: qgsdataitem.h:517
QgsProjectItem::hasDragEnabled
bool hasDragEnabled() const override
Returns true if the item may be dragged.
Definition: qgsdataitem.h:831
QgsDataItem::paramWidget
virtual Q_DECL_DEPRECATED QWidget * paramWidget()
Returns source widget from data item for QgsBrowserPropertiesWidget.
Definition: qgsdataitem.h:176
qgsmaplayer.h
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QgsDataItem::Collection
@ Collection
Definition: qgsdataitem.h:79
QgsDataItem::acceptDrop
virtual Q_DECL_DEPRECATED bool acceptDrop()
Returns whether the item accepts drag and dropped layers - e.g.
Definition: qgsdataitem.h:205
QgsDataItem::Capability
Capability
Definition: qgsdataitem.h:243
QgsDataItem::Populating
@ Populating
Creating children in separate thread (populating or refreshing)
Definition: qgsdataitem.h:127
QgsDataItem::Project
@ Project
Represents a QGIS project.
Definition: qgsdataitem.h:84
QgsDataItem::hasDragEnabled
virtual bool hasDragEnabled() const
Returns true if the item may be dragged.
Definition: qgsdataitem.h:232
QgsDataItem::mName
QString mName
Definition: qgsdataitem.h:417
QgsDataItem::Type
Type
Definition: qgsdataitem.h:78
QgsMimeDataUtils::Uri
Definition: qgsmimedatautils.h:41
qgsVsiPrefix
QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:194
QgsDataItem::NotPopulated
@ NotPopulated
Children not yet created.
Definition: qgsdataitem.h:126
QgsLayerItem::Polygon
@ Polygon
Definition: qgsdataitem.h:518
QgsAnimatedIcon
Animated icon is keeping an animation running if there are listeners connected to frameChanged.
Definition: qgsanimatedicon.h:31
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsDataItem::setCapabilities
virtual void setCapabilities(Capabilities capabilities)
Sets the capabilities for the data item.
Definition: qgsdataitem.h:294
QgsDataItem::connectionsChanged
void connectionsChanged(const QString &providerKey=QString())
Emitted when the connections of the provider with the specified providerKey have changed.
QgsZipItem::vsiPrefix
static QString vsiPrefix(const QString &uri)
Definition: qgsdataitem.h:949
QgsErrorItem
Data item that can be used to report problems (e.g.
Definition: qgsdataitem.h:842
QgsDirectoryItem::mDirPath
QString mDirPath
Definition: qgsdataitem.h:805
QgsDataItem::endInsertItems
void endInsertItems()
QgsLayerItem::Plugin
@ Plugin
Added in 2.10.
Definition: qgsdataitem.h:522
QgsDataItem::mCapabilities
Capabilities mCapabilities
Definition: qgsdataitem.h:413
QgsDataItem::mPath
QString mPath
Definition: qgsdataitem.h:423
QgsLayerItem::comments
virtual QString comments() const
Returns comments of the layer.
Definition: qgsdataitem.h:572
QgsDataItem::mProviderKey
QString mProviderKey
Definition: qgsdataitem.h:418
QgsDataItem::setPath
void setPath(const QString &path)
Definition: qgsdataitem.h:334
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsDataItem::mChildren
QVector< QgsDataItem * > mChildren
Definition: qgsdataitem.h:415
QgsDataItem::Fields
@ Fields
Collection of fields.
Definition: qgsdataitem.h:86
QgsDataItem::handleDrop
virtual Q_DECL_DEPRECATED bool handleDrop(const QMimeData *, Qt::DropAction)
Attempts to process the mime data dropped on this item.
Definition: qgsdataitem.h:215
QgsDataItem::Layer
@ Layer
Definition: qgsdataitem.h:81
QgsDataItem::setState
virtual void setState(State state)
Set item state.
Definition: qgsdataitem.cpp:762
QgsLayerItem::supportedCrs
QStringList supportedCrs() const
Returns the supported CRS.
Definition: qgsdataitem.h:560
QgsDataItem::children
QVector< QgsDataItem * > children() const
Definition: qgsdataitem.h:316
QgsLayerItem
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:507
QgsDirectoryParamWidget
Browser parameter widget implementation for directory items.
Definition: qgsdataitem.h:861
QgsDataItem::deferredDelete
bool deferredDelete()
The item is scheduled to be deleted.
Definition: qgsdataitem.h:410
QgsDataItem::Custom
@ Custom
Custom item type.
Definition: qgsdataitem.h:85
QgsConnectionsRootItem
A Collection that represents a root group of connections from a single data provider.
Definition: qgsdataitem.h:717
QgsZipItem::sProviderNames
static QStringList sProviderNames
Definition: qgsdataitem.h:947
QgsLayerItem::Table
@ Table
Definition: qgsdataitem.h:521
QgsLayerItem::providerKey
QString providerKey() const
Returns provider key.
Definition: qgsdataitem.h:554
QgsFavoritesItem
Contains various Favorites directories.
Definition: qgsdataitem.h:880
QgsDataItem::Field
@ Field
Vector layer field.
Definition: qgsdataitem.h:87
QgsDataItem
Base class for all items in the model.
Definition: qgsdataitem.h:51
Q_NOWARN_DEPRECATED_PUSH
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:796
QgsLayerItem::supportedFormats
QStringList supportedFormats() const
Returns the supported formats.
Definition: qgsdataitem.h:566
QgsDataItem::stateChanged
void stateChanged(QgsDataItem *item, QgsDataItem::State oldState)
qgsabstractdatabaseproviderconnection.h
qgswkbtypes.h
SIP_END
#define SIP_END
Definition: qgis_sip.h:194
QgsConnectionsRootItem::~QgsConnectionsRootItem
~QgsConnectionsRootItem() override=default
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgscoordinatereferencesystem.h
QgsDataItem::State
State
Definition: qgsdataitem.h:125
QgsLayerItem::hasDragEnabled
bool hasDragEnabled() const override
Returns true if the item may be dragged.
Definition: qgsdataitem.h:535
QgsDatabaseSchemaItem
A Collection that represents a database schema item.
Definition: qgsdataitem.h:681
QgsDataItem::createChildren
virtual QVector< QgsDataItem * > createChildren()
Create children.
Definition: qgsdataitem.cpp:423
QgsDataItem::beginInsertItems
void beginInsertItems(QgsDataItem *parent, int first, int last)
QgsLayerItem::LayerType
LayerType
Definition: qgsdataitem.h:512
QgsLayerItem::Raster
@ Raster
Definition: qgsdataitem.h:515
QgsLayerItem::uri
QString uri() const
Returns layer uri or empty string if layer cannot be created.
Definition: qgsdataitem.h:551
QgsDataItem::childrenCreated
virtual void childrenCreated()
Definition: qgsdataitem.cpp:475
QgsField
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:50