Skip to content
Permalink
Browse files

[styledock] Connect missing signals for order and effects

  • Loading branch information
NathanW2 committed Jun 5, 2016
1 parent b5696a8 commit dd0ddd5aed25bd053a6d2d84aa928442d474bc2f
@@ -368,16 +368,6 @@ void QgsMapStylingWidget::layerAboutToBeRemoved( QgsMapLayer* layer )
}
}

void QgsMapStylingWidget::syncWidgetState()
{
QWidget* current = mWidgetArea->widget();

if ( QgsRendererV2PropertiesDialog* widget = qobject_cast<QgsRendererV2PropertiesDialog*>( current ) )
{
widget->syncToLayer();
}
}

void QgsMapStylingWidget::pushUndoItem( const QString &name )
{
QString errorMsg;
@@ -85,7 +85,6 @@ class APP_EXPORT QgsMapStylingWidget : public QWidget, private Ui::QgsMapStyling
private slots:
void updateCurrentWidgetLayer();
void layerAboutToBeRemoved( QgsMapLayer* layer );
void syncWidgetState();

private:
void pushUndoItem( const QString& name );
@@ -120,6 +120,18 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog( QgsVectorLayer* la
connect( btnOrderBy, SIGNAL( clicked( bool ) ), this, SLOT( showOrderByDialog() ) );

syncToLayer();

QList<QWidget*> widgets;
widgets << mLayerTransparencySpnBx
<< cboRenderers
<< checkboxEnableOrderBy
<< lineEditOrderBy
<< mBlendModeComboBox
<< mFeatureBlendComboBox
<< mEffectWidget;


connectValueChanged( widgets, SIGNAL( widgetChanged() ) );
}

void QgsRendererV2PropertiesDialog::connectValueChanged( QList<QWidget *> widgets, const char *slot )
@@ -158,49 +170,13 @@ void QgsRendererV2PropertiesDialog::connectValueChanged( QList<QWidget *> widget
else if ( QLineEdit* w = qobject_cast<QLineEdit*>( widget ) )
{
connect( w, SIGNAL( textEdited( QString ) ), this, slot );
connect( w, SIGNAL( textChanged( QString ) ), this, slot );
}
}
}

void QgsRendererV2PropertiesDialog::disconnectValueChanged( QList<QWidget *> widgets, const char *slot )
{
Q_FOREACH ( QWidget* widget, widgets )
{
if ( QgsDataDefinedButton* w = qobject_cast<QgsDataDefinedButton*>( widget ) )
{
disconnect( w, SIGNAL( dataDefinedActivated( bool ) ), this, slot );
disconnect( w, SIGNAL( dataDefinedChanged( QString ) ), this, slot );
}
else if ( QgsFieldExpressionWidget* w = qobject_cast<QgsFieldExpressionWidget*>( widget ) )
{
disconnect( w, SIGNAL( fieldChanged( QString ) ), this, slot );
}
else if ( QComboBox* w = qobject_cast<QComboBox*>( widget ) )
{
disconnect( w, SIGNAL( currentIndexChanged( int ) ), this, slot );
}
else if ( QSpinBox* w = qobject_cast<QSpinBox*>( widget ) )
{
disconnect( w, SIGNAL( valueChanged( int ) ), this, slot );
}
else if ( QDoubleSpinBox* w = qobject_cast<QDoubleSpinBox*>( widget ) )
{
disconnect( w , SIGNAL( valueChanged( double ) ), this, slot );
}
else if ( QgsColorButtonV2* w = qobject_cast<QgsColorButtonV2*>( widget ) )
{
disconnect( w, SIGNAL( colorChanged( QColor ) ), this, slot );
}
else if ( QCheckBox* w = qobject_cast<QCheckBox*>( widget ) )
else if ( QgsEffectStackCompactWidget* w = qobject_cast<QgsEffectStackCompactWidget*>( widget ) )
{
disconnect( w, SIGNAL( toggled( bool ) ), this, slot );
}
else if ( QLineEdit* w = qobject_cast<QLineEdit*>( widget ) )
{
disconnect( w, SIGNAL( textEdited( QString ) ), this, slot );
connect( w, SIGNAL( changed() ), this, slot );
}
}

}

QgsRendererV2PropertiesDialog::~QgsRendererV2PropertiesDialog()
@@ -312,8 +288,6 @@ void QgsRendererV2PropertiesDialog::onOK()

void QgsRendererV2PropertiesDialog::syncToLayer()
{
QgsDebugMsg( "SYNC TO LAYER!!" );
disconnectValueChanged( findChildren<QWidget*>(), SIGNAL( widgetChanged() ) );
// Blend mode
mBlendModeComboBox->setBlendMode( mLayer->blendMode() );

@@ -324,7 +298,6 @@ void QgsRendererV2PropertiesDialog::syncToLayer()
mLayerTransparencySlider->setValue( mLayer->layerTransparency() );
mLayerTransparencySpnBx->setValue( mLayer->layerTransparency() );

QgsDebugMsg( QString( "VALUE: %1" ).arg( mLayer->layerTransparency() ) );
//paint effect widget
if ( mLayer->rendererV2() )
{
@@ -362,7 +335,6 @@ void QgsRendererV2PropertiesDialog::syncToLayer()
// no renderer found... this mustn't happen
Q_ASSERT( rendererIdx != -1 && "there must be a renderer!" );

connectValueChanged( findChildren<QWidget*>(), SIGNAL( widgetChanged() ) );
}

void QgsRendererV2PropertiesDialog::showOrderByDialog()
@@ -72,15 +72,15 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs
//! Apply and accept the changes for the dialog.
void onOK();

void syncToLayer();

private slots:
void showOrderByDialog();

void changeOrderBy( const QgsFeatureRequest::OrderBy& orderBy, bool orderByEnabled );

void updateUIState( bool hidden );

void syncToLayer();

protected:
/**
* Connect the given slot to the value changed event for the set of widgets
@@ -92,8 +92,6 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs
*/
void connectValueChanged( QList<QWidget *> widgets, const char *slot );

void disconnectValueChanged( QList<QWidget *> widgets, const char *slot );

//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event ) override;

0 comments on commit dd0ddd5

Please sign in to comment.
You can’t perform that action at this time.