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 );
84 PathRole = Qt::UserRole,
85 CommentRole = Qt::UserRole + 1,
90 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
91 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
92 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
93 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
94 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
95 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
96 QModelIndex parent(
const QModelIndex &index )
const override;
97 QStringList mimeTypes()
const override;
98 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
99 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
100 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
101 bool canFetchMore(
const QModelIndex &parent )
const override;
102 void fetchMore(
const QModelIndex &parent )
override;
106 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
109 void refresh(
const QString &path );
112 void refresh(
const QModelIndex &index = QModelIndex() );
121 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
124 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
143 void connectionsChanged();
148 void beginInsertItems(
QgsDataItem *parent,
int first,
int last );
149 void endInsertItems();
150 void beginRemoveItems(
QgsDataItem *parent,
int first,
int last );
151 void endRemoveItems();
164 void addFavoriteDirectory(
const QString &directory,
const QString &name = QString() );
171 void removeFavorite(
const QModelIndex &index );
173 void updateProjectHome();
187 void removeRootItems();
194 bool mInitialized =
false;
197 #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.
A model for showing available data sources and other items in a structured tree.