QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsBrowserGuiModel Class Reference

A model for showing available data sources and other items in a structured tree. More...

#include <qgsbrowserguimodel.h>

Inheritance diagram for QgsBrowserGuiModel:
Inheritance graph
[legend]

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
 
QgsDataItemdataItem (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
QgsFavoritesItemmFavorites = nullptr
 
QgsDirectoryItemmProjectHome = nullptr
 
QVector< QgsDataItem * > mRootItems
 

Detailed Description

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.

Since
QGIS 3.10

Definition at line 36 of file qgsbrowserguimodel.h.

Constructor & Destructor Documentation

◆ QgsBrowserGuiModel()

QgsBrowserGuiModel::QgsBrowserGuiModel ( QObject *  parent = nullptr)
explicit

Constructor for QgsBrowserGuiModel, with the specified parent object.

Note
QgsBrowserModel models are not initially populated and use a deferred initialization approach. After constructing a QgsBrowserModel, a call must be made to initialize() in order to populate the model.

Definition at line 23 of file qgsbrowserguimodel.cpp.

Member Function Documentation

◆ dropMimeData()

bool QgsBrowserGuiModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
override

Definition at line 107 of file qgsbrowserguimodel.cpp.

◆ flags()

Qt::ItemFlags QgsBrowserGuiModel::flags ( const QModelIndex &  index) const
override

Definition at line 42 of file qgsbrowserguimodel.cpp.

◆ setData()

bool QgsBrowserGuiModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Definition at line 142 of file qgsbrowserguimodel.cpp.

◆ setMessageBar()

void QgsBrowserGuiModel::setMessageBar ( QgsMessageBar bar)

Sets message bar that will be passed in QgsDataItemGuiContext to data items.

Definition at line 177 of file qgsbrowserguimodel.cpp.


The documentation for this class was generated from the following files: