Skip to content

Commit

Permalink
fixing unwanted side effects of input method events
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Jan 15, 2025
1 parent c07cf24 commit 4fa3c6e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/controls/QskTextInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 );
}
Expand Down

0 comments on commit 4fa3c6e

Please sign in to comment.