-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphicsplaneitem.h
75 lines (61 loc) · 1.75 KB
/
graphicsplaneitem.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright (C) 2018 Microchip Technology Inc. All rights reserved.
* Joshua Henderson <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef GRAPHICSPLANEITEM_H
#define GRAPHICSPLANEITEM_H
#include <QGraphicsObject>
#include <QDebug>
#include "planemanager.h"
#include <QGraphicsView>
/**
* @brief The GraphicsPlaneItem class
*
* A QGraphicsObject that translates functions away from native Qt operations into hardware
* planes functions using libplanes.
*/
class GraphicsPlaneItem : public QGraphicsObject
{
public:
GraphicsPlaneItem(struct plane_data* plane, const QRectF& bounding);
virtual QRectF boundingRect() const override
{
return m_bounding;
}
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
{
Q_UNUSED(painter);
Q_UNUSED(option);
Q_UNUSED(widget);
}
/**
* @brief update
* Custom version of Qt required to make this virtual.
*/
virtual void update(const QRectF &rect = QRectF())
{
qDebug() << "GraphicsPlaneItem::update aborted";
Q_UNUSED(rect);
}
virtual ~GraphicsPlaneItem()
{}
protected:
virtual void moveEvent(const QPointF& point);
/**
* @brief draw
*
* A special drawing function that draws an image directly to a plane.
*
* @param plane
* @param image
* @param horizontal
* @param vertical
*/
void draw(struct plane_data* plane, QImage image, bool horizontal = false, bool vertical = false, bool scale = true);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
QRectF m_bounding;
struct plane_data* m_plane;
};
#endif // GRAPHICSPLANEITEM_H