Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › How can i load a file in C++ (the file need to be loaded at compilation)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24092

    Florian

    Hello,

     

    I’m currently trying to use MQTT with Felgo, I’m not using the QT official libraries but it works without SSL.
    The problem is the certificate file, I want to use SSL and I need to read a certificate. I can’t open the file like this :

    p_sslConfig = QSslConfiguration::defaultConfiguration();
    
    QFile certfile("./broker.emqxio-ca.crt");
    Q_ASSERT(certfile.open(QIODevice::ReadOnly)); //! ERROR HERE
    QSslCertificate cert(&certfile, QSsl::Pem);
    p_sslConfig.setLocalCertificate(cert);
    
    p_client = new QMQTT::Client(MQTT_URL, MQTT_PORT, p_sslConfig);

     

    It seems logic that it’s not working, but how can I add a file to the APK and open it in C++ (Same problem for IOS).

    I didn’t find help your documentation, did I miss it or is it even possible ?

     

    I hope you’ll have a solution.

    Thank you for your time.

    #24093

    Filippo
    Felgo Team

    Hi Florian,

     

    the easiest solution is adding the needed files to the qrc resources files: https://doc.qt.io/qt-5/resources.html .

     

    Once added your files are deployed together with your binary files and access through QFile is transparent on every platform.

     

    Hoping that’s enough to get you started.

    #24095

    Florian

    Hi Filippo,

    Thanks for the advise, it work now. 😀
    It was quite simple, I didn’t checked the right place.

    Cordially.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded