QKeyMapper: Remove indirection via QKeyMapperPrivate for possibleKeys

Change-Id: I1988ac60689b3e6f4b29e38d1167d2b998702c09
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-09-20 20:52:15 +02:00
parent 96e762e5a4
commit 953e7eece8
2 changed files with 9 additions and 16 deletions

View File

@ -37,7 +37,15 @@ QKeyMapper::~QKeyMapper()
QList<int> QKeyMapper::possibleKeys(QKeyEvent *e)
{
return instance()->d_func()->possibleKeys(e);
QList<int> result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e);
if (!result.isEmpty())
return result;
if (e->key() && (e->key() != Qt::Key_unknown))
result << e->keyCombination().toCombined();
else if (!e->text().isEmpty())
result << int(e->text().at(0).unicode() + (int)e->modifiers());
return result;
}
extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // in qapplication_*.cpp
@ -80,19 +88,6 @@ QKeyMapperPrivate::~QKeyMapperPrivate()
{
}
QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
{
QList<int> result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e);
if (!result.isEmpty())
return result;
if (e->key() && (e->key() != Qt::Key_unknown))
result << e->keyCombination().toCombined();
else if (!e->text().isEmpty())
result << int(e->text().at(0).unicode() + (int)e->modifiers());
return result;
}
void *QKeyMapper::resolveInterface(const char *name, int revision) const
{
Q_UNUSED(name); Q_UNUSED(revision);

View File

@ -55,8 +55,6 @@ public:
QKeyMapperPrivate();
~QKeyMapperPrivate();
QList<int> possibleKeys(QKeyEvent *e);
QLocale keyboardInputLocale;
Qt::LayoutDirection keyboardInputDirection;
};