[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
This commit is contained in:
Denis Rouzaud 2017-05-10 08:34:51 +02:00
parent 13c1318a5f
commit 97866f4a20
18 changed files with 472 additions and 188 deletions

View File

@ -282,7 +282,6 @@ gui/qgsfeatureselectiondlg.sip
gui/qgsfieldvalidator.sip gui/qgsfieldvalidator.sip
gui/qgsfieldvalueslineedit.sip gui/qgsfieldvalueslineedit.sip
gui/qgsfiledropedit.sip gui/qgsfiledropedit.sip
gui/qgsfilterlineedit.sip
gui/qgsfloatingwidget.sip gui/qgsfloatingwidget.sip
gui/qgsfocuswatcher.sip gui/qgsfocuswatcher.sip
gui/qgsformannotation.sip gui/qgsformannotation.sip
@ -346,7 +345,6 @@ gui/qgsquerybuilder.sip
gui/qgsrasterformatsaveoptionswidget.sip gui/qgsrasterformatsaveoptionswidget.sip
gui/qgsrasterlayersaveasdialog.sip gui/qgsrasterlayersaveasdialog.sip
gui/qgsrasterpyramidsoptionswidget.sip gui/qgsrasterpyramidsoptionswidget.sip
gui/qgsrelationeditorwidget.sip
gui/qgsrubberband.sip gui/qgsrubberband.sip
gui/qgsscalerangewidget.sip gui/qgsscalerangewidget.sip
gui/qgsscalevisibilitydialog.sip gui/qgsscalevisibilitydialog.sip

View File

@ -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 class QgsDoubleSpinBox : QDoubleSpinBox
{ {
%Docstring %Docstring
@ -19,6 +28,13 @@ class QgsDoubleSpinBox : QDoubleSpinBox
%TypeHeaderCode %TypeHeaderCode
#include "qgsdoublespinbox.h" #include "qgsdoublespinbox.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
sipType = sipType_QgsDoubleSpinBox;
else
sipType = NULL;
%End %End
public: public:

View File

@ -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 class QgsRelationReferenceWidget : QWidget
{ {
%TypeHeaderCode %TypeHeaderCode
#include "qgsrelationreferencewidget.h" #include "qgsrelationreferencewidget.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
sipType = sipType_QgsRelationReferenceWidget;
else
sipType = NULL;
%End %End
public: public:

View File

@ -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 class QgsSpinBox : QSpinBox
{ {
%Docstring %Docstring
@ -19,6 +28,13 @@ class QgsSpinBox : QSpinBox
%TypeHeaderCode %TypeHeaderCode
#include "qgsspinbox.h" #include "qgsspinbox.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsSpinBox *>( sipCpp ) )
sipType = sipType_QgsSpinBox;
else
sipType = NULL;
%End %End
public: public:

View File

@ -19,6 +19,13 @@ class QgsColorButton : QToolButton
%TypeHeaderCode %TypeHeaderCode
#include "qgscolorbutton.h" #include "qgscolorbutton.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsColorButton *>( sipCpp ) )
sipType = sipType_QgsColorButton;
else
sipType = NULL;
%End %End
public: public:

View File

@ -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 class QgsExternalResourceWidget : QWidget
{ {
%Docstring %Docstring
@ -21,6 +29,13 @@ class QgsExternalResourceWidget : QWidget
%TypeHeaderCode %TypeHeaderCode
#include "qgsexternalresourcewidget.h" #include "qgsexternalresourcewidget.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsExternalResourceWidget *>( sipCpp ) )
sipType = sipType_QgsExternalResourceWidget;
else
sipType = NULL;
%End %End
public: public:
enum DocumentViewerContent enum DocumentViewerContent

View File

@ -19,6 +19,13 @@ class QgsFileWidget : QWidget
%TypeHeaderCode %TypeHeaderCode
#include "qgsfilewidget.h" #include "qgsfilewidget.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
sipType = sipType_QgsFileWidget;
else
sipType = NULL;
%End %End
public: public:

View File

@ -1,158 +1,214 @@
/** \class QgsFilterLineEdit /************************************************************************
* \ingroup gui * This file has been generated automatically from *
* QLineEdit subclass with built in support for clearing the widget's value and * *
* handling custom null value representations. * src/gui/qgsfilterlineedit.h *
* * *
* When using QgsFilterLineEdit the value(), setValue() and clearValue() methods should be used * Do not edit manually ! Edit header and run scripts/sipify.pl again *
* instead of QLineEdit's text(), setText() and clear() methods, and the valueChanged() ************************************************************************/
* signal should be used instead of textChanged().
**/
class QgsFilterLineEdit : QLineEdit class QgsFilterLineEdit : QLineEdit
{ {
%Docstring
QLineEdit subclass with built in support for clearing the widget's value and
handling custom null value representations.
When using QgsFilterLineEdit the value(), setValue() and clearValue() methods should be used
instead of QLineEdit's text(), setText() and clear() methods, and the valueChanged()
signal should be used instead of textChanged().
*
%End
%TypeHeaderCode %TypeHeaderCode
#include <qgsfilterlineedit.h> #include "qgsfilterlineedit.h"
%End
%ConvertToSubClassCode
if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
sipType = sipType_QgsFilterLineEdit;
else
sipType = NULL;
%End %End
public: public:
//! Behavior when clearing value of widget
enum ClearMode enum ClearMode
{ {
ClearToNull, //!< Reset value to null ClearToNull,
ClearToDefault, //!< Reset value to default value (see defaultValue() ) ClearToDefault,
}; };
/** Constructor for QgsFilterLineEdit.
* @param parent parent widget
* @param nullValue string for representing null values
*/
QgsFilterLineEdit( QWidget *parent /TransferThis/ = 0, const QString &nullValue = QString::null ); QgsFilterLineEdit( QWidget *parent /TransferThis/ = 0, const QString &nullValue = QString::null );
%Docstring
Constructor for QgsFilterLineEdit.
\param parent parent widget
\param nullValue string for representing null values
%End
/** Returns true if the widget's clear button is visible.
* @see setShowClearButton()
* @note added in QGIS 3.0
*/
bool showClearButton() const; bool showClearButton() const;
%Docstring
Returns true if the widget's clear button is visible.
.. seealso:: setShowClearButton()
.. versionadded:: 3.0
:rtype: bool
%End
/** Sets whether the widget's clear button is visible.
* @param visible set to false to hide the clear button
* @see showClearButton()
* @note added in QGIS 3.0
*/
void setShowClearButton( bool visible ); void setShowClearButton( bool visible );
%Docstring
Sets whether the widget's clear button is visible.
\param visible set to false to hide the clear button
.. seealso:: showClearButton()
.. versionadded:: 3.0
%End
/** Returns the clear mode for the widget. The clear mode defines the behavior of the
* widget when its value is cleared. This defaults to ClearToNull.
* @see setClearMode()
* @note added in QGIS 3.0
*/
ClearMode clearMode() const; ClearMode clearMode() const;
%Docstring
Returns the clear mode for the widget. The clear mode defines the behavior of the
widget when its value is cleared. This defaults to ClearToNull.
.. seealso:: setClearMode()
.. versionadded:: 3.0
:rtype: ClearMode
%End
/** Sets the clear mode for the widget. The clear mode defines the behavior of the
* widget when its value is cleared. This defaults to ClearToNull.
* @see clearMode()
* @note added in QGIS 3.0
*/
void setClearMode( ClearMode mode ); void setClearMode( ClearMode mode );
%Docstring
Sets the clear mode for the widget. The clear mode defines the behavior of the
widget when its value is cleared. This defaults to ClearToNull.
.. seealso:: clearMode()
.. versionadded:: 3.0
%End
/** Sets the string representation for null values in the widget. This does not
* affect the values returned for null values by value(), rather it only affects
* the text that is shown to users when the widget's value is null.
* @param nullValue string to show when widget's value is null
* @see nullValue()
*/
void setNullValue( const QString &nullValue ); void setNullValue( const QString &nullValue );
%Docstring
Sets the string representation for null values in the widget. This does not
affect the values returned for null values by value(), rather it only affects
the text that is shown to users when the widget's value is null.
\param nullValue string to show when widget's value is null
.. seealso:: nullValue()
%End
/** Returns the string used for representating null values in the widget.
* @see setNullValue()
* @see isNull()
*/
QString nullValue() const; QString nullValue() const;
%Docstring
Returns the string used for representating null values in the widget.
.. seealso:: setNullValue()
.. seealso:: isNull()
:rtype: str
%End
/** Define if a search icon shall be shown on the left of the image
* when no text is entered
* @param visible set to false to hide the search icon
* @note added in QGIS 3.0
*/
void setShowSearchIcon( bool visible ); void setShowSearchIcon( bool visible );
%Docstring
Define if a search icon shall be shown on the left of the image
when no text is entered
\param visible set to false to hide the search icon
.. versionadded:: 3.0
%End
/** Returns if a search icon shall be shown on the left of the image
* when no text is entered
* @note added in QGIS 3.0
*/
bool showSearchIcon() const; bool showSearchIcon() const;
%Docstring
Returns if a search icon shall be shown on the left of the image
when no text is entered
.. versionadded:: 3.0
:rtype: bool
%End
/** Sets the default value for the widget. The default value is a value
* which the widget will be reset to if it is cleared and the clearMode()
* is equal to ClearToDefault.
* @param defaultValue default value
* @see defaultValue()
* @see clearMode()
* @note added in QGIS 3.0
*/
void setDefaultValue( const QString &defaultValue ); void setDefaultValue( const QString &defaultValue );
%Docstring
Sets the default value for the widget. The default value is a value
which the widget will be reset to if it is cleared and the clearMode()
is equal to ClearToDefault.
\param defaultValue default value
.. seealso:: defaultValue()
.. seealso:: clearMode()
.. versionadded:: 3.0
%End
/** Returns the default value for the widget. The default value is a value
* which the widget will be reset to if it is cleared and the clearMode()
* is equal to ClearToDefault.
* @see setDefaultValue()
* @see clearMode()
* @note added in QGIS 3.0
*/
QString defaultValue() const; QString defaultValue() const;
%Docstring
Returns the default value for the widget. The default value is a value
which the widget will be reset to if it is cleared and the clearMode()
is equal to ClearToDefault.
.. seealso:: setDefaultValue()
.. seealso:: clearMode()
.. versionadded:: 3.0
:rtype: str
%End
/**
* Sets the current text for the widget with support for handling null values.
*
* @param value The text to set. If a null string is provided, the text shown in the
* widget will be set to the current nullValue().
* @see value()
*/
void setValue( const QString &value ); void setValue( const QString &value );
%Docstring
Sets the current text for the widget with support for handling null values.
\param value The text to set. If a null string is provided, the text shown in the
widget will be set to the current nullValue().
.. seealso:: value()
%End
/**
* Returns the text of this edit with support for handling null values. If the text
* in the widget matches the current nullValue() then the returned value will be
* a null string.
*
* @return Current text (or null string if it matches the nullValue() property )
* @see setValue()
*/
QString value() const; QString value() const;
%Docstring
Returns the text of this edit with support for handling null values. If the text
in the widget matches the current nullValue() then the returned value will be
a null string.
:return: Current text (or null string if it matches the nullValue() property )
.. seealso:: setValue()
:rtype: str
%End
/**
* Determine if the current text represents null.
*
* @return True if the widget's value is null.
* @see nullValue()
*/
bool isNull() const; bool isNull() const;
%Docstring
Determine if the current text represents null.
:return: True if the widget's value is null.
.. seealso:: nullValue()
:rtype: bool
%End
public slots: public slots:
/** Clears the widget and resets it to the null value.
* @see nullValue()
* @note added in QGIS 3.0
*/
virtual void clearValue(); virtual void clearValue();
%Docstring
Clears the widget and resets it to the null value.
.. seealso:: nullValue()
.. versionadded:: 3.0
%End
signals: signals:
/** Emitted when the widget is cleared
* @see clearValue()
*/
void cleared(); void cleared();
%Docstring
Emitted when the widget is cleared
.. seealso:: clearValue()
%End
/**
* Same as textChanged() but with support for null values.
*
* @param value The current text or null string if it matches the nullValue() property.
*/
void valueChanged( const QString &value ); void valueChanged( const QString &value );
%Docstring
Same as textChanged() but with support for null values.
\param value The current text or null string if it matches the nullValue() property.
%End
protected: protected:
void mousePressEvent( QMouseEvent *e ); virtual void mousePressEvent( QMouseEvent *e );
void mouseMoveEvent( QMouseEvent *e );
void focusInEvent( QFocusEvent *e ); virtual void mouseMoveEvent( QMouseEvent *e );
void paintEvent( QPaintEvent *e );
void leaveEvent( QEvent *e ); virtual void focusInEvent( QFocusEvent *e );
virtual void paintEvent( QPaintEvent *e );
virtual void leaveEvent( QEvent *e );
}; };
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfilterlineedit.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,108 +1,128 @@
/*************************************************************************** /************************************************************************
qgsrelationeditorwidget.sip * This file has been generated automatically from *
--------------------------------------
Date : 28.11.2015
Copyright : (C) 2015 Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * src/gui/qgsrelationeditorwidget.h *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* * * *
***************************************************************************/ * Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
%ModuleCode
#include "qgsrelationeditorwidget.h"
%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 <qgsrelationeditorwidget.h>
%End %End
class QgsRelationEditorWidget : QgsCollapsibleGroupBox class QgsRelationEditorWidget : QgsCollapsibleGroupBox
{ {
%TypeHeaderCode
#include <qgsrelationeditorwidget.h>
%End
%TypeHeaderCode
#include "qgsrelationeditorwidget.h"
%End
%ConvertToSubClassCode %ConvertToSubClassCode
if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) ) if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) )
sipType = sipType_QgsRelationEditorWidget; sipType = sipType_QgsRelationEditorWidget;
else else
sipType = 0; sipType = NULL;
%End
public:
QgsRelationEditorWidget( QWidget *parent /TransferThis/ = 0 );
%Docstring
\param parent parent widget
%End %End
public:
/**
* @param parent parent widget
*/
QgsRelationEditorWidget( QWidget *parent /TransferThis/= 0 );
//! Define the view mode for the dual view
void setViewMode( QgsDualView::ViewMode mode ); void setViewMode( QgsDualView::ViewMode mode );
%Docstring
Define the view mode for the dual view
%End
//! Get the view mode for the dual view
QgsDualView::ViewMode viewMode(); QgsDualView::ViewMode viewMode();
%Docstring
Get the view mode for the dual view
:rtype: QgsDualView.ViewMode
%End
void setRelationFeature( const QgsRelation &relation, const QgsFeature &feature ); void setRelationFeature( const QgsRelation &relation, const QgsFeature &feature );
/**
* Set the relation(s) for this widget
* If only one relation is set, it will act as a simple 1:N relation widget
* If both relations are set, it will act as an N:M relation widget
* inserting and deleting entries on the intermediate table as required.
*
* @param relation Relation referencing the edited table
* @param nmrelation Optional reference from the referencing table to a 3rd N:M table
*/
void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation ); void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation );
%Docstring
Set the relation(s) for this widget
If only one relation is set, it will act as a simple 1:N relation widget
If both relations are set, it will act as an N:M relation widget
inserting and deleting entries on the intermediate table as required.
\param relation Relation referencing the edited table
\param nmrelation Optional reference from the referencing table to a 3rd N:M table
%End
void setFeature( const QgsFeature &feature ); void setFeature( const QgsFeature &feature );
void setEditorContext( const QgsAttributeEditorContext &context ); void setEditorContext( const QgsAttributeEditorContext &context );
/**
* The feature selection manager is responsible for the selected features
* which are currently being edited.
*/
QgsIFeatureSelectionManager *featureSelectionManager(); QgsIFeatureSelectionManager *featureSelectionManager();
%Docstring
The feature selection manager is responsible for the selected features
which are currently being edited.
:rtype: QgsIFeatureSelectionManager
%End
/**
* Defines if a title label should be shown for this widget.
*
* @note Added in QGIS 2.18
*/
bool showLabel() const; bool showLabel() const;
%Docstring
Defines if a title label should be shown for this widget.
.. versionadded:: 2.18
:rtype: bool
%End
/**
* Defines if a title label should be shown for this widget.
*
* @note Added in QGIS 2.18
*/
void setShowLabel( bool showLabel ); void setShowLabel( bool showLabel );
%Docstring
Defines if a title label should be shown for this widget.
.. versionadded:: 2.18
%End
/**
* Determines if the "link feature" button should be shown
*
* @note Added in QGIS 2.18
*/
bool showLinkButton() const; bool showLinkButton() const;
/** %Docstring
* Determines if the "link feature" button should be shown Determines if the "link feature" button should be shown
*
* @note Added in QGIS 2.18 .. versionadded:: 2.18
*/ :rtype: bool
void setShowLinkButton( bool showLinkButton ); %End
void setShowLinkButton( bool showLinkButton );
%Docstring
Determines if the "link feature" button should be shown
.. versionadded:: 2.18
%End
/**
* Determines if the "unlink feature" button should be shown
*
* @note Added in QGIS 2.18
*/
bool showUnlinkButton() const; bool showUnlinkButton() const;
/** %Docstring
* Determines if the "unlink feature" button should be shown Determines if the "unlink feature" button should be shown
*
* @note Added in QGIS 2.18 .. versionadded:: 2.18
*/ :rtype: bool
%End
void setShowUnlinkButton( bool showUnlinkButton ); void setShowUnlinkButton( bool showUnlinkButton );
%Docstring
Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18
%End
}; };
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrelationeditorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -96,7 +96,8 @@ sub remove_constructor_or_body {
# https://regex101.com/r/ZaP3tC/3 # https://regex101.com/r/ZaP3tC/3
do {no warnings 'uninitialized'; do {no warnings 'uninitialized';
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*\/\/.*)?$/ 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*\/\/.*)?$/
|| $line =~ m/SIP_SKIP\s*(?!;)\s*(\/\/.*)?$/ ){ || $line =~ m/SIP_SKIP\s*(?!;)\s*(\/\/.*)?$/
|| $line =~ m/^\s*class.*SIP_SKIP/ ){
dbg_info("remove constructor definition, function bodies, member initializing list"); dbg_info("remove constructor definition, function bodies, member initializing list");
my $newline = "$1$2$3$4$5;"; my $newline = "$1$2$3$4$5;";
if ($line !~ m/{.*}(\s*SIP_\w+)*\s*(\/\/.*)?$/){ if ($line !~ m/{.*}(\s*SIP_\w+)*\s*(\/\/.*)?$/){

View File

@ -22,6 +22,17 @@
class QgsSpinBoxLineEdit; class QgsSpinBoxLineEdit;
#ifdef SIP_RUN
% 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
#endif
/** \ingroup gui /** \ingroup gui
* \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value. * \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
* The clear value can be either the minimum or the maiximum value of the spin box or a custom value. * The clear value can be either the minimum or the maiximum value of the spin box or a custom value.
@ -29,6 +40,16 @@ class QgsSpinBoxLineEdit;
*/ */
class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
sipType = sipType_QgsDoubleSpinBox;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton ) Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton )
Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue ) Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue )

View File

@ -40,11 +40,30 @@ class QgsFeatureListModel;
class QgsCollapsibleGroupBox; class QgsCollapsibleGroupBox;
class QLabel; class QLabel;
#ifdef SIP_RUN
% 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
#endif
/** \ingroup gui /** \ingroup gui
* \class QgsRelationReferenceWidget * \class QgsRelationReferenceWidget
*/ */
class GUI_EXPORT QgsRelationReferenceWidget : public QWidget class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsRelationReferenceWidget *>( sipCpp ) )
sipType = sipType_QgsRelationReferenceWidget;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( bool openFormButtonVisible READ openFormButtonVisible WRITE setOpenFormButtonVisible ) Q_PROPERTY( bool openFormButtonVisible READ openFormButtonVisible WRITE setOpenFormButtonVisible )

View File

@ -22,6 +22,17 @@
class QgsSpinBoxLineEdit; class QgsSpinBoxLineEdit;
#ifdef SIP_RUN
% 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
#endif
/** \ingroup gui /** \ingroup gui
* \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value. * \brief The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
* The clear value can be either the minimum or the maiximum value of the spin box or a custom value. * The clear value can be either the minimum or the maiximum value of the spin box or a custom value.
@ -29,6 +40,16 @@ class QgsSpinBoxLineEdit;
*/ */
class GUI_EXPORT QgsSpinBox : public QSpinBox class GUI_EXPORT QgsSpinBox : public QSpinBox
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsSpinBox *>( sipCpp ) )
sipType = sipType_QgsSpinBox;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton ) Q_PROPERTY( bool showClearButton READ showClearButton WRITE setShowClearButton )
Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue ) Q_PROPERTY( bool clearValue READ clearValue WRITE setClearValue )

View File

@ -34,6 +34,17 @@ class QgsPanelWidget;
*/ */
class GUI_EXPORT QgsColorButton : public QToolButton class GUI_EXPORT QgsColorButton : public QToolButton
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsColorButton *>( sipCpp ) )
sipType = sipType_QgsColorButton;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_ENUMS( Behavior ) Q_ENUMS( Behavior )
Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle ) Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )

View File

@ -28,6 +28,16 @@ class QgsPixmapLabel;
#include "qgis.h" #include "qgis.h"
#ifdef SIP_RUN
% 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
#endif
/** \ingroup gui /** \ingroup gui
* Widget to display file path with a push button for an "open file" dialog * Widget to display file path with a push button for an "open file" dialog
* It can also be used to display a picture or a web page. * It can also be used to display a picture or a web page.
@ -35,6 +45,15 @@ class QgsPixmapLabel;
class GUI_EXPORT QgsExternalResourceWidget : public QWidget class GUI_EXPORT QgsExternalResourceWidget : public QWidget
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsExternalResourceWidget *>( sipCpp ) )
sipType = sipType_QgsExternalResourceWidget;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( bool fileWidgetVisible READ fileWidgetVisible WRITE setFileWidgetVisible ) Q_PROPERTY( bool fileWidgetVisible READ fileWidgetVisible WRITE setFileWidgetVisible )
Q_PROPERTY( DocumentViewerContent documentViewerContent READ documentViewerContent WRITE setDocumentViewerContent ) Q_PROPERTY( DocumentViewerContent documentViewerContent READ documentViewerContent WRITE setDocumentViewerContent )

View File

@ -33,6 +33,17 @@ class QgsFilterLineEdit;
*/ */
class GUI_EXPORT QgsFileWidget : public QWidget class GUI_EXPORT QgsFileWidget : public QWidget
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
sipType = sipType_QgsFileWidget;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( bool fileWidgetButtonVisible READ fileWidgetButtonVisible WRITE setFileWidgetButtonVisible ) Q_PROPERTY( bool fileWidgetButtonVisible READ fileWidgetButtonVisible WRITE setFileWidgetButtonVisible )
Q_PROPERTY( bool useLink READ useLink WRITE setUseLink ) Q_PROPERTY( bool useLink READ useLink WRITE setUseLink )

View File

@ -24,6 +24,7 @@
class QToolButton; class QToolButton;
/** \class QgsFilterLineEdit /** \class QgsFilterLineEdit
* \ingroup gui * \ingroup gui
* QLineEdit subclass with built in support for clearing the widget's value and * QLineEdit subclass with built in support for clearing the widget's value and
@ -35,6 +36,16 @@ class QToolButton;
**/ **/
class GUI_EXPORT QgsFilterLineEdit : public QLineEdit class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
sipType = sipType_QgsFilterLineEdit;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_ENUMS( ClearMode ) Q_ENUMS( ClearMode )
Q_PROPERTY( ClearMode clearMode READ clearMode WRITE setClearMode ) Q_PROPERTY( ClearMode clearMode READ clearMode WRITE setClearMode )
@ -225,7 +236,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
* of clicks, but override clearValue() and let Qgs(Double)SpinBox handle the clearing * of clicks, but override clearValue() and let Qgs(Double)SpinBox handle the clearing
* themselves. * themselves.
*/ */
class QgsSpinBoxLineEdit : public QgsFilterLineEdit class SIP_SKIP QgsSpinBoxLineEdit : public QgsFilterLineEdit
{ {
Q_OBJECT Q_OBJECT

View File

@ -32,11 +32,32 @@ class QgsGenericFeatureSelectionManager;
class QgsVectorLayer; class QgsVectorLayer;
class QgsVectorLayerTools; class QgsVectorLayerTools;
#ifdef SIP_RUN
% 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 <qgsrelationeditorwidget.h>
% End
#endif
/** \ingroup gui /** \ingroup gui
* \class QgsRelationEditorWidget * \class QgsRelationEditorWidget
*/ */
class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
{ {
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( qobject_cast<QgsRelationEditorWidget *>( sipCpp ) )
sipType = sipType_QgsRelationEditorWidget;
else
sipType = NULL;
SIP_END
#endif
Q_OBJECT Q_OBJECT
Q_PROPERTY( QgsDualView::ViewMode viewMode READ viewMode WRITE setViewMode ) Q_PROPERTY( QgsDualView::ViewMode viewMode READ viewMode WRITE setViewMode )
Q_PROPERTY( bool showLabel READ showLabel WRITE setShowLabel ) Q_PROPERTY( bool showLabel READ showLabel WRITE setShowLabel )
@ -46,7 +67,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
/** /**
* \param parent parent widget * \param parent parent widget
*/ */
QgsRelationEditorWidget( QWidget *parent = nullptr ); QgsRelationEditorWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
//! Define the view mode for the dual view //! Define the view mode for the dual view
void setViewMode( QgsDualView::ViewMode mode ); void setViewMode( QgsDualView::ViewMode mode );