Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Charts crash my application
Qt 6.11 is out! See what's new in the release blog

Charts crash my application

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.8k 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.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by ODБOï
    #1

    hi,
    If i create a ChartView in QML and run my app it will crash with this error :

    ASSERT: "!"No style available without QApplication!"" in file kernel\qapplication.cpp, line 1051
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    ASSERT: "!"No style available without QApplication!"" in file kernel\qapplication.cpp, line 1051
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    C:/Users/zer/Documents/build-Test-Desktop_Qt_5_11_0_MinGW_32bit2-Debug/debug/Test.exe exited with code 3
    

    Why ?

    Qt_5_11_0_MinGW_32bit2

    .qml

    import QtQuick 2.10
    import QtQuick.Window 2.10
    import QtCharts 2.2
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("QChartCrash")
           ChartView {
                   title: "chart"
               }
    }
    
    

    .cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        if (engine.rootObjects().isEmpty())
            return -1;
        return app.exec();
    }
    
    

    .pro

    QT += quick
    QT+= charts
    QT += widgets
    CONFIG += c++11
    DEFINES += QT_DEPRECATED_WARNINGS
    SOURCES += main.cpp
    RESOURCES += qml.qrc
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    

    thx

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Replace your QGuiApplication with a QApplication as the error message suggests.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        Thx SGaist

        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