aboutsummaryrefslogtreecommitdiffstats
path: root/stats/statsgrid.cpp
AgeCommit message (Collapse)Author
2021-01-20statistics: refactor QSG memory managementGravatar Berthold Stoeger
The code was wrong, because it deleted the ChartItems in the main UI thread, not the render thread. This would delete the QSG nodes in the UI thread and then crash on mobile. Therefore refactor this part of the code by adding the items to be deleted to a list that will be deleted by the render thread. As a drop in replacement of std::unique_ptr, implement a silly ChartItemPtr class, which auto-initializes to null. This turns the deterministic and easily controlled memory management into a steaming pile of insanity. Obviously, this can be made much more elegant, but this has to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: turn ChartGrid into QSGNodesGravatar Berthold Stoeger
Turn the background grid into QSGNodes. Each grid line is represented by a QSG line item. An alternative would be drawing the grid into a QImage and blasting that onto the screen. It is unclear which one is preferred. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10build-system: compile stats code on mobile OSsGravatar Dirk Hohndel
Android and iOS use qmake, so add the code to the .pro file. This also removes all remnants of QCharts includes and uses and all the references to QCharts in our various build systems. That was a brief but extremely useful detour. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10statistics: convert chart to QQuickItemGravatar Berthold Stoeger
It turns out that the wrong base class was used for the chart. QQuickWidget can only be used on desktop, not in a mobile UI. Therefore, turn this into a QQuickItem and move the container QQuickWidget into desktop-only code. Currently, this code is insane: The chart is rendered onto a QGraphicsScene (as it was before), which is then rendered into a QImage, which is transformed into a QSGTexture, which is then projected onto the device. This is performed on every mouse move event, since these events in general change the position of the info-box. The plan is to slowly convert elements such as the info-box into QQuickItems. Browsing the QtQuick documentation, this will not be much fun. Also note that the rendering currently tears, flickers and has antialiasing artifacts, most likely owing to integer (QImage) to floating point (QGraphicsScene, QQuickItem) conversion problems. The data flow is QGraphicsScene (float) -> QImage (int) -> QQuickItem (float). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: paint custom gridGravatar Berthold Stoeger
With removal of QtCharts' axes, the grid was lost. Readd it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>