dead inputcontext related code removed
This commit is contained in:
parent
67052eb60a
commit
7b2e63c7e5
@ -93,13 +93,6 @@ QString QskHunspellCompositionModel::polishPreedit( const QString& preedit )
|
||||
return preedit;
|
||||
}
|
||||
|
||||
bool QskHunspellCompositionModel::isComposable( const QStringRef& preedit ) const
|
||||
{
|
||||
// ### What is this function even supposed do?
|
||||
Q_UNUSED( preedit );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QskHunspellCompositionModel::hasIntermediate() const
|
||||
{
|
||||
return true;
|
||||
|
@ -25,7 +25,6 @@ public:
|
||||
protected:
|
||||
virtual bool hasIntermediate() const override;
|
||||
virtual QString polishPreedit( const QString& ) override;
|
||||
virtual bool isComposable( const QStringRef& ) const override;
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
|
@ -42,8 +42,6 @@ public:
|
||||
QString preedit;
|
||||
QTextCharFormat preeditFormat;
|
||||
QList< QInputMethodEvent::Attribute > preeditAttributes;
|
||||
|
||||
int groupIndex = 0;
|
||||
};
|
||||
|
||||
QskInputCompositionModel::QskInputCompositionModel( QskInputContext* context ):
|
||||
@ -272,40 +270,4 @@ bool QskInputCompositionModel::hasIntermediate() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QskInputCompositionModel::isComposable( const QStringRef& preedit ) const
|
||||
{
|
||||
Q_UNUSED( preedit );
|
||||
return false;
|
||||
}
|
||||
|
||||
int QskInputCompositionModel::groupIndex() const
|
||||
{
|
||||
return m_data->groupIndex;
|
||||
}
|
||||
|
||||
void QskInputCompositionModel::setGroupIndex( int groupIndex )
|
||||
{
|
||||
if ( groupIndex == m_data->groupIndex )
|
||||
return;
|
||||
|
||||
m_data->groupIndex = groupIndex;
|
||||
const QString displayText = polishPreedit( m_data->preedit );
|
||||
m_data->preeditAttributes.first().length = displayText.length();
|
||||
|
||||
QInputMethodEvent event( displayText, m_data->preeditAttributes );
|
||||
sendCompositionEvent( &event );
|
||||
}
|
||||
|
||||
QVector< Qt::Key > QskInputCompositionModel::groups() const
|
||||
{
|
||||
return QVector< Qt::Key >();
|
||||
}
|
||||
|
||||
bool QskInputCompositionModel::nextGroupIndex( int& index, bool forward ) const
|
||||
{
|
||||
Q_UNUSED( index );
|
||||
Q_UNUSED( forward );
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "moc_QskInputCompositionModel.cpp"
|
||||
|
@ -17,8 +17,6 @@ class QskInputCompositionModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( QVector< Qt::Key > groups READ groups NOTIFY groupsChanged )
|
||||
|
||||
public:
|
||||
QskInputCompositionModel( QskInputContext* context );
|
||||
virtual ~QskInputCompositionModel();
|
||||
@ -35,22 +33,14 @@ public:
|
||||
virtual int candidateCount() const;
|
||||
virtual QString candidate( int ) const;
|
||||
|
||||
int groupIndex() const;
|
||||
void setGroupIndex( int groupIndex );
|
||||
virtual bool nextGroupIndex( int&, bool = true ) const;
|
||||
|
||||
virtual QVector< Qt::Key > groups() const;
|
||||
|
||||
protected:
|
||||
// Used for text composition
|
||||
virtual bool hasIntermediate() const;
|
||||
virtual QString polishPreedit( const QString& preedit );
|
||||
virtual bool isComposable( const QStringRef& preedit ) const;
|
||||
|
||||
QskInputContext* context() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void groupsChanged( const QVector< Qt::Key >& );
|
||||
void candidatesChanged();
|
||||
|
||||
private:
|
||||
|
@ -4,24 +4,63 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskInputContext.h"
|
||||
#include "QskVirtualKeyboard.h"
|
||||
|
||||
#include "QskInputCompositionModel.h"
|
||||
#include "QskPinyinCompositionModel.h"
|
||||
|
||||
#include <QskVirtualKeyboard.h>
|
||||
#include <QskDialog.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskControl.h>
|
||||
#include <QskSetup.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QHash>
|
||||
#include <QPointer>
|
||||
|
||||
void qskSetLocale( QQuickItem* inputPanel, const QLocale& locale )
|
||||
{
|
||||
if ( auto control = qobject_cast< QskControl* >( inputPanel ) )
|
||||
{
|
||||
control->setLocale( locale );
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto mo = inputPanel->metaObject();
|
||||
|
||||
const auto property = mo->property( mo->indexOfProperty( "locale" ) );
|
||||
if ( property.isWritable() )
|
||||
property.write( inputPanel, locale );
|
||||
}
|
||||
}
|
||||
|
||||
QLocale qskLocale( const QQuickItem* inputPanel )
|
||||
{
|
||||
if ( inputPanel == nullptr )
|
||||
return QLocale();
|
||||
|
||||
if ( auto control = qobject_cast< const QskControl* >( inputPanel ) )
|
||||
return control->locale();
|
||||
|
||||
return inputPanel->property( "locale" ).toLocale();
|
||||
}
|
||||
|
||||
QskVirtualKeyboard* qskVirtualKeyboard( QQuickItem* inputPanel )
|
||||
{
|
||||
// we should not depend on QskVirtualKeyboard TODO ...
|
||||
|
||||
if ( inputPanel )
|
||||
return inputPanel->findChild< QskVirtualKeyboard* >();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class QskInputContext::PrivateData
|
||||
{
|
||||
public:
|
||||
QPointer< QQuickItem > inputItem;
|
||||
QPointer< QskVirtualKeyboard > inputPanel;
|
||||
QPointer< QQuickItem > inputPanel;
|
||||
|
||||
QskInputCompositionModel* compositionModel;
|
||||
QHash< QLocale, QskInputCompositionModel* > compositionModels;
|
||||
};
|
||||
@ -119,23 +158,17 @@ void QskInputContext::update( Qt::InputMethodQueries queries )
|
||||
auto oldModel = compositionModel();
|
||||
|
||||
if( m_data->inputPanel )
|
||||
m_data->inputPanel->setLocale( locale );
|
||||
qskSetLocale( m_data->inputPanel, locale );
|
||||
|
||||
auto newModel = compositionModel();
|
||||
|
||||
if( oldModel != newModel )
|
||||
{
|
||||
if( m_data->inputPanel )
|
||||
{
|
||||
m_data->inputPanel->setCandidateBarVisible( newModel->supportsSuggestions() );
|
||||
m_data->inputPanel->disconnect( oldModel );
|
||||
connect( newModel, &QskInputCompositionModel::candidatesChanged,
|
||||
this, &QskInputContext::handleCandidatesChanged );
|
||||
|
||||
connect( newModel, &QskInputCompositionModel::groupsChanged,
|
||||
m_data->inputPanel.data(), &QskVirtualKeyboard::setPreeditGroups );
|
||||
|
||||
connect( newModel, &QskInputCompositionModel::candidatesChanged,
|
||||
this, &QskInputContext::handleCandidatesChanged );
|
||||
}
|
||||
if ( auto keyboard = qskVirtualKeyboard( m_data->inputPanel ) )
|
||||
keyboard->setCandidateBarVisible( newModel->supportsSuggestions() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +193,7 @@ QRectF QskInputContext::keyboardRect() const
|
||||
if ( m_data->inputPanel
|
||||
&& QskDialog::instance()->policy() != QskDialog::TopLevelWindow )
|
||||
{
|
||||
return m_data->inputPanel->geometry();
|
||||
return qskItemGeometry( m_data->inputPanel );
|
||||
}
|
||||
|
||||
return Inherited::keyboardRect();
|
||||
@ -226,7 +259,7 @@ bool QskInputContext::isInputPanelVisible() const
|
||||
|
||||
QLocale QskInputContext::locale() const
|
||||
{
|
||||
return m_data->inputPanel ? m_data->inputPanel->locale() : QLocale();
|
||||
return qskLocale( m_data->inputPanel );
|
||||
}
|
||||
|
||||
Qt::LayoutDirection QskInputContext::inputDirection() const
|
||||
@ -308,7 +341,7 @@ QskInputCompositionModel* QskInputContext::compositionModel() const
|
||||
return m_data->compositionModels.value( locale(), m_data->compositionModel );
|
||||
}
|
||||
|
||||
void QskInputContext::invokeAction( QInputMethod::Action action, int cursorPosition )
|
||||
void QskInputContext::invokeAction( QInputMethod::Action action, int value )
|
||||
{
|
||||
auto model = compositionModel();
|
||||
|
||||
@ -316,20 +349,15 @@ void QskInputContext::invokeAction( QInputMethod::Action action, int cursorPosit
|
||||
{
|
||||
case QskVirtualKeyboard::Compose:
|
||||
{
|
||||
model->composeKey( static_cast< Qt::Key >( cursorPosition ) );
|
||||
break;
|
||||
}
|
||||
case QskVirtualKeyboard::SelectGroup:
|
||||
{
|
||||
model->setGroupIndex( cursorPosition );
|
||||
model->composeKey( static_cast< Qt::Key >( value ) );
|
||||
break;
|
||||
}
|
||||
case QskVirtualKeyboard::SelectCandidate:
|
||||
{
|
||||
model->commitCandidate( cursorPosition );
|
||||
model->commitCandidate( value );
|
||||
|
||||
if ( m_data->inputPanel )
|
||||
m_data->inputPanel->setPreeditCandidates( QVector< QString >() );
|
||||
if ( auto keyboard = qskVirtualKeyboard( m_data->inputPanel ) )
|
||||
keyboard->setPreeditCandidates( QVector< QString >() );
|
||||
|
||||
break;
|
||||
}
|
||||
@ -355,10 +383,11 @@ void QskInputContext::handleCandidatesChanged()
|
||||
for( int i = 0; i < count; i++ )
|
||||
candidates += model->candidate( i );
|
||||
|
||||
m_data->inputPanel->setPreeditCandidates( candidates );
|
||||
if ( auto keyboard = qskVirtualKeyboard( m_data->inputPanel ) )
|
||||
keyboard->setPreeditCandidates( candidates );
|
||||
}
|
||||
|
||||
void QskInputContext::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||
void QskInputContext::setInputPanel( QQuickItem* inputPanel )
|
||||
{
|
||||
if ( m_data->inputPanel == inputPanel )
|
||||
return;
|
||||
@ -377,22 +406,34 @@ void QskInputContext::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||
|
||||
if ( inputPanel )
|
||||
{
|
||||
connect( inputPanel, &QskVirtualKeyboard::visibleChanged,
|
||||
// maybe using a QQuickItemChangeListener instead
|
||||
#if 1
|
||||
connect( inputPanel, &QQuickItem::visibleChanged,
|
||||
this, &QPlatformInputContext::emitInputPanelVisibleChanged );
|
||||
|
||||
connect( inputPanel, &QskVirtualKeyboard::keyboardRectChanged,
|
||||
connect( inputPanel, &QQuickItem::xChanged,
|
||||
this, &QPlatformInputContext::emitKeyboardRectChanged );
|
||||
|
||||
connect( inputPanel, &QskVirtualKeyboard::localeChanged,
|
||||
this, &QPlatformInputContext::emitLocaleChanged );
|
||||
connect( inputPanel, &QQuickItem::yChanged,
|
||||
this, &QPlatformInputContext::emitKeyboardRectChanged );
|
||||
|
||||
connect( inputPanel, &QQuickItem::widthChanged,
|
||||
this, &QPlatformInputContext::emitKeyboardRectChanged );
|
||||
|
||||
connect( inputPanel, &QQuickItem::heightChanged,
|
||||
this, &QPlatformInputContext::emitKeyboardRectChanged );
|
||||
#endif
|
||||
|
||||
if ( auto control = qobject_cast< QskControl* >( inputPanel ) )
|
||||
{
|
||||
connect( control, &QskControl::localeChanged,
|
||||
this, &QPlatformInputContext::emitLocaleChanged );
|
||||
}
|
||||
|
||||
if ( model )
|
||||
{
|
||||
inputPanel->setCandidateBarVisible(
|
||||
model->supportsSuggestions() );
|
||||
|
||||
connect( model, &QskInputCompositionModel::groupsChanged,
|
||||
inputPanel, &QskVirtualKeyboard::setPreeditGroups );
|
||||
if ( auto keyboard = qskVirtualKeyboard( inputPanel ) )
|
||||
keyboard->setCandidateBarVisible( model->supportsSuggestions() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <qpa/qplatforminputcontext.h>
|
||||
#include <memory>
|
||||
|
||||
class QskVirtualKeyboard;
|
||||
class QskInputCompositionModel;
|
||||
class QQuickItem;
|
||||
class QInputMethodQueryEvent;
|
||||
@ -56,7 +55,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void handleCandidatesChanged();
|
||||
void setInputPanel( QskVirtualKeyboard* );
|
||||
void setInputPanel( QQuickItem* );
|
||||
|
||||
private:
|
||||
void setInputItem( QQuickItem* );
|
||||
|
@ -8,15 +8,13 @@
|
||||
|
||||
#include "pinyinime.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QVector>
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
|
||||
class QskPinyinCompositionModel::PrivateData
|
||||
{
|
||||
public:
|
||||
QStringList candidates;
|
||||
QVector< Qt::Key > groups;
|
||||
};
|
||||
|
||||
QskPinyinCompositionModel::QskPinyinCompositionModel( QskInputContext* context ):
|
||||
@ -59,11 +57,6 @@ QString QskPinyinCompositionModel::candidate( int index ) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QVector< Qt::Key > QskPinyinCompositionModel::groups() const
|
||||
{
|
||||
return m_data->groups;
|
||||
}
|
||||
|
||||
bool QskPinyinCompositionModel::hasIntermediate() const
|
||||
{
|
||||
return m_data->candidates.count() > 0;
|
||||
@ -114,14 +107,3 @@ QString QskPinyinCompositionModel::polishPreedit( const QString& preedit )
|
||||
|
||||
return preedit;
|
||||
}
|
||||
|
||||
bool QskPinyinCompositionModel::isComposable( const QStringRef& preedit ) const
|
||||
{
|
||||
Q_UNUSED( preedit );
|
||||
return false; // ### implement
|
||||
}
|
||||
|
||||
void QskPinyinCompositionModel::handleGroupIndexChanged()
|
||||
{
|
||||
// ### implement
|
||||
}
|
||||
|
@ -21,17 +21,12 @@ public:
|
||||
virtual int candidateCount() const override;
|
||||
virtual QString candidate( int ) const override;
|
||||
|
||||
virtual QVector< Qt::Key > groups() const override;
|
||||
|
||||
protected:
|
||||
// Used for text composition
|
||||
virtual bool hasIntermediate() const override;
|
||||
virtual QString polishPreedit( const QString& preedit ) override;
|
||||
virtual bool isComposable( const QStringRef& preedit ) const override;
|
||||
|
||||
private:
|
||||
void handleGroupIndexChanged();
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
@ -90,17 +90,6 @@ public:
|
||||
setPreferredWidth( columnWidth( 0 ) + 20 );
|
||||
|
||||
setScrollableSize( QSizeF( columnWidth( 0 ), rowCount() * rowHeight() ) );
|
||||
|
||||
// TODO:
|
||||
// 1) changing the keyboard layouts does not yet work
|
||||
// 2) QskInputPanel does not work properly in the threaded environment
|
||||
#if 1
|
||||
connect( this, &QskListView::selectedRowChanged,
|
||||
this, [ this ] { qskSetup->inputPanel()->setLocale( m_values[selectedRow()].second ); } );
|
||||
#else
|
||||
connect( this, &QskListView::selectedRowChanged,
|
||||
this, [ this ] { QLocale::setDefault( m_values[selectedRow()].second ); } );
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual int rowCount() const override final
|
||||
@ -146,6 +135,14 @@ public:
|
||||
return m_values[row].first;
|
||||
}
|
||||
|
||||
QLocale localeAt( int row ) const
|
||||
{
|
||||
if ( row >= 0 && row < m_values.size() )
|
||||
return m_values[row].second;
|
||||
|
||||
return QLocale();
|
||||
}
|
||||
|
||||
private:
|
||||
inline void append( QLocale locale, const QString& name )
|
||||
{
|
||||
@ -179,8 +176,11 @@ int main( int argc, char* argv[] )
|
||||
box->setSpacing( 10 );
|
||||
box->setMargins( 20 );
|
||||
|
||||
(void) new LocaleListView( box );
|
||||
(void) new InputBox( box );
|
||||
auto listView = new LocaleListView( box );
|
||||
auto inputBox = new InputBox( box );
|
||||
|
||||
QObject::connect( listView, &QskListView::selectedRowChanged,
|
||||
inputBox, [ = ]( int row ) { inputBox->setLocale( listView->localeAt( row ) ); } );
|
||||
|
||||
QskWindow window;
|
||||
window.setColor( "PapayaWhip" );
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
|
||||
Q_PROPERTY( QStringList skinList READ skinList NOTIFY skinListChanged )
|
||||
|
||||
Q_PRIVATE_PROPERTY( setup(), QskVirtualKeyboard* inputPanel READ inputPanel
|
||||
Q_PRIVATE_PROPERTY( setup(), QQuickItem* inputPanel READ inputPanel
|
||||
WRITE setInputPanel NOTIFY inputPanelChanged )
|
||||
|
||||
Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsProvider controlFlags
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "QskSkinManager.h"
|
||||
#include "QskGraphicProviderMap.h"
|
||||
#include "QskControl.h"
|
||||
#include "QskVirtualKeyboard.h"
|
||||
#include "QskWindow.h"
|
||||
#include "QskObjectTree.h"
|
||||
|
||||
@ -127,7 +126,7 @@ public:
|
||||
|
||||
QskGraphicProviderMap graphicProviders;
|
||||
|
||||
QPointer< QskVirtualKeyboard > inputPanel;
|
||||
QPointer< QQuickItem > inputPanel;
|
||||
QskSetup::Flags controlFlags;
|
||||
};
|
||||
|
||||
@ -262,7 +261,7 @@ QskGraphicProvider* QskSetup::graphicProvider( const QString& providerId ) const
|
||||
return m_data->graphicProviders.provider( providerId );
|
||||
}
|
||||
|
||||
void QskSetup::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||
void QskSetup::setInputPanel( QQuickItem* inputPanel )
|
||||
{
|
||||
if ( m_data->inputPanel == inputPanel )
|
||||
return;
|
||||
@ -271,7 +270,7 @@ void QskSetup::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||
Q_EMIT inputPanelChanged( m_data->inputPanel );
|
||||
}
|
||||
|
||||
QskVirtualKeyboard* QskSetup::inputPanel()
|
||||
QQuickItem* QskSetup::inputPanel()
|
||||
{
|
||||
return m_data->inputPanel;
|
||||
}
|
||||
|
@ -11,10 +11,8 @@
|
||||
#include <qqml.h>
|
||||
#include <memory>
|
||||
|
||||
class QskVirtualKeyboard;
|
||||
class QskSkin;
|
||||
class QskSkinlet;
|
||||
class QskControl;
|
||||
class QQuickItem;
|
||||
class QskGraphicProvider;
|
||||
|
||||
class QLocale;
|
||||
@ -60,8 +58,8 @@ public:
|
||||
|
||||
QskSkin* skin();
|
||||
|
||||
void setInputPanel( QskVirtualKeyboard* );
|
||||
QskVirtualKeyboard* inputPanel();
|
||||
void setInputPanel( QQuickItem* );
|
||||
QQuickItem* inputPanel();
|
||||
|
||||
void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
|
||||
QskGraphicProvider* graphicProvider( const QString& providerId ) const;
|
||||
@ -76,7 +74,7 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void skinChanged( QskSkin* );
|
||||
void inputPanelChanged( QskVirtualKeyboard* );
|
||||
void inputPanelChanged( QQuickItem* );
|
||||
void controlFlagsChanged();
|
||||
|
||||
private:
|
||||
|
@ -271,9 +271,6 @@ public:
|
||||
qint16 selectedGroup;
|
||||
qint32 candidateOffset;
|
||||
|
||||
QLocale locale;
|
||||
|
||||
QVector< Qt::Key > groups;
|
||||
QVector< QString > candidates;
|
||||
|
||||
KeyTable keyTable[ ModeCount ];
|
||||
@ -506,25 +503,6 @@ QString QskVirtualKeyboard::displayLanguageName() const
|
||||
return QLocale::languageToString( locale.language() );
|
||||
}
|
||||
|
||||
void QskVirtualKeyboard::setPreeditGroups( const QVector< Qt::Key >& groups )
|
||||
{
|
||||
auto& topRow = m_data->keyTable[ LowercaseMode ].data[ 0 ];
|
||||
|
||||
for( const auto& group : groups )
|
||||
{
|
||||
auto& keyData = topRow[ &group - groups.data() ];
|
||||
keyData.key = group;
|
||||
}
|
||||
|
||||
m_data->groups = groups;
|
||||
selectGroup( -1 );
|
||||
|
||||
if( m_data->mode == LowercaseMode )
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void QskVirtualKeyboard::setPreeditCandidates( const QVector< QString >& candidates )
|
||||
{
|
||||
if( m_data->candidates == candidates )
|
||||
@ -540,7 +518,6 @@ void QskVirtualKeyboard::setCandidateOffset( int candidateOffset )
|
||||
{
|
||||
m_data->candidateOffset = candidateOffset;
|
||||
|
||||
const auto groupCount = m_data->groups.length();
|
||||
const auto candidateCount = m_data->candidates.length();
|
||||
const auto count = std::min( candidateCount, QskVirtualKeyboardCandidateButton::maxCandidates() );
|
||||
const bool continueLeft = m_data->candidateOffset > 0;
|
||||
@ -554,7 +531,7 @@ void QskVirtualKeyboard::setCandidateOffset( int candidateOffset )
|
||||
{
|
||||
button->setIndexAndText( i, textForKey( Qt::Key_ApplicationLeft ) );
|
||||
}
|
||||
else if( continueRight && ( i == KeyCount - groupCount - 1 ) )
|
||||
else if( continueRight && ( i == KeyCount - 1 ) )
|
||||
{
|
||||
button->setIndexAndText( i, textForKey( Qt::Key_ApplicationRight ) );
|
||||
}
|
||||
@ -727,33 +704,6 @@ void QskVirtualKeyboard::compose( int key )
|
||||
static_cast< QInputMethod::Action >( Compose ), key );
|
||||
}
|
||||
|
||||
void QskVirtualKeyboard::selectGroup( int index )
|
||||
{
|
||||
auto& topRow = m_data->keyTable[ m_data->mode ].data[ 0 ];
|
||||
|
||||
if( m_data->selectedGroup >= 0 )
|
||||
{
|
||||
auto group = static_cast< int >( m_data->selectedGroup );
|
||||
topRow[ group ].key &= ~KeyLocked;
|
||||
}
|
||||
|
||||
if( m_data->selectedGroup == index )
|
||||
{
|
||||
index = -1; // clear selection
|
||||
}
|
||||
|
||||
m_data->selectedGroup = index;
|
||||
QGuiApplication::inputMethod()->invokeAction(
|
||||
static_cast< QInputMethod::Action >( SelectGroup ), m_data->selectedGroup + 1 );
|
||||
|
||||
if( m_data->selectedGroup < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
topRow[ m_data->selectedGroup ].key |= KeyLocked;
|
||||
}
|
||||
|
||||
void QskVirtualKeyboard::selectCandidate( int index )
|
||||
{
|
||||
QGuiApplication::inputMethod()->invokeAction(
|
||||
|
@ -84,8 +84,7 @@ public:
|
||||
enum Action
|
||||
{
|
||||
Compose = 0x10,
|
||||
SelectGroup = 0x11,
|
||||
SelectCandidate = 0x12,
|
||||
SelectCandidate = 0x11,
|
||||
};
|
||||
Q_ENUM( Action )
|
||||
|
||||
@ -133,7 +132,6 @@ public:
|
||||
void setCandidateBarVisible( bool visible );
|
||||
|
||||
public Q_SLOTS:
|
||||
void setPreeditGroups( const QVector< Qt::Key >& );
|
||||
void setPreeditCandidates( const QVector< QString >& );
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user