Skip to content
Permalink
Browse files

Add parameter for QgsMessageViewer to disable deleteOnClose, allows r…

…etrieving checkBoxState after dialog has closed
  • Loading branch information
nyalldawson committed May 5, 2013
1 parent 2479d83 commit a3573cedf4426d79430ca12c47f5f52774df0443
Showing with 10 additions and 7 deletions.
  1. +4 −3 src/app/composer/qgscomposer.cpp
  2. +5 −3 src/gui/qgsmessageviewer.cpp
  3. +1 −1 src/gui/qgsmessageviewer.h
@@ -2079,24 +2079,25 @@ void QgsComposer::showBlendModePrintingWarning()
{
if ( ! mComposition->printAsRaster() )
{
QgsMessageViewer* m = new QgsMessageViewer( this );
QgsMessageViewer* m = new QgsMessageViewer( this, QgisGui::ModalDialogFlags, false );
m->setWindowTitle( tr( "Project contains blend modes" ) );
m->setMessage( tr( "Blend modes are enabled in this project, 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 );

// TODO - fix this - checkBoxState is never true
// also need to make sure composer print as raster checkbox is updated
if ( m->checkBoxState() == Qt::Checked )
{
mComposition->setPrintAsRaster( true );
}
else
{
mComposition->setPrintAsRaster( true );
mComposition->setPrintAsRaster( false );
}

delete m;
}
}

@@ -18,12 +18,14 @@
#include "qgsmessageviewer.h"
#include <QSettings>

QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WFlags fl )
QgsMessageViewer::QgsMessageViewer( QWidget *parent, Qt::WFlags fl, bool deleteOnClose )
: QDialog( parent, fl )
{
setupUi( this );
setAttribute( Qt::WA_DeleteOnClose );

if ( deleteOnClose )
{
setAttribute( Qt::WA_DeleteOnClose );
}
// Default state for the checkbox
setCheckBoxVisible( false );
setCheckBoxState( Qt::Unchecked );
@@ -31,7 +31,7 @@ class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, priv
{
Q_OBJECT
public:
QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags, bool deleteOnClose = true );
~QgsMessageViewer();

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

0 comments on commit a3573ce

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