.bin file from qml



  • how to make ubuntu binary file(.bin executable file) from qml UI file.



  • First create a Qt Quick Application not Qt Quick UI. Then you should be able to load your qml files through a QDeclarativeView then you can easily create executable files.



  • i tried this way too...create a quick application and it generate the binary file for the main.cpp only....

    if i clicked the .bin file without qml means it only shows blank white screen...if i copy the qml in the .bin folder means it runs. ???



  • You need to put qml file into resource.



  • @#include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::Auto);
    viewer.setMainQmlFile&#40;QLatin1String(":/new/main.qml"&#41;);
    
    viewer.show();
    
    return app.exec();
    

    }@

    <Unknown File>: File error for URL file:///root/qt_workout/qml/textbinary-build-desktop/:/new/main.qml



  • You have to add
    Myfile.qrc

    @<!DOCTYPE RCC><RCC version="1.0">
    <qresource>
    <file>new/main.qml</file>
    </qresource>
    </RCC>@

    update .pro file add this line

    RESOURCES += Myfile.qrc


Log in to reply
 

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