20 #include <QFileSystemWatcher>
21 #include <QFutureWatcher>
28 #include <QTreeWidget>
68 virtual QVector<QgsDataItem*> createChildren();
81 virtual void setState( State state );
88 virtual void addChildItem(
QgsDataItem *child,
bool refresh =
false );
91 virtual void deleteChildItem(
QgsDataItem * child );
102 virtual QList<QAction*>
actions() {
return QList<QAction*>(); }
108 virtual bool handleDrop(
const QMimeData * , Qt::DropAction ) {
return false; }
117 Q_DECLARE_FLAGS( Capabilities, Capability )
121 { Q_UNUSED( crs );
return false; }
128 virtual void setCapabilities( Capabilities capabilities ) { mCapabilities = capabilities; }
133 static int findItem( QVector<QgsDataItem*> items,
QgsDataItem * item );
145 QVector<QgsDataItem*>
children()
const {
return mChildren; }
146 virtual QIcon icon();
147 QString
name()
const {
return mName; }
148 void setName(
const QString &name ) { mName = name; }
149 QString
path()
const {
return mPath; }
150 void setPath(
const QString &path ) { mPath = path; }
152 static QString pathComponent(
const QString &component );
158 void setIconName(
const QString & iconName ) { mIconName = iconName; }
164 static void deleteLater( QVector<QgsDataItem*> &items );
167 void moveToThread( QThread * targetThread );
170 virtual void populate( QVector<QgsDataItem*> children );
171 virtual void refresh( QVector<QgsDataItem*> children );
207 virtual void deleteLater();
210 virtual void populate();
213 virtual void depopulate();
215 virtual void refresh();
217 void emitBeginInsertItems(
QgsDataItem* parent,
int first,
int last );
218 void emitEndInsertItems();
219 void emitBeginRemoveItems(
QgsDataItem* parent,
int first,
int last );
220 void emitEndRemoveItems();
222 void emitDataChanged( );
224 virtual void childrenCreated();
225 void setPopulatingIcon();
228 void beginInsertItems(
QgsDataItem* parent,
int first,
int last );
229 void endInsertItems();
230 void beginRemoveItems(
QgsDataItem* parent,
int first,
int last );
231 void endRemoveItems();
236 static QVector<QgsDataItem*> runCreateChildren(
QgsDataItem* item );
239 bool mDeferredDelete;
240 QFutureWatcher< QVector <QgsDataItem*> > *mFutureWatcher;
242 static int mPopulatingCount;
243 static QMovie * mPopulatingMovie;
244 static QIcon mPopulatingIcon;
247 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsDataItem::Capabilities )
267 QgsLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType, QString providerKey );
271 virtual bool equal(
const QgsDataItem *other )
override;
279 QString
uri() {
return mUri; }
303 static const QIcon &iconPoint();
304 static const QIcon &iconLine();
305 static const QIcon &iconPolygon();
306 static const QIcon &iconTable();
307 static const QIcon &iconRaster();
308 static const QIcon &iconDefault();
324 static const QIcon &iconDir();
325 static const QIcon &iconDataCollection();
354 virtual void setState( State state )
override;
360 virtual QIcon
icon()
override;
369 void directoryChanged();
376 QFileSystemWatcher * mFileSystemWatcher;
404 void mousePressEvent( QMouseEvent* event )
override;
407 void showHideColumn();
420 void addDirectory( QString favIcon );
423 static const QIcon &iconFavourites();
442 const QStringList & getZipFileList();
453 static const QIcon &iconZip();
459 #endif // QGSDATAITEM_H