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. ChartView pointer from QML to C++

ChartView pointer from QML to C++

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k Views
  • 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.
  • V Offline
    V Offline
    Vasiliy
    wrote on last edited by Vasiliy
    #1

    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!

    EluvatarE 1 Reply Last reply
    2
    • V Vasiliy

      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!

      EluvatarE Offline
      EluvatarE Offline
      Eluvatar
      wrote on last edited by
      #2

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

      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