Client: Allow inheritance of key translation
Use a virtual method keysymToQtKey for Qt key code translation, so that it can be customized by a descendant class if needed. Change-Id: I3b48346a63e2c6f134230fe15279faa95abe11a0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
98c921c0e2
commit
bffa397f68
@ -1268,7 +1268,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
|||||||
|
|
||||||
Qt::KeyboardModifiers modifiers = mParent->modifiers();
|
Qt::KeyboardModifiers modifiers = mParent->modifiers();
|
||||||
|
|
||||||
int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, mXkbState.get(), code);
|
int qtkey = keysymToQtKey(sym, modifiers, mXkbState.get(), code);
|
||||||
QString text = QXkbCommon::lookupString(mXkbState.get(), code);
|
QString text = QXkbCommon::lookupString(mXkbState.get(), code);
|
||||||
|
|
||||||
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
||||||
|
@ -263,6 +263,12 @@ public:
|
|||||||
|
|
||||||
struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); }
|
struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); }
|
||||||
|
|
||||||
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
virtual int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers, xkb_state *state, xkb_keycode_t code) {
|
||||||
|
return QXkbCommon::keysymToQtKey(keysym, modifiers, state, code);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleFocusDestroyed();
|
void handleFocusDestroyed();
|
||||||
void handleFocusLost();
|
void handleFocusLost();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user