Skip to content

Commit 97866f4

Browse files
committedMay 10, 2017
[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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 16 additions & 0 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 16 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

‎python/gui/qgsfilterlineedit.sip

Lines changed: 164 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,214 @@
1-
/** \class QgsFilterLineEdit
2-
* \ingroup gui
3-
* QLineEdit subclass with built in support for clearing the widget's value and
4-
* handling custom null value representations.
5-
*
6-
* When using QgsFilterLineEdit the value(), setValue() and clearValue() methods should be used
7-
* instead of QLineEdit's text(), setText() and clear() methods, and the valueChanged()
8-
* signal should be used instead of textChanged().
9-
**/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsfilterlineedit.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
1014
class QgsFilterLineEdit : QLineEdit
1115
{
16+
%Docstring
17+
QLineEdit subclass with built in support for clearing the widget's value and
18+
handling custom null value representations.
19+
20+
When using QgsFilterLineEdit the value(), setValue() and clearValue() methods should be used
21+
instead of QLineEdit's text(), setText() and clear() methods, and the valueChanged()
22+
signal should be used instead of textChanged().
23+
*
24+
%End
25+
1226
%TypeHeaderCode
13-
#include <qgsfilterlineedit.h>
27+
#include "qgsfilterlineedit.h"
28+
%End
29+
30+
%ConvertToSubClassCode
31+
if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
32+
sipType = sipType_QgsFilterLineEdit;
33+
else
34+
sipType = NULL;
1435
%End
1536
public:
1637

17-
//! Behavior when clearing value of widget
1838
enum ClearMode
1939
{
20-
ClearToNull, //!< Reset value to null
21-
ClearToDefault, //!< Reset value to default value (see defaultValue() )
40+
ClearToNull,
41+
ClearToDefault,
2242
};
2343

24-
/** Constructor for QgsFilterLineEdit.
25-
* @param parent parent widget
26-
* @param nullValue string for representing null values
27-
*/
2844
QgsFilterLineEdit( QWidget *parent /TransferThis/ = 0, const QString &nullValue = QString::null );
45+
%Docstring
46+
Constructor for QgsFilterLineEdit.
47+
\param parent parent widget
48+
\param nullValue string for representing null values
49+
%End
2950

30-
/** Returns true if the widget's clear button is visible.
31-
* @see setShowClearButton()
32-
* @note added in QGIS 3.0
33-
*/
3451
bool showClearButton() const;
52+
%Docstring
53+
Returns true if the widget's clear button is visible.
54+
.. seealso:: setShowClearButton()
55+
.. versionadded:: 3.0
56+
:rtype: bool
57+
%End
3558

36-
/** Sets whether the widget's clear button is visible.
37-
* @param visible set to false to hide the clear button
38-
* @see showClearButton()
39-
* @note added in QGIS 3.0
40-
*/
4159
void setShowClearButton( bool visible );
60+
%Docstring
61+
Sets whether the widget's clear button is visible.
62+
\param visible set to false to hide the clear button
63+
.. seealso:: showClearButton()
64+
.. versionadded:: 3.0
65+
%End
4266

43-
/** Returns the clear mode for the widget. The clear mode defines the behavior of the
44-
* widget when its value is cleared. This defaults to ClearToNull.
45-
* @see setClearMode()
46-
* @note added in QGIS 3.0
47-
*/
4867
ClearMode clearMode() const;
68+
%Docstring
69+
Returns the clear mode for the widget. The clear mode defines the behavior of the
70+
widget when its value is cleared. This defaults to ClearToNull.
71+
.. seealso:: setClearMode()
72+
.. versionadded:: 3.0
73+
:rtype: ClearMode
74+
%End
4975

50-
/** Sets the clear mode for the widget. The clear mode defines the behavior of the
51-
* widget when its value is cleared. This defaults to ClearToNull.
52-
* @see clearMode()
53-
* @note added in QGIS 3.0
54-
*/
5576
void setClearMode( ClearMode mode );
77+
%Docstring
78+
Sets the clear mode for the widget. The clear mode defines the behavior of the
79+
widget when its value is cleared. This defaults to ClearToNull.
80+
.. seealso:: clearMode()
81+
.. versionadded:: 3.0
82+
%End
5683

57-
/** Sets the string representation for null values in the widget. This does not
58-
* affect the values returned for null values by value(), rather it only affects
59-
* the text that is shown to users when the widget's value is null.
60-
* @param nullValue string to show when widget's value is null
61-
* @see nullValue()
62-
*/
6384
void setNullValue( const QString &nullValue );
85+
%Docstring
86+
Sets the string representation for null values in the widget. This does not
87+
affect the values returned for null values by value(), rather it only affects
88+
the text that is shown to users when the widget's value is null.
89+
\param nullValue string to show when widget's value is null
90+
.. seealso:: nullValue()
91+
%End
6492

65-
/** Returns the string used for representating null values in the widget.
66-
* @see setNullValue()
67-
* @see isNull()
68-
*/
6993
QString nullValue() const;
94+
%Docstring
95+
Returns the string used for representating null values in the widget.
96+
.. seealso:: setNullValue()
97+
.. seealso:: isNull()
98+
:rtype: str
99+
%End
70100

71-
/** Define if a search icon shall be shown on the left of the image
72-
* when no text is entered
73-
* @param visible set to false to hide the search icon
74-
* @note added in QGIS 3.0
75-
*/
76101
void setShowSearchIcon( bool visible );
102+
%Docstring
103+
Define if a search icon shall be shown on the left of the image
104+
when no text is entered
105+
\param visible set to false to hide the search icon
106+
.. versionadded:: 3.0
107+
%End
77108

78-
/** Returns if a search icon shall be shown on the left of the image
79-
* when no text is entered
80-
* @note added in QGIS 3.0
81-
*/
82109
bool showSearchIcon() const;
110+
%Docstring
111+
Returns if a search icon shall be shown on the left of the image
112+
when no text is entered
113+
.. versionadded:: 3.0
114+
:rtype: bool
115+
%End
83116

84-
/** Sets the default value for the widget. The default value is a value
85-
* which the widget will be reset to if it is cleared and the clearMode()
86-
* is equal to ClearToDefault.
87-
* @param defaultValue default value
88-
* @see defaultValue()
89-
* @see clearMode()
90-
* @note added in QGIS 3.0
91-
*/
92117
void setDefaultValue( const QString &defaultValue );
118+
%Docstring
119+
Sets the default value for the widget. The default value is a value
120+
which the widget will be reset to if it is cleared and the clearMode()
121+
is equal to ClearToDefault.
122+
\param defaultValue default value
123+
.. seealso:: defaultValue()
124+
.. seealso:: clearMode()
125+
.. versionadded:: 3.0
126+
%End
93127

94-
/** Returns the default value for the widget. The default value is a value
95-
* which the widget will be reset to if it is cleared and the clearMode()
96-
* is equal to ClearToDefault.
97-
* @see setDefaultValue()
98-
* @see clearMode()
99-
* @note added in QGIS 3.0
100-
*/
101128
QString defaultValue() const;
129+
%Docstring
130+
Returns the default value for the widget. The default value is a value
131+
which the widget will be reset to if it is cleared and the clearMode()
132+
is equal to ClearToDefault.
133+
.. seealso:: setDefaultValue()
134+
.. seealso:: clearMode()
135+
.. versionadded:: 3.0
136+
:rtype: str
137+
%End
102138

103-
/**
104-
* Sets the current text for the widget with support for handling null values.
105-
*
106-
* @param value The text to set. If a null string is provided, the text shown in the
107-
* widget will be set to the current nullValue().
108-
* @see value()
109-
*/
110139
void setValue( const QString &value );
140+
%Docstring
141+
Sets the current text for the widget with support for handling null values.
142+
143+
\param value The text to set. If a null string is provided, the text shown in the
144+
widget will be set to the current nullValue().
145+
.. seealso:: value()
146+
%End
111147

112-
/**
113-
* Returns the text of this edit with support for handling null values. If the text
114-
* in the widget matches the current nullValue() then the returned value will be
115-
* a null string.
116-
*
117-
* @return Current text (or null string if it matches the nullValue() property )
118-
* @see setValue()
119-
*/
120148
QString value() const;
149+
%Docstring
150+
Returns the text of this edit with support for handling null values. If the text
151+
in the widget matches the current nullValue() then the returned value will be
152+
a null string.
153+
154+
:return: Current text (or null string if it matches the nullValue() property )
155+
.. seealso:: setValue()
156+
:rtype: str
157+
%End
121158

122-
/**
123-
* Determine if the current text represents null.
124-
*
125-
* @return True if the widget's value is null.
126-
* @see nullValue()
127-
*/
128159
bool isNull() const;
160+
%Docstring
161+
Determine if the current text represents null.
162+
163+
:return: True if the widget's value is null.
164+
.. seealso:: nullValue()
165+
:rtype: bool
166+
%End
129167

130168
public slots:
131169

132-
/** Clears the widget and resets it to the null value.
133-
* @see nullValue()
134-
* @note added in QGIS 3.0
135-
*/
136170
virtual void clearValue();
171+
%Docstring
172+
Clears the widget and resets it to the null value.
173+
.. seealso:: nullValue()
174+
.. versionadded:: 3.0
175+
%End
137176

138177
signals:
139178

140-
/** Emitted when the widget is cleared
141-
* @see clearValue()
142-
*/
143179
void cleared();
180+
%Docstring
181+
Emitted when the widget is cleared
182+
.. seealso:: clearValue()
183+
%End
144184

145-
/**
146-
* Same as textChanged() but with support for null values.
147-
*
148-
* @param value The current text or null string if it matches the nullValue() property.
149-
*/
150185
void valueChanged( const QString &value );
186+
%Docstring
187+
Same as textChanged() but with support for null values.
188+
189+
\param value The current text or null string if it matches the nullValue() property.
190+
%End
151191

152192
protected:
153-
void mousePressEvent( QMouseEvent *e );
154-
void mouseMoveEvent( QMouseEvent *e );
155-
void focusInEvent( QFocusEvent *e );
156-
void paintEvent( QPaintEvent *e );
157-
void leaveEvent( QEvent *e );
193+
virtual void mousePressEvent( QMouseEvent *e );
194+
195+
virtual void mouseMoveEvent( QMouseEvent *e );
196+
197+
virtual void focusInEvent( QFocusEvent *e );
198+
199+
virtual void paintEvent( QPaintEvent *e );
200+
201+
virtual void leaveEvent( QEvent *e );
202+
203+
158204
};
205+
206+
207+
208+
/************************************************************************
209+
* This file has been generated automatically from *
210+
* *
211+
* src/gui/qgsfilterlineedit.h *
212+
* *
213+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
214+
************************************************************************/
Lines changed: 93 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,128 @@
1-
/***************************************************************************
2-
qgsrelationeditorwidget.sip
3-
--------------------------------------
4-
Date : 28.11.2015
5-
Copyright : (C) 2015 Matthias Kuhn
6-
Email : matthias at opengis dot ch
7-
***************************************************************************
8-
* *
9-
* This program is free software; you can redistribute it and/or modify *
10-
* it under the terms of the GNU General Public License as published by *
11-
* the Free Software Foundation; either version 2 of the License, or *
12-
* (at your option) any later version. *
13-
* *
14-
***************************************************************************/
15-
16-
%ModuleCode
17-
#include "qgsrelationeditorwidget.h"
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsrelationeditorwidget.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
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 <qgsrelationeditorwidget.h>
1818
%End
1919

2020
class QgsRelationEditorWidget : QgsCollapsibleGroupBox
2121
{
22+
2223
%TypeHeaderCode
23-
#include <qgsrelationeditorwidget.h>
24+
#include "qgsrelationeditorwidget.h"
2425
%End
2526

26-
2727
%ConvertToSubClassCode
28-
if ( qobject_cast<QgsRelationEditorWidget*>( sipCpp ) )
29-
sipType = sipType_QgsRelationEditorWidget;
30-
else
31-
sipType = 0;
28+
if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) )
29+
sipType = sipType_QgsRelationEditorWidget;
30+
else
31+
sipType = NULL;
3232
%End
33-
3433
public:
35-
/**
36-
* @param parent parent widget
37-
*/
38-
QgsRelationEditorWidget( QWidget *parent /TransferThis/= 0 );
3934

40-
//! Define the view mode for the dual view
35+
QgsRelationEditorWidget( QWidget *parent /TransferThis/ = 0 );
36+
%Docstring
37+
\param parent parent widget
38+
%End
39+
4140
void setViewMode( QgsDualView::ViewMode mode );
41+
%Docstring
42+
Define the view mode for the dual view
43+
%End
4244

43-
//! Get the view mode for the dual view
4445
QgsDualView::ViewMode viewMode();
46+
%Docstring
47+
Get the view mode for the dual view
48+
:rtype: QgsDualView.ViewMode
49+
%End
4550

4651
void setRelationFeature( const QgsRelation &relation, const QgsFeature &feature );
4752

48-
/**
49-
* Set the relation(s) for this widget
50-
* If only one relation is set, it will act as a simple 1:N relation widget
51-
* If both relations are set, it will act as an N:M relation widget
52-
* inserting and deleting entries on the intermediate table as required.
53-
*
54-
* @param relation Relation referencing the edited table
55-
* @param nmrelation Optional reference from the referencing table to a 3rd N:M table
56-
*/
5753
void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation );
54+
%Docstring
55+
Set the relation(s) for this widget
56+
If only one relation is set, it will act as a simple 1:N relation widget
57+
If both relations are set, it will act as an N:M relation widget
58+
inserting and deleting entries on the intermediate table as required.
59+
60+
\param relation Relation referencing the edited table
61+
\param nmrelation Optional reference from the referencing table to a 3rd N:M table
62+
%End
5863

5964
void setFeature( const QgsFeature &feature );
6065

6166
void setEditorContext( const QgsAttributeEditorContext &context );
6267

63-
/**
64-
* The feature selection manager is responsible for the selected features
65-
* which are currently being edited.
66-
*/
6768
QgsIFeatureSelectionManager *featureSelectionManager();
69+
%Docstring
70+
The feature selection manager is responsible for the selected features
71+
which are currently being edited.
72+
:rtype: QgsIFeatureSelectionManager
73+
%End
6874

69-
/**
70-
* Defines if a title label should be shown for this widget.
71-
*
72-
* @note Added in QGIS 2.18
73-
*/
7475
bool showLabel() const;
76+
%Docstring
77+
Defines if a title label should be shown for this widget.
78+
79+
.. versionadded:: 2.18
80+
:rtype: bool
81+
%End
7582

76-
/**
77-
* Defines if a title label should be shown for this widget.
78-
*
79-
* @note Added in QGIS 2.18
80-
*/
8183
void setShowLabel( bool showLabel );
84+
%Docstring
85+
Defines if a title label should be shown for this widget.
86+
87+
.. versionadded:: 2.18
88+
%End
8289

83-
/**
84-
* Determines if the "link feature" button should be shown
85-
*
86-
* @note Added in QGIS 2.18
87-
*/
8890
bool showLinkButton() const;
89-
/**
90-
* Determines if the "link feature" button should be shown
91-
*
92-
* @note Added in QGIS 2.18
93-
*/
91+
%Docstring
92+
Determines if the "link feature" button should be shown
93+
94+
.. versionadded:: 2.18
95+
:rtype: bool
96+
%End
97+
9498
void setShowLinkButton( bool showLinkButton );
99+
%Docstring
100+
Determines if the "link feature" button should be shown
101+
102+
.. versionadded:: 2.18
103+
%End
95104

96-
/**
97-
* Determines if the "unlink feature" button should be shown
98-
*
99-
* @note Added in QGIS 2.18
100-
*/
101105
bool showUnlinkButton() const;
102-
/**
103-
* Determines if the "unlink feature" button should be shown
104-
*
105-
* @note Added in QGIS 2.18
106-
*/
106+
%Docstring
107+
Determines if the "unlink feature" button should be shown
108+
109+
.. versionadded:: 2.18
110+
:rtype: bool
111+
%End
112+
107113
void setShowUnlinkButton( bool showUnlinkButton );
114+
%Docstring
115+
Determines if the "unlink feature" button should be shown
116+
117+
.. versionadded:: 2.18
118+
%End
119+
108120
};
121+
122+
/************************************************************************
123+
* This file has been generated automatically from *
124+
* *
125+
* src/gui/qgsrelationeditorwidget.h *
126+
* *
127+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
128+
************************************************************************/

‎scripts/sipify.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ sub remove_constructor_or_body {
9696
# https://regex101.com/r/ZaP3tC/3
9797
do {no warnings 'uninitialized';
9898
if ( $line =~ m/^(\s*)?(explicit )?(virtual )?(static |const )*(([\w:]+(<.*?>)?\s+(\*|&)?)?(~?\w+|operator.{1,2})\(([\w=()\/ ,&*<>."-]|::)*\)( (?:const|SIP_[A-Z_]*?))*)\s*((\s*[:,]\s+\w+\(.*\))*\s*\{.*\};?|(?!;))(\s*\/\/.*)?$/
99-
|| $line =~ m/SIP_SKIP\s*(?!;)\s*(\/\/.*)?$/ ){
99+
|| $line =~ m/SIP_SKIP\s*(?!;)\s*(\/\/.*)?$/
100+
|| $line =~ m/^\s*class.*SIP_SKIP/ ){
100101
dbg_info("remove constructor definition, function bodies, member initializing list");
101102
my $newline = "$1$2$3$4$5;";
102103
if ($line !~ m/{.*}(\s*SIP_\w+)*\s*(\/\/.*)?$/){

‎src/gui/editorwidgets/qgsdoublespinbox.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,34 @@
2222

2323
class QgsSpinBoxLineEdit;
2424

25+
26+
#ifdef SIP_RUN
27+
% ModuleHeaderCode
28+
// fix to allow compilation with sip that for some reason
29+
// doesn't add this include to the file where the code from
30+
// ConvertToSubClassCode goes.
31+
#include <qgsdoublespinbox.h>
32+
% End
33+
#endif
34+
35+
2536
/** \ingroup gui
2637
* \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
2738
* The clear value can be either the minimum or the maiximum value of the spin box or a custom value.
2839
* This value can then be handled by a special value text.
2940
*/
3041
class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox
3142
{
43+
44+
#ifdef SIP_RUN
45+
SIP_CONVERT_TO_SUBCLASS_CODE
46+
if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
47+
sipType = sipType_QgsDoubleSpinBox;
48+
else
49+
sipType = NULL;
50+
SIP_END
51+
#endif
52+
3253
Q_OBJECT
3354
Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton )
3455
Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue )

‎src/gui/editorwidgets/qgsrelationreferencewidget.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,30 @@ class QgsFeatureListModel;
4040
class QgsCollapsibleGroupBox;
4141
class QLabel;
4242

43+
#ifdef SIP_RUN
44+
% ModuleHeaderCode
45+
// fix to allow compilation with sip that for some reason
46+
// doesn't add this include to the file where the code from
47+
// ConvertToSubClassCode goes.
48+
#include <qgsrelationreferencewidget.h>
49+
% End
50+
#endif
51+
4352
/** \ingroup gui
4453
* \class QgsRelationReferenceWidget
4554
*/
4655
class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
4756
{
57+
58+
#ifdef SIP_RUN
59+
SIP_CONVERT_TO_SUBCLASS_CODE
60+
if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
61+
sipType = sipType_QgsRelationReferenceWidget;
62+
else
63+
sipType = NULL;
64+
SIP_END
65+
#endif
66+
4867
Q_OBJECT
4968
Q_PROPERTY( bool openFormButtonVisible READ openFormButtonVisible WRITE setOpenFormButtonVisible )
5069

‎src/gui/editorwidgets/qgsspinbox.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,34 @@
2222

2323
class QgsSpinBoxLineEdit;
2424

25+
26+
#ifdef SIP_RUN
27+
% ModuleHeaderCode
28+
// fix to allow compilation with sip 4.7 that for some reason
29+
// doesn't add this include to the file where the code from
30+
// ConvertToSubClassCode goes.
31+
#include <qgsspinbox.h>
32+
% End
33+
#endif
34+
35+
2536
/** \ingroup gui
2637
* \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
2738
* The clear value can be either the minimum or the maiximum value of the spin box or a custom value.
2839
* This value can then be handled by a special value text.
2940
*/
3041
class GUI_EXPORT QgsSpinBox : public QSpinBox
3142
{
43+
44+
#ifdef SIP_RUN
45+
SIP_CONVERT_TO_SUBCLASS_CODE
46+
if ( qobject_cast<QgsSpinBox *>( sipCpp ) )
47+
sipType = sipType_QgsSpinBox;
48+
else
49+
sipType = NULL;
50+
SIP_END
51+
#endif
52+
3253
Q_OBJECT
3354
Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton )
3455
Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue )

‎src/gui/qgscolorbutton.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ class QgsPanelWidget;
3434
*/
3535
class GUI_EXPORT QgsColorButton : public QToolButton
3636
{
37+
38+
#ifdef SIP_RUN
39+
SIP_CONVERT_TO_SUBCLASS_CODE
40+
if ( qobject_cast<QgsColorButton *>( sipCpp ) )
41+
sipType = sipType_QgsColorButton;
42+
else
43+
sipType = NULL;
44+
SIP_END
45+
#endif
46+
47+
3748
Q_OBJECT
3849
Q_ENUMS( Behavior )
3950
Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )

‎src/gui/qgsexternalresourcewidget.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,32 @@ class QgsPixmapLabel;
2828
#include "qgis.h"
2929

3030

31+
#ifdef SIP_RUN
32+
% ModuleHeaderCode
33+
// fix to allow compilation with sip that for some reason
34+
// doesn't add this include to the file where the code from
35+
// ConvertToSubClassCode goes.
36+
#include <qgsexternalresourcewidget.h>
37+
% End
38+
#endif
39+
40+
3141
/** \ingroup gui
3242
* Widget to display file path with a push button for an "open file" dialog
3343
* It can also be used to display a picture or a web page.
3444
**/
3545
class GUI_EXPORT QgsExternalResourceWidget : public QWidget
3646
{
3747

48+
#ifdef SIP_RUN
49+
SIP_CONVERT_TO_SUBCLASS_CODE
50+
if ( qobject_cast<QgsExternalResourceWidget *>( sipCpp ) )
51+
sipType = sipType_QgsExternalResourceWidget;
52+
else
53+
sipType = NULL;
54+
SIP_END
55+
#endif
56+
3857
Q_OBJECT
3958
Q_PROPERTY( bool fileWidgetVisible READ fileWidgetVisible WRITE setFileWidgetVisible )
4059
Q_PROPERTY( DocumentViewerContent documentViewerContent READ documentViewerContent WRITE setDocumentViewerContent )

‎src/gui/qgsfilewidget.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ class QgsFilterLineEdit;
3333
*/
3434
class GUI_EXPORT QgsFileWidget : public QWidget
3535
{
36+
37+
#ifdef SIP_RUN
38+
SIP_CONVERT_TO_SUBCLASS_CODE
39+
if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
40+
sipType = sipType_QgsFileWidget;
41+
else
42+
sipType = NULL;
43+
SIP_END
44+
#endif
45+
46+
3647
Q_OBJECT
3748
Q_PROPERTY( bool fileWidgetButtonVisible READ fileWidgetButtonVisible WRITE setFileWidgetButtonVisible )
3849
Q_PROPERTY( bool useLink READ useLink WRITE setUseLink )

‎src/gui/qgsfilterlineedit.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
class QToolButton;
2626

27+
2728
/** \class QgsFilterLineEdit
2829
* \ingroup gui
2930
* QLineEdit subclass with built in support for clearing the widget's value and
@@ -35,6 +36,16 @@ class QToolButton;
3536
**/
3637
class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
3738
{
39+
40+
#ifdef SIP_RUN
41+
SIP_CONVERT_TO_SUBCLASS_CODE
42+
if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
43+
sipType = sipType_QgsFilterLineEdit;
44+
else
45+
sipType = NULL;
46+
SIP_END
47+
#endif
48+
3849
Q_OBJECT
3950
Q_ENUMS( ClearMode )
4051
Q_PROPERTY( ClearMode clearMode READ clearMode WRITE setClearMode )
@@ -225,7 +236,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
225236
* of clicks, but override clearValue() and let Qgs(Double)SpinBox handle the clearing
226237
* themselves.
227238
*/
228-
class QgsSpinBoxLineEdit : public QgsFilterLineEdit
239+
class SIP_SKIP QgsSpinBoxLineEdit : public QgsFilterLineEdit
229240
{
230241
Q_OBJECT
231242

‎src/gui/qgsrelationeditorwidget.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,32 @@ class QgsGenericFeatureSelectionManager;
3232
class QgsVectorLayer;
3333
class QgsVectorLayerTools;
3434

35+
#ifdef SIP_RUN
36+
% ModuleHeaderCode
37+
// fix to allow compilation with sip that for some reason
38+
// doesn't add this include to the file where the code from
39+
// ConvertToSubClassCode goes.
40+
#include <qgsrelationeditorwidget.h>
41+
% End
42+
#endif
43+
3544
/** \ingroup gui
3645
* \class QgsRelationEditorWidget
3746
*/
3847
class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
3948
{
49+
50+
#ifdef SIP_RUN
51+
SIP_CONVERT_TO_SUBCLASS_CODE
52+
if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) )
53+
sipType = sipType_QgsRelationEditorWidget;
54+
else
55+
sipType = NULL;
56+
SIP_END
57+
#endif
58+
59+
60+
4061
Q_OBJECT
4162
Q_PROPERTY( QgsDualView::ViewMode viewMode READ viewMode WRITE setViewMode )
4263
Q_PROPERTY( bool showLabel READ showLabel WRITE setShowLabel )
@@ -46,7 +67,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
4667
/**
4768
* \param parent parent widget
4869
*/
49-
QgsRelationEditorWidget( QWidget *parent = nullptr );
70+
QgsRelationEditorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
5071

5172
//! Define the view mode for the dual view
5273
void setViewMode( QgsDualView::ViewMode mode );

0 commit comments

Comments
 (0)
Please sign in to comment.