Skip to content
Permalink
Browse files

[composer] Correctly handle cancelling shape, overview, grid and page…

… style changes
  • Loading branch information
nyalldawson committed Apr 14, 2014
1 parent 96809eb commit 80b70213be63f67017e1bb89e4a347447cc418b5
@@ -773,18 +773,20 @@ void QgsComposerMapWidget::on_mOverviewFrameStyleButton_clicked()
return;
}

mComposerMap->beginCommand( tr( "Overview frame style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerMap->overviewFrameMapSymbol(), QgsStyleV2::defaultStyle(), 0 );
QgsFillSymbolV2* newSymbol = dynamic_cast<QgsFillSymbolV2*>( mComposerMap->overviewFrameMapSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0 );

//QgsSymbolV2PropertiesDialog d( mComposerMap->overviewFrameMapSymbol(), 0, this );
if ( d.exec() == QDialog::Accepted )
{
mComposerMap->beginCommand( tr( "Overview frame style changed" ) );
mComposerMap->setOverviewFrameMapSymbol( newSymbol );
updateOverviewSymbolMarker();
mComposerMap->endCommand();
}
else
{
mComposerMap->cancelCommand();
delete newSymbol;
}
}

@@ -898,19 +900,21 @@ void QgsComposerMapWidget::on_mGridLineStyleButton_clicked()
return;
}

mComposerMap->beginCommand( tr( "Grid line style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerMap->gridLineSymbol(), QgsStyleV2::defaultStyle(), 0 );
QgsLineSymbolV2* newSymbol = dynamic_cast<QgsLineSymbolV2*>( mComposerMap->gridLineSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0 );

if ( d.exec() == QDialog::Accepted )
{
mComposerMap->beginCommand( tr( "Grid line style changed" ) );
mComposerMap->setGridLineSymbol( newSymbol );
updateLineSymbolMarker();
mComposerMap->endCommand();
mComposerMap->update();
}
else
{
mComposerMap->cancelCommand();
delete newSymbol;
}

mComposerMap->update();
}

void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QString& text )
@@ -111,17 +111,19 @@ void QgsComposerShapeWidget::on_mShapeStyleButton_clicked()
coverageLayer = mComposerShape->composition()->atlasComposition().coverageLayer();
}

mComposerShape->beginCommand( tr( "Shape style changed" ) );
QgsSymbolV2SelectorDialog d( mComposerShape->shapeStyleSymbol(), QgsStyleV2::defaultStyle(), coverageLayer );
QgsFillSymbolV2* newSymbol = dynamic_cast<QgsFillSymbolV2*>( mComposerShape->shapeStyleSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), coverageLayer );

if ( d.exec() == QDialog::Accepted )
{
mComposerShape->beginCommand( tr( "Shape style changed" ) );
mComposerShape->setShapeStyleSymbol( newSymbol );
updateShapeStyle();
mComposerShape->endCommand();
}
else
{
mComposerShape->cancelCommand();
delete newSymbol;
}
}

@@ -400,12 +400,19 @@ void QgsCompositionWidget::on_mPageStyleButton_clicked()
{
coverageLayer = mComposition->atlasComposition().coverageLayer();
}
QgsSymbolV2SelectorDialog d( mComposition->pageStyleSymbol(), QgsStyleV2::defaultStyle(), coverageLayer );

QgsFillSymbolV2* newSymbol = dynamic_cast<QgsFillSymbolV2*>( mComposition->pageStyleSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), coverageLayer );

if ( d.exec() == QDialog::Accepted )
{
mComposition->setPageStyleSymbol( newSymbol );
updatePageStyle();
}
else
{
delete newSymbol;
}
}

void QgsCompositionWidget::updatePageStyle()

0 comments on commit 80b7021

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