1 #include "qkeyboardlineedit.h"
3 #include <QFocusEvent>
4 #include <QtDebug>
5 #include "keyboard/keyboard.h"
7 QKeyboardLineEdit::QKeyboardLineEdit(QWidget *parent) :
8 QLineEdit(parent)
9 {
10 //connect(this, SIGNAL(selectionChanged()), this, SLOT(showKeyboard()));
11 m_keyboardWidget=NULL;
12 m_isBeingEdited = false;
13 }
15 QKeyboardLineEdit::~QKeyboardLineEdit()
16 {
17 }
19 void QKeyboardLineEdit::mousePressEvent(QMouseEvent *e)
20 {
21 if(!m_isBeingEdited)
22 {
23 m_isBeingEdited = true;
24 m_keyboardWidget = new Keyboard;
25 connect(m_keyboardWidget, SIGNAL(closed()), this, SLOT(keyboardClosed()));
26 m_keyboardWidget->setLineEdit(this);
27 m_keyboardWidget->showMaximized();
28 }
29 if(m_isBeingEdited && m_keyboardWidget)
30 qApp->setActiveWindow(m_keyboardWidget);
31 QLineEdit::mousePressEvent(e);
32 }
34 void QKeyboardLineEdit::keyboardClosed()
35 {
36 m_isBeingEdited = false;
37 m_keyboardWidget->deleteLater();
38 m_keyboardWidget = NULL;
39 }