Skip to content

Commit 97866f4

Browse files
committed
[sip] add missing ConvertToClassCode
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
1 parent 13c1318 commit 97866f4

18 files changed

+470
-186
lines changed

python/auto_sip.blacklist

-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ gui/qgsfeatureselectiondlg.sip
282282
gui/qgsfieldvalidator.sip
283283
gui/qgsfieldvalueslineedit.sip
284284
gui/qgsfiledropedit.sip
285-
gui/qgsfilterlineedit.sip
286285
gui/qgsfloatingwidget.sip
287286
gui/qgsfocuswatcher.sip
288287
gui/qgsformannotation.sip
@@ -346,7 +345,6 @@ gui/qgsquerybuilder.sip
346345
gui/qgsrasterformatsaveoptionswidget.sip
347346
gui/qgsrasterlayersaveasdialog.sip
348347
gui/qgsrasterpyramidsoptionswidget.sip
349-
gui/qgsrelationeditorwidget.sip
350348
gui/qgsrubberband.sip
351349
gui/qgsscalerangewidget.sip
352350
gui/qgsscalevisibilitydialog.sip

python/gui/editorwidgets/qgsdoublespinbox.sip

+16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99

1010

1111

12+
13+
%ModuleHeaderCode
14+
// fix to allow compilation with sip that for some reason
15+
// doesn't add this include to the file where the code from
16+
// ConvertToSubClassCode goes.
17+
#include <qgsdoublespinbox.h>
18+
%End
19+
20+
1221
class QgsDoubleSpinBox : QDoubleSpinBox
1322
{
1423
%Docstring
@@ -19,6 +28,13 @@ class QgsDoubleSpinBox : QDoubleSpinBox
1928

2029
%TypeHeaderCode
2130
#include "qgsdoublespinbox.h"
31+
%End
32+
33+
%ConvertToSubClassCode
34+
if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
35+
sipType = sipType_QgsDoubleSpinBox;
36+
else
37+
sipType = NULL;
2238
%End
2339
public:
2440

python/gui/editorwidgets/qgsrelationreferencewidget.sip

+14
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,25 @@
1010

1111

1212

13+
%ModuleHeaderCode
14+
// fix to allow compilation with sip that for some reason
15+
// doesn't add this include to the file where the code from
16+
// ConvertToSubClassCode goes.
17+
#include <qgsrelationreferencewidget.h>
18+
%End
19+
1320
class QgsRelationReferenceWidget : QWidget
1421
{
1522

1623
%TypeHeaderCode
1724
#include "qgsrelationreferencewidget.h"
25+
%End
26+
27+
%ConvertToSubClassCode
28+
if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
29+
sipType = sipType_QgsRelationReferenceWidget;
30+
else
31+
sipType = NULL;
1832
%End
1933
public:
2034

python/gui/editorwidgets/qgsspinbox.sip

+16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99

1010

1111

12+
13+
%ModuleHeaderCode
14+
// fix to allow compilation with sip 4.7 that for some reason
15+
// doesn't add this include to the file where the code from
16+
// ConvertToSubClassCode goes.
17+
#include <qgsspinbox.h>
18+
%End
19+
20+
1221
class QgsSpinBox : QSpinBox
1322
{
1423
%Docstring
@@ -19,6 +28,13 @@ class QgsSpinBox : QSpinBox
1928

2029
%TypeHeaderCode
2130
#include "qgsspinbox.h"
31+
%End
32+
33+
%ConvertToSubClassCode
34+
if ( qobject_cast<QgsSpinBox *>( sipCpp ) )
35+
sipType = sipType_QgsSpinBox;
36+
else
37+
sipType = NULL;
2238
%End
2339
public:
2440

python/gui/qgscolorbutton.sip

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class QgsColorButton : QToolButton
1919

2020
%TypeHeaderCode
2121
#include "qgscolorbutton.h"
22+
%End
23+
24+
%ConvertToSubClassCode
25+
if ( qobject_cast<QgsColorButton *>( sipCpp ) )
26+
sipType = sipType_QgsColorButton;
27+
else
28+
sipType = NULL;
2229
%End
2330
public:
2431

python/gui/qgsexternalresourcewidget.sip

+15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111

1212

1313

14+
%ModuleHeaderCode
15+
// fix to allow compilation with sip that for some reason
16+
// doesn't add this include to the file where the code from
17+
// ConvertToSubClassCode goes.
18+
#include <qgsexternalresourcewidget.h>
19+
%End
20+
21+
1422
class QgsExternalResourceWidget : QWidget
1523
{
1624
%Docstring
@@ -21,6 +29,13 @@ class QgsExternalResourceWidget : QWidget
2129

2230
%TypeHeaderCode
2331
#include "qgsexternalresourcewidget.h"
32+
%End
33+
34+
%ConvertToSubClassCode
35+
if ( qobject_cast<QgsExternalResourceWidget *>( sipCpp ) )
36+
sipType = sipType_QgsExternalResourceWidget;
37+
else
38+
sipType = NULL;
2439
%End
2540
public:
2641
enum DocumentViewerContent

python/gui/qgsfilewidget.sip

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class QgsFileWidget : QWidget
1919

2020
%TypeHeaderCode
2121
#include "qgsfilewidget.h"
22+
%End
23+
24+
%ConvertToSubClassCode
25+
if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
26+
sipType = sipType_QgsFileWidget;
27+
else
28+
sipType = NULL;
2229
%End
2330
public:
2431

0 commit comments

Comments
 (0)