-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKbdEditBox.cpp
More file actions
53 lines (49 loc) · 1.09 KB
/
Copy pathKbdEditBox.cpp
File metadata and controls
53 lines (49 loc) · 1.09 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
44
45
46
47
48
49
50
51
52
53
#include "KbdEditBox.h"
#include "NumericKbd.h"
#include "EnglishKbd.h"
#include "stdio.h"
CKbdEditBox::CKbdEditBox(QWidget *parent) :
QLineEdit(parent)
{
IsNumeric=false;
IsAutoDeleteEnabled=false;
}
void CKbdEditBox::focusInEvent(QFocusEvent *ev)
{
QLineEdit::focusInEvent(ev);
QWidget* parent = parentWidget();
while(parent->parentWidget() && !parent->inherits("QDialog"))
{
parent = parent->parentWidget();
}
if(IsNumeric)
{
if(IsAutoDeleteEnabled && CNumericKbd::GetEdit()!=this)
{
setText("");
}
CNumericKbd::ShowKeyboard((QLineEdit*)this,parent);
CEnglishKbd::Close();
}
else
{
if(IsAutoDeleteEnabled && CEnglishKbd::GetEdit()!=this)
{
setText("");
}
CEnglishKbd::ShowKeyboard((QLineEdit*)this,parent);
CNumericKbd::Close();
}
}
void CKbdEditBox::focusOutEvent(QFocusEvent *ev)
{
QLineEdit::focusOutEvent(ev);
if(IsNumeric)
{
CNumericKbd::CloseDelayed();
}
else
{
CEnglishKbd::CloseDelayed();
}
}