Why are you adding MouseArea on top of clickable or scrollable items?
Sorry to reply to an old post but this thread got resurrected and this caught my eye. In my case I have a MouseArea on TreeView, which is clickable and scrollable. As I recall (bearing in mind it was some time ago now) it seemed to be the only way to implement a context menu popup when right clicking tree branches. Is there something different I could have done?
(This is the old TreeView BTW - I haven't looked closely at the new one in Qt 6 to see if that is any different.)
Finally I searched a while by myself, and I think I may answer my own question. Although I couldn't completely resolve my issue, I noticed that the answer is hidden in the other MouseArea events. For example, by handling the onPressed event and adding the mouse.accepted in several key locations, I could let the component take care of the scrolling when the left mouse button is pressed, whereas the right click opens a popup menu.
My conclusion is that there is no ready-to-use way, i.e there is no parameter to activate in the MouseArea itself which may resolve this kind of issue, and the solution is a good balance between activating different parameters in the different functions.
@JLimbocker Tried your code but unfortunately it does not exactly what I want. It is selecting from the beginning instead of from where I was clicking when dragging.
Problem with passing the mouse event through to the TextField is that when I do that using mouse.accepted = false. The other handler like onRelease: are not called on the MouseArea anymore which destroys my handling there. The selectAll() could be switched off when something is already selected but I do not know why that TextField's selection is starting from the beginning...
Anyone knows how to forward the mouse events to an underlying element but still have the complete handling in the MouseArea available? That would solve my question.
I just stumbled accros the same odd behavior with Qt 5.7.1. However, the strange thing is, that it seems to be only a problem on android (on windows it's fine). Does anybody know if that's a (already reported) bug?
Hello @p3c0 thank you for helping. Unfortunately i did try as you suggested but no luck so far. Mouse wheel is not responding it just wok when i press and drag Don't know what could be the issue. I must check other files of my app maybe something is interfering with this file.