aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod.cpp
blob: ed8d4abd7ce976f2c671de31d393b1cf06f97816 (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "xt9thaiinputmethod_p.h"
#include "xt9thaiinputmethodprivate_p.h"

QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {

/*!
    \class QtVirtualKeyboard::Xt9ThaiInputMethod
    \internal
*/

Xt9ThaiInputMethod::Xt9ThaiInputMethod(QObject *parent) :
    Xt9AwInputMethod(*new Xt9ThaiInputMethodPrivate(this), parent)
{
}

bool Xt9ThaiInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
{
    const bool isMark = text.length() == 2 && text.at(0) == QLatin1Char(' ');
    if (isMark) {
        const QString mark(text.right(1));
        return Xt9AwInputMethod::keyEvent(static_cast<Qt::Key>(mark.at(0).unicode()),
                                          mark, modifiers);
    }
    return Xt9AwInputMethod::keyEvent(key, text, modifiers);
}

} // namespace QtVirtualKeyboard
QT_END_NAMESPACE