Add mouse shortcut for Fill and adapt docbook
ClosedPublic

Authored by rkflx on Jul 13 2018, 10:25 PM.

Details

Summary

D14093 will add back middle-clicking to toggle between Fit (with
F as its keyboard shortcut) and 100% zoom. In addition,
D14094 sets +F as a shortcut for Fill.

Going along with this, here we add -middle-clicking for
Fill. The code is moved to DocumentView in order not to
duplicate the handling of the toggling behaviour.

We also adapt the docbook accordingly, as some users still seem to read
the manual.

CCBUG: 396360

Depends on D14093

Test Plan

Middle-click multiple times on an image in View mode and observe
Fit is toggled. Repeat while holding down for
Fill.
Proof-read docbook ("View mode" and "Tips" sections).

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx created this revision.Jul 13 2018, 10:25 PM
Restricted Application added a project: Documentation. · View Herald TranscriptJul 13 2018, 10:25 PM
Restricted Application added a subscriber: kde-doc-english. · View Herald Transcript
rkflx requested review of this revision.Jul 13 2018, 10:25 PM
rkflx added inline comments.Jul 13 2018, 10:26 PM
lib/documentview/documentview.cpp
717

I'd rather be able to write something like setZoomMode(ZoomMode::Custom, zoomLevel) or setZoomMode(ZoomMode::Fit) here…

Code looks good to me.
Sadly the centering to mouse position when zooming to 100% gets lost with our combination.
Should I add this to DocumentView::toggleZoomTo...()? It will work for both shortcut (maybe surprising for users?) and click.
Or add an argument to pass the mouse position only for click events?

rkflx added a comment.EditedJul 15 2018, 12:06 PM

Sadly the centering to mouse position when zooming to 100% gets lost with our combination.

Interesting. Is this really working for you without the patches? For me, even middle-clicking with a KDE4-based Gwenview centers instead of respecting the mouse position.

Should I add this to DocumentView::toggleZoomTo...()? It will work for both shortcut (maybe surprising for users?) and click.
Or add an argument to pass the mouse position only for click events?

I think it would be great to get this working for both clicking and the keyboard shortcuts, see my comment in D14093#291581. (I'm not sure how well this will work for the shortcut case when the cursor is outside the viewport. If it is confusing maybe in that case there could be a fallback to the center, but let's try without the fallback first.)

Sadly the centering to mouse position when zooming to 100% gets lost with our combination.

Interesting. Is this really working for you without the patches? For me, even middle-clicking with a KDE4-based Gwenview centers instead of respecting the mouse position.

I never saw it not working. No matter what Kubuntu version I used, up to 18.04 (Frameworks 5.44 / Qt 5.9.5).

I think it would be great to get this working for both clicking and the keyboard shortcuts, see my comment in D14093#291581. (I'm not sure how well this will work for the shortcut case when the cursor is outside the viewport. If it is confusing maybe in that case there could be a fallback to the center, but let's try without the fallback first.)

It's not easy to map the current mouse position from global QCursor::pos() in a QGraphicsWidget.
But finally found a way in the Qt source. :)

muhlenpfordt accepted this revision.Jul 16 2018, 5:47 PM

Tested with the updated master and it works great now.
(Centering to cursor on Fill to be done.)

This revision is now accepted and ready to land.Jul 16 2018, 5:47 PM
This revision was automatically updated to reflect the committed changes.