QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
#include <qgsbrowsermodel.h>
Public Types | |
enum | ItemDataRole { PathRole = Qt::UserRole, CommentRole = Qt::UserRole + 1 } |
Public Slots | |
void | addFavouriteDirectory (const QString &favDir) |
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 | itemDataChanged (QgsDataItem *item) |
void | itemStateChanged (QgsDataItem *item, QgsDataItem::State oldState) |
void | reload () |
Reload the whole model. More... | |
void | removeFavourite (const QModelIndex &index) |
void | updateProjectHome () |
Signals | |
void | stateChanged (const QModelIndex &index, QgsDataItem::State oldState) |
Emitted when item children fetch was finished. More... | |
Public Member Functions | |
QgsBrowserModel (QObject *parent=nullptr, bool initialize=true) | |
QgsBrowserModel. More... | |
~QgsBrowserModel () | |
bool | canFetchMore (const QModelIndex &parent) const override |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
Provides the number of columns of data exposed by the model. More... | |
void | connectItem (QgsDataItem *item) |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
Used to supply item data to views and delegates. More... | |
QgsDataItem * | dataItem (const QModelIndex &idx) const |
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
Handles the data supplied by a drag and drop operation that ended with the given action. More... | |
void | fetchMore (const QModelIndex &parent) override |
QModelIndex | findItem (QgsDataItem *item, QgsDataItem *parent=nullptr) const |
QModelIndex | findPath (const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly) |
Return index of item with given path. More... | |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const override |
Used by other components to obtain information about each item provided by the model. More... | |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Provides views with information to show in their headers. More... | |
virtual QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
Returns the index of the item in the model specified by the given row, column and parent index. More... | |
void | init () |
Delayed initialization. More... | |
bool | initialized () const |
Returns true if the model has been initialized. More... | |
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const override |
Returns an object that contains serialized items of data corresponding to the list of indexes specified. More... | |
virtual QStringList | mimeTypes () const override |
Returns a list of mime that can describe model indexes. More... | |
virtual QModelIndex | parent (const QModelIndex &index) const override |
Returns the parent of the model item with the given index. More... | |
void | refresh (const QString &path) |
Refresh item specified by path. More... | |
void | refresh (const QModelIndex &index=QModelIndex()) |
Refresh item children. More... | |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
Provides the number of rows of data exposed by the model. More... | |
![]() | |
QAbstractItemModel (QObject *parent) | |
virtual | ~QAbstractItemModel () |
virtual QModelIndex | buddy (const QModelIndex &index) const |
virtual int | columnCount (const QModelIndex &parent) const=0 |
void | columnsAboutToBeInserted (const QModelIndex &parent, int start, int end) |
void | columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) |
void | columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
void | columnsInserted (const QModelIndex &parent, int start, int end) |
void | columnsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) |
void | columnsRemoved (const QModelIndex &parent, int start, int end) |
virtual QVariant | data (const QModelIndex &index, int role) const=0 |
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
bool | hasIndex (int row, int column, const QModelIndex &parent) const |
void | headerDataChanged (Qt::Orientation orientation, int first, int last) |
virtual QModelIndex | index (int row, int column, const QModelIndex &parent) const=0 |
bool | insertColumn (int column, const QModelIndex &parent) |
virtual bool | insertColumns (int column, int count, const QModelIndex &parent) |
bool | insertRow (int row, const QModelIndex &parent) |
virtual bool | insertRows (int row, int count, const QModelIndex &parent) |
virtual QMap< int, QVariant > | itemData (const QModelIndex &index) const |
void | layoutAboutToBeChanged () |
void | layoutChanged () |
virtual QModelIndexList | match (const QModelIndex &start, int role, const QVariant &value, int hits, QFlags< Qt::MatchFlag > flags) const |
void | modelAboutToBeReset () |
void | modelReset () |
virtual QModelIndex | parent (const QModelIndex &index) const=0 |
bool | removeColumn (int column, const QModelIndex &parent) |
virtual bool | removeColumns (int column, int count, const QModelIndex &parent) |
bool | removeRow (int row, const QModelIndex &parent) |
virtual bool | removeRows (int row, int count, const QModelIndex &parent) |
virtual void | revert () |
const QHash< int, QByteArray > & | roleNames () const |
virtual int | rowCount (const QModelIndex &parent) const=0 |
void | rowsAboutToBeInserted (const QModelIndex &parent, int start, int end) |
void | rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) |
void | rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
void | rowsInserted (const QModelIndex &parent, int start, int end) |
void | rowsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) |
void | rowsRemoved (const QModelIndex &parent, int start, int end) |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) |
virtual bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role) |
virtual bool | setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles) |
void | setSupportedDragActions (QFlags< Qt::DropAction > actions) |
QModelIndex | sibling (int row, int column, const QModelIndex &index) const |
virtual void | sort (int column, Qt::SortOrder order) |
virtual QSize | span (const QModelIndex &index) const |
virtual bool | submit () |
Qt::DropActions | supportedDragActions () const |
virtual Qt::DropActions | supportedDropActions () const |
![]() | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static QModelIndex | findPath (QAbstractItemModel *model, const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly) |
![]() | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
void | addRootItems () |
Populates the model. More... | |
void | removeRootItems () |
![]() | |
void | beginInsertColumns (const QModelIndex &parent, int first, int last) |
void | beginInsertRows (const QModelIndex &parent, int first, int last) |
bool | beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) |
bool | beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) |
void | beginRemoveColumns (const QModelIndex &parent, int first, int last) |
void | beginRemoveRows (const QModelIndex &parent, int first, int last) |
void | beginResetModel () |
void | changePersistentIndex (const QModelIndex &from, const QModelIndex &to) |
void | changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to) |
QModelIndex | createIndex (int row, int column, void *ptr) const |
QModelIndex | createIndex (int row, int column, int id) const |
QModelIndex | createIndex (int row, int column, quint32 id) const |
void | endInsertColumns () |
void | endInsertRows () |
void | endMoveColumns () |
void | endMoveRows () |
void | endRemoveColumns () |
void | endRemoveRows () |
void | endResetModel () |
QModelIndexList | persistentIndexList () const |
void | reset () |
void | resetInternalData () |
void | setRoleNames (const QHash< int, QByteArray > &roleNames) |
![]() | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QgsFavouritesItem * | mFavourites |
QgsDirectoryItem * | mProjectHome |
QVector< QgsDataItem * > | mRootItems |
Additional Inherited Members | |
![]() | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
![]() | |
objectName | |
Definition at line 51 of file qgsbrowsermodel.h.
Enumerator | |
---|---|
PathRole | Item path used to access path in the tree, see QgsDataItem::mPath |
CommentRole | Item comment |
Definition at line 65 of file qgsbrowsermodel.h.
|
explicit |
parent | |
initialize | immediately called init, default to true |
Definition at line 50 of file qgsbrowsermodel.cpp.
QgsBrowserModel::~QgsBrowserModel | ( | ) |
Definition at line 60 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 534 of file qgsbrowsermodel.cpp.
|
protected |
Populates the model.
Definition at line 92 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 375 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 390 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Reimplemented from QAbstractItemModel.
Definition at line 495 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Provides the number of columns of data exposed by the model.
List models do not provide this function because it is already implemented in QAbstractListModel.
Definition at line 278 of file qgsbrowsermodel.cpp.
void QgsBrowserModel::connectItem | ( | QgsDataItem * | item | ) |
Definition at line 421 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Used to supply item data to views and delegates.
Generally, models only need to supply data for Qt::DisplayRole and any application-specific user roles, but it is also good practice to provide data for Qt::ToolTipRole, Qt::AccessibleTextRole, and Qt::AccessibleDescriptionRole. See the Qt::ItemDataRole enum documentation for information about the types associated with each role.
Definition at line 198 of file qgsbrowsermodel.cpp.
QgsDataItem * QgsBrowserModel::dataItem | ( | const QModelIndex & | idx | ) | const |
Definition at line 487 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Handles the data supplied by a drag and drop operation that ended with the given action.
Reimplemented from QAbstractItemModel.
Definition at line 472 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 385 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 398 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Reimplemented from QAbstractItemModel.
Definition at line 503 of file qgsbrowsermodel.cpp.
QModelIndex QgsBrowserModel::findItem | ( | QgsDataItem * | item, |
QgsDataItem * | parent = nullptr |
||
) | const |
Definition at line 358 of file qgsbrowsermodel.cpp.
QModelIndex QgsBrowserModel::findPath | ( | const QString & | path, |
Qt::MatchFlag | matchFlag = Qt::MatchExactly |
||
) |
Return index of item with given path.
It only searches in currently fetched items, i.e. it does not fetch children.
path | item path |
matchFlag | supported is Qt::MatchExactly and Qt::MatchStartsWith which has reverse meaning, i.e. find item with the longest match from start with path (to get as close/deep as possible to deleted item). |
Definition at line 284 of file qgsbrowsermodel.cpp.
|
static |
Definition at line 289 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Used by other components to obtain information about each item provided by the model.
In many models, the combination of flags should include Qt::ItemIsEnabled and Qt::ItemIsSelectable.
Reimplemented from QAbstractItemModel.
Definition at line 181 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Reimplemented from QAbstractItemModel.
Definition at line 269 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Provides views with information to show in their headers.
The information is only retrieved by views that can display header information.
Reimplemented from QAbstractItemModel.
Definition at line 240 of file qgsbrowsermodel.cpp.
|
slot |
Hide the given path in the browser model.
Definition at line 549 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Returns the index of the item in the model specified by the given row, column and parent index.
Definition at line 338 of file qgsbrowsermodel.cpp.
void QgsBrowserModel::init | ( | ) |
Delayed initialization.
Definition at line 578 of file qgsbrowsermodel.cpp.
|
inline |
Returns true if the model has been initialized.
Definition at line 139 of file qgsbrowsermodel.h.
|
slot |
Definition at line 403 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 411 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Returns an object that contains serialized items of data corresponding to the list of indexes specified.
Reimplemented from QAbstractItemModel.
Definition at line 446 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Returns a list of mime that can describe model indexes.
Reimplemented from QAbstractItemModel.
Definition at line 437 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Returns the parent of the model item with the given index.
If the item has no parent, an invalid QModelIndex is returned.
Definition at line 349 of file qgsbrowsermodel.cpp.
void QgsBrowserModel::refresh | ( | const QString & | path | ) |
Refresh item specified by path.
Definition at line 516 of file qgsbrowsermodel.cpp.
void QgsBrowserModel::refresh | ( | const QModelIndex & | index = QModelIndex() | ) |
Refresh item children.
Definition at line 523 of file qgsbrowsermodel.cpp.
|
slot |
Reload the whole model.
Definition at line 329 of file qgsbrowsermodel.cpp.
|
slot |
Definition at line 540 of file qgsbrowsermodel.cpp.
|
protected |
Definition at line 170 of file qgsbrowsermodel.cpp.
|
overridevirtual |
Provides the number of rows of data exposed by the model.
Definition at line 251 of file qgsbrowsermodel.cpp.
|
signal |
Emitted when item children fetch was finished.
|
slot |
Definition at line 65 of file qgsbrowsermodel.cpp.
|
protected |
Definition at line 171 of file qgsbrowsermodel.h.
|
protected |
Definition at line 172 of file qgsbrowsermodel.h.
|
protected |
Definition at line 170 of file qgsbrowsermodel.h.