-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathButtonMouse.cpp
48 lines (39 loc) · 1.99 KB
/
ButtonMouse.cpp
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
#include "ButtonMouse.h"
ButtonMouse::ButtonMouse(QQuickItem* gui, QCursor* cursor)
{
this->gui = gui;
this->cursor = cursor;
}
void ButtonMouse::Button1Slot()
{
// cursor->setPos(50, 175);
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonPress, QPointF(50, 175),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonRelease, QPointF(50, 175),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
}
void ButtonMouse::Button2Slot()
{
// cursor->setPos(50, 125);
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonPress, QPointF(50, 125),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonRelease, QPointF(50, 125),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
}
void ButtonMouse::Button3Slot()
{
// cursor->setPos(50, 75);
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonPress, QPointF(50, 75),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonRelease, QPointF(50, 75),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
}
void ButtonMouse::Button4Slot()
{
// cursor->setPos(50, 25);
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonPress, QPointF(50, 25),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
QGuiApplication::sendEvent(gui, new QMouseEvent(QEvent::MouseButtonRelease, QPointF(50, 25),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
qDebug() << "in button4 slot";
}