15 #ifndef QGSBROWSERMODEL_H 16 #define QGSBROWSERMODEL_H 18 #include "qgis_core.h" 19 #include <QAbstractItemModel> 24 #include <QFutureWatcher> 44 void finished(
QgsDataItem *item,
const QVector <QgsDataItem *> &items );
90 PathRole = Qt::UserRole,
91 CommentRole = Qt::UserRole + 1,
97 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
98 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
99 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
100 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
101 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
102 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
103 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
104 QModelIndex parent(
const QModelIndex &index )
const override;
105 QStringList mimeTypes()
const override;
106 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
107 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
108 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
109 bool canFetchMore(
const QModelIndex &parent )
const override;
110 void fetchMore(
const QModelIndex &parent )
override;
126 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
129 void refresh(
const QString &path );
132 void refresh(
const QModelIndex &index = QModelIndex() );
142 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
145 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
156 QModelIndex findUri(
const QString &uri, QModelIndex index = QModelIndex() );
178 QMap<QString, QgsDirectoryItem *> driveItems()
const;
188 void connectionsChanged();
200 void refreshDrives();
202 void beginInsertItems(
QgsDataItem *parent,
int first,
int last );
203 void endInsertItems();
204 void beginRemoveItems(
QgsDataItem *parent,
int first,
int last );
205 void endRemoveItems();
218 void addFavoriteDirectory(
const QString &directory,
const QString &name = QString() );
225 void removeFavorite(
const QModelIndex &index );
233 void removeFavorite( QgsFavoriteItem *favorite )
SIP_SKIP;
235 void updateProjectHome();
249 void removeRootItems();
256 bool mInitialized =
false;
257 QMap< QString, QgsDirectoryItem * > mDriveItems;
263 friend class TestQgsBrowserModel;
264 friend class TestQgsBrowserProxyModel;
267 #endif // QGSBROWSERMODEL_H
bool initialized() const
Returns true if the model has been initialized.
QgsDataItem * item() const
QVector< QgsDataItem * > mRootItems
A directory: contains subdirectories and layers.
Base class for all items in the model.
Custom sort role, see QgsDataItem::sortKey()
Contains various Favorites directories.
Data item provider key that created the item,.
A model for showing available data sources and other items in a structured tree.