Skip to content

qml: try to eliminate mouse areas in favor of handlers

Fatih Uzunoğlu requested to merge fuzun/vlc:qt/eliminatemouseareas into master

Mouse area is considered a legacy component by Qt. It is still supported, but it is hard to control touch events at the same time of using them. Recent Qt docs recommend using handlers instead of MouseArea.

There are some current problems with mouse areas:

  • In most places it is placed incorrectly. Notably "GridItem.qml". It should have placed as direct children to the control, but then it causes other problems because children mouse areas would not be in the parent-child chain.
  • Impossible to fine tune for touch control.

I switched to handlers, but they are also problematic:

  • Handlers still seem to be not stabilized in mainline Qt 6. They behave differently all over Qt versions, and there are bugs with earlier versions such as Qt 5.12.
  • blocking setting which is very useful is not available in Qt 5.
  • Handlers are available in Qt 5.12, but support is limited. For example, DragHandler can not set the cursor shape or can not adjust snapping.
  • Handlers do not provide handling for "pressed" action which is quite weird.

Both ways are problematic, thanks to Qt. But I believe this approach is better.

Request review @chub

Merge request reports

Loading