You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
732 B
C++
36 lines
732 B
C++
#include "PreClick.h"
|
|
|
|
PreClick::PreClick(QWidget* parent) : QMainWindow(parent)
|
|
{
|
|
ui.setupUi(this);
|
|
connect(ui.BtnGetPos, &QPushButton::clicked, this, &PreClick::StartCursorTrack);
|
|
connect(&CursorUpdate, &QTimer::timeout, this, &PreClick::UpdateCursorPosition);
|
|
CursorUpdate.setInterval(50);
|
|
}
|
|
|
|
PreClick::~PreClick()
|
|
{
|
|
}
|
|
|
|
void PreClick::UpdateCursorPosition()
|
|
{
|
|
POINT point;
|
|
GetCursorPos(&point);
|
|
ui.PosX->setText(QString::asprintf("%ld", point.x));
|
|
ui.PosY->setText(QString::asprintf("%ld", point.y));
|
|
}
|
|
|
|
void PreClick::StartCursorTrack()
|
|
{
|
|
if (CursorUpdate.isActive())
|
|
{
|
|
CursorUpdate.stop();
|
|
ui.BtnGetPos->setText("获取坐标");
|
|
}
|
|
else
|
|
{
|
|
CursorUpdate.stop();
|
|
ui.BtnGetPos->setText("停止获取");
|
|
}
|
|
}
|