Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. I can't run static qt-qml app on another computer
Forum Updated to NodeBB v4.3 + New Features

I can't run static qt-qml app on another computer

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 3 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mib383
    wrote on last edited by
    #1

    I built qt statically with params:
    @
    C:\Qt5.3\5.3\StaticQt>configure -prefix c:\Qt5.3\5.3\StaticQt\qtbase -opensource -static -release -opengl desktop -nomake examples -nomake tests -confirm-license
    @
    Added this built in Qt Versions (with warning: non-installed -prefix build - for internal development only), make corresponding Kit. App size = 24Mb. I can run app on my own computer with Windows 7 not from QtCreator. But from another desktop with Win7 and WinXP i can't run it. The program is really runs (in Task Manager) but i do not see interface. Help me please!
    .pro file:
    @
    TEMPLATE = app

    QT += qml quick widgets

    SOURCES += main.cpp

    RESOURCES += qml.qrc

    Additional import path used to resolve QML modules in Qt Creator's code model

    QML_IMPORT_PATH =

    Default rules for deployment.

    include(deployment.pri)
    @
    .cpp
    @
    #include <QApplication>
    #include <QQmlApplicationEngine>

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

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
    
    return app.exec&#40;&#41;;
    

    }
    @
    .qml
    @
    import QtQuick 2.2
    import QtQuick.Controls 1.1

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    
    Text {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
    

    }
    @

    This is a standard template for QtQuick projects.
    P.S. i am a newbie in qt and i need your help!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Cmdr
      wrote on last edited by
      #2

      Have you tried running your application from the command line? Maybe it outputs some debug information.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mib383
        wrote on last edited by
        #3

        The problem is in plugins. I changed my source code to:
        @
        #include <QGuiApplication>
        #include <QQmlApplicationEngine>

        #include <QQuickView>
        #include <QtPlugin>
        #include <QQmlEngine>

        #include <QQmlExtensionPlugin>
        Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
        Q_IMPORT_PLUGIN(QtQuick2Plugin)

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

        qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())->registerTypes("QtQuick");
        
        /*QQmlApplicationEngine engine;
        //engine.setImportPathList(QStringList());
        engine.load(QUrl(QStringLiteral("qrc:///main.qml")));*/
        
        QQuickView viewer;
        viewer.engine()->setImportPathList(QStringList());
        viewer.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
        viewer.show();
        
        return app.exec&#40;&#41;;
        

        }
        @
        And qml to:
        @
        import QtQuick 2.2
        //import QtQuick.Controls 1.1

        Rectangle{
        width: 200
        height: 200
        color: "LightGreen"
        }

        /*ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")

        menuBar: MenuBar {
            Menu {
                title: qsTr("File")
                MenuItem {
                    text: qsTr("Exit2")
                    onTriggered: Qt.quit();
                }
            }
        }
        
        Text {
            text: qsTr("Hello World")
            anchors.centerIn: parent
        }
        

        }*/
        @
        And it works. But when i tryed to include QtQuick.Controls 1.1 and use ApplicationWindow in qml and QQmlApplicationEngine in cpp, it NOT did work!
        With:
        @
        QQmlApplicationEngine failed to load component
        qrc:///main.qml:10 Type ApplicationWindow unavailable
        qrc:/QtQuick/Controls/ApplicationWindow.qml:41 module "QtQuick.Window" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:44 module "QtQuick.Layouts" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:45 module "QtQuick.Controls.Private" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:41 module "QtQuick.Window" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:44 module "QtQuick.Layouts" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:45 module "QtQuick.Controls.Private" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:41 module "QtQuick.Window" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:44 module "QtQuick.Layouts" is not installed
        qrc:/QtQuick/Controls/ApplicationWindow.qml:45 module "QtQuick.Controls.Private" is not installed
        @

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mib383
          wrote on last edited by
          #4

          Today i made some progress: i included plugins with help of code:
          @
          #include <QGuiApplication>
          #include <QQmlApplicationEngine>

          #include <QQuickView>
          #include <QtPlugin>
          #include <QQmlEngine>
          #include <QDebug>

          #define STATIC_BUILD

          #ifdef STATIC_BUILD
          #include <QQmlExtensionPlugin>
          Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
          Q_IMPORT_PLUGIN(QtQuick2Plugin)
          Q_IMPORT_PLUGIN(QtQuickControlsPlugin)
          Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
          Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
          #endif

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

          #ifdef STATIC_BUILD
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2Plugin().instance())->registerTypes("QtQuick 2.2");
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls");
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Private");
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Styles");
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickLayoutsPlugin().instance())->registerTypes("QtQuick.Layouts");
              qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuick2WindowPlugin().instance())->registerTypes("QtQuick.Window");
          #endif
          
          QQmlApplicationEngine engine;
          #ifdef STATIC_BUILD
              engine.setImportPathList(QStringList());
          #endif
          engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
          QStringList list = engine.importPathList();
          qDebug() << "ImportPathList" << list;
          
          /*QQuickView viewer;
          viewer.engine()->setImportPathList(QStringList());
          viewer.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
          viewer.show();*/
          
          return app.exec();
          

          }
          @
          Now the error is:
          qrc:/QtQuick/Controls/ApplicationWindow.qml:201 ContentItem is not a type

          I think strings:
          @
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Private");
          qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControlsPlugin().instance())->registerTypes("QtQuick.Controls.Styles");
          @
          is not valid, because ContentItem declared in QtQuick.Controls.Private. People help!

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mib383
            wrote on last edited by
            #5
            1 Reply Last reply
            0
            • Malek_KhlifM Offline
              Malek_KhlifM Offline
              Malek_Khlif
              wrote on last edited by
              #6

              I have the same problem. Did you find any solution ?

              I Love Qt &lt;3

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved