From 60c16c82c82744767e78d54192c83d57ff3bccdd Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 27 Mar 2018 19:00:43 +0200 Subject: [PATCH] keyboard: Make key buttons work Not sure whether this is the right way... --- inputcontext/QskInputCompositionModel.cpp | 3 +++ src/controls/QskInputPanel.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/inputcontext/QskInputCompositionModel.cpp b/inputcontext/QskInputCompositionModel.cpp index eed9c1bb..4eb112e8 100644 --- a/inputcontext/QskInputCompositionModel.cpp +++ b/inputcontext/QskInputCompositionModel.cpp @@ -258,8 +258,11 @@ void QskInputCompositionModel::moveCursor( Qt::Key key ) if ( !m_data->preedit.isEmpty() ) return; + // ### this should be in the panel: QKeyEvent moveCursorPress( QEvent::KeyPress, key, Qt::NoModifier ); QKeyEvent moveCursorRelease( QEvent::KeyRelease, key, Qt::NoModifier ); + QFocusEvent focusIn( QEvent::FocusIn ); // hack to display the cursor + QCoreApplication::sendEvent( m_data->inputItem, &focusIn ); QCoreApplication::sendEvent( m_data->inputItem, &moveCursorPress ); QCoreApplication::sendEvent( m_data->inputItem, &moveCursorRelease ); } diff --git a/src/controls/QskInputPanel.cpp b/src/controls/QskInputPanel.cpp index 633f687f..49aff391 100644 --- a/src/controls/QskInputPanel.cpp +++ b/src/controls/QskInputPanel.cpp @@ -160,6 +160,8 @@ QskKeyButton::QskKeyButton( int keyIndex, QskInputPanel* inputPanel, QQuickItem* options.setFontSizeMode( QskTextOptions::VerticalFit ); setTextOptions( options ); + setFocusPolicy( Qt::TabFocus ); + auto keyData = m_inputPanel->keyDataAt( m_keyIndex ); const auto key = keyData.key & ~KeyStates;