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 );
65 PathRole = Qt::UserRole,
66 CommentRole = Qt::UserRole + 1,
74 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
81 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
86 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
89 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
94 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
97 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
105 QModelIndex parent(
const QModelIndex &index )
const override;
108 QStringList mimeTypes()
const override;
111 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
114 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
116 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
118 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
121 void refresh(
const QString &path );
124 void refresh(
const QModelIndex &index = QModelIndex() );
133 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
136 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
140 bool canFetchMore(
const QModelIndex &parent )
const override;
141 void fetchMore(
const QModelIndex &parent )
override;
154 void connectionsChanged();
159 void beginInsertItems(
QgsDataItem *parent,
int first,
int last );
160 void endInsertItems();
161 void beginRemoveItems(
QgsDataItem *parent,
int first,
int last );
162 void endRemoveItems();
175 void addFavoriteDirectory(
const QString &directory,
const QString &name = QString() );
182 void removeFavorite(
const QModelIndex &index );
184 void updateProjectHome();
195 void removeRootItems();
202 bool mInitialized =
false;
205 #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.