|
QGIS API Documentation
master-59fd5e0
|
#include <qgsbrowsermodel.h>
Collaboration diagram for QgsBrowserModel:Public Slots | |
| void | addFavouriteDirectory (QString favDir) |
| void | beginInsertItems (QgsDataItem *parent, int first, int last) |
| void | beginRemoveItems (QgsDataItem *parent, int first, int last) |
| void | endInsertItems () |
| void | endRemoveItems () |
| void | reload () |
| void | removeFavourite (const QModelIndex &index) |
| void | updateProjectHome () |
Public Member Functions | |
| QgsBrowserModel (QObject *parent=0) | |
| ~QgsBrowserModel () | |
| bool | canFetchMore (const QModelIndex &parent) const |
| virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| Provides the number of columns of data exposed by the model. | |
| void | connectItem (QgsDataItem *item) |
| virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
| Used to supply item data to views and delegates. | |
| QgsDataItem * | dataItem (const QModelIndex &idx) const |
| virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
| Handles the data supplied by a drag and drop operation that ended with the given action. | |
| void | fetchMore (const QModelIndex &parent) |
| QModelIndex | findItem (QgsDataItem *item, QgsDataItem *parent=0) const |
| QModelIndex | findPath (QString path) |
| return index of a path | |
| virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
| Used by other components to obtain information about each item provided by the model. | |
| bool | hasChildren (const QModelIndex &parent=QModelIndex()) const |
| virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
| Provides views with information to show in their headers. | |
| virtual QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
| Returns the index of the item in the model specified by the given row, column and parent index. | |
| virtual QMimeData * | mimeData (const QModelIndexList &indexes) const |
| Returns an object that contains serialized items of data corresponding to the list of indexes specified. | |
| virtual QStringList | mimeTypes () const |
| Returns a list of mime that can describe model indexes. | |
| virtual QModelIndex | parent (const QModelIndex &index) const |
| Returns the parent of the model item with the given index. | |
| void | refresh (QString path) |
| void | refresh (const QModelIndex &index=QModelIndex()) |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| Provides the number of rows of data exposed by the model. | |
Protected Member Functions | |
| void | addRootItems () |
| void | removeRootItems () |
Protected Attributes | |
| QgsFavouritesItem * | mFavourites |
| QgsDirectoryItem * | mProjectHome |
| QVector< QgsDataItem * > | mRootItems |
Definition at line 24 of file qgsbrowsermodel.h.
| QgsBrowserModel::QgsBrowserModel | ( | QObject * | parent = 0 | ) | [explicit] |
Definition at line 31 of file qgsbrowsermodel.cpp.
References addRootItems(), QgsProject::instance(), and updateProjectHome().
Definition at line 41 of file qgsbrowsermodel.cpp.
References removeRootItems().
| void QgsBrowserModel::addFavouriteDirectory | ( | QString | favDir | ) | [slot] |
Definition at line 450 of file qgsbrowsermodel.cpp.
References QgsFavouritesItem::addDirectory(), and mFavourites.
| void QgsBrowserModel::addRootItems | ( | ) | [protected] |
Definition at line 70 of file qgsbrowsermodel.cpp.
References cast_to_fptr, connectItem(), dataItem(), QgsProviderRegistry::instance(), mFavourites, mRootItems, QgsDataItem::name(), QgsDataProvider::NoDataCapabilities, QgsProviderRegistry::providerLibrary(), QgsProviderRegistry::providerList(), QgsDebugMsg, QgsDataItem::setIcon(), tr, and updateProjectHome().
Referenced by QgsBrowserModel(), and reload().
| void QgsBrowserModel::beginInsertItems | ( | QgsDataItem * | parent, |
| int | first, | ||
| int | last | ||
| ) | [slot] |
Definition at line 346 of file qgsbrowsermodel.cpp.
References findItem(), QgsDataItem::path(), and QgsDebugMsg.
Referenced by connectItem().
| void QgsBrowserModel::beginRemoveItems | ( | QgsDataItem * | parent, |
| int | first, | ||
| int | last | ||
| ) | [slot] |
Definition at line 361 of file qgsbrowsermodel.cpp.
References findItem(), QgsDataItem::path(), and QgsDebugMsg.
Referenced by connectItem().
| bool QgsBrowserModel::canFetchMore | ( | const QModelIndex & | parent | ) | const |
Definition at line 434 of file qgsbrowsermodel.cpp.
References dataItem(), and QgsDataItem::isPopulated().
| int QgsBrowserModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
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 241 of file qgsbrowsermodel.cpp.
| void QgsBrowserModel::connectItem | ( | QgsDataItem * | item | ) |
Definition at line 374 of file qgsbrowsermodel.cpp.
References beginInsertItems(), beginRemoveItems(), endInsertItems(), and endRemoveItems().
Referenced by addRootItems(), and updateProjectHome().
| QVariant QgsBrowserModel::data | ( | const QModelIndex & | index, |
| int | role = Qt::DisplayRole |
||
| ) | const [virtual] |
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 175 of file qgsbrowsermodel.cpp.
References dataItem(), QgsDataItem::icon(), QgsDataItem::name(), and QgsDataItem::toolTip().
| QgsDataItem * QgsBrowserModel::dataItem | ( | const QModelIndex & | idx | ) | const |
Definition at line 426 of file qgsbrowsermodel.cpp.
Referenced by addRootItems(), canFetchMore(), data(), dropMimeData(), fetchMore(), findPath(), hasChildren(), index(), parent(), refresh(), removeFavourite(), and rowCount().
| bool QgsBrowserModel::dropMimeData | ( | const QMimeData * | data, |
| Qt::DropAction | action, | ||
| int | row, | ||
| int | column, | ||
| const QModelIndex & | parent | ||
| ) | [virtual] |
Handles the data supplied by a drag and drop operation that ended with the given action.
Definition at line 411 of file qgsbrowsermodel.cpp.
References dataItem(), QgsDataItem::handleDrop(), and QgsDebugMsg.
| void QgsBrowserModel::endInsertItems | ( | ) | [slot] |
Definition at line 356 of file qgsbrowsermodel.cpp.
References QgsDebugMsg.
Referenced by connectItem().
| void QgsBrowserModel::endRemoveItems | ( | ) | [slot] |
Definition at line 369 of file qgsbrowsermodel.cpp.
References QgsDebugMsg.
Referenced by connectItem().
| void QgsBrowserModel::fetchMore | ( | const QModelIndex & | parent | ) |
Definition at line 442 of file qgsbrowsermodel.cpp.
References dataItem(), QgsDataItem::path(), QgsDataItem::populate(), and QgsDebugMsg.
| QModelIndex QgsBrowserModel::findItem | ( | QgsDataItem * | item, |
| QgsDataItem * | parent = 0 |
||
| ) | const |
Definition at line 318 of file qgsbrowsermodel.cpp.
References QgsDataItem::children(), and mRootItems.
Referenced by beginInsertItems(), beginRemoveItems(), and parent().
| QModelIndex QgsBrowserModel::findPath | ( | QString | path | ) |
return index of a path
Definition at line 247 of file qgsbrowsermodel.cpp.
References dataItem(), index(), QgsDataItem::path(), QgsDebugMsg, and rowCount().
Referenced by refresh().
| Qt::ItemFlags QgsBrowserModel::flags | ( | const QModelIndex & | index | ) | const [virtual] |
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.
Definition at line 158 of file qgsbrowsermodel.cpp.
References QgsDataItem::acceptDrop(), QgsDataItem::Layer, and QgsDataItem::type().
| bool QgsBrowserModel::hasChildren | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Definition at line 232 of file qgsbrowsermodel.cpp.
References dataItem(), and QgsDataItem::hasChildren().
| QVariant QgsBrowserModel::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole |
||
| ) | const [virtual] |
Provides views with information to show in their headers.
The information is only retrieved by views that can display header information.
Definition at line 204 of file qgsbrowsermodel.cpp.
| QModelIndex QgsBrowserModel::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) | const [virtual] |
Returns the index of the item in the model specified by the given row, column and parent index.
Definition at line 301 of file qgsbrowsermodel.cpp.
References QgsDataItem::children(), dataItem(), and mRootItems.
Referenced by findPath(), and mimeData().
| QMimeData * QgsBrowserModel::mimeData | ( | const QModelIndexList & | indexes | ) | const [virtual] |
Returns an object that contains serialized items of data corresponding to the list of indexes specified.
Definition at line 395 of file qgsbrowsermodel.cpp.
References QgsMimeDataUtils::encodeUriList(), index(), QgsDataItem::Layer, and QgsDataItem::type().
| QStringList QgsBrowserModel::mimeTypes | ( | ) | const [virtual] |
Returns a list of mime that can describe model indexes.
Definition at line 386 of file qgsbrowsermodel.cpp.
| QModelIndex QgsBrowserModel::parent | ( | const QModelIndex & | index | ) | const [virtual] |
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 309 of file qgsbrowsermodel.cpp.
References dataItem(), findItem(), and QgsDataItem::parent().
| void QgsBrowserModel::refresh | ( | QString | path | ) |
Definition at line 290 of file qgsbrowsermodel.cpp.
References dataItem(), findPath(), and QgsDataItem::refresh().
| void QgsBrowserModel::refresh | ( | const QModelIndex & | index = QModelIndex() | ) |
Definition at line 336 of file qgsbrowsermodel.cpp.
References dataItem(), QgsDataItem::path(), QgsDebugMsg, and QgsDataItem::refresh().
| void QgsBrowserModel::reload | ( | ) | [slot] |
Definition at line 282 of file qgsbrowsermodel.cpp.
References addRootItems(), and removeRootItems().
| void QgsBrowserModel::removeFavourite | ( | const QModelIndex & | index | ) | [slot] |
Definition at line 456 of file qgsbrowsermodel.cpp.
References dataItem(), mFavourites, and QgsFavouritesItem::removeDirectory().
| void QgsBrowserModel::removeRootItems | ( | ) | [protected] |
Definition at line 147 of file qgsbrowsermodel.cpp.
References mRootItems.
Referenced by reload(), and ~QgsBrowserModel().
| int QgsBrowserModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
Provides the number of rows of data exposed by the model.
Definition at line 215 of file qgsbrowsermodel.cpp.
References dataItem(), mRootItems, and QgsDataItem::rowCount().
Referenced by findPath().
| void QgsBrowserModel::updateProjectHome | ( | ) | [slot] |
Definition at line 46 of file qgsbrowsermodel.cpp.
References connectItem(), QgsProject::homePath(), QgsProject::instance(), mProjectHome, mRootItems, and tr.
Referenced by addRootItems(), and QgsBrowserModel().
QgsFavouritesItem* QgsBrowserModel::mFavourites [protected] |
Definition at line 111 of file qgsbrowsermodel.h.
Referenced by addFavouriteDirectory(), addRootItems(), and removeFavourite().
QgsDirectoryItem* QgsBrowserModel::mProjectHome [protected] |
Definition at line 112 of file qgsbrowsermodel.h.
Referenced by updateProjectHome().
QVector<QgsDataItem*> QgsBrowserModel::mRootItems [protected] |
Definition at line 110 of file qgsbrowsermodel.h.
Referenced by addRootItems(), findItem(), index(), removeRootItems(), rowCount(), and updateProjectHome().