Skip to content

Commit

Permalink
Better memory management
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 17, 2017
1 parent 8d1e717 commit 9ab813f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,19 +1847,17 @@ void QgsLayoutDesignerDialog::showRasterizationWarning()
mLayout->customProperty( QStringLiteral( "forceVector" ), false ).toBool() )
return;

QgsMessageViewer *m = new QgsMessageViewer( this, QgsGuiUtils::ModalDialogFlags, false );
m->setWindowTitle( tr( "Composition Effects" ) );
m->setMessage( tr( "Advanced composition effects such as blend modes or vector layer transparency are enabled in this layout, which cannot be printed as vectors. Printing as a raster is recommended." ), QgsMessageOutput::MessageText );
m->setCheckBoxText( tr( "Print as raster" ) );
m->setCheckBoxState( Qt::Checked );
m->setCheckBoxVisible( true );
m->showMessage( true );

mLayout->setCustomProperty( QStringLiteral( "rasterise" ), m->checkBoxState() == Qt::Checked );
QgsMessageViewer m( this, QgsGuiUtils::ModalDialogFlags, false );
m.setWindowTitle( tr( "Composition Effects" ) );
m.setMessage( tr( "Advanced composition effects such as blend modes or vector layer transparency are enabled in this layout, which cannot be printed as vectors. Printing as a raster is recommended." ), QgsMessageOutput::MessageText );
m.setCheckBoxText( tr( "Print as raster" ) );
m.setCheckBoxState( Qt::Checked );
m.setCheckBoxVisible( true );
m.showMessage( true );

mLayout->setCustomProperty( QStringLiteral( "rasterise" ), m.checkBoxState() == Qt::Checked );
//make sure print as raster checkbox is updated
mLayoutPropertiesWidget->updateGui();

delete m;
}

void QgsLayoutDesignerDialog::showForceVectorWarning()
Expand All @@ -1868,19 +1866,18 @@ void QgsLayoutDesignerDialog::showForceVectorWarning()
if ( settings.value( QStringLiteral( "LayoutDesigner/hideForceVectorWarning" ), false, QgsSettings::App ).toBool() )
return;

QgsMessageViewer *m = new QgsMessageViewer( this, QgsGuiUtils::ModalDialogFlags, false );
m->setWindowTitle( tr( "Force Vector" ) );
m->setMessage( tr( "This layout has the \"Always export as vectors\" option enabled, but the layout contains effects such as blend modes or vector layer transparency, which cannot be printed as vectors. The generated file will differ from the layout contents." ), QgsMessageOutput::MessageText );
m->setCheckBoxText( tr( "Never show this message again" ) );
m->setCheckBoxState( Qt::Unchecked );
m->setCheckBoxVisible( true );
m->showMessage( true );
QgsMessageViewer m( this, QgsGuiUtils::ModalDialogFlags, false );
m.setWindowTitle( tr( "Force Vector" ) );
m.setMessage( tr( "This layout has the \"Always export as vectors\" option enabled, but the layout contains effects such as blend modes or vector layer transparency, which cannot be printed as vectors. The generated file will differ from the layout contents." ), QgsMessageOutput::MessageText );
m.setCheckBoxText( tr( "Never show this message again" ) );
m.setCheckBoxState( Qt::Unchecked );
m.setCheckBoxVisible( true );
m.showMessage( true );

if ( m->checkBoxState() == Qt::Checked )
if ( m.checkBoxState() == Qt::Checked )
{
settings.setValue( QStringLiteral( "LayoutDesigner/hideForceVectorWarning" ), true, QgsSettings::App );
}
delete m;
}

void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> items )
Expand Down
1 change: 1 addition & 0 deletions src/app/layout/qgslayoutimageexportoptionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* A dialog for customising the properties of an exported image file.
* \since QGIS 3.0
*/
class QgsLayoutImageExportOptionsDialog: public QDialog, private Ui::QgsLayoutImageExportOptionsDialog
{
Expand Down

0 comments on commit 9ab813f

Please sign in to comment.