Skip to content

Commit 68743f9

Browse files
author
Sandro Santilli
committed
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)
1 parent 11f73e7 commit 68743f9

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

src/app/qgisapp.cpp

+34-32
Original file line numberDiff line numberDiff line change
@@ -1750,38 +1750,40 @@ void QgisApp::createStatusBar()
17501750
statusBar()->addPermanentWidget( mScaleEdit, 0 );
17511751
connect( mScaleEdit, SIGNAL( scaleChanged() ), this, SLOT( userScale() ) );
17521752

1753-
// add a widget to show/set current rotation
1754-
mRotationLabel = new QLabel( QString(), statusBar() );
1755-
mRotationLabel->setObjectName( "mRotationLabel" );
1756-
mRotationLabel->setFont( myFont );
1757-
mRotationLabel->setMinimumWidth( 10 );
1758-
mRotationLabel->setMaximumHeight( 20 );
1759-
mRotationLabel->setMargin( 3 );
1760-
mRotationLabel->setAlignment( Qt::AlignCenter );
1761-
mRotationLabel->setFrameStyle( QFrame::NoFrame );
1762-
mRotationLabel->setText( tr( "Rotation:" ) );
1763-
mRotationLabel->setToolTip( tr( "Current clockwise map rotation in degrees" ) );
1764-
statusBar()->addPermanentWidget( mRotationLabel, 0 );
1765-
1766-
mRotationEdit = new QgsDoubleSpinBox( statusBar() );
1767-
mRotationEdit->setObjectName( "mRotationEdit" );
1768-
mRotationEdit->setClearValue( 0.0 );
1769-
mRotationEdit->setKeyboardTracking( false );
1770-
mRotationEdit->setMaximumWidth( 120 );
1771-
mRotationEdit->setDecimals( 1 );
1772-
mRotationEdit->setMaximumHeight( 20 );
1773-
mRotationEdit->setRange( -180.0, 180.0 );
1774-
mRotationEdit->setWrapping( true );
1775-
mRotationEdit->setSingleStep( 5.0 );
1776-
mRotationEdit->setFont( myFont );
1777-
mRotationEdit->setWhatsThis( tr( "Shows the current map clockwise rotation "
1778-
"in degrees. It also allows editing to set "
1779-
"the rotation" ) );
1780-
mRotationEdit->setToolTip( tr( "Current clockwise map rotation in degrees" ) );
1781-
statusBar()->addPermanentWidget( mRotationEdit, 0 );
1782-
connect( mRotationEdit, SIGNAL( valueChanged( double ) ), this, SLOT( userRotation() ) );
1783-
1784-
showRotation();
1753+
if ( getenv( "QGIS_ENABLE_CANVAS_ROTATION" ) ) {
1754+
// add a widget to show/set current rotation
1755+
mRotationLabel = new QLabel( QString(), statusBar() );
1756+
mRotationLabel->setObjectName( "mRotationLabel" );
1757+
mRotationLabel->setFont( myFont );
1758+
mRotationLabel->setMinimumWidth( 10 );
1759+
mRotationLabel->setMaximumHeight( 20 );
1760+
mRotationLabel->setMargin( 3 );
1761+
mRotationLabel->setAlignment( Qt::AlignCenter );
1762+
mRotationLabel->setFrameStyle( QFrame::NoFrame );
1763+
mRotationLabel->setText( tr( "Rotation:" ) );
1764+
mRotationLabel->setToolTip( tr( "Current clockwise map rotation in degrees" ) );
1765+
statusBar()->addPermanentWidget( mRotationLabel, 0 );
1766+
1767+
mRotationEdit = new QgsDoubleSpinBox( statusBar() );
1768+
mRotationEdit->setObjectName( "mRotationEdit" );
1769+
mRotationEdit->setClearValue( 0.0 );
1770+
mRotationEdit->setKeyboardTracking( false );
1771+
mRotationEdit->setMaximumWidth( 120 );
1772+
mRotationEdit->setDecimals( 1 );
1773+
mRotationEdit->setMaximumHeight( 20 );
1774+
mRotationEdit->setRange( -180.0, 180.0 );
1775+
mRotationEdit->setWrapping( true );
1776+
mRotationEdit->setSingleStep( 5.0 );
1777+
mRotationEdit->setFont( myFont );
1778+
mRotationEdit->setWhatsThis( tr( "Shows the current map clockwise rotation "
1779+
"in degrees. It also allows editing to set "
1780+
"the rotation" ) );
1781+
mRotationEdit->setToolTip( tr( "Current clockwise map rotation in degrees" ) );
1782+
statusBar()->addPermanentWidget( mRotationEdit, 0 );
1783+
connect( mRotationEdit, SIGNAL( valueChanged( double ) ), this, SLOT( userRotation() ) );
1784+
1785+
showRotation();
1786+
}
17851787

17861788

17871789
// render suppression status bar widget

src/gui/qgsmapcanvas.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,8 @@ double QgsMapCanvas::rotation() const
899899

900900
void QgsMapCanvas::setRotation( double degrees )
901901
{
902+
if ( ! getenv( "QGIS_ENABLE_CANVAS_ROTATION" ) ) return;
903+
902904
double current = rotation();
903905

904906
if ( degrees == current )

0 commit comments

Comments
 (0)