How to release software which includes QtGraphicalEffects module and QtCharts module



  • I want to release my software which includes QtGraphicalEffects module and QtCharts module by static and dynamic compilation, but it runs on other computers only if I disable the two modules.

    Here is the project file source code:

    QT += qml quick widgets
    QT += charts
    
    CONFIG += c++11
    
    SOURCES += main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target//your code here
    

    the main file source code:

    #include <QQmlApplicationEngine>
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        QApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QLatin1String("qrc:/main.qml")));
    
        return app.exec();
    }
    

    the main.qml file source code:

    import QtQuick 2.5
    import QtQuick.Controls 2.1
    import QtQuick.Layouts 1.3
    //import QtCharts 2.2
    import QtGraphicalEffects 1.0
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Static Test")
    
        SwipeView {
            id: swipeView
            anchors.fill: parent
            currentIndex: tabBar.currentIndex
    
            Page {
                Button{
                    anchors.centerIn: parent
                    text:"First page"
    
                    layer.enabled: hovered
                    layer.smooth: true
                    layer.effect: DropShadow {
                        color: activeFocus ? "#330066ff" : "#aaaaaa"
                        verticalOffset: 3
                        horizontalOffset: 3
                        radius: 6
                        samples: 12
                        spread: 0.7
                    }
                }
    
            }
    
            Page {
    //            ChartView {
    //                title: "Line"
    //                anchors.fill: parent
    //                antialiasing: true
    
    //                LineSeries {
    //                    name: "LineSeries"
     //                   XYPoint { x: 0; y: 0 }
    //                    XYPoint { x: 1.1; y: 2.1 }
     //                   XYPoint { x: 1.9; y: 3.3 }
    //                    XYPoint { x: 2.1; y: 2.1 }
    //                    XYPoint { x: 2.9; y: 4.9 }
     //                   XYPoint { x: 3.4; y: 3.0 }
    //                    XYPoint { x: 4.1; y: 3.3 }
     //               }
    //            }
            }
        }
    
        footer: TabBar {
            id: tabBar
            currentIndex: swipeView.currentIndex
            TabButton {
                text: qsTr("First")
            }
            TabButton {
                text: qsTr("Second")
            }
        }
    }
    

    This problem has confused me a long time. Help me, please!

    The version of Qt is qt-opensource-windows-x86-mingw530-5.8.0. And the static configure command is "configure -confirm-license -opensource -platform win32-g++ -debug-and-release -static -ltcg -prefix "C:\Qt\5.8.0_Static" -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -qt-freetype -gui -widgets -no-qml-debug -nomake tests -nomake examples -skip qtwebkit -skip qtwebview -qt-pcre -no-compile-examples"

    Update in 1st, Mar, 2017: It seems that I have found the problem failed to release my program. The module, QtChart, leads to failing to release my software. Also I have updated my code.

    I find that even the official example -qml axes, cannot release and run on other computer without installing Qt. So the problem is how to release a software with QtCharts Module?

    Update in 2nd, Mar, 2017: A part of my problem has been solved releasing a software contained QtCharts module by dynamical version. Qt5Charts.dll located in "C:\Qt\Qt5.8.0\5.8\mingw53_32\bin" and QtCharts folder located in "C:\Qt\Qt5.8.0\5.8\mingw53_32\qml" should be added to the folder containing the executable manually. There are still a doubt that the line, QT += charts, has been added to the qmake project file to link against the Qt Charts module, but Qt5Charts.dll and QtCharts folder need to be added manually.

    Finally, I still have no idea about releasing a software with QtCharts module by static version. A message, module "QtCharts" plugin "qtchartsqml2" not found, is shown in debug window when I tried to release static version. Help me ,please.


  • Lifetime Qt Champion

    Hi,

    You should also add which version of Qt you are using, which platform you are targeting.

    Also, don't forget the license implications of using a static build of Qt.



  • Thanks for your atentation. I have updated my question, the version of Qt and the static configure command are given in the last passage. I'm looking forward your reply again.


  • Lifetime Qt Champion

    Did you check that these two modules were built also ?

    One thing, I'd recommend just building the release version, that will save you time and space.



  • The two modules do work since the debug and release versions can run on my machine stably. The problem is that these versions cannot run on another computers which don't install Qt.


  • Lifetime Qt Champion

    What exact error are you getting ?
    Also how did you install your application on that other machine ?



  • For dynamical releasing version, I use command line,windeployqt, to deploy my program.

    For static version, the .exe file is what I wan.

    In other machines which don't install Qt, interface cannot be displayed while the process of the software can be seen in Explorer.


  • Lifetime Qt Champion

    Are you shipping the QML modules you are using with your application like explained here ?



  • @SGaist I‘m not sure. So I pasted the source code of my program’


  • Lifetime Qt Champion

    If you are only giving your executable then no, you are not shipping them. Are you using windeployqt on your application before distributing it ?



  • @SGaist For dynamical version, I use command line "windeployqt --qmldir C:\Qt\Qt5.8.0\5.8\mingw53_32\qml" while Qt installed in the path -"C:\Qt". And the dynamical version failed to run on other macthines.

    For static version, I just release it.


  • Lifetime Qt Champion

    The --qmldiroption should point to your application QML sources folder.

    Even if static, you need to deploy the QML files.



  • @SGaist I have deployed my program by dynamical version. More information about my problem has been updated in the topic. I'm looking forward your reply again.

    For static version, how to deploy the QML files. There is only one file for static version


  • Lifetime Qt Champion

    Did you also run windployqt for your static application ?



  • @SGaist No, I just use the source code of Qt to make a new Qt version which can release a software staticaly. And the static configure command has been mentioned before in the topic.


  • Lifetime Qt Champion

    Your application might be static but it still needs the QML files from the corresponding Qt modules hence you should still call windeployqt.



  • @SGaist But, how?


  • Lifetime Qt Champion

    The same as you would on a build using the dynamic version of Qt.


Log in to reply
 

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