15 #ifndef QGSBROWSERMODEL_H
16 #define QGSBROWSERMODEL_H
18 #include "qgis_core.h"
21 #include <QAbstractItemModel>
71 PathRole = Qt::UserRole,
72 CommentRole = Qt::UserRole + 1,
78 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
79 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
80 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
81 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
82 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
83 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
84 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
85 QModelIndex parent(
const QModelIndex &index )
const override;
86 QStringList mimeTypes()
const override;
87 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
88 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
89 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
90 bool canFetchMore(
const QModelIndex &parent )
const override;
91 void fetchMore(
const QModelIndex &parent )
override;
107 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
110 void refresh(
const QString &path );
113 void refresh(
const QModelIndex &index = QModelIndex() );
123 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
126 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
137 QModelIndex findUri(
const QString &uri, QModelIndex index = QModelIndex() );
159 QMap<QString, QgsDirectoryItem *> driveItems()
const;
170 void connectionsChanged(
const QString &providerKey );
182 void refreshDrives();
184 void beginInsertItems(
QgsDataItem *parent,
int first,
int last );
185 void endInsertItems();
186 void beginRemoveItems(
QgsDataItem *parent,
int first,
int last );
187 void endRemoveItems();
204 void addFavoriteDirectory(
const QString &directory,
const QString &name = QString() );
211 void removeFavorite(
const QModelIndex &index );
221 void updateProjectHome();
235 void removeRootItems();
244 void onConnectionsChanged(
const QString &providerKey );
247 bool mInitialized =
false;
248 QMap< QString, QgsDirectoryItem * > mDriveItems;
256 friend class TestQgsBrowserModel;
257 friend class TestQgsBrowserProxyModel;
260 #endif // QGSBROWSERMODEL_H