25#include <QFutureWatcher>
56 if ( qobject_cast<QgsLayerItem *>( sipCpp ) )
57 sipType = sipType_QgsLayerItem;
58 else if ( qobject_cast<QgsErrorItem *>( sipCpp ) )
59 sipType = sipType_QgsErrorItem;
60 else if ( qobject_cast<QgsDirectoryItem *>( sipCpp ) )
61 sipType = sipType_QgsDirectoryItem;
62 else if ( qobject_cast<QgsFavoritesItem *>( sipCpp ) )
63 sipType = sipType_QgsFavoritesItem;
64 else if ( qobject_cast<QgsZipItem *>( sipCpp ) )
65 sipType = sipType_QgsZipItem;
66 else if ( qobject_cast<QgsDataCollectionItem *>( sipCpp ) )
67 sipType = sipType_QgsDataCollectionItem;
68 else if ( qobject_cast<QgsProjectItem *>( sipCpp ) )
69 sipType = sipType_QgsProjectItem;
95 SIP_PYOBJECT __repr__();
97 QString str = QStringLiteral(
"<QgsDataItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
98 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
109 virtual bool layerCollection()
const;
120 PyObject *sipResObj = sipCallMethod( 0, sipMethod,
"" );
123 sipIsErr = !sipResObj || sipParseResult( 0, sipMethod, sipResObj,
"H5", sipType_QVector_0101QgsDataItem, &sipRes ) < 0;
128 PyObject *pyItem = sipGetPyObject( item, sipType_QgsDataItem );
129 if ( pyItem != NULL )
132 sipTransferTo( pyItem, Py_None );
136 if ( sipResObj != NULL )
138 Py_DECREF( sipResObj );
164 virtual void deleteChildItem(
QgsDataItem *child );
194 virtual QList<QAction *> actions( QWidget *parent );
203 virtual QList<QMenu *> menus( QWidget *parent );
216#pragma clang diagnostic push
217#pragma clang diagnostic ignored "-Woverloaded-virtual"
230#pragma clang diagnostic pop
238 virtual bool handleDoubleClick();
286 Q_DECL_DEPRECATED virtual
bool rename( const QString &name )
SIP_DEPRECATED;
295 virtual
Qgis::BrowserItemCapabilities capabilities2()
const {
return mCapabilities; }
307 Q_DECL_DEPRECATED
void setCapabilities(
int capabilities )
SIP_DEPRECATED;
312 static int findItem( QVector<QgsDataItem *> items,
QgsDataItem *item );
325 result.reserve( items.size() );
328 if ( T *matchedItem = qobject_cast< T * >( item ) )
329 result << matchedItem;
350 QVector<QgsDataItem *>
children()
const {
return mChildren; }
351 virtual QIcon icon();
358 QString
name()
const {
return mName; }
365 void setName(
const QString &name );
367 QString
path()
const {
return mPath; }
368 void setPath(
const QString &path ) { mPath = path; }
378 QString providerKey()
const;
388 void setProviderKey(
const QString &value );
391 static QString pathComponent(
const QString &component );
402 virtual QVariant sortKey()
const;
408 void setSortKey(
const QVariant &key );
414 void setIcon(
const QIcon &icon ) { mIcon = icon; }
415 void setIconName(
const QString &iconName ) { mIconName = iconName; }
421 static void deleteLater( QVector<QgsDataItem *> &items );
424 void moveToThread( QThread *targetThread );
438 virtual
void populate( const QVector<
QgsDataItem *> &children );
443 virtual
void refresh( const QVector<
QgsDataItem *> &children );
453 bool deferredDelete() {
return mDeferredDelete; }
486 virtual void deleteLater();
490 virtual void populate(
bool foreground =
false );
493 virtual void depopulate();
495 virtual void refresh();
503 virtual void refreshConnections(
const QString &providerKey = QString() );
505 virtual void childrenCreated();
581 static QVector<QgsDataItem *> runCreateChildren(
QgsDataItem *item );
584 bool mDeferredDelete =
false;
585 QFutureWatcher< QVector <QgsDataItem *> > *mFutureWatcher =
nullptr;
602 SIP_PYOBJECT __repr__();
604 QString str = QStringLiteral(
"<QgsErrorItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
605 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
The Qgis class provides global constants 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.
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
Animated icon is keeping an animation running if there are listeners connected to frameChanged.
This class 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.
Qgis::BrowserItemType mType
QVector< QgsDataItem * > mChildren
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.
void dataChanged(QgsDataItem *item)
Emitted when data changes for an item.
void endRemoveItems()
Emitted after child items have been removed from this data item.
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::BrowserItemType type() const
QMap< QString, QIcon > mIconMap
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 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).
void beginInsertItems(QgsDataItem *parent, int first, int last)
Emitted before child items are added to this data item.
virtual void setCapabilities(Qgis::BrowserItemCapabilities capabilities)
Sets the capabilities for the data 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)
void endInsertItems()
Emitted after child items have been added to this data item.
static QList< T * > filteredItems(const QList< QgsDataItem * > &items)
Returns a filtered list of data items which match the template type.
Data item that can be used to report problems (e.g.
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 *)
const QgsCoordinateReferenceSystem & crs