@@ -3026,6 +3026,9 @@ void QgisApp::fileExit()
3026
3026
3027
3027
if ( saveDirty () )
3028
3028
{
3029
+ delete mComposer ;
3030
+ mComposer = 0 ;
3031
+
3029
3032
mMapCanvas ->freeze ( true );
3030
3033
removeAllLayers ();
3031
3034
qApp->exit ( 0 );
@@ -3048,6 +3051,9 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
3048
3051
return ;
3049
3052
}
3050
3053
3054
+ delete mComposer ;
3055
+ mComposer = new QgsComposer ( this );
3056
+
3051
3057
if ( thePromptToSaveFlag )
3052
3058
{
3053
3059
if ( !saveDirty () )
@@ -3065,9 +3071,6 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
3065
3071
removeAllLayers ();
3066
3072
mMapCanvas ->clear ();
3067
3073
3068
- delete mComposer ;
3069
- mComposer = new QgsComposer ( this );
3070
-
3071
3074
QgsProject* prj = QgsProject::instance ();
3072
3075
prj->title ( QString::null );
3073
3076
prj->setFileName ( QString::null );
@@ -3283,13 +3286,13 @@ void QgisApp::fileOpen()
3283
3286
3284
3287
delete openFileDialog;
3285
3288
3289
+ delete mComposer ;
3290
+ mComposer = new QgsComposer ( this );
3291
+
3286
3292
// clear out any stuff from previous project
3287
3293
mMapCanvas ->freeze ( true );
3288
3294
removeAllLayers ();
3289
3295
3290
- delete mComposer ;
3291
- mComposer = new QgsComposer ( this );
3292
-
3293
3296
QgsProject::instance ()->setFileName ( fullPath );
3294
3297
3295
3298
try
@@ -3341,13 +3344,13 @@ bool QgisApp::addProject( QString projectFile )
3341
3344
3342
3345
QApplication::setOverrideCursor ( Qt::WaitCursor );
3343
3346
3344
- // clear the map canvas
3345
- removeAllLayers ();
3346
-
3347
3347
// clear the composer
3348
3348
delete mComposer ;
3349
3349
mComposer = new QgsComposer ( this );
3350
3350
3351
+ // clear the map canvas
3352
+ removeAllLayers ();
3353
+
3351
3354
try
3352
3355
{
3353
3356
if ( QgsProject::instance ()->read ( projectFile ) )
@@ -3669,43 +3672,6 @@ bool QgisApp::openLayer( const QString & fileName )
3669
3672
return ok;
3670
3673
}
3671
3674
3672
-
3673
- #if 0
3674
- void QgisApp::filePrint()
3675
- {
3676
- //
3677
- // Warn the user first that priting is experimental still
3678
- //
3679
- QString myHeading = "QGIS Printing Support is Experimental";
3680
- QString myMessage = "Please note that printing only works on A4 landscape at the moment.\n";
3681
- myMessage += "For other page sizes your mileage may vary.\n";
3682
- QMessageBox::information( this, tr( myHeading ), tr( myMessage ) );
3683
-
3684
- QPrinter myQPrinter;
3685
- if ( myQPrinter.setup( this ) )
3686
- {
3687
- QgsDebugMsg( ".............................." );
3688
- QgsDebugMsg( "...........Printing..........." );
3689
- QgsDebugMsg( ".............................." );
3690
- // Ithought we could just do this:
3691
- //mMapCanvas->render(&myQPrinter);
3692
- //but it doesnt work so now we try this....
3693
- QPaintDeviceMetrics myMetrics( &myQPrinter ); // need width/height of printer surface
3694
- QgsDebugMsg( QString( "Print device width: %1" ).arg( myMetrics.width() ) );
3695
- QgsDebugMsg( QString( "Print device height: %1" ).arg( myMetrics.height() ) );
3696
- QPainter myQPainter;
3697
- myQPainter.begin( &myQPrinter );
3698
- QPixmap myQPixmap( myMetrics.width(), myMetrics.height() );
3699
- myQPixmap.fill();
3700
- mMapCanvas->freeze( false );
3701
- mMapCanvas->setDirty( true );
3702
- mMapCanvas->render( &myQPixmap );
3703
- myQPainter.drawPixmap( 0, 0, myQPixmap );
3704
- myQPainter.end();
3705
- }
3706
- }
3707
- #endif
3708
-
3709
3675
void QgisApp::filePrint ()
3710
3676
{
3711
3677
if ( mMapCanvas && mMapCanvas ->isDrawing () )
0 commit comments