Skip to content

Commit 59bf146

Browse files
committed
- updated const variables on the qgsvector header.
- Removed dataItem_t pointer from qgsdataitem bindings. - Put back qobject_cast.
1 parent a81cc12 commit 59bf146

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

python/core/qgsdataitem.sip

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212

1313

14-
typedef QgsDataItem *dataItem_t( QString, QgsDataItem * );
1514

1615
class QgsDataItem : QObject
1716
{
@@ -25,22 +24,22 @@ class QgsDataItem : QObject
2524
%End
2625

2726
%ConvertToSubClassCode
28-
if ( sipCpp->inherits( "QgsLayerItem" ) )
29-
sipType = sipType_QgsLayerItem;
30-
if ( sipCpp->inherits( "QgsErrorItem" ) )
31-
sipType = sipType_QgsErrorItem;
32-
if ( sipCpp->inherits( "QgsDirectoryItem" ) )
33-
sipType = sipType_QgsDirectoryItem;
34-
if ( sipCpp->inherits( "QgsFavoritesItem" ) )
35-
sipType = sipType_QgsFavoritesItem;
36-
if ( sipCpp->inherits( "QgsZipItem" ) )
37-
sipType = sipType_QgsZipItem;
38-
if ( sipCpp->inherits( "QgsDataCollectionItem" ) )
39-
sipType = sipType_QgsDataCollectionItem;
40-
if ( sipCpp->inherits( "QgsProjectItem" ) )
41-
sipType = sipType_QgsProjectItem;
42-
else
43-
sipType = 0;
27+
if (qobject_cast<QgsLayerItem*>(sipCpp))
28+
sipType = sipType_QgsLayerItem;
29+
else if (qobject_cast<QgsErrorItem*>(sipCpp))
30+
sipType = sipType_QgsErrorItem;
31+
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
32+
sipType = sipType_QgsDirectoryItem;
33+
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
34+
sipType = sipType_QgsFavoritesItem;
35+
else if (qobject_cast<QgsZipItem*>(sipCpp))
36+
sipType = sipType_QgsZipItem;
37+
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
38+
sipType = sipType_QgsDataCollectionItem;
39+
else if (qobject_cast<QgsProjectItem*>(sipCpp))
40+
sipType = sipType_QgsProjectItem;
41+
else
42+
sipType = 0;
4443
%End
4544
public:
4645
enum Type

python/core/qgsvector.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ Swaps the sign of the x and y components of the vector.
6767
:rtype: QgsVector
6868
%End
6969

70-
QgsVector &operator+=( QgsVector other );
70+
QgsVector &operator+=( const QgsVector other );
7171
%Docstring
7272
Adds another vector to this vector in place.
7373
.. versionadded:: 3.0
7474
:rtype: QgsVector
7575
%End
7676

77-
QgsVector operator-( QgsVector other ) const;
77+
QgsVector operator-( const QgsVector other ) const;
7878
%Docstring
7979
Subtracts another vector to this vector.
8080
.. versionadded:: 3.0
8181
:rtype: QgsVector
8282
%End
8383

84-
QgsVector &operator-=( QgsVector other );
84+
QgsVector &operator-=( const QgsVector other );
8585
%Docstring
8686
Subtracts another vector to this vector in place.
8787
.. versionadded:: 3.0

src/core/qgsdataitem.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class QgsDataProvider;
3737
class QgsDataItem;
3838
class QgsAnimatedIcon;
3939

40-
typedef QgsDataItem *dataItem_t( QString, QgsDataItem * );
40+
typedef QgsDataItem *dataItem_t( QString, QgsDataItem * ) SIP_SKIP;
4141

4242
/** \ingroup core
4343
* Base class for all items in the model.
@@ -48,22 +48,22 @@ class CORE_EXPORT QgsDataItem : public QObject
4848

4949
#ifdef SIP_RUN
5050
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;
51+
if (qobject_cast<QgsLayerItem*>(sipCpp))
52+
sipType = sipType_QgsLayerItem;
53+
else if (qobject_cast<QgsErrorItem*>(sipCpp))
54+
sipType = sipType_QgsErrorItem;
55+
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
56+
sipType = sipType_QgsDirectoryItem;
57+
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
58+
sipType = sipType_QgsFavoritesItem;
59+
else if (qobject_cast<QgsZipItem*>(sipCpp))
60+
sipType = sipType_QgsZipItem;
61+
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
62+
sipType = sipType_QgsDataCollectionItem;
63+
else if (qobject_cast<QgsProjectItem*>(sipCpp))
64+
sipType = sipType_QgsProjectItem;
65+
else
66+
sipType = 0;
6767
SIP_END
6868
#endif
6969

src/core/qgsvector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ class CORE_EXPORT QgsVector
6767
* Adds another vector to this vector in place.
6868
* \since QGIS 3.0
6969
*/
70-
QgsVector &operator+=( QgsVector other );
70+
QgsVector &operator+=( const QgsVector other );
7171

7272
/**
7373
* Subtracts another vector to this vector.
7474
* \since QGIS 3.0
7575
*/
76-
QgsVector operator-( QgsVector other ) const;
76+
QgsVector operator-( const QgsVector other ) const;
7777

7878
/**
7979
* Subtracts another vector to this vector in place.
8080
* \since QGIS 3.0
8181
*/
82-
QgsVector &operator-=( QgsVector other );
82+
QgsVector &operator-=( const QgsVector other );
8383

8484
/** Returns the length of the vector.
8585
*/

0 commit comments

Comments
 (0)