15 #ifndef QGSBROWSERMODEL_H
16 #define QGSBROWSERMODEL_H
18 #include "qgis_core.h"
19 #include <QAbstractItemModel>
24 #include <QFutureWatcher>
92 PathRole = Qt::UserRole,
93 CommentRole = Qt::UserRole + 1,
99 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
100 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
101 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
102 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
103 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
104 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
105 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
106 QModelIndex parent(
const QModelIndex &index )
const override;
107 QStringList mimeTypes()
const override;
108 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
109 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
110 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
111 bool canFetchMore(
const QModelIndex &parent )
const override;
112 void fetchMore(
const QModelIndex &parent )
override;
128 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
131 void refresh(
const QString &path );
134 void refresh(
const QModelIndex &index = QModelIndex() );
144 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
147 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
158 QModelIndex findUri(
const QString &uri, QModelIndex index = QModelIndex() );
180 QMap<QString, QgsDirectoryItem *> driveItems()
const;
203 void refreshDrives();
205 void beginInsertItems(
QgsDataItem *parent,
int first,
int last );
206 void endInsertItems();
207 void beginRemoveItems(
QgsDataItem *parent,
int first,
int last );
208 void endRemoveItems();
221 void addFavoriteDirectory(
const QString &directory,
const QString &name = QString() );
228 void removeFavorite(
const QModelIndex &index );
236 void removeFavorite( QgsFavoriteItem *favorite )
SIP_SKIP;
238 void updateProjectHome();
252 void removeRootItems();
261 void onConnectionsChanged(
const QString &providerKey );
264 bool mInitialized =
false;
265 QMap< QString, QgsDirectoryItem * > mDriveItems;
273 friend class TestQgsBrowserModel;
274 friend class TestQgsBrowserProxyModel;
277 #endif // QGSBROWSERMODEL_H