-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphicwidget.h
56 lines (48 loc) · 1.77 KB
/
graphicwidget.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
#ifndef GRAPHICWIDGET_H
#define GRAPHICWIDGET_H
#include <QWidget>
#include "graphicobject.h"
class HintWindow;
class GraphicWidget : public QWidget, public AbstractGraphicSupervisor
{
Q_OBJECT
public:
GraphicWidget(QWidget *parent = NULL);
~GraphicWidget() override;
void setGraphicObject(GraphicObject *value);
GraphicObject* graphicObject() const;
void redraw() override;
void updateAndRedraw() override;
QPointF positionFromLocalToGlobal(const QPointF &p) override;
QPointF positionFromGlobalToLocal(const QPointF &p) override;
signals:
void keyPressed(QKeyEvent *event);
void keyReleased(QKeyEvent *event);
void mousePress(QMouseEvent *event, bool &processed);
void mouseRelease(QMouseEvent *event, bool &processed);
void mouseMove(QMouseEvent *event, bool &processed);
protected:
void timerEvent(QTimerEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void leaveEvent(QEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void hideEvent(QHideEvent *event) override;
private:
GraphicObject *m_graphicObject;
bool m_contextMenuShown;
HintWindow *m_hintWindow;
int m_hintTimerID;
QPointF m_lastMousePosition;
bool processEvents() const;
void killHintTimer();
void destroyHintWindow();
void showHintWindow(const QPointF &hintPosition, const QString &hintText);
void applySizeConstraint();
};
#endif // GRAPHICWIDGET_H