Skip to content
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

Add Last & Next zoom actions in layouts #58789

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

YoannQDQ
Copy link
Contributor

@YoannQDQ YoannQDQ commented Sep 18, 2024

Description

Adapt QgsMapCanvas zoomToLastExtent / zoomToNextExtent to the QgsLayoutView.

layout_zoom_history

@github-actions github-actions bot added this to the 3.40.0 milestone Sep 18, 2024
Copy link

github-actions bot commented Sep 18, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit dc9abb6)

@nyalldawson nyalldawson added the Frozen Feature freeze - Do not merge! label Sep 18, 2024
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from be685de to a6bf1bf Compare September 18, 2024 21:28
@nyalldawson
Copy link
Collaborator

@YoannQDQ got a screencast or screenshot of this in action?

(It's great to see you back! 😁 🥳)

@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from a6bf1bf to 8f896a5 Compare September 22, 2024 22:14
@YoannQDQ
Copy link
Contributor Author

Done! Also fixed pan handling. By the way @nyalldawson I noticed I can no longer edit the label(s) on the issues I create. Could I maybe get the privilege back? Thanks.

@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from dc9abb6 to bbbf7ce Compare October 14, 2024 20:25
Copy link

github-actions bot commented Oct 14, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 47f2a6a)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 47f2a6a)

@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from bbbf7ce to ec5b8ec Compare October 21, 2024 07:25
@YoannQDQ YoannQDQ added Feature Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels Oct 22, 2024
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from ec5b8ec to 5184972 Compare October 28, 2024 22:09
@YoannQDQ YoannQDQ modified the milestones: 3.40.0, 3.42.0 Oct 31, 2024
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from 5184972 to ff61225 Compare November 4, 2024 13:19
@YoannQDQ YoannQDQ closed this Nov 5, 2024
@YoannQDQ YoannQDQ reopened this Nov 5, 2024
@YoannQDQ YoannQDQ removed the Frozen Feature freeze - Do not merge! label Nov 5, 2024
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from ff61225 to 0192669 Compare November 13, 2024 16:09
src/app/layout/qgslayoutdesignerdialog.cpp Outdated Show resolved Hide resolved
src/gui/layout/qgslayoutview.cpp Outdated Show resolved Hide resolved
Comment on lines +70 to +73
connect( this, &QgsLayoutView::zoomLevelChanged, this, &QgsLayoutView::extentChanged );

verticalScrollBar()->installEventFilter( this );
horizontalScrollBar()->installEventFilter( this );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could all this logic be moved into the existing QgsLayoutView::viewChanged method? That should already be getting called whenever the view extent is changed, and already handles all the different ways this can happen.

That should also avoid the emit view()->extentChanged(); calls from other classes, which is rather fragile.

Copy link
Contributor Author

@YoannQDQ YoannQDQ Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is viewChanged is called every time the scrollbar moves. So dragging the scrollbar handle will trigger many MANY viewChanged calls, and we dont want them to clutter the zoom level history. Similarly, we do not want to add entries in the history while dragging the view with the pan tool.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above -- I'd handle this by using a timer to "collapse" extents which were used very close to each other.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on this @YoannQDQ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the approach you suggested is better (it could also be applied to the map canvas imho). There's some additional consideration in the layout view since changing the scale will sometime make the scalebars appears/disappear, which in turn slightly change the view center and does not play well with the zoom/center history. It is on my backlog, but I haven't had the time to finalize it yet.

src/gui/layout/qgslayoutview.cpp Outdated Show resolved Hide resolved
@nyalldawson
Copy link
Collaborator

For bonus points you could handle Qt::BackButton and Qt::ForwardButton in QgsLayoutView::mouseReleaseEvent, just like we do in QgsMapCanvas. 🥳

@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from 0192669 to f1805b3 Compare November 14, 2024 15:25
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from f1805b3 to 0353c3f Compare November 22, 2024 21:38
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch 2 times, most recently from 599af3e to 2c41878 Compare December 6, 2024 23:02
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch 2 times, most recently from 5e37b15 to 5edaaa6 Compare December 21, 2024 12:44
Copy link

github-actions bot commented Jan 5, 2025

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jan 5, 2025
@YoannQDQ YoannQDQ removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jan 6, 2025
@YoannQDQ YoannQDQ force-pushed the zoom-next-last-in-layouts branch from 5edaaa6 to 47f2a6a Compare January 6, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks
Projects
None yet
3 participants