summaryrefslogtreecommitdiffstats
path: root/stats/informationbox.cpp
AgeCommit message (Collapse)Author
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: improve placement of info-boxGravatar Berthold Stoeger
The info box was placed either above or below the mouse-pointer. If the pointer is at the center and the infobox higher than half the chart, it would cross the border. Detect this case and place the info box at the center. Same logic for right/left, though that should typically not happen. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-03statistics: use RoundRectItem for legend and info-boxGravatar Berthold Stoeger
Dirk says rounded corners look better. This now looks a bit extreme to me and probably the border size should be increased. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02statistics: implement a simple information boxGravatar Berthold Stoeger
When the user hovers over features in the chart, they should be presented with more information. For example in bar charts on the dives the bar represents and the exact value that the bar represents, etc. The InformationBox is a simple QGraphicsWidget, which can be placed on top of QCharts and can show a number of arbitrary text lines. When placing the box on the chart, the code attempts to stay inside the plot area of the chart. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>