Skip to content

Commit

Permalink
[sip] add missing ConvertToClassCode
Browse files Browse the repository at this point in the history
This was causing an issue if you tried to access widgets in a form using findChildren
widgets could not be casted to QGIs native types

also sipify QgsFilterLineEdit and QgsRelationEditorWidget
  • Loading branch information
3nids committed May 10, 2017
1 parent 13c1318 commit 97866f4
Show file tree
Hide file tree
Showing 18 changed files with 470 additions and 186 deletions.
2 changes: 0 additions & 2 deletions python/auto_sip.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ gui/qgsfeatureselectiondlg.sip
gui/qgsfieldvalidator.sip
gui/qgsfieldvalueslineedit.sip
gui/qgsfiledropedit.sip
gui/qgsfilterlineedit.sip
gui/qgsfloatingwidget.sip
gui/qgsfocuswatcher.sip
gui/qgsformannotation.sip
Expand Down Expand Up @@ -346,7 +345,6 @@ gui/qgsquerybuilder.sip
gui/qgsrasterformatsaveoptionswidget.sip
gui/qgsrasterlayersaveasdialog.sip
gui/qgsrasterpyramidsoptionswidget.sip
gui/qgsrelationeditorwidget.sip
gui/qgsrubberband.sip
gui/qgsscalerangewidget.sip
gui/qgsscalevisibilitydialog.sip
Expand Down
16 changes: 16 additions & 0 deletions python/gui/editorwidgets/qgsdoublespinbox.sip
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@




%ModuleHeaderCode
// fix to allow compilation with sip that for some reason
// doesn't add this include to the file where the code from
// ConvertToSubClassCode goes.
#include <qgsdoublespinbox.h>
%End


class QgsDoubleSpinBox : QDoubleSpinBox
{
%Docstring
Expand All @@ -19,6 +28,13 @@ class QgsDoubleSpinBox : QDoubleSpinBox

%TypeHeaderCode
#include "qgsdoublespinbox.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
sipType = sipType_QgsDoubleSpinBox;
else
sipType = NULL;
%End
public:

Expand Down
14 changes: 14 additions & 0 deletions python/gui/editorwidgets/qgsrelationreferencewidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@



%ModuleHeaderCode
// fix to allow compilation with sip that for some reason
// doesn't add this include to the file where the code from
// ConvertToSubClassCode goes.
#include <qgsrelationreferencewidget.h>
%End

class QgsRelationReferenceWidget : QWidget
{

%TypeHeaderCode
#include "qgsrelationreferencewidget.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
sipType = sipType_QgsRelationReferenceWidget;
else
sipType = NULL;
%End
public:

Expand Down
16 changes: 16 additions & 0 deletions python/gui/editorwidgets/qgsspinbox.sip
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@




%ModuleHeaderCode
// fix to allow compilation with sip 4.7 that for some reason
// doesn't add this include to the file where the code from
// ConvertToSubClassCode goes.
#include <qgsspinbox.h>
%End


class QgsSpinBox : QSpinBox
{
%Docstring
Expand All @@ -19,6 +28,13 @@ class QgsSpinBox : QSpinBox

%TypeHeaderCode
#include "qgsspinbox.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsSpinBox *>( sipCpp ) )
sipType = sipType_QgsSpinBox;
else
sipType = NULL;
%End
public:

Expand Down
7 changes: 7 additions & 0 deletions python/gui/qgscolorbutton.sip
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ class QgsColorButton : QToolButton

%TypeHeaderCode
#include "qgscolorbutton.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsColorButton *>( sipCpp ) )
sipType = sipType_QgsColorButton;
else
sipType = NULL;
%End
public:

Expand Down
15 changes: 15 additions & 0 deletions python/gui/qgsexternalresourcewidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@



%ModuleHeaderCode
// fix to allow compilation with sip that for some reason
// doesn't add this include to the file where the code from
// ConvertToSubClassCode goes.
#include <qgsexternalresourcewidget.h>
%End


class QgsExternalResourceWidget : QWidget
{
%Docstring
Expand All @@ -21,6 +29,13 @@ class QgsExternalResourceWidget : QWidget

%TypeHeaderCode
#include "qgsexternalresourcewidget.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsExternalResourceWidget *>( sipCpp ) )
sipType = sipType_QgsExternalResourceWidget;
else
sipType = NULL;
%End
public:
enum DocumentViewerContent
Expand Down
7 changes: 7 additions & 0 deletions python/gui/qgsfilewidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ class QgsFileWidget : QWidget

%TypeHeaderCode
#include "qgsfilewidget.h"
%End

%ConvertToSubClassCode
if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
sipType = sipType_QgsFileWidget;
else
sipType = NULL;
%End
public:

Expand Down

0 comments on commit 97866f4

Please sign in to comment.