mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d63d4cd3c3
commit
06a091643e
5 changed files with 107 additions and 5 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue