Files
vx4-GuiLin-Gear/.svn/pristine/4d/4d4081d515c6d65810bd58b879d0faf83f5e8742.svn-base
T

44 lines
1.2 KiB
Plaintext

#include "moveinput.h"
#include "ui_moveinput.h"
#include <QWSServer>
MoveInput::MoveInput(QWidget *parent) :
QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)),
ui(new Ui::MoveInput)
{
ui->setupUi(this);
connect(ui->Key_left,SIGNAL(pressed()),this,SLOT(onKeyLeftPressed()));
connect(ui->Key_right,SIGNAL(pressed()),this,SLOT(onKeyRightPressed()));
connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed()));
connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed()));
}
MoveInput::~MoveInput()
{
delete ui;
}
void MoveInput::onKeyLeftPressed(){
#ifndef Q_OS_WIN32
QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件
#endif
}
void MoveInput::onKeyRightPressed(){
#ifndef Q_OS_WIN32
QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件
#endif
}
void MoveInput::onKeyUpPressed(){
#ifndef Q_OS_WIN32
QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件
#endif
}
void MoveInput::onKeyDownPressed(){
#ifndef Q_OS_WIN32
QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件
#endif
}