提交原始齿轮泵代码
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
#include "DigitalInput.h"
|
||||
#include "ui_digitalinput.h"
|
||||
#include "MyInputMethod.h"
|
||||
#include <QObject>
|
||||
#include <QSpinBox>
|
||||
DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
|
||||
QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)),
|
||||
ui(new Ui::DigitalInput)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->myInputMethod = myInputMethod;
|
||||
|
||||
connect(ui->Key_0,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_1,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_2,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_3,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_4,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_5,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_6,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_7,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_8,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_9,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_pluse,SIGNAL(pressed()),this,SLOT(onCharPressed()));
|
||||
connect(ui->Key_backspace,SIGNAL(pressed()),this,SLOT(onKeyBackspacePressed()));
|
||||
connect(ui->Key_selectAll,SIGNAL(pressed()),this,SLOT(onKeySelectAllPressed()));
|
||||
connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed()));
|
||||
connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed()));
|
||||
}
|
||||
|
||||
DigitalInput::~DigitalInput()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void DigitalInput::onCharPressed(){
|
||||
QPushButton * button = qobject_cast<QPushButton *>(sender());
|
||||
QString text = button->text();
|
||||
myInputMethod->sendString (text);
|
||||
}
|
||||
|
||||
void DigitalInput::onKeyBackspacePressed(){
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void DigitalInput::onKeySelectAllPressed(){
|
||||
//static int init = 0;
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //向系统发送键盘事件
|
||||
//if(!init)
|
||||
// QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //向系统发送键盘事件
|
||||
//init = 1;
|
||||
|
||||
MyInputMethod::sendEvent(Qt::Key_A, Qt::ControlModifier);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
void DigitalInput::onKeyUpPressed(){
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier);
|
||||
#endif
|
||||
}
|
||||
void DigitalInput::onKeyDownPressed(){
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user