From bd4f7126e166eeb0b51c75adc84a2d3278b6a4ef Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Wed, 19 Apr 2017 11:31:23 +0200 Subject: [PATCH] sipify QgsMapLayerCombobox, QgsFieldCombobox --- python/auto_sip.blacklist | 2 - python/gui/qgsfieldcombobox.sip | 116 +++++++++++------ python/gui/qgsmaplayercombobox.sip | 192 ++++++++++++++++++----------- src/gui/qgsfieldcombobox.h | 4 +- src/gui/qgsmaplayercombobox.h | 4 +- 5 files changed, 200 insertions(+), 118 deletions(-) diff --git a/python/auto_sip.blacklist b/python/auto_sip.blacklist index f4f3d9bab62..667d1796a32 100644 --- a/python/auto_sip.blacklist +++ b/python/auto_sip.blacklist @@ -361,7 +361,6 @@ gui/qgsexpressionlineedit.sip gui/qgsexpressionselectiondialog.sip gui/qgsextentgroupbox.sip gui/qgsfeatureselectiondlg.sip -gui/qgsfieldcombobox.sip gui/qgsfieldmodel.sip gui/qgsfieldproxymodel.sip gui/qgsfieldvalidator.sip @@ -393,7 +392,6 @@ gui/qgsmapcanvasitem.sip gui/qgsmapcanvassnappingutils.sip gui/qgsmapcanvastracer.sip gui/qgsmaplayeractionregistry.sip -gui/qgsmaplayercombobox.sip gui/qgsmaplayerconfigwidget.sip gui/qgsmaplayerconfigwidgetfactory.sip gui/qgsmapmouseevent.sip diff --git a/python/gui/qgsfieldcombobox.sip b/python/gui/qgsfieldcombobox.sip index 195168a6a16..8345acce096 100644 --- a/python/gui/qgsfieldcombobox.sip +++ b/python/gui/qgsfieldcombobox.sip @@ -1,69 +1,105 @@ -/** - * @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer. - * It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer. - * If expression must be used, QgsFieldExpressionWidget shall be used instead. - * @see QgsMapLayerComboBox - * @note added in 2.3 - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/gui/qgsfieldcombobox.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + + class QgsFieldComboBox : QComboBox { +%Docstring + The QgsFieldComboBox is a combo box which displays the list of fields of a given layer. + It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer. + If expression must be used, QgsFieldExpressionWidget shall be used instead. + \see QgsMapLayerComboBox +.. versionadded:: 2.3 +%End %TypeHeaderCode #include "qgsfieldcombobox.h" %End - public: - /** - * @brief QgsFieldComboBox creates a combo box to display the fields of a layer. - * The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer. - */ + explicit QgsFieldComboBox( QWidget *parent /TransferThis/ = 0 ); +%Docstring + QgsFieldComboBox creates a combo box to display the fields of a layer. + The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox.layerChanged to the slot setLayer. +%End - //! setFilters allows fitering according to the type of field void setFilters( QgsFieldProxyModel::Filters filters ); +%Docstring +setFilters allows fitering according to the type of field +%End - //! currently used filter on list of fields QgsFieldProxyModel::Filters filters() const; +%Docstring +currently used filter on list of fields + :rtype: QgsFieldProxyModel.Filters +%End - /** - * Sets whether an optional empty field ("not set") option is shown in the combo box. - * @see allowEmptyFieldName() - * @note added in QGIS 3.0 - */ void setAllowEmptyFieldName( bool allowEmpty ); +%Docstring + Sets whether an optional empty field ("not set") option is shown in the combo box. + \see allowEmptyFieldName() +.. versionadded:: 3.0 +%End - /** - * Returns true if the combo box allows the empty field ("not set") choice. - * @see setAllowEmptyFieldName() - * @note added in QGIS 3.0 - */ bool allowEmptyFieldName() const; +%Docstring + Returns true if the combo box allows the empty field ("not set") choice. + \see setAllowEmptyFieldName() +.. versionadded:: 3.0 + :rtype: bool +%End - //! return the currently selected field QString currentField() const; +%Docstring +return the currently selected field + :rtype: str +%End - /** - * Returns the layer currently associated with the combobox. - * @see setLayer() - */ - QgsVectorLayer* layer() const; + QgsVectorLayer *layer() const; +%Docstring + Returns the layer currently associated with the combobox. + \see setLayer() + :rtype: QgsVectorLayer +%End signals: - //! the signal is emitted when the currently selected field changes - void fieldChanged( const QString& fieldName ); + void fieldChanged( const QString &fieldName ); +%Docstring +the signal is emitted when the currently selected field changes +%End public slots: - /** - * Sets the layer for which fields are listed in the combobox. If no layer is set - * or a non-vector layer is set then the combobox will be empty. - * @see layer() - */ - void setLayer( QgsMapLayer* layer ); + void setLayer( QgsMapLayer *layer ); +%Docstring + Sets the layer for which fields are listed in the combobox. If no layer is set + or a non-vector layer is set then the combobox will be empty. + \see layer() +%End - //! setField sets the currently selected field - void setField( const QString& fieldName ); + void setField( const QString &fieldName ); +%Docstring +setField sets the currently selected field +%End protected slots: void indexChanged( int i ); + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/gui/qgsfieldcombobox.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/gui/qgsmaplayercombobox.sip b/python/gui/qgsmaplayercombobox.sip index 745e06108e1..88bade4f0f6 100644 --- a/python/gui/qgsmaplayercombobox.sip +++ b/python/gui/qgsmaplayercombobox.sip @@ -1,112 +1,156 @@ -/** - * @brief The QgsMapLayerComboBox class is a combo box which displays the list of layers - * @note added in 2.3 - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/gui/qgsmaplayercombobox.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + + class QgsMapLayerComboBox : QComboBox { +%Docstring + The QgsMapLayerComboBox class is a combo box which displays the list of layers +.. versionadded:: 2.3 +%End %TypeHeaderCode #include "qgsmaplayercombobox.h" %End - public: - /** - * @brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry). - * The layers can be filtered and/or ordered. - */ + explicit QgsMapLayerComboBox( QWidget *parent /TransferThis/ = 0 ); +%Docstring + QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry). + The layers can be filtered and/or ordered. +%End - //! setFilters allows fitering according to layer type and/or geometry type. - void setFilters( const QgsMapLayerProxyModel::Filters& filters ); + void setFilters( QgsMapLayerProxyModel::Filters filters ); +%Docstring +setFilters allows fitering according to layer type and/or geometry type. +%End - //! currently used filter on list layers QgsMapLayerProxyModel::Filters filters() const; +%Docstring +currently used filter on list layers + :rtype: QgsMapLayerProxyModel.Filters +%End - //! except a list of layers not to be listed - void setExceptedLayerList( const QList& layerList ); + void setExceptedLayerList( const QList &layerList ); +%Docstring +except a list of layers not to be listed +%End - //! returns the list of excepted layers - QList exceptedLayerList() const; + QList exceptedLayerList() const; +%Docstring +returns the list of excepted layers + :rtype: list of QgsMapLayer +%End - /** - * Sets a list of data providers which should be excluded from the combobox. - * @note added in QGIS 3.0 - * @see excludedProviders() - */ - void setExcludedProviders( const QStringList& providers ); + void setExcludedProviders( const QStringList &providers ); +%Docstring + Sets a list of data providers which should be excluded from the combobox. +.. versionadded:: 3.0 + \see excludedProviders() +%End - /** - * Returns the list of data providers which are excluded from the combobox. - * @see setExcludedProviders() - * @note added in QGIS 3.0 - */ QStringList excludedProviders() const; +%Docstring + Returns the list of data providers which are excluded from the combobox. + \see setExcludedProviders() +.. versionadded:: 3.0 + :rtype: list of str +%End - /** - * Sets whether an optional empty layer ("not set") option is shown in the combo box. - * @see allowEmptyLayer() - * @note added in QGIS 3.0 - */ void setAllowEmptyLayer( bool allowEmpty ); +%Docstring + Sets whether an optional empty layer ("not set") option is shown in the combo box. + \see allowEmptyLayer() +.. versionadded:: 3.0 +%End - /** - * Returns true if the combo box allows the empty layer ("not set") choice. - * @see setAllowEmptyLayer() - * @note added in QGIS 3.0 - */ bool allowEmptyLayer() const; +%Docstring + Returns true if the combo box allows the empty layer ("not set") choice. + \see setAllowEmptyLayer() +.. versionadded:: 3.0 + :rtype: bool +%End - /** - * Sets whether the CRS of layers is also included in the combo box text. - * @see showCrs() - * @note added in QGIS 3.0 - */ void setShowCrs( bool showCrs ); +%Docstring + Sets whether the CRS of layers is also included in the combo box text. + \see showCrs() +.. versionadded:: 3.0 +%End - /** - * Returns true if the combo box shows the layer's CRS. - * @see setShowCrs() - * @note added in QGIS 3.0 - */ bool showCrs() const; +%Docstring + Returns true if the combo box shows the layer's CRS. + \see setShowCrs() +.. versionadded:: 3.0 + :rtype: bool +%End - /** - * Sets a list of additional (non map layer) items to include at the end of the combobox. - * These may represent additional layers such as layers which are not included in the map - * layer registry, or paths to layers which have not yet been loaded into QGIS. - * @see additionalItems() - * @note added in QGIS 3.0 - */ - void setAdditionalItems( const QStringList& items ); + void setAdditionalItems( const QStringList &items ); +%Docstring + Sets a list of additional (non map layer) items to include at the end of the combobox. + These may represent additional layers such as layers which are not included in the map + layer registry, or paths to layers which have not yet been loaded into QGIS. + \see additionalItems() +.. versionadded:: 3.0 +%End - /** - * Return the list of additional (non map layer) items included at the end of the combo box. - * @see setAdditionalItems() - * @note added in QGIS 3.0 - */ QStringList additionalItems() const; +%Docstring + Return the list of additional (non map layer) items included at the end of the combo box. + \see setAdditionalItems() +.. versionadded:: 3.0 + :rtype: list of str +%End - /** Returns the current layer selected in the combo box. - * @see layer - */ - QgsMapLayer* currentLayer() const; + QgsMapLayer *currentLayer() const; +%Docstring + Returns the current layer selected in the combo box. + \see layer + :rtype: QgsMapLayer +%End - /** Return the layer currently shown at the specified index within the combo box. - * @param layerIndex position of layer to return - * @note added in QGIS 2.10 - * @see currentLayer - */ - QgsMapLayer* layer( int layerIndex ) const; + QgsMapLayer *layer( int layerIndex ) const; +%Docstring + Return the layer currently shown at the specified index within the combo box. + \param layerIndex position of layer to return +.. versionadded:: 2.10 + \see currentLayer + :rtype: QgsMapLayer +%End public slots: - //! setLayer set the current layer selected in the combo - void setLayer( QgsMapLayer* layer ); + void setLayer( QgsMapLayer *layer ); +%Docstring +setLayer set the current layer selected in the combo +%End signals: - //! layerChanged this signal is emitted whenever the currently selected layer changes - void layerChanged( QgsMapLayer* layer ); + void layerChanged( QgsMapLayer *layer ); +%Docstring +layerChanged this signal is emitted whenever the currently selected layer changes +%End protected slots: void indexChanged( int i ); void rowsChanged(); + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/gui/qgsmaplayercombobox.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/src/gui/qgsfieldcombobox.h b/src/gui/qgsfieldcombobox.h index 981a1613294..d53b1c6dd71 100644 --- a/src/gui/qgsfieldcombobox.h +++ b/src/gui/qgsfieldcombobox.h @@ -21,6 +21,8 @@ #include "qgsfieldproxymodel.h" #include "qgis_gui.h" +#include "qgis.h" + class QgsMapLayer; class QgsVectorLayer; @@ -44,7 +46,7 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox * \brief QgsFieldComboBox creates a combo box to display the fields of a layer. * The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer. */ - explicit QgsFieldComboBox( QWidget *parent = nullptr ); + explicit QgsFieldComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr ); //! setFilters allows fitering according to the type of field void setFilters( QgsFieldProxyModel::Filters filters ); diff --git a/src/gui/qgsmaplayercombobox.h b/src/gui/qgsmaplayercombobox.h index 7784da5d738..bb8a0ae22d6 100644 --- a/src/gui/qgsmaplayercombobox.h +++ b/src/gui/qgsmaplayercombobox.h @@ -21,6 +21,8 @@ #include "qgsmaplayerproxymodel.h" #include "qgis_gui.h" +#include "qgis.h" + class QgsMapLayer; class QgsVectorLayer; @@ -43,7 +45,7 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox * \brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry). * The layers can be filtered and/or ordered. */ - explicit QgsMapLayerComboBox( QWidget *parent = nullptr ); + explicit QgsMapLayerComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr ); //! setFilters allows fitering according to layer type and/or geometry type. void setFilters( QgsMapLayerProxyModel::Filters filters ) { mProxyModel->setFilters( filters ); }