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

Fix some Qt deprecation warnings, memory leaks; clean up related code #206

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

vedgy
Copy link
Contributor

@vedgy vedgy commented Feb 10, 2021

See the commit messages for details.

@@ -141,31 +141,34 @@ void MagnifyingGlass::updateImage()
}
void MagnifyingGlass::wheelEvent(QWheelEvent *event)
{
// TODO: consider handling horizontal scrolling differently.
const auto delta = event->angleDelta().x() + event->angleDelta().y();
const bool grow = delta < 0;
Copy link
Contributor Author

@vedgy vedgy Feb 10, 2021

Choose a reason for hiding this comment

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

The zoom in/out direction of the Magnifying glass is opposite to the direction in other applications. Is this intentional or an oversight that should be fixed by initializing grow with delta > 0? If this is intentional, the reason should be explained in a comment.

@vedgy vedgy mentioned this pull request Mar 7, 2021
Add a local elapsedMs variable to improve readability and performance.

Remove some of the redundant parentheses in a long `if` statement to
improve readability.
QTime's start(), restart() and elapsed() member functions have been
deprecated since Qt 5.14 and were removed in Qt 6.

Don't leak the timer object in ScrollManagement.

Add a local elapsedMs variable to improve readability and performance.

Remove some of the redundant parentheses to improve readability.
GoToFlow and ComicFlow are the only two classes that use YACReaderFlow.
They both handled wheelEvent() manually in practically the same way as
YACReaderFlow does now, except for time and minimum move checks in
ScrollManagement::getMovement().

This new implementation is equivalent to and consistent with the OpenGL
version in YACReaderFlowGL::wheelEvent().
QWheelEvent::orientation() and QWheelEvent::delta() are deprecated. The
documentation for both suggests using QWheelEvent::angleDelta() instead.

Keep treating the horizontal mouse wheel the same as vertical in Comic
and Page Flow: comics and pages move horizontally, so horizontal
scrolling is even more natural than vertical in these cases.

Viewer handles horizontal scrolling separately - to scroll the comic
page to the right or to the left. So ScrollManagement must ignore
horizontal delta in this case. For this purpose the new parameter in
ScrollManagement::getMovement() determines which orientations are taken
into account: horizontal, vertical or both.

Remove redundant parentheses in long `if` statements to improve
readability.
Keep treating horizontal and vertical scrolling equivalently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant