ChartView pointer from QML to C++



  • Hi,

    my system:
    Ubuntu 16.04
    Qt 5.7.0
    QtCreator 4.0.2

    There is example in QtCreator (on the "Welcome->Examples" tab link): "Qml Oscilloscope". In the example shown how to glue QML and C++:
    QML use Timer and periodically request data update from c++ (see file ""ScopeView.qml line #85):

        Timer {
            id: refreshTimer
            interval: 1 / 60 * 1000 // 60 Hz
            running: true
            repeat: true
            onTriggered: {
                dataSource.update(chartView.series(0));
                dataSource.update(chartView.series(1));
            }
    

    an argumet of the 'update' function is pointer to QML's data series.

    I've implemented my code based on the example and successfully can pass a series to my c++ code too. But when I try pass ChartView in reimplemented 'update' function I always get '0 pointer' (reimplemented function)
    hpp

    public: Q_SLOT update(QChartView *chart);
    

    cpp:

    void DataSource::update(QChartView *chart){
    qDebug()<<chart; // <---- Always NULL
    ...
    }
    

    So my question is:

    How to pass pointer on QML's ChartView ( QtQuick 2.0, QtCharts 2.1) to my C++?

    Thanks a lot for any idea!



  • @Vasiliy I'm also having this issue in windows, did you ever find a solution?


Log in to reply
 

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