ChartView crash when launching on Mobile - QT QML error

Viewed 1540

i've a problem, when i launching debug on android tablet (android 7.0) with chart, i get a crash app.

So my qt.pro:

QT += qml quick core charts widgets

my chart code:

ChartView {
       id: chart
       title: "Top-5 car brand shares in Finland"
       anchors.fill: parent
       legend.alignment: Qt.AlignBottom
       antialiasing: true

       PieSeries {
           id: pieSeries
           PieSlice { label: "Volkswagen"; value: 13.5 }
           PieSlice { label: "Toyota"; value: 10.9 }
           PieSlice { label: "Ford"; value: 8.6 }
           PieSlice { label: "Skoda"; value: 8.2 }
           PieSlice { label: "Volvo"; value: 6.8 }
       }
   }

my import in qml file:

import QtQuick 2.6
import QtQuick.Controls 2.0
import QtQuick.Controls 2.1
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtCharts 2.2

I've followed this guides to set charts:

https://doc.qt.io/qt-5/qtcharts-index.html

but when i launching the page on android tablet, this crash. Also on iOS i get the crash. The error return is:

W linker : /data/data/domain.app/qt-reserved-files/qml/QtCharts/libqtchartsqml2.so: unsupported flags DT_FLAGS_1=0x81 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 6778 (QtThread)

someone can help me ?

1 Answers

The solution is: set this in main.cpp

#include <QApplication>

and in the main class use

QApplication app(argc, argv);

and not

QGuiApplication app(argc, argv);

now works.

Related