Skip to content

Commit a3573ce

Browse files
committedMay 5, 2013
Add parameter for QgsMessageViewer to disable deleteOnClose, allows retrieving checkBoxState after dialog has closed
1 parent 2479d83 commit a3573ce

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
 

‎src/app/composer/qgscomposer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,24 +2079,25 @@ void QgsComposer::showBlendModePrintingWarning()
20792079
{
20802080
if ( ! mComposition->printAsRaster() )
20812081
{
2082-
QgsMessageViewer* m = new QgsMessageViewer( this );
2082+
QgsMessageViewer* m = new QgsMessageViewer( this, QgisGui::ModalDialogFlags, false );
20832083
m->setWindowTitle( tr( "Project contains blend modes" ) );
20842084
m->setMessage( tr( "Blend modes are enabled in this project, which cannot be printed as vectors. Printing as a raster is recommended." ), QgsMessageOutput::MessageText );
20852085
m->setCheckBoxText( tr( "Print as raster" ) );
20862086
m->setCheckBoxState( Qt::Checked );
20872087
m->setCheckBoxVisible( true );
20882088
m->showMessage( true );
20892089

2090-
// TODO - fix this - checkBoxState is never true
20912090
// also need to make sure composer print as raster checkbox is updated
20922091
if ( m->checkBoxState() == Qt::Checked )
20932092
{
20942093
mComposition->setPrintAsRaster( true );
20952094
}
20962095
else
20972096
{
2098-
mComposition->setPrintAsRaster( true );
2097+
mComposition->setPrintAsRaster( false );
20992098
}
2099+
2100+
delete m;
21002101
}
21012102
}
21022103

‎src/gui/qgsmessageviewer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
#include "qgsmessageviewer.h"
1919
#include <QSettings>
2020

21-
QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WFlags fl )
21+
QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WFlags fl, bool deleteOnClose )
2222
: QDialog( parent, fl )
2323
{
2424
setupUi( this );
25-
setAttribute( Qt::WA_DeleteOnClose );
26-
25+
if ( deleteOnClose )
26+
{
27+
setAttribute( Qt::WA_DeleteOnClose );
28+
}
2729
// Default state for the checkbox
2830
setCheckBoxVisible( false );
2931
setCheckBoxState( Qt::Unchecked );

‎src/gui/qgsmessageviewer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, priv
3131
{
3232
Q_OBJECT
3333
public:
34-
QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
34+
QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags, bool deleteOnClose = true );
3535
~QgsMessageViewer();
3636

3737
virtual void setMessage( const QString& message, MessageType msgType );

0 commit comments

Comments
 (0)
Please sign in to comment.