Qt World Summit: Submit your Presentation

QML Not Refreshing (Using QChart.js from Julien Wintz)

  • In this thread...


    ...I was referred to ask the question here. I have some QML that connects with Julien Wintz's QChart.js project on Github. My QML looks like so:

    import QtQuick 2.0
    import "."
    import "QChart.js"        as Charts
    import "QChartGallery.js" as ChartsData
    Chart {
      id: chart_line;
      width: 300;
      height: 300;
      chartAnimated: false;
      chartData: ChartsData.ChartLineData;
      chartType: Charts.ChartType.LINE;

    Trouble is -- I have this on a tab (QTabWidget) and at runtime when I click another tab and then come back, my chart data is gone. However, if I use some very simple QML to draw a rectangle (not using QChart.js), the problem doesn't occur.

    For now, I'm intercepting the QQuickWidget's paint event and doing another setSource() call on it to get around the problem. However, is there a better way?