QPlatformKeyMapper -> QKeyMapper

This commit is contained in:
Ilya Fedin 2025-02-17 08:30:09 +00:00 committed by John Preston
parent 700e10d32c
commit abb58c58a0

View file

@ -21,12 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_menu_icons.h"
#include "styles/style_settings.h"
#include <qpa/qplatformintegration.h>
#include <private/qguiapplication_p.h>
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
#include <qpa/qplatformkeymapper.h>
#endif
#include <private/qkeymapper_p.h>
namespace Settings {
namespace {
@ -388,7 +383,6 @@ struct Labeled {
}
const auto key = static_cast<QKeyEvent*>(e.get());
const auto m = key->modifiers();
const auto integration = QGuiApplicationPrivate::platformIntegration();
const auto k = key->key();
const auto clear = !m
&& (k == Qt::Key_Backspace || k == Qt::Key_Delete);
@ -407,22 +401,18 @@ struct Labeled {
const auto r = [&] {
auto result = int(k);
if (m & Qt::ShiftModifier) {
const auto keys = QKeyMapper::possibleKeys(key);
for (const auto &possible : keys) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
const auto mapper = integration->keyMapper();
const auto list = mapper->possibleKeyCombinations(key);
for (const auto &possible : list) {
if (possible.keyboardModifiers() == m) {
return int(possible.key());
}
}
#else // Qt >= 6.7.0
const auto keys = integration->possibleKeys(key);
for (const auto possible : keys) {
if (possible > int(m)) {
return possible - int(m);
}
}
#endif // Qt < 6.7.0
}
}
return result;
}();