input panel improvements
This commit is contained in:
parent
f9ef60e2d5
commit
6b47678805
|
@ -265,6 +265,15 @@ void QskInputContext::showInputPanel()
|
||||||
this, &QPlatformInputContext::emitLocaleChanged,
|
this, &QPlatformInputContext::emitLocaleChanged,
|
||||||
Qt::UniqueConnection );
|
Qt::UniqueConnection );
|
||||||
|
|
||||||
|
if ( qskInputPanel->parent() == nullptr )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Take ownership to avoid, that the panel gets
|
||||||
|
destroyed together with the popup/window
|
||||||
|
*/
|
||||||
|
qskInputPanel->setParent( this );
|
||||||
|
}
|
||||||
|
|
||||||
if ( QskDialog::instance()->policy() == QskDialog::TopLevelWindow )
|
if ( QskDialog::instance()->policy() == QskDialog::TopLevelWindow )
|
||||||
{
|
{
|
||||||
// The input panel is embedded in a top level window
|
// The input panel is embedded in a top level window
|
||||||
|
|
|
@ -369,7 +369,6 @@ void QskInputPanel::processKey( int key,
|
||||||
const auto result = m_data->engine->processKey( key, inputHints, spaceLeft );
|
const auto result = m_data->engine->processKey( key, inputHints, spaceLeft );
|
||||||
|
|
||||||
auto inputItem = m_data->inputItem;
|
auto inputItem = m_data->inputItem;
|
||||||
auto inputProxy = m_data->inputProxy;
|
|
||||||
|
|
||||||
if ( result.key )
|
if ( result.key )
|
||||||
{
|
{
|
||||||
|
@ -377,15 +376,12 @@ void QskInputPanel::processKey( int key,
|
||||||
{
|
{
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
{
|
{
|
||||||
if ( m_data->hasInputProxy )
|
done( true );
|
||||||
qskSendReplaceText( inputItem, inputProxy->text() );
|
|
||||||
|
|
||||||
qskSendKey( inputItem, result.key );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Qt::Key_Escape:
|
case Qt::Key_Escape:
|
||||||
{
|
{
|
||||||
qskSendKey( inputItem, result.key );
|
done( false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -401,6 +397,18 @@ void QskInputPanel::processKey( int key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskInputPanel::done( bool success )
|
||||||
|
{
|
||||||
|
if ( success )
|
||||||
|
{
|
||||||
|
if ( m_data->hasInputProxy )
|
||||||
|
qskSendReplaceText( m_data->inputItem, m_data->inputProxy->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
qskSendKey( m_data->inputItem,
|
||||||
|
success ? Qt::Key_Return : Qt::Key_Escape );
|
||||||
|
}
|
||||||
|
|
||||||
void QskInputPanel::processInputMethodQueries( Qt::InputMethodQueries queries )
|
void QskInputPanel::processInputMethodQueries( Qt::InputMethodQueries queries )
|
||||||
{
|
{
|
||||||
if ( m_data->inputItem == nullptr )
|
if ( m_data->inputItem == nullptr )
|
||||||
|
|
|
@ -65,6 +65,7 @@ protected:
|
||||||
Qt::InputMethodHints, int spaceLeft );
|
Qt::InputMethodHints, int spaceLeft );
|
||||||
|
|
||||||
virtual void updatePrediction();
|
virtual void updatePrediction();
|
||||||
|
virtual void done( bool success );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void commitKey( int key );
|
void commitKey( int key );
|
||||||
|
|
|
@ -30,18 +30,18 @@ public:
|
||||||
QskVirtualKeyboard( QQuickItem* parent = nullptr );
|
QskVirtualKeyboard( QQuickItem* parent = nullptr );
|
||||||
virtual ~QskVirtualKeyboard() override;
|
virtual ~QskVirtualKeyboard() override;
|
||||||
|
|
||||||
virtual QskAspect::Subcontrol effectiveSubcontrol(
|
|
||||||
QskAspect::Subcontrol ) const override;
|
|
||||||
|
|
||||||
void updateLocale( const QLocale& );
|
|
||||||
|
|
||||||
void setMode( Mode );
|
void setMode( Mode );
|
||||||
Mode mode() const;
|
Mode mode() const;
|
||||||
|
|
||||||
|
void updateLocale( const QLocale& );
|
||||||
|
|
||||||
virtual qreal heightForWidth( qreal width ) const override;
|
virtual qreal heightForWidth( qreal width ) const override;
|
||||||
virtual qreal widthForHeight( qreal height ) const override;
|
virtual qreal widthForHeight( qreal height ) const override;
|
||||||
virtual QSizeF contentsSizeHint() const override;
|
virtual QSizeF contentsSizeHint() const override;
|
||||||
|
|
||||||
|
virtual QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
QskAspect::Subcontrol ) const override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void modeChanged( Mode );
|
void modeChanged( Mode );
|
||||||
void keySelected( int keyCode );
|
void keySelected( int keyCode );
|
||||||
|
|
Loading…
Reference in New Issue