15#ifndef QGSBROWSERMODEL_H
16#define QGSBROWSERMODEL_H
21#include <QAbstractItemModel>
90 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
91 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
92 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
93 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
94 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
95 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
96 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
97 QModelIndex parent(
const QModelIndex &index )
const override;
98 QStringList mimeTypes()
const override;
99 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
100 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
101 bool hasChildren(
const QModelIndex &parent = QModelIndex() )
const override;
102 bool canFetchMore(
const QModelIndex &parent )
const override;
103 void fetchMore(
const QModelIndex &parent )
override;
119 QgsDataItem *dataItem(
const QModelIndex &idx )
const;
122 void refresh(
const QString &path );
125 void refresh(
const QModelIndex &index = QModelIndex() );
135 QModelIndex findPath(
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly );
138 static QModelIndex findPath( QAbstractItemModel *model,
const QString &path, Qt::MatchFlag matchFlag = Qt::MatchExactly )
SIP_SKIP;
149 QModelIndex findUri(
const QString &uri, QModelIndex index = QModelIndex() );
171 QMap<QString, QgsDirectoryItem *> driveItems()
const;
262 void onConnectionsChanged(
const QString &providerKey );
265 bool mInitialized =
false;
266 QMap< QString, QgsDirectoryItem * > mDriveItems;
BrowserItemState
Browser item states.
void connectionsChanged(const QString &providerKey)
Emitted when connections for the specified providerKey have changed in the browser.
QgsFavoritesItem * mFavorites
void hidePath(QgsDataItem *item)
Hide the given path in the browser model.
void refreshDrives()
Refreshes the list of drive items, removing any corresponding to removed drives and adding newly adde...
void reload()
Reload the whole model.
void itemStateChanged(QgsDataItem *item, Qgis::BrowserItemState oldState)
Emitted when an item's state is changed.
void beginInsertItems(QgsDataItem *parent, int first, int last)
QVector< QgsDataItem * > mRootItems
void beginRemoveItems(QgsDataItem *parent, int first, int last)
QModelIndex parent(const QModelIndex &index) const override
void initialize()
Delayed initialization, needed because the provider registry must be already populated.
void addFavoriteDirectory(const QString &directory, const QString &name=QString())
Adds a directory to the favorites group.
friend class TestQgsBrowserModel
QgsBrowserModel(QObject *parent=nullptr)
Constructor for QgsBrowserModel, with the specified parent object.
QgsDirectoryItem * mProjectHome
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
void stateChanged(const QModelIndex &index, Qgis::BrowserItemState oldState)
Emitted when item children fetch was finished.
void itemDataChanged(QgsDataItem *item)
void addRootItems()
Populates the model.
bool initialized() const
Returns true if the model has been initialized.
QVector< QgsDataItem * > rootItems() const
Returns the root items for the model.
friend class TestQgsBrowserProxyModel
CustomRole
Custom model roles.
void removeFavorite(const QModelIndex &index)
Removes a favorite directory from its corresponding model index.
Interface for providers that add custom data items to the browser tree.
Base class for all items in the model.
A browser item for directories: contains subdirectories and layers.
A directory item showing a single favorite directory.
A browser item which contains various Favorites directories.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)