7#include <QtCore/private/qmakearray_p.h>
8#include <QtCore/qglobal.h>
9#include <QtCore/qobject.h>
18 static constexpr char StringTerminator =
'\0';
25 return !(strcmp(that) > 0);
34 return web[
i] == StringTerminator && that.
web[
i] == StringTerminator ? 0
35 : web[
i] == StringTerminator ? -1
36 : that.
web[
i] == StringTerminator ? 1
37 : web[
i] < that.
web[
i] ? -1
38 : web[
i] > that.
web[
i] ? 1
39 : strcmp(that,
i + 1);
43template<
unsigned int Qt,
char... WebChar>
46 static constexpr const char storage[
sizeof...(WebChar) + 1] = { WebChar...,
'\0' };
51template<
unsigned int Qt,
char... WebChar>
59 Web2Qt<
Qt::Key_Backspace,
'B',
'a',
'c',
'k',
's',
'p',
'a',
'c',
'e'>,
63 Web2Qt<
Qt::Key_Down,
'A',
'r',
'r',
'o',
'w',
'D',
'o',
'w',
'n'>,
80 Web2Qt<
Qt::Key_Left,
'A',
'r',
'r',
'o',
'w',
'L',
'e',
'f',
't'>,
82 Web2Qt<
Qt::Key_Menu,
'C',
'o',
'n',
't',
'e',
'x',
't',
'M',
'e',
'n',
'u'>,
89 Web2Qt<
Qt::Key_QuoteLeft,
'B',
'a',
'c',
'k',
'q',
'u',
'o',
't',
'e'>,
90 Web2Qt<
Qt::Key_QuoteLeft,
'I',
'n',
't',
'l',
'B',
'a',
'c',
'k',
's',
'l',
'a',
's',
'h'>,
92 Web2Qt<
Qt::Key_Right,
'A',
'r',
'r',
'o',
'w',
'R',
'i',
'g',
'h',
't'>,
93 Web2Qt<
Qt::Key_ScrollLock,
'S',
'c',
'r',
'o',
'l',
'l',
'L',
'o',
'c',
'k'>,
163static_assert(DiacriticalCharsKeyToTextLowercase.size()
164 == DiacriticalCharsKeyToTextUppercase.size(),
165 "Add the new key to both arrays");
203 while (
first != last) {
238 const auto it = std::find_if(mappingArray.cbegin(), mappingArray.cend(),
240 return it != mappingArray.
cend() ?
it->web : std::optional<QString>();
246 const WebKb2QtData searchKey{ toFind, 0 };
247 const auto it = std::lower_bound(WebToQtKeyCodeMappings.cbegin(), WebToQtKeyCodeMappings.cend(),
249 return it != WebToQtKeyCodeMappings.cend() && searchKey == *
it ?
static_cast<Qt::Key>(
it->qt)
250 : std::optional<Qt::Key>();
259 if (
event->deadKey) {
260 m_activeDeadKey =
event->key;
264 || (m_keyModifiedByDeadKeyOnPress ==
event->key
266 const Qt::Key baseKey =
event->key;
267 const Qt::Key translatedKey = translateBaseKeyUsingDeadKey(baseKey, m_activeDeadKey);
269 event->key = translatedKey;
272 ? findKeyTextByKeyId(DiacriticalCharsKeyToTextUppercase,
event->key)
273 : findKeyTextByKeyId(DiacriticalCharsKeyToTextLowercase,
event->key);
275 event->text = foundText->size() == 1 ? *foundText :
QString();
278 if (!
event->text.isEmpty()) {
283 if (!
event->text.isEmpty())
284 m_keyModifiedByDeadKeyOnPress = baseKey;
287 Q_ASSERT(m_keyModifiedByDeadKeyOnPress == baseKey);
const_iterator cend() const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
void applyDeadKeyTranslations(KeyEvent *event)
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
std::optional< QString > findKeyTextByKeyId(const T &mappingArray, Qt::Key qtKey)
constexpr KeyMapping circumflexKeyTable[]
static Qt::Key find(const KeyMapping(&map)[N], Qt::Key key) noexcept
constexpr KeyMapping graveKeyTable[]
static constexpr const auto DiacriticalCharsKeyToTextLowercase
static constexpr const auto WebToQtKeyCodeMappings
constexpr KeyMapping acuteKeyTable[]
static Qt::Key find_impl(const KeyMapping *first, const KeyMapping *last, Qt::Key key) noexcept
static constexpr const auto DiacriticalCharsKeyToTextUppercase
Qt::Key translateBaseKeyUsingDeadKey(Qt::Key accentBaseKey, Qt::Key deadKey)
constexpr KeyMapping diaeresisKeyTable[]
constexpr KeyMapping tildeKeyTable[]
std::optional< Qt::Key > mapWebKeyTextToQtKey(const char *toFind)
constexpr QtPrivate::ArrayType< ManualType, Types... > qMakeArray(Types &&... t) noexcept
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static QString qtKey(CFStringRef cfkey)
static constexpr Type data() noexcept
bool operator<(const WebKb2QtData &that) const noexcept
constexpr int strcmp(const WebKb2QtData &that, const int i=0) const
constexpr bool operator==(const WebKb2QtData &that) const noexcept
constexpr bool operator<=(const WebKb2QtData &that) const noexcept