Move the various font objects the the StatsTheme structure to enable
different font weights for different themes.
For the dark theme, switch to a bold font, because the thin white
font was barely visible.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To enable rudimentary theming, collect all colors in a new
theme class. The class has to be passed down to the various
items.
In general the items save a reference to the them in the
constructor. Alternatively, they might also just query
the StatsView everytime they need to access a color.
For now, it's hard the say what is preferred: a reference
per item or a function call per invokation?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
A small step in converting from QGraphicsScene to QQuickItem.
This is the second item to be converted (after the legend)
and for now items are drawn in order of creation, which means
that the infobox is on top of the legend. This will have
to be made deterministic in follow-up commits.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
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>
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>