QGIS API Documentation
2.8.2-Wien
|
Base class for all items in the model. More...
#include <qgsdataitem.h>
Public Types | |
enum | Capability { NoCapabilities = 0, SetCrs = 1 << 0, Fertile = 1 << 1, Fast = 1 << 2 } |
enum | State { NotPopulated, Populating, Populated } |
enum | Type { Collection, Directory, Layer, Error, Favourites } |
Public Slots | |
virtual void | childrenCreated () |
virtual void | deleteLater () |
Safely delete the item: | |
virtual void | depopulate () |
Remove children recursively and set as not populated. | |
void | emitBeginInsertItems (QgsDataItem *parent, int first, int last) |
void | emitBeginRemoveItems (QgsDataItem *parent, int first, int last) |
void | emitDataChanged (QgsDataItem *item) |
void | emitDataChanged () |
void | emitEndInsertItems () |
void | emitEndRemoveItems () |
void | emitStateChanged (QgsDataItem *item, QgsDataItem::State oldState) |
virtual void | populate () |
virtual void | refresh () |
void | setPopulatingIcon () |
Signals | |
void | beginInsertItems (QgsDataItem *parent, int first, int last) |
void | beginRemoveItems (QgsDataItem *parent, int first, int last) |
void | dataChanged (QgsDataItem *item) |
void | endInsertItems () |
void | endRemoveItems () |
void | stateChanged (QgsDataItem *item, QgsDataItem::State oldState) |
Public Member Functions | |
QgsDataItem (QgsDataItem::Type type, QgsDataItem *parent, QString name, QString path) | |
Create new data item. | |
virtual | ~QgsDataItem () |
virtual bool | acceptDrop () |
virtual QList< QAction * > | actions () |
virtual void | addChildItem (QgsDataItem *child, bool refresh=false) |
virtual Q_DECL_DEPRECATED Capability | capabilities () |
virtual Capabilities | capabilities2 () const |
QVector< QgsDataItem * > | children () const |
virtual QVector< QgsDataItem * > | createChildren () |
Create children. | |
virtual void | deleteChildItem (QgsDataItem *child) |
virtual bool | equal (const QgsDataItem *other) |
virtual bool | handleDrop (const QMimeData *, Qt::DropAction) |
bool | hasChildren () |
virtual QIcon | icon () |
bool | isPopulated () |
void | moveToThread (QThread *targetThread) |
Move object and all its descendants to thread. | |
QString | name () const |
virtual QWidget * | paramWidget () |
QgsDataItem * | parent () const |
Get item parent. | |
QString | path () const |
virtual QgsDataItem * | removeChildItem (QgsDataItem *child) |
int | rowCount () |
virtual void | setCapabilities (Capabilities capabilities) |
virtual bool | setCrs (QgsCoordinateReferenceSystem crs) |
void | setIcon (QIcon icon) |
void | setIconName (const QString &iconName) |
void | setName (const QString &name) |
void | setParent (QgsDataItem *parent) |
Set item parent and connect / disconnect parent to / from item signals. | |
void | setPath (const QString &path) |
virtual void | setState (State state) |
Set item state. | |
void | setToolTip (QString msg) |
State | state () const |
QString | toolTip () const |
Type | type () const |
Static Public Member Functions | |
static void | deleteLater (QVector< QgsDataItem * > &items) |
static int | findItem (QVector< QgsDataItem * > items, QgsDataItem *item) |
static QString | pathComponent (const QString &component) |
Create path component replacing path separators. |
Protected Member Functions | |
bool | deferredDelete () |
The item is scheduled to be deleted. | |
virtual void | populate (QVector< QgsDataItem * > children) |
QIcon | populatingIcon () |
virtual void | refresh (QVector< QgsDataItem * > children) |
Protected Attributes | |
Capabilities | mCapabilities |
QVector< QgsDataItem * > | mChildren |
QIcon | mIcon |
QString | mIconName |
QString | mName |
QgsDataItem * | mParent |
QString | mPath |
bool | mPopulated |
State | mState |
QString | mToolTip |
Type | mType |
Static Protected Attributes | |
static QMap< QString, QIcon > | mIconMap = QMap<QString, QIcon>() |
Base class for all items in the model.
Parent/children hierarchy is not based on QObject.
Definition at line 43 of file qgsdataitem.h.
NoCapabilities | |
SetCrs |
Can set CRS on layer or group of layers. |
Fertile |
Can create children. Even items without this capability may have children, but cannot create them, it means that children are created by item ancestors. |
Fast |
createChildren() is fast enough to be run in main thread when refreshing items, most root items (wms,wfs,wcs,postgres...) are considered fast because they are reading data only from QSettings |
Definition at line 110 of file qgsdataitem.h.
enum QgsDataItem::State |
NotPopulated |
Children not yet created. |
Populating |
Creating children in separate thread (populating or refreshing) |
Populated |
children created |
Definition at line 70 of file qgsdataitem.h.
enum QgsDataItem::Type |
Definition at line 49 of file qgsdataitem.h.
QgsDataItem::QgsDataItem | ( | QgsDataItem::Type | type, |
QgsDataItem * | parent, | ||
QString | name, | ||
QString | path | ||
) |
Create new data item.
Definition at line 158 of file qgsdataitem.cpp.
|
virtual |
Definition at line 173 of file qgsdataitem.cpp.
|
inlinevirtual |
Definition at line 105 of file qgsdataitem.h.
|
inlinevirtual |
Definition at line 102 of file qgsdataitem.h.
|
virtual |
Definition at line 494 of file qgsdataitem.cpp.
|
signal |
|
signal |
|
inlinevirtual |
Definition at line 124 of file qgsdataitem.h.
|
inlinevirtual |
Definition at line 126 of file qgsdataitem.h.
|
inline |
Definition at line 145 of file qgsdataitem.h.
|
virtualslot |
Definition at line 344 of file qgsdataitem.cpp.
|
virtual |
Create children.
Children are not expected to have parent set. This method MUST BE THREAD SAFE.
Reimplemented in QgsZipItem, QgsFavouritesItem, and QgsDirectoryItem.
Definition at line 295 of file qgsdataitem.cpp.
|
signal |
|
inlineprotected |
The item is scheduled to be deleted.
E.g. if deleteLater() is called when item is in Populating state (createChildren() running in another thread), the deferredDelete() returns true and item will be deleted once Populating finished. Items with slow reateChildren() (for example network or database based) may check during createChildren() if deferredDelete() returns true and return from createChildren() immediately because result will be useless.
Definition at line 179 of file qgsdataitem.h.
|
virtual |
Definition at line 528 of file qgsdataitem.cpp.
|
static |
Definition at line 221 of file qgsdataitem.cpp.
|
virtualslot |
Safely delete the item:
Definition at line 198 of file qgsdataitem.cpp.
|
virtualslot |
Remove children recursively and set as not populated.
This is used when refreshing collapsed items.
Definition at line 381 of file qgsdataitem.cpp.
|
slot |
Definition at line 260 of file qgsdataitem.cpp.
|
slot |
Definition at line 268 of file qgsdataitem.cpp.
|
slot |
Definition at line 277 of file qgsdataitem.cpp.
|
slot |
Definition at line 282 of file qgsdataitem.cpp.
|
slot |
Definition at line 264 of file qgsdataitem.cpp.
|
slot |
Definition at line 272 of file qgsdataitem.cpp.
|
slot |
Definition at line 287 of file qgsdataitem.cpp.
|
signal |
|
signal |
|
virtual |
Reimplemented in QgsDirectoryItem, and QgsLayerItem.
Definition at line 563 of file qgsdataitem.cpp.
|
static |
Definition at line 551 of file qgsdataitem.cpp.
|
inlinevirtual |
Definition at line 108 of file qgsdataitem.h.
bool QgsDataItem::hasChildren | ( | ) |
Definition at line 465 of file qgsdataitem.cpp.
|
virtual |
Reimplemented in QgsDirectoryItem.
Definition at line 246 of file qgsdataitem.cpp.
|
inline |
Definition at line 84 of file qgsdataitem.h.
void QgsDataItem::moveToThread | ( | QThread * | targetThread | ) |
Move object and all its descendants to thread.
Definition at line 232 of file qgsdataitem.cpp.
|
inline |
Definition at line 147 of file qgsdataitem.h.
|
inlinevirtual |
Reimplemented in QgsDirectoryItem.
Definition at line 99 of file qgsdataitem.h.
|
inline |
Get item parent.
QgsDataItem maintains its own items hierarchy, it does not use QObject hierarchy.
Definition at line 141 of file qgsdataitem.h.
|
inline |
Definition at line 149 of file qgsdataitem.h.
|
static |
Create path component replacing path separators.
Definition at line 193 of file qgsdataitem.cpp.
|
protectedvirtual |
Definition at line 367 of file qgsdataitem.cpp.
|
virtualslot |
Definition at line 300 of file qgsdataitem.cpp.
|
inlineprotected |
Definition at line 172 of file qgsdataitem.h.
|
protectedvirtual |
Definition at line 417 of file qgsdataitem.cpp.
|
virtualslot |
Definition at line 394 of file qgsdataitem.cpp.
|
virtual |
Definition at line 539 of file qgsdataitem.cpp.
int QgsDataItem::rowCount | ( | ) |
Definition at line 461 of file qgsdataitem.cpp.
|
inlinevirtual |
Definition at line 128 of file qgsdataitem.h.
|
inlinevirtual |
Definition at line 120 of file qgsdataitem.h.
|
inline |
Definition at line 157 of file qgsdataitem.h.
|
inline |
Definition at line 158 of file qgsdataitem.h.
|
inline |
Definition at line 148 of file qgsdataitem.h.
void QgsDataItem::setParent | ( | QgsDataItem * | parent | ) |
Set item parent and connect / disconnect parent to / from item signals.
It does not add itself to parents children (mChildren)
Definition at line 470 of file qgsdataitem.cpp.
|
inline |
Definition at line 150 of file qgsdataitem.h.
|
slot |
Definition at line 573 of file qgsdataitem.cpp.
|
virtual |
Set item state.
It also take care about starting/stopping loading icon animation.
state |
Reimplemented in QgsDirectoryItem.
Definition at line 587 of file qgsdataitem.cpp.
|
inline |
Definition at line 160 of file qgsdataitem.h.
QgsDataItem::State QgsDataItem::state | ( | ) | const |
Definition at line 578 of file qgsdataitem.cpp.
|
signal |
|
inline |
Definition at line 161 of file qgsdataitem.h.
|
inline |
Definition at line 137 of file qgsdataitem.h.
|
protected |
Definition at line 182 of file qgsdataitem.h.
|
protected |
Definition at line 184 of file qgsdataitem.h.
|
protected |
Definition at line 196 of file qgsdataitem.h.
|
staticprotected |
Definition at line 197 of file qgsdataitem.h.
|
protected |
Definition at line 195 of file qgsdataitem.h.
|
protected |
Definition at line 188 of file qgsdataitem.h.
|
protected |
Definition at line 183 of file qgsdataitem.h.
|
protected |
Definition at line 193 of file qgsdataitem.h.
|
protected |
Definition at line 187 of file qgsdataitem.h.
|
protected |
Definition at line 185 of file qgsdataitem.h.
|
protected |
Definition at line 194 of file qgsdataitem.h.
|
protected |
Definition at line 181 of file qgsdataitem.h.