Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

OpenStreetMaps with QtWidgets/C++



  • Hi,

    I'm trying to implement a simple way to get position information via visual maps from OpenStreetMaps. Extensive search has shown me that it is not possible to do it with QtWidgets and C++. Every example I've found shows the way as QML and osm plugin. And also this page says that it is not possible to use C++ as of now.

    Is this correct?

    If so, is it possible to insert a QML page (or widget?) into a Qt Widgets application? Or do I have to convert the project to QML somehow?

    Thanks in advance. Any help is highly appreciated.


  • Lifetime Qt Champion

    Hi,

    QQuickWidget comes to mind from your description.

    Hope it helps



  • Thank you SGaist,

    I guess this would be the easiest way to do it. I'd have to write some QML code after a while.



  • Hi,

    I've applied a simple example into my project and can see the QQuickWidget inside of my QDialog window. But somehow the tiles are not loaded properly. I'm getting errors like these;

    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
    qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
    qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
    qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
    qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
    qt.network.ssl: QSslSocket: cannot resolve sk_new_null
    qt.network.ssl: QSslSocket: cannot resolve sk_push
    ...
    

    Clearly the TLS handshake is not working at all.

    I can build and run minimal_map example and able to see the tiles. So it should be something with my project settings or something like that.

    Could it be the QtQuickWidget?

    Regards,


  • Lifetime Qt Champion

    It doesn't find the OpenSSL version matching the one used when building Qt. A v1.1 VS v1.0 classic issue. Which version of Qt are you using ?
    On what platform ?



  • I'm using 5.12 on Ubuntu 18.10. And after switching to 5.12 in the QML file everything started to work normal. I guess, like you said, the project configuration and qml imports were not matching. Thanks for helping me out.

    Now I'll have to find how I could switch to "cycle" map, download offline tiles and use them and control the map view via C++.


Log in to reply