34 lines
776 B
C++
34 lines
776 B
C++
|
#include "LineEditWithKeyboard.h"
|
||
|
#include <QDebug>
|
||
|
#include "keyboard.h"
|
||
|
|
||
|
LineEditWithKeyboard::LineEditWithKeyboard(QWidget *parent) :
|
||
|
QLineEdit(parent), m_keyboard(nullptr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void LineEditWithKeyboard::mousePressEvent(QMouseEvent *event)
|
||
|
{
|
||
|
qDebug() << "LineEditWithKeyboard::mousePressEvent";
|
||
|
emit signalMousePressed();
|
||
|
|
||
|
keyboard::GetInstance(this);
|
||
|
QLineEdit::mousePressEvent(event);
|
||
|
}
|
||
|
|
||
|
void LineEditWithKeyboard::slotWordChoose(QString word)
|
||
|
{
|
||
|
setText(text() + word);
|
||
|
}
|
||
|
|
||
|
void LineEditWithKeyboard::keyPressEvent(QKeyEvent* event)
|
||
|
{
|
||
|
//qDebug() << "LineEditWithKeyboard::keyPressEvent";
|
||
|
emit signalMousePressed();
|
||
|
QWidget* w = dynamic_cast<QWidget*>(parent());
|
||
|
if(w)
|
||
|
w->setFocus();
|
||
|
QLineEdit::keyPressEvent(event);
|
||
|
}
|
||
|
|