QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
A model for showing available data sources and other items in a structured tree. More...
#include <qgsbrowserguimodel.h>
Public Member Functions | |
QgsBrowserGuiModel (QObject *parent=nullptr) | |
Constructor for QgsBrowserGuiModel, with the specified parent object. | |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
void | setMessageBar (QgsMessageBar *bar) |
Sets message bar that will be passed in QgsDataItemGuiContext to data items. | |
Public Member Functions inherited from QgsBrowserModel | |
QgsBrowserModel (QObject *parent=nullptr) | |
Constructor for QgsBrowserModel, with the specified parent object. | |
~QgsBrowserModel () override | |
bool | canFetchMore (const QModelIndex &parent) const override |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
Q_DECL_DEPRECATED void | connectItem (QgsDataItem *item) |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QgsDataItem * | dataItem (const QModelIndex &idx) const |
Returns the data item at the specified index, or nullptr if no item exists at the index. | |
QMap< QString, QgsDirectoryItem * > | driveItems () const |
Returns a map of the root drive items shown in the browser. | |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
void | fetchMore (const QModelIndex &parent) override |
QModelIndex | findItem (QgsDataItem *item, QgsDataItem *parent=nullptr) const |
Returns the model index corresponding to the specified data item. | |
QModelIndex | findPath (const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly) |
Returns index of item with given path. | |
QModelIndex | findUri (const QString &uri, QModelIndex index=QModelIndex()) |
Returns index of layer item with given uri. | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
bool | initialized () const |
Returns true if the model has been initialized. | |
QMimeData * | mimeData (const QModelIndexList &indexes) const override |
QStringList | mimeTypes () const override |
QModelIndex | parent (const QModelIndex &index) const override |
void | refresh (const QModelIndex &index=QModelIndex()) |
Refresh item children. | |
void | refresh (const QString &path) |
Refresh item specified by path. | |
QVector< QgsDataItem * > | rootItems () const |
Returns the root items for the model. | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
Additional Inherited Members | |
Public Types inherited from QgsBrowserModel | |
enum class | CustomRole : int { Path = Qt::UserRole , Comment = Qt::UserRole + 1 , Sort , ProviderKey , LayerMetadata } |
Custom model roles. More... | |
Public Slots inherited from QgsBrowserModel | |
void | addFavoriteDirectory (const QString &directory, const QString &name=QString()) |
Adds a directory to the favorites group. | |
void | beginInsertItems (QgsDataItem *parent, int first, int last) |
void | beginRemoveItems (QgsDataItem *parent, int first, int last) |
void | endInsertItems () |
void | endRemoveItems () |
void | hidePath (QgsDataItem *item) |
Hide the given path in the browser model. | |
void | initialize () |
Delayed initialization, needed because the provider registry must be already populated. | |
void | itemDataChanged (QgsDataItem *item) |
void | itemStateChanged (QgsDataItem *item, Qgis::BrowserItemState oldState) |
Emitted when an item's state is changed. | |
void | refreshDrives () |
Refreshes the list of drive items, removing any corresponding to removed drives and adding newly added drives. | |
void | reload () |
Reload the whole model. | |
void | removeFavorite (const QModelIndex &index) |
Removes a favorite directory from its corresponding model index. | |
void | removeFavorite (QgsFavoriteItem *favorite) |
Removes a favorite item. | |
void | updateProjectHome () |
Signals inherited from QgsBrowserModel | |
void | connectionsChanged (const QString &providerKey) |
Emitted when connections for the specified providerKey have changed in the browser. | |
void | stateChanged (const QModelIndex &index, Qgis::BrowserItemState oldState) |
Emitted when item children fetch was finished. | |
Static Public Member Functions inherited from QgsBrowserModel | |
static QModelIndex | findPath (QAbstractItemModel *model, const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly) |
Protected Member Functions inherited from QgsBrowserModel | |
void | addRootItems () |
Populates the model. | |
void | removeRootItems () |
Protected Attributes inherited from QgsBrowserModel | |
QgsFavoritesItem * | mFavorites = nullptr |
QgsDirectoryItem * | mProjectHome = nullptr |
QVector< QgsDataItem * > | mRootItems |
A model for showing available data sources and other items in a structured tree.
QgsBrowserGuiModel is the foundation for the QGIS browser panel, and includes items for the different data providers and folders accessible to users.
Definition at line 36 of file qgsbrowserguimodel.h.
|
explicit |
Constructor for QgsBrowserGuiModel, with the specified parent object.
Definition at line 24 of file qgsbrowserguimodel.cpp.
|
override |
Definition at line 108 of file qgsbrowserguimodel.cpp.
|
override |
Definition at line 43 of file qgsbrowserguimodel.cpp.
|
override |
Definition at line 143 of file qgsbrowserguimodel.cpp.
void QgsBrowserGuiModel::setMessageBar | ( | QgsMessageBar * | bar | ) |
Sets message bar that will be passed in QgsDataItemGuiContext to data items.
Definition at line 178 of file qgsbrowserguimodel.cpp.