Skip to content

Commit

Permalink
Add parameter for QgsMessageViewer to disable deleteOnClose, allows r…
Browse files Browse the repository at this point in the history
…etrieving checkBoxState after dialog has closed
  • Loading branch information
nyalldawson committed May 5, 2013
1 parent 2479d83 commit a3573ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/gui/qgsmessageviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmessageviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit a3573ce

Please sign in to comment.