QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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. More...
 
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. More...
 
- Public Member Functions inherited from QgsBrowserModel
 QgsBrowserModel (QObject *parent=nullptr)
 Constructor for QgsBrowserModel, with the specified parent object. More...
 
 ~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. More...
 
QMap< QString, QgsDirectoryItem * > driveItems () const
 Returns a map of the root drive items shown in the browser. More...
 
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. More...
 
QModelIndex findPath (const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly)
 Returns index of item with given path. More...
 
QModelIndex findUri (const QString &uri, QModelIndex index=QModelIndex())
 Returns index of layer item with given uri. More...
 
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. More...
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
QModelIndex parent (const QModelIndex &index) const override
 
void refresh (const QString &path)
 Refresh item specified by path. More...
 
void refresh (const QModelIndex &index=QModelIndex())
 Refresh item children. More...
 
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  ItemDataRole { PathRole = Qt::UserRole, CommentRole = Qt::UserRole + 1, SortRole }
 
- Public Slots inherited from QgsBrowserModel
void addFavoriteDirectory (const QString &directory, const QString &name=QString())
 Adds a directory to the favorites group. More...
 
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. More...
 
void initialize ()
 Delayed initialization, needed because the provider registry must be already populated. More...
 
void itemDataChanged (QgsDataItem *item)
 
void itemStateChanged (QgsDataItem *item, QgsDataItem::State oldState)
 
void refreshDrives ()
 Refreshes the list of drive items, removing any corresponding to removed drives and adding newly added drives. More...
 
void reload ()
 Reload the whole model. More...
 
void removeFavorite (const QModelIndex &index)
 Removes a favorite directory from its corresponding model index. More...
 
void removeFavorite (QgsFavoriteItem *favorite)
 Removes a favorite item. More...
 
void updateProjectHome ()
 
- Signals inherited from QgsBrowserModel
void connectionsChanged ()
 Connections changed in the browser, forwarded to the widget and used to notify the provider dialogs of a changed connection. More...
 
void stateChanged (const QModelIndex &index, QgsDataItem::State oldState)
 Emitted when item children fetch was finished. More...
 
- 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. More...
 
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 37 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 22 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 71 of file qgsbrowserguimodel.cpp.

◆ flags()

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

Definition at line 34 of file qgsbrowserguimodel.cpp.

◆ setData()

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

Definition at line 106 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 140 of file qgsbrowserguimodel.cpp.


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