Loading...
Searching...
No Matches
QGraphicsSelectablePixmapToggle.hpp
1#pragma once
2#include <score/graphics/widgets/Constants.hpp>
3#include <score/widgets/Pixmap.hpp>
4
5#include <QGraphicsItem>
6#include <QGraphicsPixmapItem>
7#include <QObject>
8
9#include <score_lib_base_export.h>
10
11#include <functional>
12#include <verdigris>
13
14class QMimeData;
15namespace score
16{
17class SCORE_LIB_BASE_EXPORT QGraphicsSelectablePixmapToggle final
18 : public QObject
19 , public QGraphicsPixmapItem
20{
22 SCORE_GRAPHICS_ITEM_TYPE(170)
23
24 const QPixmap m_pressed, m_pressed_selected, m_released, m_released_selected;
25 bool m_toggled{};
26 bool m_selected{};
27
28public:
30 QPixmap pressed, QPixmap pressed_selected, QPixmap released,
31 QPixmap released_selected, QGraphicsItem* parent);
32
33 void toggle();
34 void setSelected(bool selected);
35 void setState(bool toggled);
36
37 bool state() const noexcept { return m_toggled; }
38
39public:
40 void toggled(bool arg_1) E_SIGNAL(SCORE_LIB_BASE_EXPORT, toggled, arg_1)
41
42protected:
43 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
44 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
45 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
46};
47
48class SCORE_LIB_BASE_EXPORT QGraphicsDraggablePixmap final
49 : public QObject
50 , public QGraphicsPixmapItem
51{
53 SCORE_GRAPHICS_ITEM_TYPE(180)
54
55 const QPixmap m_pressed, m_pressed_selected, m_released, m_released_selected;
56
57public:
58 QGraphicsDraggablePixmap(QPixmap pressed, QPixmap released, QGraphicsItem* parent);
59
60 std::function<void(QMimeData&)> createDrag;
61 std::function<void(QPointF)> click;
62
63protected:
64 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
65 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
66 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
67
68 bool m_didDrag{};
69};
70}
Definition QGraphicsSelectablePixmapToggle.hpp:51
Definition QGraphicsSelectablePixmapToggle.hpp:20
Base toolkit upon which the software is built.
Definition Application.cpp:90