Skip to content

Commit

Permalink
- updated const variables on the qgsvector header.
Browse files Browse the repository at this point in the history
- Removed dataItem_t pointer from qgsdataitem bindings.
- Put back qobject_cast.
  • Loading branch information
doublebyte1 committed Apr 30, 2017
1 parent a81cc12 commit 59bf146
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 40 deletions.
33 changes: 16 additions & 17 deletions python/core/qgsdataitem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@



typedef QgsDataItem *dataItem_t( QString, QgsDataItem * );

class QgsDataItem : QObject
{
Expand All @@ -25,22 +24,22 @@ class QgsDataItem : QObject
%End

%ConvertToSubClassCode
if ( sipCpp->inherits( "QgsLayerItem" ) )
sipType = sipType_QgsLayerItem;
if ( sipCpp->inherits( "QgsErrorItem" ) )
sipType = sipType_QgsErrorItem;
if ( sipCpp->inherits( "QgsDirectoryItem" ) )
sipType = sipType_QgsDirectoryItem;
if ( sipCpp->inherits( "QgsFavoritesItem" ) )
sipType = sipType_QgsFavoritesItem;
if ( sipCpp->inherits( "QgsZipItem" ) )
sipType = sipType_QgsZipItem;
if ( sipCpp->inherits( "QgsDataCollectionItem" ) )
sipType = sipType_QgsDataCollectionItem;
if ( sipCpp->inherits( "QgsProjectItem" ) )
sipType = sipType_QgsProjectItem;
else
sipType = 0;
if (qobject_cast<QgsLayerItem*>(sipCpp))
sipType = sipType_QgsLayerItem;
else if (qobject_cast<QgsErrorItem*>(sipCpp))
sipType = sipType_QgsErrorItem;
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
sipType = sipType_QgsDirectoryItem;
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
sipType = sipType_QgsFavoritesItem;
else if (qobject_cast<QgsZipItem*>(sipCpp))
sipType = sipType_QgsZipItem;
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
sipType = sipType_QgsDataCollectionItem;
else if (qobject_cast<QgsProjectItem*>(sipCpp))
sipType = sipType_QgsProjectItem;
else
sipType = 0;
%End
public:
enum Type
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgsvector.sip
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ Swaps the sign of the x and y components of the vector.
:rtype: QgsVector
%End

QgsVector &operator+=( QgsVector other );
QgsVector &operator+=( const QgsVector other );
%Docstring
Adds another vector to this vector in place.
.. versionadded:: 3.0
:rtype: QgsVector
%End

QgsVector operator-( QgsVector other ) const;
QgsVector operator-( const QgsVector other ) const;
%Docstring
Subtracts another vector to this vector.
.. versionadded:: 3.0
:rtype: QgsVector
%End

QgsVector &operator-=( QgsVector other );
QgsVector &operator-=( const QgsVector other );
%Docstring
Subtracts another vector to this vector in place.
.. versionadded:: 3.0
Expand Down
34 changes: 17 additions & 17 deletions src/core/qgsdataitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class QgsDataProvider;
class QgsDataItem;
class QgsAnimatedIcon;

typedef QgsDataItem *dataItem_t( QString, QgsDataItem * );
typedef QgsDataItem *dataItem_t( QString, QgsDataItem * ) SIP_SKIP;

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

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->inherits( "QgsLayerItem" ) )
sipType = sipType_QgsLayerItem;
if ( sipCpp->inherits( "QgsErrorItem" ) )
sipType = sipType_QgsErrorItem;
if ( sipCpp->inherits( "QgsDirectoryItem" ) )
sipType = sipType_QgsDirectoryItem;
if ( sipCpp->inherits( "QgsFavoritesItem" ) )
sipType = sipType_QgsFavoritesItem;
if ( sipCpp->inherits( "QgsZipItem" ) )
sipType = sipType_QgsZipItem;
if ( sipCpp->inherits( "QgsDataCollectionItem" ) )
sipType = sipType_QgsDataCollectionItem;
if ( sipCpp->inherits( "QgsProjectItem" ) )
sipType = sipType_QgsProjectItem;
else
sipType = 0;
if (qobject_cast<QgsLayerItem*>(sipCpp))
sipType = sipType_QgsLayerItem;
else if (qobject_cast<QgsErrorItem*>(sipCpp))
sipType = sipType_QgsErrorItem;
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
sipType = sipType_QgsDirectoryItem;
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
sipType = sipType_QgsFavoritesItem;
else if (qobject_cast<QgsZipItem*>(sipCpp))
sipType = sipType_QgsZipItem;
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
sipType = sipType_QgsDataCollectionItem;
else if (qobject_cast<QgsProjectItem*>(sipCpp))
sipType = sipType_QgsProjectItem;
else
sipType = 0;
SIP_END
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ class CORE_EXPORT QgsVector
* Adds another vector to this vector in place.
* \since QGIS 3.0
*/
QgsVector &operator+=( QgsVector other );
QgsVector &operator+=( const QgsVector other );

/**
* Subtracts another vector to this vector.
* \since QGIS 3.0
*/
QgsVector operator-( QgsVector other ) const;
QgsVector operator-( const QgsVector other ) const;

/**
* Subtracts another vector to this vector in place.
* \since QGIS 3.0
*/
QgsVector &operator-=( QgsVector other );
QgsVector &operator-=( const QgsVector other );

/** Returns the length of the vector.
*/
Expand Down

0 comments on commit 59bf146

Please sign in to comment.