FaceAccess/Linguist/keyboard/LineEditWithKeyboard.cpp

34 lines
776 B
C++
Raw Normal View History

2024-07-11 11:27:12 +08:00
#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);
}