36 , mEmbeddedRendererWidget( 0 )
48 setupBlankUi( layer->
name() );
63 blockAllSignals(
true );
69 for (
int idx = 0; idx < layerAttributes.
count(); ++idx )
71 mLabelFieldComboBox->addItem( layerAttributes[idx].name() );
73 mLabelFieldComboBox->addItem(
tr(
"None" ) );
76 if ( !currentLabelAttribute.isEmpty() )
78 mLabelFieldComboBox->setCurrentIndex( mLabelFieldComboBox->findText( currentLabelAttribute ) );
82 mLabelFieldComboBox->setCurrentIndex( mLabelFieldComboBox->findText(
tr(
"None" ) ) );
88 QStringList::const_iterator it = rendererList.constBegin();
89 for ( ; it != rendererList.constEnd(); ++it )
91 if ( *it !=
"pointDisplacement" )
98 mCircleColorButton->setColorDialogTitle(
tr(
"Select color" ) );
99 mCircleColorButton->setContext(
"symbology" );
100 mLabelColorButton->setContext(
"symbology" );
101 mLabelColorButton->setColorDialogTitle(
tr(
"Select color" ) );
103 mCircleWidthSpinBox->setValue( mRenderer->
circleWidth() );
104 mCircleColorButton->setColor( mRenderer->
circleColor() );
105 mLabelColorButton->setColor( mRenderer->
labelColor() );
107 mDistanceSpinBox->setValue( mRenderer->
tolerance() );
111 mMaxScaleDenominatorEdit->setValidator(
new QDoubleValidator( mMaxScaleDenominatorEdit ) );
114 mScaleDependentLabelsCheckBox->setCheckState( Qt::Checked );
118 mScaleDependentLabelsCheckBox->setCheckState( Qt::Unchecked );
119 mMaxScaleDenominatorEdit->setEnabled(
false );
123 blockAllSignals(
false );
129 int rendererIndex = mRendererComboBox->findData( rendererName );
130 if ( rendererIndex != -1 )
132 mRendererComboBox->setCurrentIndex( rendererIndex );
133 on_mRendererComboBox_currentIndexChanged( rendererIndex );
143 delete mEmbeddedRendererWidget;
148 if ( mRenderer && mEmbeddedRendererWidget )
151 if ( embeddedRenderer )
159 void QgsPointDisplacementRendererWidget::on_mLabelFieldComboBox_currentIndexChanged(
const QString& text )
163 if ( text ==
tr(
"None" ) )
174 void QgsPointDisplacementRendererWidget::on_mRendererComboBox_currentIndexChanged(
int index )
176 QString rendererId = mRendererComboBox->itemData( index ).toString();
180 delete mEmbeddedRendererWidget;
185 void QgsPointDisplacementRendererWidget::on_mRendererSettingsButton_clicked()
187 if ( mEmbeddedRendererWidget )
191 QDialog* d =
new QDialog( this->window() );
192 d->setWindowModality( Qt::WindowModal );
194 QDialog* d =
new QDialog();
196 QGridLayout* layout =
new QGridLayout( d );
197 mEmbeddedRendererWidget->setParent( d );
198 QDialogButtonBox* buttonBox =
new QDialogButtonBox( d );
199 buttonBox->addButton( QDialogButtonBox::Ok );
200 QObject::connect( buttonBox, SIGNAL( accepted() ), d, SLOT( accept() ) );
201 layout->addWidget( mEmbeddedRendererWidget, 0, 0 );
202 layout->addWidget( buttonBox, 1, 0 );
204 mEmbeddedRendererWidget->setParent( 0 );
209 void QgsPointDisplacementRendererWidget::on_mLabelFontButton_clicked()
224 void QgsPointDisplacementRendererWidget::on_mCircleWidthSpinBox_valueChanged(
double d )
232 void QgsPointDisplacementRendererWidget::on_mCircleColorButton_colorChanged(
const QColor& newColor )
242 void QgsPointDisplacementRendererWidget::on_mLabelColorButton_colorChanged(
const QColor& newColor )
252 void QgsPointDisplacementRendererWidget::on_mCircleModificationSpinBox_valueChanged(
double d )
262 void QgsPointDisplacementRendererWidget::on_mDistanceSpinBox_valueChanged(
double d )
270 void QgsPointDisplacementRendererWidget::on_mScaleDependentLabelsCheckBox_stateChanged(
int state )
272 if ( state == Qt::Unchecked )
274 mMaxScaleDenominatorEdit->setText(
"-1" );
275 mMaxScaleDenominatorEdit->setEnabled(
false );
279 mMaxScaleDenominatorEdit->setEnabled(
true );
283 void QgsPointDisplacementRendererWidget::on_mMaxScaleDenominatorEdit_textChanged(
const QString & text )
291 double scaleDenominator = text.toDouble( &ok );
298 void QgsPointDisplacementRendererWidget::blockAllSignals(
bool block )
300 mLabelFieldComboBox->blockSignals( block );
301 mLabelFontButton->blockSignals( block );
302 mCircleWidthSpinBox->blockSignals( block );
303 mCircleColorButton->blockSignals( block );
304 mRendererComboBox->blockSignals( block );
305 mLabelColorButton->blockSignals( block );
306 mCircleModificationSpinBox->blockSignals( block );
307 mScaleDependentLabelsCheckBox->blockSignals( block );
308 mMaxScaleDenominatorEdit->blockSignals( block );
309 mCenterSymbolPushButton->blockSignals( block );
310 mDistanceSpinBox->blockSignals( block );
313 void QgsPointDisplacementRendererWidget::on_mCenterSymbolPushButton_clicked()
321 if ( dlg.exec() == QDialog::Rejected )
330 void QgsPointDisplacementRendererWidget::updateCenterIcon()
338 mCenterSymbolPushButton->setIcon( icon );
341 void QgsPointDisplacementRendererWidget::setupBlankUi(
const QString& layerName )
343 QGridLayout* layout =
new QGridLayout(
this );
344 QLabel* label =
new QLabel(
tr(
"The point displacement renderer only applies to (single) point layers. \n'%1' is not a point layer and cannot be displayed by the point displacement renderer" ).arg( layerName ),
this );
345 layout->addWidget( label );