statistics: implement showing / hiding of items in QSG

To replace the QGraphicsScene, we need the possibility of
showing and hiding items.

Turns out, the QSG API is completely insane.

Whether an item should be shown is queried by the virtual
function isSubtreeBlocked(), which is supposed to be
overriden by the derived classes.

However, the common nodes for rectangles and pixmaps are
supposed to be created by QQuickWindow, for hardware
optimization. This gives nodes that cannot be derived
from and therefore whether the item is shown or not cannot
be controlled.

There are therefore two distinct cases to consider: The
node is allocated by the code directly or indirectly by
QQuickWindow.

In the latter case, we use a proxy node with the only
purpose of having a "visible" flag and add the obtained
node as a child.

This madness is performed with template trickery to get
unified code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-17 18:29:54 +01:00 committed by bstoeger
parent b42e19e36b
commit 5d5ebfcf3c
4 changed files with 138 additions and 20 deletions

View file

@ -97,7 +97,7 @@ BarSeries::BarLabel::BarLabel(StatsView &view, const std::vector<QString> &label
void BarSeries::BarLabel::setVisible(bool visible)
{
// item->setVisible(visible); TODO!
item->setVisible(visible);
}
void BarSeries::BarLabel::highlight(bool highlight, int bin_nr, int binCount)