-
Notifications
You must be signed in to change notification settings - Fork 4
/
diamond.h
39 lines (30 loc) · 919 Bytes
/
diamond.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef DIAMOND_H
#define DIAMOND_H
#include <QColor>
#include <QGraphicsItem>
#include "shape.h"
QT_BEGIN_NAMESPACE
class QLabel;
class QSlider;
class QToolButton;
class QListWidget;
QT_END_NAMESPACE
class Diamond : public Shape
{
public:
Diamond(const QColor &color, int x, int y);
Diamond(const QColor &color, int x, int y, QString text);
QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
int type() const Q_DECL_OVERRIDE;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
private:
int x;
int y;
QVector<QPointF> stuff;
};
#endif // DIAMOND_H