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

Refactor Schematic::sizeOfSelection #633

Merged
merged 6 commits into from
Mar 13, 2024

Conversation

wawuwo
Copy link
Contributor

@wawuwo wawuwo commented Mar 8, 2024

Hi!

A bit of refactoring of one of the Schematic's member functions. The main idea is to move the function from returning result via a set of argument reference variables to returning it the usual way, packed in suitable abstraction.

Commits are logically independent and reasonably small, so I suggest reviewing them one by one.

The function is invoked only when "zoom to selection" is performed, so if there any bugs they will affect zooming.

wawuwo added 6 commits March 8, 2024 14:14
Schematic::sizeOfSelection have a set of variables declared in
the beginning of function body. These variables are used as loop
variables further down in function body, which is bad because:
 - variable declarations are far from their actual usage
 - variables have unnecessary large scope

This commit replaces them with `auto` variables declared directly
in loops.
Schematic::sizeOfSelection returns values back to the client
via four reference variables passed to it as arguments. This
is not very elegant and most important it doesn't convey return
values semantics.

This commit makes 'sizeOfSelection' return QRect as usual return
value of function.
@zergud zergud merged commit 574c9ad into ra3xdh:current Mar 13, 2024
2 checks passed
@wawuwo wawuwo deleted the refactor-size-of-selection branch March 14, 2024 18:18
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.

2 participants