Add Keyboard.
This commit is contained in:
28
src/keyboard/KeyButton.cpp
Normal file
28
src/keyboard/KeyButton.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "KeyButton.h"
|
||||
|
||||
KeyButton::KeyButton(QWidget *aParent)
|
||||
: QPushButton(aParent)
|
||||
{
|
||||
/*支持长按*/
|
||||
setAutoRepeat(true);
|
||||
setAutoRepeatDelay(500);
|
||||
setAutoRepeatInterval(100);
|
||||
|
||||
connect(this,&QPushButton::pressed,this,&KeyButton::emitKeyButtonPressed);
|
||||
}
|
||||
|
||||
void KeyButton::setValue(const QString& aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
setText(mValue);
|
||||
}
|
||||
|
||||
void KeyButton::setKey(int aKey)
|
||||
{
|
||||
mKey = aKey;
|
||||
}
|
||||
|
||||
void KeyButton::emitKeyButtonPressed()
|
||||
{
|
||||
emit keyButtonPressed(mKey,mValue);
|
||||
}
|
||||
Reference in New Issue
Block a user