aboutsummaryrefslogtreecommitdiffstats
path: root/stats/chartitem.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-02-07 14:33:48 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-02-13 13:02:54 -0800
commit06a091643e63e4c0eb1d3bda61871be1b44b93a9 (patch)
tree702cb83aa4814a1241360d6b66acf60f8c3b79a6 /stats/chartitem.h
parentd63d4cd3c357a4294e4810ad320acf519b37882d (diff)
downloadsubsurface-06a091643e63e4c0eb1d3bda61871be1b44b93a9.tar.gz
statistics: highlight selected bar
When all items of a bar in a bar chart are selected, highlight them by overlaying with a checkerboard pattern. A gray checkerboard seems to work reasonably well, regardless of base color. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'stats/chartitem.h')
-rw-r--r--stats/chartitem.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/stats/chartitem.h b/stats/chartitem.h
index 038054c39..87fb0f993 100644
--- a/stats/chartitem.h
+++ b/stats/chartitem.h
@@ -15,6 +15,7 @@ class QSGFlatColorMaterial;
class QSGImageNode;
class QSGRectangleNode;
class QSGTexture;
+class QSGTextureMaterial;
class StatsView;
enum class ChartZValue : int;
@@ -148,18 +149,27 @@ public:
~ChartBarItem();
void setColor(QColor color, QColor borderColor);
void setRect(const QRectF &rect);
+ void setSelected(bool selected);
QRectF getRect() const;
void render() override; // Only call on render thread!
protected:
QColor color, borderColor;
double borderWidth;
QRectF rect;
+ bool selected;
bool horizontal;
bool positionDirty;
bool colorDirty;
+ bool selectedDirty;
std::unique_ptr<QSGGeometryNode> borderNode;
std::unique_ptr<QSGFlatColorMaterial> borderMaterial;
std::unique_ptr<QSGGeometry> borderGeometry;
+private:
+ // Overlay for selected items. Created on demand.
+ std::unique_ptr<QSGGeometryNode> selectionNode;
+ std::unique_ptr<QSGTextureMaterial> selectionMaterial;
+ std::unique_ptr<QSGGeometry> selectionGeometry;
+ QSGTexture *getSelectedTexture() const;
};
// A box-and-whiskers item. This is a bit lazy: derive from the bar item and add whiskers.