Details
-
Task
-
Resolution: Fixed
-
Not Evaluated
-
None
-
None
-
7867a683f (dev), 4b81f1a34 (dev), eaab46307 (dev), 123fc9742 (6.5), 15ec82c25 (6.5)
Description
We feel the need to do this to prove that Pointer Handlers are done. There should be suitable handlers for all of the gestures that maps actually need.
I made a naive attempt here to rip out everything and start over: https://codereview.qt-project.org/#/c/221725/ but found some issues. A big one is that QDeclarativeGeoMap has
Q_PROPERTY(QQuickGeoMapGestureArea *gesture READ gesture CONSTANT)
that is, QQuickGeoMapGestureArea (the very thing we are trying to get rid of) is part of its public API. So, unless we can get rid of that (which would break many applications), we have to keep it working... so it seems that to use Pointer Handlers, they must be programmatically instantiated inside. We can use them to do the work, but we have to keep QQuickGeoMapGestureArea's public API working too.
This implies that Pointer Handers need to have public C++ API to make such things possible: and it's a good way of verifying that the C++ API will be useful, too. Perhaps Qt Quick Controls could later on make use of the same C++ API. But this is a lot of work, and is not yet started.
The other big issue I noticed is that the map item is not just a map renderer which can be panned inside a Flickable for example. It actually only renders the part of the map which should be visible. Therefore it will not work to let DragHandler try to drag it around simply by changing its x and y coordinates like we're doing in FakeFlickable. So maybe we have to set `target` to null, and in a slot connected to translationChanged, convert the pixel-based translation vector to a geo coordinate offset, and ask the map to recenter there. Or something like that. What I tried to do is make the map render 3x as big in each direction so that you can always drag it within the bounds of the viewport (and then it re-renders when you release the point), but that wastes more memory and CPU power, and does not allow extreme pinch-zooming either.
All in all, I think the map item is not architected to be a good "do one thing and do it well" component; and because of having public API, we can't change it too much either. The way I see it, rendering maps should be based on some sort of reusable tile-rendering item whose size in pixels is as big as the whole map, but which somehow gets informed of the area within that which actually needs to be rendered. (It should be reusable for Table, too. TableView has the same problem, that it does too much internally rather than just managing the rendering of the cells and leaving everything else up to other components.) Maybe you have to subclass it in C++ to write the tile-providing logic. You end up with an Item that simply renders the relevant part of the map, and has no other responsibilities. Then, you put it inside an Item which is used to clip it, and which also hosts the PinchHandler, the DragHandler and so on. (The same architecture as FakeFlickable.) Those manipulate the map item's coordinates and scale. It would be much more modular, much easier to compose any kind of UI that you like by working better with the rest of QtQuick.
It has been said though, that because OpenGL uses float coordinates, not doubles, perhaps the pixel-coordinate precision is not good enough to do it that way. (At the maximum zoom level, how big is the whole world in pixels? How much land area does one pixel represent then? Can you still drag it by one pixel, or would it jump across larger distances when you try to do that?)
Attachments
Issue Links
- depends on
-
QTBUG-67965 PinchHandler: if the first-pressed touchpoint is released first, the target item jumps
- Reported
-
QTBUG-109373 DragHandler and PinchHandler: meaning of axis persistentValue is wrong
- Reported
-
QTBUG-75486 BoundaryRule can only transform an Item around its transformOrigin
- Reported
-
QTBUG-102307 WheelHandler may need limits
- Reported
-
QTBUG-109395 PinchHandler needs to provide translation deltas for non-centered zooming even with weird axis target properties and scaling
- Reported
-
QTBUG-108549 PinchHandler.scale loses the accumulated scaling if target == null
- Closed
-
QTBUG-68110 Pointer Handlers: get ready for public C++ API support
- Reported
-
QTBUG-68106 decide whether to add a 2-finger-drag Pointer Handler (or add feature to an existing one)
- Closed
- is required for
-
QTBUG-96795 QtLocation maps to Qt 6.2
- Closed
- relates to
-
QTBUG-108542 enable use of ScriptAction with Behavior
- Reported
-
QTBUG-76379 PinchHandler should have a way to reset
- Closed
- replaces
-
QTBUG-53634 Qml Map pinch gesture never completes causing control to become unresponsive
- Closed
-
QTBUG-79063 QDeclarativeGeoMap with custom QQuickGeoMapGestureArea possible?
- Reported