25#include <QFutureWatcher>
57 if ( qobject_cast<QgsLayerItem *>( sipCpp ) )
58 sipType = sipType_QgsLayerItem;
59 else if ( qobject_cast<QgsErrorItem *>( sipCpp ) )
60 sipType = sipType_QgsErrorItem;
61 else if ( qobject_cast<QgsDirectoryItem *>( sipCpp ) )
62 sipType = sipType_QgsDirectoryItem;
63 else if ( qobject_cast<QgsFavoritesItem *>( sipCpp ) )
64 sipType = sipType_QgsFavoritesItem;
65 else if ( qobject_cast<QgsZipItem *>( sipCpp ) )
66 sipType = sipType_QgsZipItem;
67 else if ( qobject_cast<QgsDataCollectionItem *>( sipCpp ) )
68 sipType = sipType_QgsDataCollectionItem;
69 else if ( qobject_cast<QgsProjectItem *>( sipCpp ) )
70 sipType = sipType_QgsProjectItem;
96 SIP_PYOBJECT __repr__();
98 QString str = u
"<QgsDataItem: \"%1\" %2>"_s.arg( sipCpp->name(), sipCpp->path() );
99 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
127 PyObject *sipResObj = sipCallMethod( 0, sipMethod,
"" );
130 sipIsErr = !sipResObj || sipParseResult( 0, sipMethod, sipResObj,
"H5", sipType_QVector_0101QgsDataItem, &sipRes ) < 0;
135 PyObject *pyItem = sipGetPyObject( item, sipType_QgsDataItem );
136 if ( pyItem != NULL )
139 sipTransferTo( pyItem, Py_None );
143 if ( sipResObj != NULL )
145 Py_DECREF( sipResObj );
220 virtual QList<QAction *> actions( QWidget *parent );
229 virtual QList<QMenu *> menus( QWidget *parent );
242#pragma clang diagnostic push
243#pragma clang diagnostic ignored "-Woverloaded-virtual"
256#pragma clang diagnostic pop
264 virtual bool handleDoubleClick();
312 Q_DECL_DEPRECATED virtual
bool rename( const QString &name )
SIP_DEPRECATED;
333 Q_DECL_DEPRECATED
void setCapabilities(
int capabilities )
SIP_DEPRECATED;
338 static int findItem( QVector<QgsDataItem *> items,
QgsDataItem *item );
351 result.reserve( items.size() );
354 if ( T *matchedItem = qobject_cast< T * >( item ) )
355 result << matchedItem;
389 virtual QIcon icon();
403 void setName(
const QString &name );
416 QString providerKey()
const;
426 void setProviderKey(
const QString &value );
429 static QString pathComponent(
const QString &component );
440 virtual QVariant sortKey()
const;
446 void setSortKey(
const QVariant &key );
459 static void deleteLater( QVector<QgsDataItem *> &items );
462 void moveToThread( QThread *targetThread );
537 virtual void populate(
bool foreground =
false );
628 static QVector<QgsDataItem *> runCreateChildren(
QgsDataItem *item );
631 bool mDeferredDelete =
false;
632 std::unique_ptr<QFutureWatcher<QVector<QgsDataItem *> >> mFutureWatcher;
650 SIP_PYOBJECT __repr__();
652 QString str = u
"<QgsErrorItem: \"%1\" %2>"_s.arg( sipCpp->name(), sipCpp->path() );
653 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
Provides global constants and enumerations for use throughout the application.
BrowserItemState
Browser item states.
@ NotPopulated
Children not yet created.
@ NoCapabilities
Item has no capabilities.
BrowserItemType
Browser item types.
QFlags< BrowserItemCapability > BrowserItemCapabilities
Browser item capabilities.
Provides common functionality for database based connections.
Animated icon is keeping an animation running if there are listeners connected to frameChanged.
Represents a coordinate reference system (CRS).
Base class for all items in the model.
void stateChanged(QgsDataItem *item, Qgis::BrowserItemState oldState)
Emitted when an item's state is changed.
bool hasChildren() const
Returns whether this item has children.
Qgis::BrowserItemType mType
int rowCount() const
Returns the number of rows of this item.
virtual void deleteChildItem(QgsDataItem *child)
Removes and deletes a child item, emitting relevant signals to the model.
QVector< QgsDataItem * > mChildren
int mCreatorAncestorDepth
Creator ancestor depth.
Qgis::BrowserItemState mState
void setToolTip(const QString &msg)
virtual Q_DECL_DEPRECATED bool handleDrop(const QMimeData *, Qt::DropAction)
Attempts to process the mime data dropped on this item.
virtual void refresh(const QVector< QgsDataItem * > &children)
Refresh the items from a specified list of child items.
void dataChanged(QgsDataItem *item)
Emitted when data changes for an item.
int creatorAncestorDepth() const
Returns the hierarchical depth of the item's original creator/source.
static void deleteLater(QVector< QgsDataItem * > &items)
void endRemoveItems()
Emitted after child items have been removed from this data item.
virtual bool layerCollection() const
Returns true if the data item is a collection of layers The default implementation returns false,...
QVector< QgsDataItem * > children() const
void beginRemoveItems(QgsDataItem *parent, int first, int last)
Emitted before child items are removed from this data item.
virtual Q_DECL_DEPRECATED bool acceptDrop()
Returns whether the item accepts drag and dropped layers - e.g.
Qgis::BrowserItemCapabilities mCapabilities
Qgis::BrowserItemType type() const
QgsDataItem(Qgis::BrowserItemType type, QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey=QString())
Constructor for QgsDataItem, with the specified parent item.
virtual QVector< QgsDataItem * > createChildren()
Create children.
QMap< QString, QIcon > mIconMap
Qgis::BrowserItemState state() const
virtual void childrenCreated()
virtual QgsDataItem * removeChildItem(QgsDataItem *child)
Removes a child item and returns it without deleting it.
virtual bool hasDragEnabled() const
Returns true if the item may be dragged.
QVariant mSortKey
Custom sort key. If invalid, name() will be used for sorting instead.
void updateIcon()
Will request a repaint of this icon.
void connectionsChanged(const QString &providerKey=QString())
Emitted when the connections of the provider with the specified providerKey have changed.
QString name() const
Returns the name of the item (the displayed text for the item).
virtual void setState(Qgis::BrowserItemState state)
Set item state.
void beginInsertItems(QgsDataItem *parent, int first, int last)
Emitted before child items are added to this data item.
virtual void refreshConnections(const QString &providerKey=QString())
Causes a data item provider to refresh all registered connections.
virtual void setCapabilities(Qgis::BrowserItemCapabilities capabilities)
Sets the capabilities for the data item.
virtual void addChildItem(QgsDataItem *child, bool refresh=false)
Inserts a new child item.
QgsDataItem * parent() const
Gets item parent.
virtual Q_DECL_DEPRECATED QWidget * paramWidget()
Returns source widget from data item for QgsBrowserPropertiesWidget.
void setIcon(const QIcon &icon)
void setIconName(const QString &iconName)
void setPath(const QString &path)
QString providerKey() const
Returns the provider key that created this item (e.g.
void endInsertItems()
Emitted after child items have been added to this data item.
virtual Qgis::BrowserItemCapabilities capabilities2() const
Returns the capabilities for the data item.
virtual void populate(const QVector< QgsDataItem * > &children)
virtual bool equal(const QgsDataItem *other)
Returns true if this item is equal to another item (by testing item type and path).
virtual void depopulate()
Remove children recursively and set as not populated. This is used when refreshing collapsed items.
bool deferredDelete() const
Returns true if the item is scheduled to be deleted.
static QList< T * > filteredItems(const QList< QgsDataItem * > &items)
Returns a filtered list of data items which match the template type.
QgsErrorItem(QgsDataItem *parent, const QString &error, const QString &path)
Contains utility functions for working with MIME data.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define SIP_VIRTUAL_CATCHER_CODE(code)
QgsDataItem * dataItem_t(QString, QgsDataItem *)