-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputbox.cpp
More file actions
43 lines (39 loc) · 1.11 KB
/
inputbox.cpp
File metadata and controls
43 lines (39 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "inputbox.h"
#include "btn_event.h"
#include "data.h"
#include "ui_contral.h"
void InputBox::keyPressEvent(QKeyEvent *event) // Override the keypressevent
{
if (event->key() == Qt::Key_Escape)
{
QCoreApplication::sendEvent(_UI->_Key_Listener, _UI->_EscapeEvent);
return;
}
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
QCoreApplication::sendEvent(_UI->_Key_Listener, _UI->_ReturnEvent);
return;
}
QLineEdit::keyPressEvent(event);
}
void InputBox::focusInEvent(QFocusEvent *event) // Override the focusinevent (to make the input valid)
{
grabKeyboard();
QLineEdit::focusInEvent(event);
}
InputBox::InputBox(UI *__UI, QString __Type, qint32 x, qint32 y, qint32 w, qint32 h)
{
_UI = __UI;
_Type = __Type;
setParent(_UI->_Screen);
setStyleSheet("background-color:transparent; color:white;");
setAlignment(Qt::AlignLeft);
setGeometry(x, y, w, h);
setFont(Data::font(1, 45, 40));
setMaxLength(10);
if (__Type == "PasswordBoard") setEchoMode(QLineEdit::Password);
hide();
}
InputBox::~InputBox()
{
}