From 68743f9b8a95b7fa8ddc582cec507b6ac7788789 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 24 Dec 2014 10:58:16 +0100 Subject: [PATCH] Disable support for canvas rotation by default Rotation support can be enabled at runtime exporting the QGIS_ENABLE_CANVAS_ROTATION variable (set to any value) --- src/app/qgisapp.cpp | 62 +++++++++++++++++++++------------------- src/gui/qgsmapcanvas.cpp | 2 ++ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 54721b6850e..97f3598a3cb 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -1750,38 +1750,40 @@ void QgisApp::createStatusBar() statusBar()->addPermanentWidget( mScaleEdit, 0 ); connect( mScaleEdit, SIGNAL( scaleChanged() ), this, SLOT( userScale() ) ); - // add a widget to show/set current rotation - mRotationLabel = new QLabel( QString(), statusBar() ); - mRotationLabel->setObjectName( "mRotationLabel" ); - mRotationLabel->setFont( myFont ); - mRotationLabel->setMinimumWidth( 10 ); - mRotationLabel->setMaximumHeight( 20 ); - mRotationLabel->setMargin( 3 ); - mRotationLabel->setAlignment( Qt::AlignCenter ); - mRotationLabel->setFrameStyle( QFrame::NoFrame ); - mRotationLabel->setText( tr( "Rotation:" ) ); - mRotationLabel->setToolTip( tr( "Current clockwise map rotation in degrees" ) ); - statusBar()->addPermanentWidget( mRotationLabel, 0 ); + if ( getenv( "QGIS_ENABLE_CANVAS_ROTATION" ) ) { + // add a widget to show/set current rotation + mRotationLabel = new QLabel( QString(), statusBar() ); + mRotationLabel->setObjectName( "mRotationLabel" ); + mRotationLabel->setFont( myFont ); + mRotationLabel->setMinimumWidth( 10 ); + mRotationLabel->setMaximumHeight( 20 ); + mRotationLabel->setMargin( 3 ); + mRotationLabel->setAlignment( Qt::AlignCenter ); + mRotationLabel->setFrameStyle( QFrame::NoFrame ); + mRotationLabel->setText( tr( "Rotation:" ) ); + mRotationLabel->setToolTip( tr( "Current clockwise map rotation in degrees" ) ); + statusBar()->addPermanentWidget( mRotationLabel, 0 ); - mRotationEdit = new QgsDoubleSpinBox( statusBar() ); - mRotationEdit->setObjectName( "mRotationEdit" ); - mRotationEdit->setClearValue( 0.0 ); - mRotationEdit->setKeyboardTracking( false ); - mRotationEdit->setMaximumWidth( 120 ); - mRotationEdit->setDecimals( 1 ); - mRotationEdit->setMaximumHeight( 20 ); - mRotationEdit->setRange( -180.0, 180.0 ); - mRotationEdit->setWrapping( true ); - mRotationEdit->setSingleStep( 5.0 ); - mRotationEdit->setFont( myFont ); - mRotationEdit->setWhatsThis( tr( "Shows the current map clockwise rotation " - "in degrees. It also allows editing to set " - "the rotation" ) ); - mRotationEdit->setToolTip( tr( "Current clockwise map rotation in degrees" ) ); - statusBar()->addPermanentWidget( mRotationEdit, 0 ); - connect( mRotationEdit, SIGNAL( valueChanged( double ) ), this, SLOT( userRotation() ) ); + mRotationEdit = new QgsDoubleSpinBox( statusBar() ); + mRotationEdit->setObjectName( "mRotationEdit" ); + mRotationEdit->setClearValue( 0.0 ); + mRotationEdit->setKeyboardTracking( false ); + mRotationEdit->setMaximumWidth( 120 ); + mRotationEdit->setDecimals( 1 ); + mRotationEdit->setMaximumHeight( 20 ); + mRotationEdit->setRange( -180.0, 180.0 ); + mRotationEdit->setWrapping( true ); + mRotationEdit->setSingleStep( 5.0 ); + mRotationEdit->setFont( myFont ); + mRotationEdit->setWhatsThis( tr( "Shows the current map clockwise rotation " + "in degrees. It also allows editing to set " + "the rotation" ) ); + mRotationEdit->setToolTip( tr( "Current clockwise map rotation in degrees" ) ); + statusBar()->addPermanentWidget( mRotationEdit, 0 ); + connect( mRotationEdit, SIGNAL( valueChanged( double ) ), this, SLOT( userRotation() ) ); - showRotation(); + showRotation(); + } // render suppression status bar widget diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index db35c0f6a49..9fe1beb5f82 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -899,6 +899,8 @@ double QgsMapCanvas::rotation() const void QgsMapCanvas::setRotation( double degrees ) { + if ( ! getenv( "QGIS_ENABLE_CANVAS_ROTATION" ) ) return; + double current = rotation(); if ( degrees == current )