View Single Post
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#97
Originally Posted by MartinK View Post
[...]

I *think* that if you want flick support in your custom widget and the use case does not fit a built-in container (Flickable, ListView, etc.) you are supposed to implement that yourself.

[...]
Your proposed implementation should work, as far as I can see. Seems like current code in modRana and in the demo are similar and the both lack flicking support.

Originally Posted by MartinK View Post
Also, one thing to watch for is that the mouse event coordinates are floats and you should convert them to integers as soon as possible before using them for other things. Otherwise bad things will happen - for example if you use them to move two different elements/layers during the pan by adding he position difference to x/y coordinates, the two elements/layers will gradually "float apart" due to floating point errors. All should be fine if you convert the mouse event numbers to integers first.
In the case of MapboxMap widget, there should be no issue with the floating point errors. Namely, you either plot by defining the map objects (points, roads, ...) or you paint widgets that are moving around according to the map signals (signals tell widgets exact new location in pixels). As such, we have only one center of the map and everything else is relative to that. This prevents different layers to get differently adjusted and works great, as far as I have tested.


Originally Posted by MartinK View Post
How do I build & run the demo app on desktop (Fedora 26 in my case)? Just load it to a recent QtCreator or is there more ? Don't really want to promise anything just now though - I'm already working on quite many things in modRana at the same time (routing overlay, making it possible to switch between different map element implementations, general stabilization so that a new modRana release can be made in a reasonably near future, etc.).
Very-very simple (instructions have not been tested in real life, correct as needed):

* clone recursively https://github.com/rinigus/pkg-mapbox-gl-native

* make subdir build

* copy mapbox-gl-native-lib.pro to mapbox-gl-native subdir

* in build subdir, qmake5 ../mapbox-gl-native/mapbox-gl-native-lib.pro

* make -jXX

* clone https://github.com/rinigus/mapbox-gl-qml

* open in QtCreator mapbox-gl-qml/app/mapbox-qml.pro

* Adjust mapbox-qml.pro (https://github.com/rinigus/mapbox-gl...ox-qml.pro#L12 ) INCLUDEPATH and LIBS to point to pkg-mapbox-gl-native/build and pkg-mapbox-gl-native/mapbox-gl-native location accordingly.

* Should compile and run from the creator. To run outside, adjust LD_LIBRARY_PATH if needed.

To run in modRana, you would have to install the QML extension. This is done via https://github.com/rinigus/mapbox-gl...box-gl-qml.pro - here you probably can just comment out QMAKE_XXX vars.

NB! I don't know what's gcc is on Fedora - you need decent c++14 support. Probably gcc 4.9 is fine, but I am not 100% sure. If the support is insufficient, pkg-mapbox-gl-native build will fail.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post: