Skip to content

Commit

Permalink
QKeyMapper: Merge default implementation of possibleKeys into call site
Browse files Browse the repository at this point in the history
Task-number: QTBUG-116873
Change-Id: I9091f4a9d465fb928afcabce0536fcd2d03b7f82
Reviewed-by: Andrey Butirsky <[email protected]>
Reviewed-by: Liang Qi <[email protected]>
  • Loading branch information
torarnv committed Sep 22, 2023
1 parent f58df04 commit 96e762e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/gui/kernel/qkeymapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ QKeyMapper::~QKeyMapper()
{
}

static QList<int> extractKeyFromEvent(QKeyEvent *e)
{
QList<int> 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;
}

QList<int> QKeyMapper::possibleKeys(QKeyEvent *e)
{
return instance()->d_func()->possibleKeys(e);
Expand Down Expand Up @@ -96,7 +86,11 @@ QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
if (!result.isEmpty())
return result;

return extractKeyFromEvent(e);
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
Expand Down

0 comments on commit 96e762e

Please sign in to comment.