QGIS API Documentation
2.2.0-Valmiera
|
#include <qgscptcityarchive.h>
Public Types | |
enum | ViewType { Authors = 0, Selections = 1, List = 2 } |
Public Slots | |
void | beginInsertItems (QgsCptCityDataItem *parent, int first, int last) |
void | endInsertItems () |
void | beginRemoveItems (QgsCptCityDataItem *parent, int first, int last) |
void | endRemoveItems () |
Public Member Functions | |
QgsCptCityBrowserModel (QObject *parent=0, QgsCptCityArchive *archive=QgsCptCityArchive::defaultArchive(), ViewType Type=Authors) | |
~QgsCptCityBrowserModel () | |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
Used by other components to obtain information about each item provided by the model. | |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
Used to supply item data to views and delegates. | |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Provides views with information to show in their headers. | |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
Provides the number of rows of data exposed by the model. | |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
Provides the number of columns of data exposed by the model. | |
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. | |
QModelIndex | findItem (QgsCptCityDataItem *item, QgsCptCityDataItem *parent=0) const |
virtual QModelIndex | parent (const QModelIndex &index) const |
Returns the parent of the model item with the given index. | |
QgsCptCityDataItem * | dataItem (const QModelIndex &idx) const |
Returns a list of mime that can describe model indexes. | |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const |
void | reload () |
void | refresh (QString path) |
void | refresh (const QModelIndex &index=QModelIndex()) |
QModelIndex | findPath (QString path) |
return index of a path | |
void | connectItem (QgsCptCityDataItem *item) |
bool | canFetchMore (const QModelIndex &parent) const |
void | fetchMore (const QModelIndex &parent) |
Protected Member Functions | |
void | addRootItems () |
void | removeRootItems () |
Protected Attributes | |
QVector< QgsCptCityDataItem * > | mRootItems |
QgsCptCityArchive * | mArchive |
ViewType | mViewType |
QSize | mIconSize |
Definition at line 302 of file qgscptcityarchive.h.
Definition at line 308 of file qgscptcityarchive.h.
QgsCptCityBrowserModel::QgsCptCityBrowserModel | ( | QObject * | parent = 0 , |
QgsCptCityArchive * | archive = QgsCptCityArchive::defaultArchive() , |
||
ViewType | Type = Authors |
||
) |
Definition at line 1342 of file qgscptcityarchive.cpp.
References addRootItems(), QgsCptCityArchive::archiveName(), mArchive, mIconSize, and QgsDebugMsg.
QgsCptCityBrowserModel::~QgsCptCityBrowserModel | ( | ) |
Definition at line 1353 of file qgscptcityarchive.cpp.
References removeRootItems().
|
protected |
Definition at line 1358 of file qgscptcityarchive.cpp.
References Authors, mArchive, mRootItems, mViewType, QgsDebugMsg, QgsCptCityArchive::rootItems(), QgsCptCityArchive::selectionItems(), and Selections.
Referenced by QgsCptCityBrowserModel(), and reload().
|
slot |
Definition at line 1648 of file qgscptcityarchive.cpp.
References findItem(), QgsCptCityDataItem::path(), and QgsDebugMsg.
Referenced by connectItem().
|
slot |
Definition at line 1663 of file qgscptcityarchive.cpp.
References findItem(), QgsCptCityDataItem::path(), and QgsDebugMsg.
Referenced by connectItem().
bool QgsCptCityBrowserModel::canFetchMore | ( | const QModelIndex & | parent | ) | const |
Definition at line 1688 of file qgscptcityarchive.cpp.
References QgsCptCityDataItem::AllRamps, dataItem(), QgsCptCityDataItem::isPopulated(), QgsCptCityDataItem::populate(), and QgsCptCityDataItem::type().
Referenced by findPath().
|
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 1482 of file qgscptcityarchive.cpp.
void QgsCptCityBrowserModel::connectItem | ( | QgsCptCityDataItem * | item | ) |
Definition at line 1676 of file qgscptcityarchive.cpp.
References beginInsertItems(), beginRemoveItems(), endInsertItems(), and endRemoveItems().
|
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 1392 of file qgscptcityarchive.cpp.
References QgsCptCityDataItem::ColorRamp, dataItem(), QgsCptCityDataItem::icon(), QgsCptCityDataItem::info(), List, mIconSize, mViewType, QgsCptCityDataItem::name(), QgsCptCityDataItem::path(), QgsCptCityDataItem::toolTip(), and QgsCptCityDataItem::type().
QgsCptCityDataItem * QgsCptCityBrowserModel::dataItem | ( | const QModelIndex & | idx | ) | const |
Returns a list of mime that can describe model indexes.
Returns an object that contains serialized items of data corresponding to the list of indexes specified Handles the data supplied by a drag and drop operation that ended with the given action
Definition at line 1757 of file qgscptcityarchive.cpp.
Referenced by canFetchMore(), data(), fetchMore(), findPath(), hasChildren(), index(), parent(), refresh(), and rowCount().
|
slot |
Definition at line 1658 of file qgscptcityarchive.cpp.
References QgsDebugMsg.
Referenced by connectItem().
|
slot |
Definition at line 1671 of file qgscptcityarchive.cpp.
References QgsDebugMsg.
Referenced by connectItem().
void QgsCptCityBrowserModel::fetchMore | ( | const QModelIndex & | parent | ) |
Definition at line 1706 of file qgscptcityarchive.cpp.
References dataItem(), QgsCptCityDataItem::path(), QgsCptCityDataItem::populate(), and QgsDebugMsg.
Referenced by findPath().
QModelIndex QgsCptCityBrowserModel::findItem | ( | QgsCptCityDataItem * | item, |
QgsCptCityDataItem * | parent = 0 |
||
) | const |
Definition at line 1620 of file qgscptcityarchive.cpp.
References QgsCptCityDataItem::children(), and mRootItems.
Referenced by beginInsertItems(), beginRemoveItems(), and parent().
QModelIndex QgsCptCityBrowserModel::findPath | ( | QString | path | ) |
return index of a path
Definition at line 1488 of file qgscptcityarchive.cpp.
References canFetchMore(), dataItem(), fetchMore(), index(), QgsCptCityDataItem::path(), QgsDebugMsg, rowCount(), QgsCptCityDataItem::Selection, QgsCptCitySelectionItem::selectionsList(), and QgsCptCityDataItem::type().
Referenced by refresh().
|
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 1382 of file qgscptcityarchive.cpp.
bool QgsCptCityBrowserModel::hasChildren | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Definition at line 1472 of file qgscptcityarchive.cpp.
References dataItem(), and QgsCptCityDataItem::hasChildren().
|
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 1442 of file qgscptcityarchive.cpp.
References tr.
|
virtual |
Returns the index of the item in the model specified by the given row, column and parent index.
Definition at line 1603 of file qgscptcityarchive.cpp.
References QgsCptCityDataItem::children(), dataItem(), and mRootItems.
Referenced by findPath().
|
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 1611 of file qgscptcityarchive.cpp.
References dataItem(), findItem(), and QgsCptCityDataItem::parent().
void QgsCptCityBrowserModel::refresh | ( | QString | path | ) |
Definition at line 1592 of file qgscptcityarchive.cpp.
References dataItem(), findPath(), and QgsCptCityDataItem::refresh().
void QgsCptCityBrowserModel::refresh | ( | const QModelIndex & | index = QModelIndex() | ) |
Definition at line 1638 of file qgscptcityarchive.cpp.
References dataItem(), QgsCptCityDataItem::path(), QgsDebugMsg, and QgsCptCityDataItem::refresh().
void QgsCptCityBrowserModel::reload | ( | ) |
Definition at line 1584 of file qgscptcityarchive.cpp.
References addRootItems(), and removeRootItems().
|
protected |
Definition at line 1371 of file qgscptcityarchive.cpp.
References mRootItems.
Referenced by reload(), and ~QgsCptCityBrowserModel().
|
virtual |
Provides the number of rows of data exposed by the model.
Definition at line 1455 of file qgscptcityarchive.cpp.
References dataItem(), mRootItems, and QgsCptCityDataItem::rowCount().
Referenced by findPath().
|
protected |
Definition at line 402 of file qgscptcityarchive.h.
Referenced by addRootItems(), and QgsCptCityBrowserModel().
|
protected |
Definition at line 404 of file qgscptcityarchive.h.
Referenced by data(), and QgsCptCityBrowserModel().
|
protected |
Definition at line 401 of file qgscptcityarchive.h.
Referenced by addRootItems(), findItem(), index(), removeRootItems(), and rowCount().
|
protected |
Definition at line 403 of file qgscptcityarchive.h.
Referenced by addRootItems(), and data().