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// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H
6#define QWAYLANDINPUTMETHODEVENTBUILDER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QInputMethodEvent>
20#include <private/qglobal_p.h>
21
22#include <utility> // for std::pair
23
24QT_BEGIN_NAMESPACE
25
26class QWaylandInputMethodEventBuilder
27{
28public:
29 QWaylandInputMethodEventBuilder() = default;
30 ~QWaylandInputMethodEventBuilder();
31
32 void reset();
33
34 void setCursorPosition(int32_t index, int32_t anchor);
35 void setDeleteSurroundingText(uint32_t beforeLength, uint32_t afterLength);
36
37 void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style);
38 void setPreeditCursor(int32_t index);
39
40 QInputMethodEvent *buildCommit(const QString &text);
41 QInputMethodEvent *buildPreedit(const QString &text);
42
43 static int indexFromWayland(const QString &text, int length, int base = 0);
44 static int indexToWayland(const QString &text, int length, int base = 0);
45
46 static int trimmedIndexFromWayland(const QString &text, int length, int base = 0);
47private:
48 std::pair<int, int> replacementForDeleteSurrounding();
49
50 int32_t m_anchor = 0;
51 int32_t m_cursor = 0;
52 uint32_t m_deleteBefore = 0;
53 uint32_t m_deleteAfter = 0;
54
55 int32_t m_preeditCursor = 0;
56 QList<QInputMethodEvent::Attribute> m_preeditStyles;
57};
58
62
63 static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints);
64 static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints);
65};
66
67
68QT_END_NAMESPACE
69
70#endif // QWAYLANDINPUTMETHODEVENTBUILDER_H
Combined button and popup list for selecting options.
static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints)
static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints)