presentation/KeyOverlayScrim.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | #include <QColor> | ||
| 3 | #include <QQuickPaintedItem> | ||
| 4 | #include <QVariantList> | ||
| 5 | |||
| 6 | // Sprint 105 S105.8.5 (overlay.md §2): the dimmed window with soft-edged, | ||
| 7 | // rounded "spotlight" holes around the annotated elements. Painted once per | ||
| 8 | // overlay opening (the holes never move while it is shown); the fade is an | ||
| 9 | // OpacityAnimator on this item, so no repaint happens during motion. | ||
| 10 | // Works on the software scene graph too (no shader). | ||
| 11 | class KeyOverlayScrim : public QQuickPaintedItem { | ||
| 12 | Q_OBJECT | ||
| 13 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed) | ||
| 14 | // [{x, y, width, height}] in item coordinates. | ||
| 15 | Q_PROPERTY(QVariantList holes READ holes WRITE setHoles NOTIFY changed) | ||
| 16 | Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY changed) | ||
| 17 | Q_PROPERTY(qreal feather READ feather WRITE setFeather NOTIFY changed) | ||
| 18 | public: | ||
| 19 | explicit KeyOverlayScrim(QQuickItem *parent = nullptr); | ||
| 20 | void paint(QPainter *painter) override; | ||
| 21 | ✗ | QColor color() const { return m_color; } | |
| 22 | void setColor(const QColor &color); | ||
| 23 | ✗ | QVariantList holes() const { return m_holes; } | |
| 24 | void setHoles(const QVariantList &holes); | ||
| 25 | ✗ | qreal radius() const { return m_radius; } | |
| 26 | void setRadius(qreal radius); | ||
| 27 | ✗ | qreal feather() const { return m_feather; } | |
| 28 | void setFeather(qreal feather); | ||
| 29 | signals: | ||
| 30 | void changed(); | ||
| 31 | private: | ||
| 32 | QColor m_color; // set from the overlayScrim token | ||
| 33 | QVariantList m_holes; | ||
| 34 | qreal m_radius = 8; | ||
| 35 | qreal m_feather = 12; | ||
| 36 | }; | ||
| 37 |