Access QML MapType in c++



  • Hi

    I need to access and store a QML Maptype variable in c++. How do I store this type? I am able to store individual properties of the maptype in lists but is it possible to store as it is with out using user defined types?



  • @saitej Hi! If I get the docs right there's no C++ API yet:

    Maps and Navigation (C++)
    [...]
    Currently it is not possible to interact with maps via C++. Mapping applications must use the Maps and Navigation (QML) API.

    Looks like you need to make a custom type to store the info.



  • @Wieland
    They have done it some way on this link .
    The variable m_supportedMapTypes. I think it uses QGeomaptype



  • Also, How do I access the activeMapType for a qml map. I have accessed the map from c++ in the following way.

    QQuickItem *item = widget->rootObject()->findChild<QQuickItem*>("map_main");
    

    and I am trying to set the property of the map like this

    item->setProperty("activeMapType",maptype.name) ;
    

    Is it the right way because I am not able to access the current active maptype also via

     x= item->property("activeMapType.name").toString();
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.