Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
support multi-touch #963
base: dev
Are you sure you want to change the base?
support multi-touch #963
Changes from 1 commit
5ad0a9c
f42ce1e
79de84d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Please use braces and indentation to better indicate the scope.
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.
Is there a reason to use an
eventFilter
in the scene instead of overridingevent()
in the view? I would assume (but have not tested!) that the touch events arrive at the view and can be handled there. If this is the case, then I would also move the event handling to the view, while the multi-touch drawing code could be here in the scene.What you're touching with your finger is a screen with a widget, which is the view. You don't "touch" the scene. The scene just holds all the graphics items.
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.
Qt6 recommends to prefer the C++ range based
for
over theforeach
keyword. See https://doc.qt.io/qt-6/foreach-keyword.html. It is also recommended to use a const reference in a case like this to avoid copying the point.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.
Is there a reason to not have
lastPoint_m
andendPoint_m
as local variables if they are reassigned every time?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.
What is
distance
used for? It's defined here but never used.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.
In terms of performance,
QList::contains
has linear runtime in the number of lines contained, especially if the line isn't in the list. Are duplicates a serious issue?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.
This is important because there are so many duplicates that the page can take a long time to load
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.
If we are spending so much time on searching rather than appending, it might be worth using
QSet
instead ofQList
.QSet
requires a bit more memory, but look-up is really fast.Can you test it with
QSet
and report back whether it makes an appreciable difference in performance? Otherwise I'd just leave it as is.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.
Does this have any effect? It's overwritten later, see above.