fixing unwanted side effects of input method events

This commit is contained in:
Uwe Rathmann 2025-01-15 12:28:22 +01:00
parent c07cf24800
commit 4fa3c6e5b7
1 changed files with 22 additions and 1 deletions

View File

@ -35,7 +35,7 @@ static inline void qskPropagateReadOnly( QskTextInput* input )
}
static inline void qskTranslateMouseEventPosition(
QMouseEvent* mouseEvent, const QPointF& offset )
QMouseEvent* mouseEvent, const QPointF& offset )
{
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
auto& point = mouseEvent->point(0);
@ -142,6 +142,27 @@ namespace
break;
}
case QEvent::InputMethod:
{
const bool hadCursor = isCursorVisible();
ok = this->event( event );
if ( isCursorVisible() && !hadCursor )
{
/*
The initial InputMethod events might be sent from the
platform depending on focus. Unfortunately an
empty dummy event ( = no attributes ) leads to showing
the cursor.
*/
auto input = static_cast< const QskTextInput* >( parentItem() );
if ( !input->isEditing() )
setCursorVisible( false );
}
break;
}
default:
ok = this->event( event );
}