text edit: Support enter key (#503)
It turns out inputMethodHints() is sort of a user setting; when querying the hints in inputMethodQuery(), QQuickTextEdit adds the Qt::ImMultiLine flag manually.
This commit is contained in:
parent
1b4176625b
commit
fcab034bcb
|
@ -294,13 +294,20 @@ void QskTextEdit::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
QGuiApplication::inputMethod()->commit();
|
QGuiApplication::inputMethod()->commit();
|
||||||
|
|
||||||
if ( !( inputMethodHints() & Qt::ImhMultiLine ) )
|
const auto hints = inputMethodQuery( Qt::ImHints ).toInt();
|
||||||
|
|
||||||
|
if ( hints & Qt::ImhMultiLine )
|
||||||
|
{
|
||||||
|
m_data->wrappedEdit->handleEvent( event );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEditing( false );
|
setEditing( false );
|
||||||
|
|
||||||
// When returning from a virtual keyboard
|
// When returning from a virtual keyboard
|
||||||
qskForceActiveFocus( this, Qt::PopupFocusReason );
|
qskForceActiveFocus( this, Qt::PopupFocusReason );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
|
|
|
@ -308,7 +308,13 @@ void QskTextInput::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
QGuiApplication::inputMethod()->commit();
|
QGuiApplication::inputMethod()->commit();
|
||||||
|
|
||||||
if ( !( inputMethodHints() & Qt::ImhMultiLine ) )
|
const auto hints = inputMethodQuery( Qt::ImHints ).toInt();
|
||||||
|
|
||||||
|
if ( hints & Qt::ImhMultiLine )
|
||||||
|
{
|
||||||
|
m_data->wrappedInput->handleEvent( event );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEditing( false );
|
setEditing( false );
|
||||||
|
|
||||||
|
@ -316,6 +322,7 @@ void QskTextInput::keyPressEvent( QKeyEvent* event )
|
||||||
qskForceActiveFocus( this, Qt::PopupFocusReason );
|
qskForceActiveFocus( this, Qt::PopupFocusReason );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
|
|
Loading…
Reference in New Issue