-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add option to load project extent when project is loaded #62176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add option to load project extent when project is loaded #62176
Conversation
c842450
to
0f83a24
Compare
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🪟 Windows buildsDownload Windows builds of this PR for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! One thing forgot: we need to take care of a potential difference in CRS from the map canvas (not the main) being different from. the project.
@@ -3271,7 +3271,7 @@ void QgsMapCanvas::readProject( const QDomDocument &doc ) | |||
// never manually set the crs for the main canvas - this is instead connected to the project CRS | |||
setDestinationCrs( tmpSettings.destinationCrs() ); | |||
} | |||
setExtent( tmpSettings.extent() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing this?
What we have to do here:
If the option is activated, we have to transform the extent to the CRS of the canvas and use it.
If the options is not activated, keep the existing code.
src/app/qgisapp.cpp
Outdated
|
||
if ( QgsProject::instance()->viewSettings()->canvasUseProjectExtent() ) | ||
{ | ||
zoomFull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not add this here, and leave the handling to be done in QgsMapCanvas (see my other comment)
The main goal here is to allow the possibility to set a default map extent for the project that will always be used independently of the what is saved. The question then is how do we handle different map canvas, but we didn't want to over-engineer this. |
* | ||
* \since QGIS 3.44 | ||
*/ | ||
void loadCanvasChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need a signal for this, you can remove it.
After thoughts, maybe it's cleaner and better to apply this only on the main canvas. |
@merydian A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
0f83a24
to
d2e2d90
Compare
d2e2d90
to
1f5d152
Compare
Description
Adds an option to load the extent saved under
Project Properties -> View Settings -> Set Project Full Extent
for the main canvas when a project is loaded. Also reworks the setting to useQgsExtentWidget
instead ofQgsExtentGroupBox
.Original idea by @3nids.