diff options
author | Knud Dollereder <knud.dollereder@qt.io> | 2019-05-24 15:03:51 +0200 |
---|---|---|
committer | Knud Dollereder <knud.dollereder@qt.io> | 2019-05-29 14:42:32 +0000 |
commit | 69e0ce6b1aee59585f141a320cef4f980e6ae7dc (patch) | |
tree | 4dcd6b41099fb621dc205cc0ee28cedc91672fbc /src/curveeditor/detail/curveitem.h | |
parent | df6afb91041d5225448a13aaf3bbb6f11137b0c0 (diff) |
Implement selection of keyframes and handles
Change-Id: Iaedb5561f9d57e38bfcac6fa5012a26ac5033d3b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/curveeditor/detail/curveitem.h')
-rw-r--r-- | src/curveeditor/detail/curveitem.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/curveeditor/detail/curveitem.h b/src/curveeditor/detail/curveitem.h index cf9b29f..90e68e2 100644 --- a/src/curveeditor/detail/curveitem.h +++ b/src/curveeditor/detail/curveitem.h @@ -26,6 +26,7 @@ #pragma once #include "curveeditorstyle.h" +#include "selectableitem.h" #include <QGraphicsObject> @@ -33,6 +34,7 @@ namespace DesignTools { class AnimationCurve; class KeyframeItem; +class GraphicsScene; class CurveItem : public QGraphicsObject { @@ -45,7 +47,7 @@ public: ~CurveItem() override; - enum { Type = UserType + 1 }; + enum { Type = ItemTypeCurve }; int type() const override; @@ -53,10 +55,12 @@ public: bool contains(const QPointF &point) const override; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; bool isDirty() const; + bool hasSelection() const; + unsigned int id() const; AnimationCurve curve() const; @@ -67,14 +71,13 @@ public: void setStyle(const CurveEditorStyle &style); - void setSelected(bool select); + void connect(GraphicsScene *scene); - void setPreSelected(bool preSelect); + void setIsUnderMouse(bool under); private: QPainterPath path() const; -private: unsigned int m_id; CurveItemStyleOption m_style; @@ -83,9 +86,7 @@ private: std::vector<KeyframeItem *> m_keyframes; - bool m_selected; - - bool m_preselected; + bool m_underMouse; bool m_itemDirty; |