Skip to content

Commit 9ab813f

Browse files
committed
Better memory management
1 parent 8d1e717 commit 9ab813f

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

src/app/layout/qgslayoutdesignerdialog.cpp

+17-20
Original file line numberDiff line numberDiff line change
@@ -1847,19 +1847,17 @@ void QgsLayoutDesignerDialog::showRasterizationWarning()
18471847
mLayout->customProperty( QStringLiteral( "forceVector" ), false ).toBool() )
18481848
return;
18491849

1850-
QgsMessageViewer *m = new QgsMessageViewer( this, QgsGuiUtils::ModalDialogFlags, false );
1851-
m->setWindowTitle( tr( "Composition Effects" ) );
1852-
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 );
1853-
m->setCheckBoxText( tr( "Print as raster" ) );
1854-
m->setCheckBoxState( Qt::Checked );
1855-
m->setCheckBoxVisible( true );
1856-
m->showMessage( true );
1857-
1858-
mLayout->setCustomProperty( QStringLiteral( "rasterise" ), m->checkBoxState() == Qt::Checked );
1850+
QgsMessageViewer m( this, QgsGuiUtils::ModalDialogFlags, false );
1851+
m.setWindowTitle( tr( "Composition Effects" ) );
1852+
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 );
1853+
m.setCheckBoxText( tr( "Print as raster" ) );
1854+
m.setCheckBoxState( Qt::Checked );
1855+
m.setCheckBoxVisible( true );
1856+
m.showMessage( true );
1857+
1858+
mLayout->setCustomProperty( QStringLiteral( "rasterise" ), m.checkBoxState() == Qt::Checked );
18591859
//make sure print as raster checkbox is updated
18601860
mLayoutPropertiesWidget->updateGui();
1861-
1862-
delete m;
18631861
}
18641862

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

1871-
QgsMessageViewer *m = new QgsMessageViewer( this, QgsGuiUtils::ModalDialogFlags, false );
1872-
m->setWindowTitle( tr( "Force Vector" ) );
1873-
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 );
1874-
m->setCheckBoxText( tr( "Never show this message again" ) );
1875-
m->setCheckBoxState( Qt::Unchecked );
1876-
m->setCheckBoxVisible( true );
1877-
m->showMessage( true );
1869+
QgsMessageViewer m( this, QgsGuiUtils::ModalDialogFlags, false );
1870+
m.setWindowTitle( tr( "Force Vector" ) );
1871+
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 );
1872+
m.setCheckBoxText( tr( "Never show this message again" ) );
1873+
m.setCheckBoxState( Qt::Unchecked );
1874+
m.setCheckBoxVisible( true );
1875+
m.showMessage( true );
18781876

1879-
if ( m->checkBoxState() == Qt::Checked )
1877+
if ( m.checkBoxState() == Qt::Checked )
18801878
{
18811879
settings.setValue( QStringLiteral( "LayoutDesigner/hideForceVectorWarning" ), true, QgsSettings::App );
18821880
}
1883-
delete m;
18841881
}
18851882

18861883
void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> items )

src/app/layout/qgslayoutimageexportoptionsdialog.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
/**
2626
* A dialog for customising the properties of an exported image file.
27+
* \since QGIS 3.0
2728
*/
2829
class QgsLayoutImageExportOptionsDialog: public QDialog, private Ui::QgsLayoutImageExportOptionsDialog
2930
{

0 commit comments

Comments
 (0)