sipify QgsMapLayerCombobox, QgsFieldCombobox

This commit is contained in:
Denis Rouzaud 2017-04-19 11:31:23 +02:00
parent 7552d1cc64
commit bd4f7126e1
5 changed files with 200 additions and 118 deletions

View File

@ -361,7 +361,6 @@ gui/qgsexpressionlineedit.sip
gui/qgsexpressionselectiondialog.sip gui/qgsexpressionselectiondialog.sip
gui/qgsextentgroupbox.sip gui/qgsextentgroupbox.sip
gui/qgsfeatureselectiondlg.sip gui/qgsfeatureselectiondlg.sip
gui/qgsfieldcombobox.sip
gui/qgsfieldmodel.sip gui/qgsfieldmodel.sip
gui/qgsfieldproxymodel.sip gui/qgsfieldproxymodel.sip
gui/qgsfieldvalidator.sip gui/qgsfieldvalidator.sip
@ -393,7 +392,6 @@ gui/qgsmapcanvasitem.sip
gui/qgsmapcanvassnappingutils.sip gui/qgsmapcanvassnappingutils.sip
gui/qgsmapcanvastracer.sip gui/qgsmapcanvastracer.sip
gui/qgsmaplayeractionregistry.sip gui/qgsmaplayeractionregistry.sip
gui/qgsmaplayercombobox.sip
gui/qgsmaplayerconfigwidget.sip gui/qgsmaplayerconfigwidget.sip
gui/qgsmaplayerconfigwidgetfactory.sip gui/qgsmaplayerconfigwidgetfactory.sip
gui/qgsmapmouseevent.sip gui/qgsmapmouseevent.sip

View File

@ -1,69 +1,105 @@
/** /************************************************************************
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer. * This file has been generated automatically from *
* 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. * src/gui/qgsfieldcombobox.h *
* @see QgsMapLayerComboBox * *
* @note added in 2.3 * Do not edit manually ! Edit header and run scripts/sipify.pl again *
*/ ************************************************************************/
class QgsFieldComboBox : QComboBox 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 %TypeHeaderCode
#include "qgsfieldcombobox.h" #include "qgsfieldcombobox.h"
%End %End
public: 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 ); 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 ); 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; 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 ); 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; 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; QString currentField() const;
%Docstring
return the currently selected field
:rtype: str
%End
/** QgsVectorLayer *layer() const;
* Returns the layer currently associated with the combobox. %Docstring
* @see setLayer() Returns the layer currently associated with the combobox.
*/ \see setLayer()
QgsVectorLayer* layer() const; :rtype: QgsVectorLayer
%End
signals: 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: public slots:
/** void setLayer( QgsMapLayer *layer );
* Sets the layer for which fields are listed in the combobox. If no layer is set %Docstring
* or a non-vector layer is set then the combobox will be empty. Sets the layer for which fields are listed in the combobox. If no layer is set
* @see layer() or a non-vector layer is set then the combobox will be empty.
*/ \see layer()
void setLayer( QgsMapLayer* 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: protected slots:
void indexChanged( int i ); 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 *
************************************************************************/

View File

@ -1,112 +1,156 @@
/** /************************************************************************
* @brief The QgsMapLayerComboBox class is a combo box which displays the list of layers * This file has been generated automatically from *
* @note added in 2.3 * *
*/ * src/gui/qgsmaplayercombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapLayerComboBox : QComboBox class QgsMapLayerComboBox : QComboBox
{ {
%Docstring
The QgsMapLayerComboBox class is a combo box which displays the list of layers
.. versionadded:: 2.3
%End
%TypeHeaderCode %TypeHeaderCode
#include "qgsmaplayercombobox.h" #include "qgsmaplayercombobox.h"
%End %End
public: 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 ); 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( QgsMapLayerProxyModel::Filters filters );
void setFilters( const 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; 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<QgsMapLayer *> &layerList );
void setExceptedLayerList( const QList<QgsMapLayer*>& layerList ); %Docstring
except a list of layers not to be listed
%End
//! returns the list of excepted layers QList<QgsMapLayer *> exceptedLayerList() const;
QList<QgsMapLayer*> exceptedLayerList() const; %Docstring
returns the list of excepted layers
:rtype: list of QgsMapLayer
%End
/** void setExcludedProviders( const QStringList &providers );
* Sets a list of data providers which should be excluded from the combobox. %Docstring
* @note added in QGIS 3.0 Sets a list of data providers which should be excluded from the combobox.
* @see excludedProviders() .. versionadded:: 3.0
*/ \see excludedProviders()
void setExcludedProviders( const QStringList& providers ); %End
/**
* Returns the list of data providers which are excluded from the combobox.
* @see setExcludedProviders()
* @note added in QGIS 3.0
*/
QStringList excludedProviders() const; 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 ); 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; 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 ); 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; bool showCrs() const;
%Docstring
Returns true if the combo box shows the layer's CRS.
\see setShowCrs()
.. versionadded:: 3.0
:rtype: bool
%End
/** void setAdditionalItems( const QStringList &items );
* Sets a list of additional (non map layer) items to include at the end of the combobox. %Docstring
* These may represent additional layers such as layers which are not included in the map Sets a list of additional (non map layer) items to include at the end of the combobox.
* layer registry, or paths to layers which have not yet been loaded into QGIS. These may represent additional layers such as layers which are not included in the map
* @see additionalItems() layer registry, or paths to layers which have not yet been loaded into QGIS.
* @note added in QGIS 3.0 \see additionalItems()
*/ .. versionadded:: 3.0
void setAdditionalItems( const QStringList& items ); %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; 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. QgsMapLayer *currentLayer() const;
* @see layer %Docstring
*/ Returns the current layer selected in the combo box.
QgsMapLayer* currentLayer() const; \see layer
:rtype: QgsMapLayer
%End
/** Return the layer currently shown at the specified index within the combo box. QgsMapLayer *layer( int layerIndex ) const;
* @param layerIndex position of layer to return %Docstring
* @note added in QGIS 2.10 Return the layer currently shown at the specified index within the combo box.
* @see currentLayer \param layerIndex position of layer to return
*/ .. versionadded:: 2.10
QgsMapLayer* layer( int layerIndex ) const; \see currentLayer
:rtype: QgsMapLayer
%End
public slots: 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: 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: protected slots:
void indexChanged( int i ); void indexChanged( int i );
void rowsChanged(); 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 *
************************************************************************/

View File

@ -21,6 +21,8 @@
#include "qgsfieldproxymodel.h" #include "qgsfieldproxymodel.h"
#include "qgis_gui.h" #include "qgis_gui.h"
#include "qgis.h"
class QgsMapLayer; class QgsMapLayer;
class QgsVectorLayer; 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. * \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. * 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 //! setFilters allows fitering according to the type of field
void setFilters( QgsFieldProxyModel::Filters filters ); void setFilters( QgsFieldProxyModel::Filters filters );

View File

@ -21,6 +21,8 @@
#include "qgsmaplayerproxymodel.h" #include "qgsmaplayerproxymodel.h"
#include "qgis_gui.h" #include "qgis_gui.h"
#include "qgis.h"
class QgsMapLayer; class QgsMapLayer;
class QgsVectorLayer; 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). * \brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
* The layers can be filtered and/or ordered. * 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. //! setFilters allows fitering according to layer type and/or geometry type.
void setFilters( QgsMapLayerProxyModel::Filters filters ) { mProxyModel->setFilters( filters ); } void setFilters( QgsMapLayerProxyModel::Filters filters ) { mProxyModel->setFilters( filters ); }