This appears to be a difference in mouse event handling from 4.x since the current code handles double click OK with 4.7 and 4.8 but with 5.x treats it as a triple click.
On Qt 4.x a double click is seen as two events: a mousePressEvent and then a mouseDoubleClickEvent. On 5.x there are three events: two occurrences of mousePressEvent then a mouseDoubleClickEvent.
The code could be modified with a Qt version number #if. There may also some other way of interpreting the events.
I'll accept a well-written patch that works on both 4.x and 5.x. If no one else gets to it, I may work on this but not for a while.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
but usually you communicate via the accepted flag of a event, if it was handled. One could just add a early return here, if the event was accepted, but then in the mouseReleaseEvent the emit comes last (for symmetry reasons I suppose), so the user cannot intercept the release handling of Scintilla.
One could have two signals (beginning and end) in each mouse event and return early, if the beginning one is accepted. Maybe even more Qt-like, one could leave these signals out entirely and rely on the event filter mechanism of Qt, which allows the user do decide which events are passed to Scintilla.
At lease I would start accepting handled events like this (incorporates my former patch):
So this ticket is starting to conflate different issues. I agree that defining away the mouseDoubleClickEvent on Qt 5 is probably the right fix.
I can't comment on the signals that take event parameters. Those don't look familiar to me. The signals were mostly meant to implement Scintilla notifications.
What's the purpose of adding the accept calls? What problem does it solve?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, it depends what the Qt integration should be. If there is the vision of a Scintilla Qt component, which fits seamless in the Qt eco system, then using their event style is very important. So, adding the accept calls was a first very small step. For just resolving the bug, the first patch could do it. (I don't know the full Scintilla side of course, and just a bit of the Qt side...)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I try to avoid calling accept or ignore unless there's some good reason for it. I believe that events are accepted by default so calling accept explicitly is usually unnecessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This appears to be a difference in mouse event handling from 4.x since the current code handles double click OK with 4.7 and 4.8 but with 5.x treats it as a triple click.
On Qt 4.x a double click is seen as two events: a mousePressEvent and then a mouseDoubleClickEvent. On 5.x there are three events: two occurrences of mousePressEvent then a mouseDoubleClickEvent.
The code could be modified with a Qt version number #if. There may also some other way of interpreting the events.
I'll accept a well-written patch that works on both 4.x and 5.x. If no one else gets to it, I may work on this but not for a while.
What about:
I put the whole method in an #ifdef to get rid of the unused warning of the "event". Works well with my setup. Thanks for pointing me to the problem.
Last edit: mickey 2014-02-07
Committed with reformat as [6b9cc8].
Related
Commit: [6b9cc8]
Well I thought about it. To me it feels the current behaviour is not very Qt-like.
The events are passed to the user e.g. by
but usually you communicate via the accepted flag of a event, if it was handled. One could just add a early return here, if the event was accepted, but then in the mouseReleaseEvent the emit comes last (for symmetry reasons I suppose), so the user cannot intercept the release handling of Scintilla.
One could have two signals (beginning and end) in each mouse event and return early, if the beginning one is accepted. Maybe even more Qt-like, one could leave these signals out entirely and rely on the event filter mechanism of Qt, which allows the user do decide which events are passed to Scintilla.
At lease I would start accepting handled events like this (incorporates my former patch):
So this ticket is starting to conflate different issues. I agree that defining away the mouseDoubleClickEvent on Qt 5 is probably the right fix.
I can't comment on the signals that take event parameters. Those don't look familiar to me. The signals were mostly meant to implement Scintilla notifications.
What's the purpose of adding the accept calls? What problem does it solve?
Well, it depends what the Qt integration should be. If there is the vision of a Scintilla Qt component, which fits seamless in the Qt eco system, then using their event style is very important. So, adding the accept calls was a first very small step. For just resolving the bug, the first patch could do it. (I don't know the full Scintilla side of course, and just a bit of the Qt side...)
I try to avoid calling accept or ignore unless there's some good reason for it. I believe that events are accepted by default so calling accept explicitly is usually unnecessary.
Qt 5.3 reverts to 4.x behaviour so this patch was reverted with [56de49].
Related
Commit: [56de49]