mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
映射模式切换优化
This commit is contained in:
parent
5b23da7114
commit
55c579245b
3 changed files with 28 additions and 1 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/src/QtScrcpy.pro.user
|
||||||
|
/output/debug/*.pdb
|
||||||
|
/output/debug/*.ilk
|
||||||
|
/output/debug/QtScrcpy.exe
|
||||||
|
/output/release/QtScrcpy.exe
|
|
@ -1,5 +1,6 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#include "inputconvertgame.h"
|
#include "inputconvertgame.h"
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
||||||
switch (from->key()) {
|
switch (from->key()) {
|
||||||
case Qt::Key_QuoteLeft:
|
case Qt::Key_QuoteLeft:
|
||||||
if (QEvent::KeyPress == from->type()) {
|
if (QEvent::KeyPress == from->type()) {
|
||||||
m_gameMap = !m_gameMap;
|
switchGameMap();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -266,10 +267,12 @@ bool InputConvertGame::processKeyClick(const QKeyEvent *from)
|
||||||
clickPos = QPointF(0.96f, 0.7f);
|
clickPos = QPointF(0.96f, 0.7f);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_M: // 地图
|
case Qt::Key_M: // 地图
|
||||||
|
switchGameMap();
|
||||||
clickPos = QPointF(0.98f, 0.03f);
|
clickPos = QPointF(0.98f, 0.03f);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Tab: // 背包
|
case Qt::Key_Tab: // 背包
|
||||||
clickPos = QPointF(0.06f, 0.9f);
|
clickPos = QPointF(0.06f, 0.9f);
|
||||||
|
switchGameMap();
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Z: // 趴
|
case Qt::Key_Z: // 趴
|
||||||
clickPos = QPointF(0.95f, 0.9f);
|
clickPos = QPointF(0.95f, 0.9f);
|
||||||
|
@ -432,6 +435,22 @@ void InputConvertGame::mouseMoveStopTouch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputConvertGame::switchGameMap()
|
||||||
|
{
|
||||||
|
m_gameMap = !m_gameMap;
|
||||||
|
grabCursor(m_gameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputConvertGame::grabCursor(bool grab)
|
||||||
|
{
|
||||||
|
if(grab) {
|
||||||
|
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
|
||||||
|
} else {
|
||||||
|
mouseMoveStopTouch();
|
||||||
|
QGuiApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InputConvertGame::timerEvent(QTimerEvent *event)
|
void InputConvertGame::timerEvent(QTimerEvent *event)
|
||||||
{
|
{
|
||||||
if (m_mouseMoveTimer == event->timerId()) {
|
if (m_mouseMoveTimer == event->timerId()) {
|
||||||
|
|
|
@ -47,6 +47,9 @@ protected:
|
||||||
void mouseMoveStartTouch(const QMouseEvent* from);
|
void mouseMoveStartTouch(const QMouseEvent* from);
|
||||||
void mouseMoveStopTouch();
|
void mouseMoveStopTouch();
|
||||||
|
|
||||||
|
void switchGameMap();
|
||||||
|
void grabCursor(bool grab);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue