mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Remove redundant setLayer slots from QgsField(ComboBox|ExpressionWidget)
and switch uses of remaining slot to new style connects
This commit is contained in:
parent
22dc096692
commit
8c8be007b9
@ -842,6 +842,18 @@ QgsFeatureRendererV2 {#qgis_api_break_3_0_QgsFeatureRendererV2}
|
|||||||
- copyPaintEffect() was removed. copyRendererData() should be used instead.
|
- copyPaintEffect() was removed. copyRendererData() should be used instead.
|
||||||
|
|
||||||
|
|
||||||
|
QgsFieldCombobox {#qgis_api_break_3_0_QgsFieldCombobox}
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- The setLayer( QgsVectorlayer* ) slot has been removed. Use the setLayer( QgsMapLayer* ) slot instead.
|
||||||
|
|
||||||
|
|
||||||
|
QgsFieldExpressionWidget {#qgis_api_break_3_0_QgsFieldExpressionWidget}
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
- The setLayer( QgsVectorlayer* ) slot has been removed. Use the setLayer( QgsMapLayer* ) slot instead.
|
||||||
|
|
||||||
|
|
||||||
QgsFields {#qgis_api_break_3_0_QgsFields}
|
QgsFields {#qgis_api_break_3_0_QgsFields}
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -42,7 +42,10 @@ class QgsFieldComboBox : QComboBox
|
|||||||
//! return the currently selected field
|
//! return the currently selected field
|
||||||
QString currentField() const;
|
QString currentField() const;
|
||||||
|
|
||||||
//! Returns the currently used layer
|
/**
|
||||||
|
* Returns the layer currently associated with the combobox.
|
||||||
|
* @see setLayer()
|
||||||
|
*/
|
||||||
QgsVectorLayer* layer() const;
|
QgsVectorLayer* layer() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -50,10 +53,12 @@ class QgsFieldComboBox : QComboBox
|
|||||||
void fieldChanged( const QString& fieldName );
|
void fieldChanged( const QString& fieldName );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! set the layer of which the fields are listed
|
|
||||||
void setLayer( QgsVectorLayer* layer );
|
|
||||||
|
|
||||||
//! convenience slot to connect QgsMapLayerComboBox layer signal
|
/**
|
||||||
|
* 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 );
|
||||||
|
|
||||||
//! setField sets the currently selected field
|
//! setField sets the currently selected field
|
||||||
|
@ -64,7 +64,10 @@ class QgsFieldExpressionWidget : QWidget
|
|||||||
*/
|
*/
|
||||||
QString expression() const;
|
QString expression() const;
|
||||||
|
|
||||||
//! Returns the currently used layer
|
/**
|
||||||
|
* Returns the layer currently associated with the widget.
|
||||||
|
* @see setLayer()
|
||||||
|
*/
|
||||||
QgsVectorLayer* layer() const;
|
QgsVectorLayer* layer() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,10 +89,10 @@ class QgsFieldExpressionWidget : QWidget
|
|||||||
// void returnPressed();
|
// void returnPressed();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! set the layer used to display the fields and expression
|
/**
|
||||||
void setLayer( QgsVectorLayer* layer );
|
* Sets the layer used to display the fields and expression.
|
||||||
|
* @see layer()
|
||||||
//! convenience slot to connect QgsMapLayerComboBox layer signal
|
*/
|
||||||
void setLayer( QgsMapLayer* layer );
|
void setLayer( QgsMapLayer* layer );
|
||||||
|
|
||||||
//! sets the current row in the widget
|
//! sets the current row in the widget
|
||||||
|
@ -33,8 +33,8 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
|
|||||||
|
|
||||||
mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
||||||
|
|
||||||
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mAtlasSortFeatureKeyComboBox, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mAtlasCoverageLayerComboBox, &QgsMapLayerComboBox::layerChanged, mAtlasSortFeatureKeyComboBox, &QgsFieldComboBox::setLayer );
|
||||||
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mPageNameWidget, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mAtlasCoverageLayerComboBox, &QgsMapLayerComboBox::layerChanged, mPageNameWidget, &QgsFieldExpressionWidget::setLayer );
|
||||||
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) );
|
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) );
|
||||||
connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) );
|
connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) );
|
||||||
connect( mPageNameWidget, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( pageNameExpressionChanged( QString, bool ) ) );
|
connect( mPageNameWidget, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( pageNameExpressionChanged( QString, bool ) ) );
|
||||||
|
@ -43,8 +43,8 @@ QgsJoinDialog::QgsJoinDialog( QgsVectorLayer* layer, QList<QgsMapLayer*> already
|
|||||||
|
|
||||||
mJoinLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
mJoinLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
||||||
mJoinLayerComboBox->setExceptedLayerList( alreadyJoinedLayers );
|
mJoinLayerComboBox->setExceptedLayerList( alreadyJoinedLayers );
|
||||||
connect( mJoinLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mJoinFieldComboBox, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mJoinLayerComboBox, &QgsMapLayerComboBox::layerChanged, mJoinFieldComboBox, &QgsFieldComboBox::setLayer );
|
||||||
connect( mJoinLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( joinedLayerChanged( QgsMapLayer* ) ) );
|
connect( mJoinLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsJoinDialog::joinedLayerChanged );
|
||||||
|
|
||||||
mCacheInMemoryCheckBox->setChecked( true );
|
mCacheInMemoryCheckBox->setChecked( true );
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ QgsJoinDialog::QgsJoinDialog( QgsVectorLayer* layer, QList<QgsMapLayer*> already
|
|||||||
joinedLayerChanged( joinLayer );
|
joinedLayerChanged( joinLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( mJoinLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( checkDefinitionValid() ) );
|
connect( mJoinLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsJoinDialog::checkDefinitionValid );
|
||||||
connect( mJoinFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) );
|
connect( mJoinFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) );
|
||||||
connect( mTargetFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) );
|
connect( mTargetFieldComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( checkDefinitionValid() ) );
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas* canvas, const QList<
|
|||||||
|
|
||||||
connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) );
|
connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) );
|
||||||
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
|
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||||
connect( mLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mLayerCombo, &QgsMapLayerComboBox::layerChanged, this, &QgsLayerStylingWidget::setLayer );
|
||||||
connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), this, SLOT( liveApplyToggled( bool ) ) );
|
connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), this, SLOT( liveApplyToggled( bool ) ) );
|
||||||
|
|
||||||
mStackedWidget->setCurrentIndex( 0 );
|
mStackedWidget->setCurrentIndex( 0 );
|
||||||
|
@ -25,10 +25,8 @@ QgsRelationAddDlg::QgsRelationAddDlg( QWidget *parent )
|
|||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
connect( mCbxReferencingLayer, &QgsMapLayerComboBox::layerChanged, this, [=]( QgsMapLayer * layer ) { mCbxReferencingField->setLayer( layer ); }
|
connect( mCbxReferencingLayer, &QgsMapLayerComboBox::layerChanged, mCbxReferencingField, &QgsFieldComboBox::setLayer );
|
||||||
);
|
connect( mCbxReferencedLayer, &QgsMapLayerComboBox::layerChanged, mCbxReferencedField, &QgsFieldComboBox::setLayer );
|
||||||
connect( mCbxReferencedLayer, &QgsMapLayerComboBox::layerChanged, this, [=]( QgsMapLayer * layer ) { mCbxReferencedField->setLayer( layer ); }
|
|
||||||
);
|
|
||||||
|
|
||||||
mCbxReferencingLayer->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
mCbxReferencingLayer->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
||||||
mCbxReferencingField->setLayer( mCbxReferencingLayer->currentLayer() );
|
mCbxReferencingField->setLayer( mCbxReferencingLayer->currentLayer() );
|
||||||
|
@ -23,8 +23,8 @@ QgsValueRelationConfigDlg::QgsValueRelationConfigDlg( QgsVectorLayer* vl, int fi
|
|||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
mLayerName->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
mLayerName->setFilters( QgsMapLayerProxyModel::VectorLayer );
|
||||||
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mKeyColumn, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mLayerName, &QgsMapLayerComboBox::layerChanged, mKeyColumn, &QgsFieldComboBox::setLayer );
|
||||||
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mValueColumn, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mLayerName, &QgsMapLayerComboBox::layerChanged, mValueColumn, &QgsFieldComboBox::setLayer );
|
||||||
connect( mEditExpression, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
|
connect( mEditExpression, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
|
||||||
|
|
||||||
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SIGNAL( changed() ) );
|
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SIGNAL( changed() ) );
|
||||||
|
@ -45,16 +45,8 @@ bool QgsFieldComboBox::allowEmptyFieldName() const
|
|||||||
|
|
||||||
void QgsFieldComboBox::setLayer( QgsMapLayer *layer )
|
void QgsFieldComboBox::setLayer( QgsMapLayer *layer )
|
||||||
{
|
{
|
||||||
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );
|
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( layer );
|
||||||
if ( vl )
|
mFieldProxyModel->sourceFieldModel()->setLayer( vl );
|
||||||
{
|
|
||||||
setLayer( vl );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsFieldComboBox::setLayer( QgsVectorLayer *layer )
|
|
||||||
{
|
|
||||||
mFieldProxyModel->sourceFieldModel()->setLayer( layer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsVectorLayer *QgsFieldComboBox::layer() const
|
QgsVectorLayer *QgsFieldComboBox::layer() const
|
||||||
|
@ -68,7 +68,10 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
|
|||||||
//! return the currently selected field
|
//! return the currently selected field
|
||||||
QString currentField() const;
|
QString currentField() const;
|
||||||
|
|
||||||
//! Returns the currently used layer
|
/**
|
||||||
|
* Returns the layer currently associated with the combobox.
|
||||||
|
* @see setLayer()
|
||||||
|
*/
|
||||||
QgsVectorLayer* layer() const;
|
QgsVectorLayer* layer() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -76,10 +79,12 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
|
|||||||
void fieldChanged( const QString& fieldName );
|
void fieldChanged( const QString& fieldName );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! set the layer of which the fields are listed
|
|
||||||
void setLayer( QgsVectorLayer* layer );
|
|
||||||
|
|
||||||
//! convenience slot to connect QgsMapLayerComboBox layer signal
|
/**
|
||||||
|
* 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 );
|
||||||
|
|
||||||
//! setField sets the currently selected field
|
//! setField sets the currently selected field
|
||||||
|
@ -154,24 +154,17 @@ void QgsFieldExpressionWidget::registerExpressionContextGenerator( const QgsExpr
|
|||||||
|
|
||||||
void QgsFieldExpressionWidget::setLayer( QgsMapLayer *layer )
|
void QgsFieldExpressionWidget::setLayer( QgsMapLayer *layer )
|
||||||
{
|
{
|
||||||
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );
|
QgsVectorLayer* vl = qobject_cast< QgsVectorLayer* >( layer );
|
||||||
if ( vl )
|
|
||||||
{
|
|
||||||
setLayer( vl );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsFieldExpressionWidget::setLayer( QgsVectorLayer *layer )
|
|
||||||
{
|
|
||||||
if ( mFieldProxyModel->sourceFieldModel()->layer() )
|
if ( mFieldProxyModel->sourceFieldModel()->layer() )
|
||||||
disconnect( mFieldProxyModel->sourceFieldModel()->layer(), SIGNAL( updatedFields() ), this, SLOT( reloadLayer() ) );
|
disconnect( mFieldProxyModel->sourceFieldModel()->layer(), SIGNAL( updatedFields() ), this, SLOT( reloadLayer() ) );
|
||||||
|
|
||||||
if ( layer )
|
if ( vl )
|
||||||
mExpressionContext = layer->createExpressionContext();
|
mExpressionContext = vl->createExpressionContext();
|
||||||
else
|
else
|
||||||
mExpressionContext = QgsProject::instance()->createExpressionContext();
|
mExpressionContext = QgsProject::instance()->createExpressionContext();
|
||||||
|
|
||||||
mFieldProxyModel->sourceFieldModel()->setLayer( layer );
|
mFieldProxyModel->sourceFieldModel()->setLayer( vl );
|
||||||
|
|
||||||
if ( mFieldProxyModel->sourceFieldModel()->layer() )
|
if ( mFieldProxyModel->sourceFieldModel()->layer() )
|
||||||
connect( mFieldProxyModel->sourceFieldModel()->layer(), SIGNAL( updatedFields() ), SLOT( reloadLayer() ), Qt::UniqueConnection );
|
connect( mFieldProxyModel->sourceFieldModel()->layer(), SIGNAL( updatedFields() ), SLOT( reloadLayer() ), Qt::UniqueConnection );
|
||||||
|
@ -111,7 +111,10 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
|
|||||||
*/
|
*/
|
||||||
QString expression() const;
|
QString expression() const;
|
||||||
|
|
||||||
//! Returns the currently used layer
|
/**
|
||||||
|
* Returns the layer currently associated with the widget.
|
||||||
|
* @see setLayer()
|
||||||
|
*/
|
||||||
QgsVectorLayer* layer() const;
|
QgsVectorLayer* layer() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,10 +136,11 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
|
|||||||
// void returnPressed();
|
// void returnPressed();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! set the layer used to display the fields and expression
|
|
||||||
void setLayer( QgsVectorLayer* layer );
|
|
||||||
|
|
||||||
//! convenience slot to connect QgsMapLayerComboBox layer signal
|
/**
|
||||||
|
* Sets the layer used to display the fields and expression.
|
||||||
|
* @see layer()
|
||||||
|
*/
|
||||||
void setLayer( QgsMapLayer* layer );
|
void setLayer( QgsMapLayer* layer );
|
||||||
|
|
||||||
//! sets the current row in the widget
|
//! sets the current row in the widget
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "qgsexpressionbuilderdialog.h"
|
#include "qgsexpressionbuilderdialog.h"
|
||||||
#include "qgsfieldexpressionwidget.h"
|
#include "qgsfieldexpressionwidget.h"
|
||||||
|
#include "qgsvectorlayer.h"
|
||||||
|
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
@ -71,8 +71,8 @@ HeatmapGui::HeatmapGui( QWidget* parent, Qt::WindowFlags fl, QMap<QString, QVari
|
|||||||
|
|
||||||
mRadiusFieldCombo->setFilters( QgsFieldProxyModel::Numeric );
|
mRadiusFieldCombo->setFilters( QgsFieldProxyModel::Numeric );
|
||||||
mWeightFieldCombo->setFilters( QgsFieldProxyModel::Numeric );
|
mWeightFieldCombo->setFilters( QgsFieldProxyModel::Numeric );
|
||||||
connect( mInputLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), mRadiusFieldCombo, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mInputLayerCombo, &QgsMapLayerComboBox::layerChanged, mRadiusFieldCombo, &QgsFieldComboBox::setLayer );
|
||||||
connect( mInputLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), mWeightFieldCombo, SLOT( setLayer( QgsMapLayer* ) ) );
|
connect( mInputLayerCombo, &QgsMapLayerComboBox::layerChanged, mWeightFieldCombo, &QgsFieldComboBox::setLayer );
|
||||||
mRadiusFieldCombo->setLayer( mInputLayerCombo->currentLayer() );
|
mRadiusFieldCombo->setLayer( mInputLayerCombo->currentLayer() );
|
||||||
mWeightFieldCombo->setLayer( mInputLayerCombo->currentLayer() );
|
mWeightFieldCombo->setLayer( mInputLayerCombo->currentLayer() );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user