@@ -45,6 +45,28 @@ typedef QgsDataItem *dataItem_t( QString, QgsDataItem * );
45
45
*/
46
46
class CORE_EXPORT QgsDataItem : public QObject
47
47
{
48
+
49
+ #ifdef SIP_RUN
50
+ SIP_CONVERT_TO_SUBCLASS_CODE
51
+ if ( sipCpp->inherits ( " QgsLayerItem" ) )
52
+ sipType = sipType_QgsLayerItem;
53
+ if ( sipCpp->inherits ( " QgsErrorItem" ) )
54
+ sipType = sipType_QgsErrorItem;
55
+ if ( sipCpp->inherits ( " QgsDirectoryItem" ) )
56
+ sipType = sipType_QgsDirectoryItem;
57
+ if ( sipCpp->inherits ( " QgsFavoritesItem" ) )
58
+ sipType = sipType_QgsFavoritesItem;
59
+ if ( sipCpp->inherits ( " QgsZipItem" ) )
60
+ sipType = sipType_QgsZipItem;
61
+ if ( sipCpp->inherits ( " QgsDataCollectionItem" ) )
62
+ sipType = sipType_QgsDataCollectionItem;
63
+ if ( sipCpp->inherits ( " QgsProjectItem" ) )
64
+ sipType = sipType_QgsProjectItem;
65
+ else
66
+ sipType = 0 ;
67
+ SIP_END
68
+ #endif
69
+
48
70
Q_OBJECT
49
71
Q_ENUMS ( Type )
50
72
Q_ENUMS ( State )
@@ -60,7 +82,7 @@ class CORE_EXPORT QgsDataItem : public QObject
60
82
};
61
83
62
84
// ! Create new data item.
63
- QgsDataItem ( QgsDataItem::Type type, QgsDataItem *parent, const QString &name, const QString &path );
85
+ QgsDataItem ( QgsDataItem::Type type, QgsDataItem *parent SIP_TRANSFERTHIS , const QString &name, const QString &path );
64
86
virtual ~QgsDataItem ();
65
87
66
88
bool hasChildren ();
@@ -69,7 +91,7 @@ class CORE_EXPORT QgsDataItem : public QObject
69
91
70
92
/* * Create children. Children are not expected to have parent set.
71
93
* This method MUST BE THREAD SAFE. */
72
- virtual QVector<QgsDataItem *> createChildren ();
94
+ virtual QVector<QgsDataItem *> createChildren () SIP_FACTORY ;
73
95
74
96
enum State
75
97
{
@@ -92,7 +114,7 @@ class CORE_EXPORT QgsDataItem : public QObject
92
114
* \param refresh - set to true to refresh populated item, emitting relevant signals to the model
93
115
* \see deleteChildItem()
94
116
*/
95
- virtual void addChildItem ( QgsDataItem *child, bool refresh = false );
117
+ virtual void addChildItem ( QgsDataItem *child SIP_TRANSFER , bool refresh = false );
96
118
97
119
/* * Removes and deletes a child item, emitting relevant signals to the model.
98
120
* \param child child to remove. Item must exist as a current child.
@@ -104,13 +126,13 @@ class CORE_EXPORT QgsDataItem : public QObject
104
126
* \param child child to remove
105
127
* \returns pointer to the removed item or null if no such item was found
106
128
*/
107
- virtual QgsDataItem *removeChildItem ( QgsDataItem *child );
129
+ virtual QgsDataItem *removeChildItem ( QgsDataItem *child ) SIP_TRANSFERBACK ;
108
130
109
131
/* * Returns true if this item is equal to another item (by testing item type and path).
110
132
*/
111
133
virtual bool equal ( const QgsDataItem *other );
112
134
113
- virtual QWidget *paramWidget () { return nullptr ; }
135
+ virtual QWidget *paramWidget () SIP_FACTORY { return nullptr ; }
114
136
115
137
/* * Returns the list of actions available for this item. This is usually used for the popup menu on right-clicking
116
138
* the item. Subclasses should override this to provide actions.
@@ -383,7 +405,7 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
383
405
QgsDataCollectionItem ( QgsDataItem *parent, const QString &name, const QString &path = QString::null );
384
406
~QgsDataCollectionItem ();
385
407
386
- void addChild ( QgsDataItem *item ) { mChildren .append ( item ); }
408
+ void addChild ( QgsDataItem *item SIP_TRANSFER ) { mChildren .append ( item ); }
387
409
388
410
static QIcon iconDir (); // shared icon: open/closed directory
389
411
static QIcon iconDataCollection (); // default icon for data collection
@@ -423,7 +445,7 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
423
445
QString dirPath () const { return mDirPath ; }
424
446
virtual bool equal ( const QgsDataItem *other ) override ;
425
447
virtual QIcon icon () override ;
426
- virtual QWidget *paramWidget () override ;
448
+ virtual QWidget *paramWidget () override SIP_FACTORY ;
427
449
428
450
// ! Check if the given path is hidden from the browser model
429
451
static bool hiddenPath ( const QString &path );
@@ -484,7 +506,7 @@ class CORE_EXPORT QgsDirectoryParamWidget : public QTreeWidget
484
506
Q_OBJECT
485
507
486
508
public:
487
- QgsDirectoryParamWidget ( const QString &path, QWidget *parent = nullptr );
509
+ QgsDirectoryParamWidget ( const QString &path, QWidget *parent SIP_TRANSFERTHIS = nullptr );
488
510
489
511
protected:
490
512
void mousePressEvent ( QMouseEvent *event ) override ;
@@ -557,13 +579,13 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
557
579
/* *
558
580
* Creates a new data item from the specified path.
559
581
*/
560
- static QgsDataItem *itemFromPath ( QgsDataItem *parent, const QString &path, const QString &name );
582
+ static QgsDataItem *itemFromPath ( QgsDataItem *parent, const QString &path, const QString &name ) SIP_FACTORY ;
561
583
562
584
/* *
563
585
* Creates a new data item from the specified path.
564
586
* \note available in Python as itemFromFilePath
565
587
*/
566
- static QgsDataItem *itemFromPath ( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path );
588
+ static QgsDataItem *itemFromPath ( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY, SIP_PYNAME(itemFromFilePath) ;
567
589
568
590
static QIcon iconZip ();
569
591
0 commit comments