blob: 956df3cf311e35644f6e003315af0d0924c272e3 (
plain)
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
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "xt9kinputmethod_p.h"
#include "xt9kinputmethodprivate_p.h"
#include <QVirtualKeyboardInputContext>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
/*!
\class QtVirtualKeyboard::Xt9KInputMethod
\internal
*/
Xt9KInputMethod::Xt9KInputMethod(QObject *parent) :
Xt9AwInputMethod(*new Xt9KInputMethodPrivate(this), parent)
{
}
bool Xt9KInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
{
Q_D(Xt9KInputMethod);
return Xt9AwInputMethod::keyEvent(key, d->xt9Ime()->codeConverter->convertTo(text), modifiers);
}
void Xt9KInputMethod::update()
{
Q_D(Xt9KInputMethod);
if (d->xt9Ime()->hasActiveInput()) {
if (d->selectionList.size() > 0) {
d->learnWord(d->selectionList.at(0));
d->setAutoSpaceAllowed(false);
d->selectionListSelectItem(0);
} else {
inputContext()->commit();
reset();
}
}
}
} // namespace QtVirtualKeyboard
QT_END_NAMESPACE
|