Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Webassembly QtChart not refreshing
Forum Updated to NodeBB v4.3 + New Features

Webassembly QtChart not refreshing

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
2 Posts 2 Posters 553 Views 2 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.
  • M Offline
    M Offline
    Mortimer
    wrote on last edited by
    #1

    Hi!
    I have created two test applications, a websocket server, which generates random temperature data, and sends it to the connected clients as json, and the other is a qt charts application, which updates the chart x axis on receiving the new datetime & temperature data. The chart application starts with a random preload data, and shows the temperature trend in "realtime", new data arrives in every second. This seems to work properly without webassembly, but in the browser, the chart is not updated, only if i move the mouse. When the mouse is moved, then the chart displays all the received websocket updates, so probably only the screen/chart refresh is missing.

    The relevant part of the webassembly chart update is:

    void Chart::updateDateTimeAxis()
    {
        //QDateTimeAxis *axis = static_cast<QDateTimeAxis *>(axisX());
        QDateTimeAxis *axis = static_cast<QDateTimeAxis *>(axes(Qt::Horizontal).back());
        if (m_Points.count() > 2) {
            QDateTime time = QDateTime::currentDateTime();
            qint64 msecs = static_cast<qint64>(m_Points.at(0).x());
            QDateTime startDateTime = 
    QDateTime::fromMSecsSinceEpoch(msecs,time.timeZone());//first datetime
            msecs = static_cast<qint64>(m_Points.at(m_Points.count() - 1).x());
            QDateTime endDateTime = 
    QDateTime::fromMSecsSinceEpoch(msecs,time.timeZone()); //last datetime
    
            qDebug() << "X axis range: " << startDateTime.toString(Qt::ISODate) << " - " << 
       endDateTime.toString(Qt::ISODate);
            axis->setRange(startDateTime,endDateTime);
        }
    }
    

    Any idea what could be the problem?
    The Qt version is 5.14.1 and emscripten 1.38.30.

    1 Reply Last reply
    0
    • losgatossuabesL Offline
      losgatossuabesL Offline
      losgatossuabes
      wrote on last edited by losgatossuabes
      #2

      Hi, I'm having what looks like your same issue: Widgets are not being repainted until I move the mouse. It is working well in Desktop just as in your case. Note this is not a QChart or the like, it its just a few QWidgets. Ive got a small QT WebAssembly application. (Qt 5.14.2 WebAssembly and emscripten 1.38.27-64bit).

      If any other one is seeing the issue and/or found out what to do about it please enlighten us :).

      Perhaps there is some js instruction to force the repainting or something like that.

      I am using a QStackedWidget; I suspect this might be an issue with this specific widget.

      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