From c07cf24800a5ddd09c5611f9f7ac6b9b5ce2d014 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 15 Jan 2025 12:26:26 +0100 Subject: [PATCH] don't handle keybaord inputs, when the activeFocusItem is editing --- src/controls/QskFocusIndicator.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/controls/QskFocusIndicator.cpp b/src/controls/QskFocusIndicator.cpp index bfe4be49..8ac03e9f 100644 --- a/src/controls/QskFocusIndicator.cpp +++ b/src/controls/QskFocusIndicator.cpp @@ -56,11 +56,26 @@ static inline QskAspect::Section qskItemSection( const QQuickItem* item ) } static inline bool qskIsEnablingKey( const QKeyEvent* event ) -{ +{ // what keys do we want have here ??? return qskIsButtonPressKey( event ) || qskFocusChainIncrement( event ); } +static inline bool qskIsEditing( const QQuickWindow* window ) +{ + if ( !QGuiApplication::inputMethod()->isVisible() ) + { + if ( auto item = window->activeFocusItem() ) + { + const QVariant v = item->property( "editing" ); + if ( v.value< bool >() ) + return true; + } + } + + return false; +} + class QskFocusIndicator::PrivateData { public: @@ -74,13 +89,13 @@ class QskFocusIndicator::PrivateData inline bool isAutoDisabling() const { return duration > 0; } inline bool isAutoEnabling() const { return false; } - + QPointer< QQuickItem > clippingItem; QVector< QMetaObject::Connection > connections; int duration = 0; QBasicTimer timer; - + bool blockAutoRepeatKeyEvents = false; }; @@ -187,6 +202,9 @@ bool QskFocusIndicator::eventFilter( QObject* object, QEvent* event ) case QEvent::KeyRelease: case QEvent::ShortcutOverride: { + if ( qskIsEditing( window() ) ) + return false; + if ( m_data->timer.isActive() ) { // renew the exposed period