Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandinputmethodeventbuilder_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H
5#define QWAYLANDINPUTMETHODEVENTBUILDER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QInputMethodEvent>
19#include <private/qglobal_p.h>
20
21#include <utility> // for std::pair
22
23QT_BEGIN_NAMESPACE
24
25class QWaylandInputMethodEventBuilder
26{
27public:
28 QWaylandInputMethodEventBuilder() = default;
29 ~QWaylandInputMethodEventBuilder();
30
31 void reset();
32
33 void setCursorPosition(int32_t index, int32_t anchor);
34 void setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength);
35
36 void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style);
37 void setPreeditCursor(int32_t index);
38
39 QInputMethodEvent *buildCommit(const QString &text);
40 QInputMethodEvent *buildPreedit(const QString &text);
41
42 static int indexFromWayland(const QString &text, int length, int base = 0);
43 static int indexToWayland(const QString &text, int length, int base = 0);
44
45 static int trimmedIndexFromWayland(const QString &text, int length, int base = 0);
46private:
47 std::pair<int, int> replacementForDeleteSurrounding();
48
49 int32_t m_anchor = 0;
50 int32_t m_cursor = 0;
51 uint32_t m_deleteBefore = 0;
52 uint32_t m_deleteAfter = 0;
53
54 int32_t m_preeditCursor = 0;
55 QList<QInputMethodEvent::Attribute> m_preeditStyles;
56};
57
61
62 static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints);
63 static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints);
64};
65
66
67QT_END_NAMESPACE
68
69#endif // QWAYLANDINPUTMETHODEVENTBUILDER_H
static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints)
static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints)