Skip to content

Commit

Permalink
Remove canvas rotation option + API, now always enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 20, 2016
1 parent 185ad05 commit 44c8680
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 92 deletions.
6 changes: 6 additions & 0 deletions doc/api_break.dox
Expand Up @@ -97,6 +97,12 @@ objects are implicitly shared, returning a copy helps simplify and make code mor
only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
</ul>

\subsection qgis_api_break_3_0_QgsMapCanvas QgsMapCanvas

<ul>
<li>rotationEnabled() and enableRotation() have been removed, since map rotation is now always supported</li>
</ul>

\subsection qgis_api_break_3_0_QgsMapLayer QgsMapLayer

<ul>
Expand Down
8 changes: 0 additions & 8 deletions python/gui/qgsmapcanvas.sip
Expand Up @@ -446,14 +446,6 @@ class QgsMapCanvas : QGraphicsView
//! ask user about datum transformation
void getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId );

//! return if canvas rotation is enabled
//! @note added in 2.8
static bool rotationEnabled();

//! change canvas rotation support
//! @note added in 2.8
static void enableRotation( bool enabled );

//! Sets the factor of magnification to apply to the map canvas. Indeed, we
//! increase/decrease the DPI of the map settings according to this factor
//! in order to render marker point, labels, ... bigger.
Expand Down
65 changes: 31 additions & 34 deletions src/app/qgisapp.cpp
Expand Up @@ -2328,40 +2328,37 @@ void QgisApp::createStatusBar()
mMagnifierWidget->updateMagnification( QSettings().value( "/qgis/magnifier_factor_default", 1.0 ).toDouble() );
statusBar()->addPermanentWidget( mMagnifierWidget, 0 );

if ( QgsMapCanvas::rotationEnabled() )
{
// 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->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();
}
// 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->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();

// render suppression status bar widget
mRenderSuppressionCBox = new QCheckBox( tr( "Render" ), statusBar() );
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsoptions.cpp
Expand Up @@ -642,7 +642,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
QgsClipboard::AttributesWithWKT : QgsClipboard::AttributesOnly ) );
leNullValue->setText( mSettings->value( "qgis/nullValue", "NULL" ).toString() );
cbxIgnoreShapeEncoding->setChecked( mSettings->value( "/qgis/ignoreShapeEncoding", true ).toBool() );
cbxCanvasRotation->setChecked( QgsMapCanvas::rotationEnabled() );

cmbLegendDoubleClickAction->setCurrentIndex( mSettings->value( "/qgis/legendDoubleClickAction", 0 ).toInt() );

Expand Down Expand Up @@ -1206,7 +1205,6 @@ void QgsOptions::saveOptions()
mSettings->setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
bool legendLayersCapitalise = mSettings->value( "/qgis/capitaliseLayerName", false ).toBool();
mSettings->setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
QgsMapCanvas::enableRotation( cbxCanvasRotation->isChecked() );

// Default simplify drawing configuration
QgsVectorSimplifyMethod::SimplifyHints simplifyHints = QgsVectorSimplifyMethod::NoSimplification;
Expand Down
13 changes: 0 additions & 13 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -1021,9 +1021,6 @@ double QgsMapCanvas::rotation() const

void QgsMapCanvas::setRotation( double degrees )
{
if ( !rotationEnabled() )
return;

double current = rotation();

if ( degrees == current )
Expand Down Expand Up @@ -2197,16 +2194,6 @@ bool QgsMapCanvas::event( QEvent * e )
}
#endif

bool QgsMapCanvas::rotationEnabled()
{
return QSettings().value( "/qgis/canvasRotation", true ).toBool();
}

void QgsMapCanvas::enableRotation( bool enable )
{
QSettings().setValue( "/qgis/canvasRotation", enable );
}

void QgsMapCanvas::refreshAllLayers()
{
// reload all layers in canvas
Expand Down
8 changes: 0 additions & 8 deletions src/gui/qgsmapcanvas.h
Expand Up @@ -516,14 +516,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! ask user about datum transformation
void getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId );

//! return if canvas rotation is enabled
//! @note added in 2.8
static bool rotationEnabled();

//! change canvas rotation support
//! @note added in 2.8
static void enableRotation( bool enabled );

//! Sets the factor of magnification to apply to the map canvas. Indeed, we
//! increase/decrease the DPI of the map settings according to this factor
//! in order to render marker point, labels, ... bigger.
Expand Down
42 changes: 15 additions & 27 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -308,7 +308,7 @@
<item>
<widget class="QStackedWidget" name="mOptionsStackedWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="mOptionsPageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -338,7 +338,7 @@
<x>0</x>
<y>0</y>
<width>723</width>
<height>670</height>
<height>640</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down Expand Up @@ -681,17 +681,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_32">
<item>
<widget class="QCheckBox" name="cbxCanvasRotation">
<property name="text">
<string>Canvas rotation support (restart required)</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -2623,8 +2612,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>147</width>
<height>240</height>
<width>617</width>
<height>607</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_46">
Expand Down Expand Up @@ -2770,8 +2759,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>327</height>
<width>617</width>
<height>607</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
Expand Down Expand Up @@ -3544,8 +3533,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>571</height>
<width>617</width>
<height>607</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_39">
Expand Down Expand Up @@ -3813,7 +3802,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<width>601</width>
<height>668</height>
</rect>
</property>
Expand Down Expand Up @@ -4358,8 +4347,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>474</width>
<height>372</height>
<width>617</width>
<height>607</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -4497,7 +4486,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>574</width>
<width>601</width>
<height>644</height>
</rect>
</property>
Expand Down Expand Up @@ -4743,8 +4732,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>305</width>
<height>226</height>
<width>617</width>
<height>607</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
Expand Down Expand Up @@ -4852,7 +4841,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<width>601</width>
<height>737</height>
</rect>
</property>
Expand Down Expand Up @@ -5430,7 +5419,6 @@
<tabstop>mCustomGroupBoxChkBx</tabstop>
<tabstop>mNativeColorDialogsChkBx</tabstop>
<tabstop>mLiveColorDialogsChkBx</tabstop>
<tabstop>cbxCanvasRotation</tabstop>
<tabstop>mProjectOnLaunchCmbBx</tabstop>
<tabstop>mProjectOnLaunchLineEdit</tabstop>
<tabstop>mProjectOnLaunchPushBtn</tabstop>
Expand Down

0 comments on commit 44c8680

Please sign in to comment.