mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
keep rotation support state in canvas (followup 204e7104)
This commit is contained in:
parent
204e7104fc
commit
d11cc82b3f
@ -161,7 +161,7 @@ class QgsMapCanvas : QGraphicsView
|
||||
void clearExtentHistory();
|
||||
|
||||
/** Zoom to the extent of the selected features of current (vector) layer.
|
||||
Added in version 1.2: optionally specify different than current layer */
|
||||
@param layer optionally specify different than current layer */
|
||||
void zoomToSelected( QgsVectorLayer* layer = NULL );
|
||||
|
||||
/** Pan to the selected features of current (vector) layer keeping same extent. */
|
||||
@ -203,7 +203,7 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! return number of layers on the map
|
||||
int layerCount() const;
|
||||
|
||||
//! return list of layers within map canvas. Added in v1.5
|
||||
//! return list of layers within map canvas.
|
||||
QList<QgsMapLayer*> layers() const;
|
||||
|
||||
/*! Freeze/thaw the map canvas. This is used to prevent the canvas from
|
||||
@ -350,6 +350,14 @@ 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 );
|
||||
|
||||
signals:
|
||||
/** Let the owner know how far we are with render operations */
|
||||
//! @deprecated since 2.4 - already unused in 2.0 anyway
|
||||
@ -365,6 +373,10 @@ class QgsMapCanvas : QGraphicsView
|
||||
//! Emitted when the extents of the map change
|
||||
void extentsChanged();
|
||||
|
||||
//! Emitted when the rotation of the map changes
|
||||
//! @note added in 2.8
|
||||
void rotationChanged( double );
|
||||
|
||||
/** Emitted when the canvas has rendered.
|
||||
|
||||
Passes a pointer to the painter on which the map was drawn. This is
|
||||
@ -383,8 +395,7 @@ class QgsMapCanvas : QGraphicsView
|
||||
void mapCanvasRefreshed();
|
||||
|
||||
// ### QGIS 3: rename to mapRefreshStarted()
|
||||
/** Emitted when the canvas is about to be rendered.
|
||||
\note Added in 1.5 */
|
||||
/** Emitted when the canvas is about to be rendered. */
|
||||
void renderStarting();
|
||||
|
||||
//! Emitted when a new set of layers has been received
|
||||
|
@ -1684,7 +1684,6 @@ void QgisApp::createStatusBar()
|
||||
mCoordsEdit->setMaximumHeight( 20 );
|
||||
mCoordsEdit->setContentsMargins( 0, 0, 0, 0 );
|
||||
mCoordsEdit->setAlignment( Qt::AlignCenter );
|
||||
mCoordsEdit->setAlignment( Qt::AlignCenter );
|
||||
QRegExp coordValidator( "[+-]?\\d+\\.?\\d*\\s*,\\s*[+-]?\\d+\\.?\\d*" );
|
||||
mCoordsEditValidator = new QRegExpValidator( coordValidator, mCoordsEdit );
|
||||
mCoordsEdit->setWhatsThis( tr( "Shows the map coordinates at the "
|
||||
@ -1726,7 +1725,7 @@ void QgisApp::createStatusBar()
|
||||
statusBar()->addPermanentWidget( mScaleEdit, 0 );
|
||||
connect( mScaleEdit, SIGNAL( scaleChanged() ), this, SLOT( userScale() ) );
|
||||
|
||||
if ( QSettings().value( "/qgis/canvasRotation", true ).toBool() )
|
||||
if ( QgsMapCanvas::rotationEnabled() )
|
||||
{
|
||||
// add a widget to show/set current rotation
|
||||
mRotationLabel = new QLabel( QString(), statusBar() );
|
||||
@ -1747,7 +1746,6 @@ void QgisApp::createStatusBar()
|
||||
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 );
|
||||
@ -2098,10 +2096,6 @@ void QgisApp::setupConnections()
|
||||
connect( this, SIGNAL( projectRead() ),
|
||||
this, SLOT( checkForDeprecatedLabelsInProject() ) );
|
||||
|
||||
// reset rotation on new project
|
||||
connect( this, SIGNAL( newProject() ),
|
||||
this, SLOT( resetMapSettings() ) );
|
||||
|
||||
// setup undo/redo actions
|
||||
connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) );
|
||||
}
|
||||
@ -3530,7 +3524,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
|
||||
|
||||
//QgsDebugMsg("emiting new project signal");
|
||||
|
||||
//emit signal so QgsComposer knows we have a new project
|
||||
// emit signal so listeners know we have a new project
|
||||
emit newProject();
|
||||
|
||||
mMapCanvas->freeze( false );
|
||||
|
@ -151,7 +151,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
QgsRasterLayer *addRasterLayer( const QString &rasterFile, const QString &baseName, bool guiWarning = true );
|
||||
|
||||
/** Returns and adjusted uri for the layer based on current and available CRS as well as the last selected image format
|
||||
* @note added in 2.4
|
||||
* @note added in 2.8
|
||||
*/
|
||||
QString crsAndFormatAdjustedLayerUri( const QString& uri, const QStringList& supportedCrs, const QStringList& supportedFormats ) const;
|
||||
|
||||
|
@ -583,7 +583,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
|
||||
cbxCopyWKTGeomFromTable->setChecked( settings.value( "/qgis/copyGeometryAsWKT", true ).toBool() );
|
||||
leNullValue->setText( settings.value( "qgis/nullValue", "NULL" ).toString() );
|
||||
cbxIgnoreShapeEncoding->setChecked( settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() );
|
||||
cbxCanvasRotation->setChecked( settings.value( "/qgis/canvasRotation", true ).toBool() );
|
||||
cbxCanvasRotation->setChecked( QgsMapCanvas::rotationEnabled() );
|
||||
|
||||
cmbLegendDoubleClickAction->setCurrentIndex( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() );
|
||||
|
||||
@ -1111,7 +1111,7 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
|
||||
bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool();
|
||||
settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
|
||||
settings.setValue( "/qgis/canvasRotation", cbxCanvasRotation->isChecked() );
|
||||
QgsMapCanvas::enableRotation( cbxCanvasRotation->isChecked() );
|
||||
|
||||
// Default simplify drawing configuration
|
||||
QgsVectorSimplifyMethod::SimplifyHints simplifyHints = QgsVectorSimplifyMethod::NoSimplification;
|
||||
|
@ -904,7 +904,7 @@ double QgsMapCanvas::rotation() const
|
||||
|
||||
void QgsMapCanvas::setRotation( double degrees )
|
||||
{
|
||||
if ( !QSettings().value( "/qgis/canvasRotation", true ).toBool() )
|
||||
if ( !rotationEnabled() )
|
||||
return;
|
||||
|
||||
double current = rotation();
|
||||
@ -1905,3 +1905,13 @@ bool QgsMapCanvas::event( QEvent * e )
|
||||
return done;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QgsMapCanvas::rotationEnabled()
|
||||
{
|
||||
return QSettings().value( "/qgis/canvasRotation", true ).toBool();
|
||||
}
|
||||
|
||||
void QgsMapCanvas::enableRotation( bool enable )
|
||||
{
|
||||
QSettings().setValue( "/qgis/canvasRotation", enable );
|
||||
}
|
||||
|
@ -419,6 +419,14 @@ 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 );
|
||||
|
||||
private slots:
|
||||
//! called when current maptool is destroyed
|
||||
void mapToolDestroyed();
|
||||
@ -644,7 +652,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
QgsPreviewEffect* mPreviewEffect;
|
||||
|
||||
QgsRectangle imageRect( const QImage& img );
|
||||
|
||||
}; // class QgsMapCanvas
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user