code moved from inputcontext to inputpanel
This commit is contained in:
parent
dfe2b875fd
commit
688ea07c02
@ -6,6 +6,10 @@
|
||||
#include <qpa/qplatforminputcontextplugin_p.h>
|
||||
|
||||
#include "QskInputContext.h"
|
||||
#include "QskPinyinCompositionModel.h"
|
||||
#include "QskHunspellCompositionModel.h"
|
||||
|
||||
#include <QLocale>
|
||||
|
||||
class QskInputContextPlugin final : public QPlatformInputContextPlugin
|
||||
{
|
||||
@ -17,7 +21,21 @@ public:
|
||||
const QString& system, const QStringList& ) override
|
||||
{
|
||||
if ( system.compare( QStringLiteral( "skinny" ), Qt::CaseInsensitive ) == 0 )
|
||||
return new QskInputContext;
|
||||
{
|
||||
auto context = new QskInputContext();
|
||||
|
||||
#if 1
|
||||
context->setCompositionModel( QLocale(),
|
||||
new QskHunspellCompositionModel( this ) );
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
context->setCompositionModel(
|
||||
QLocale::Chinese, new QskPinyinCompositionModel( this ) );
|
||||
#endif
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -33,13 +33,7 @@ QMAKE_RPATHDIR *= $${QSK_OUT_ROOT}/lib
|
||||
LIBS *= -L$${QSK_OUT_ROOT}/lib -lqskinny
|
||||
|
||||
SOURCES += \
|
||||
QskInputContext.cpp \
|
||||
QskInputContextPlugin.cpp \
|
||||
QskInputCompositionModel.cpp
|
||||
|
||||
HEADERS += \
|
||||
QskInputContext.h \
|
||||
QskInputCompositionModel.h
|
||||
QskInputContextPlugin.cpp
|
||||
|
||||
OTHER_FILES += metadata.json
|
||||
|
||||
|
@ -4,12 +4,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskInputContext.h"
|
||||
|
||||
#include "QskInputCompositionModel.h"
|
||||
#include "QskPinyinCompositionModel.h"
|
||||
#include "QskHunspellCompositionModel.h"
|
||||
|
||||
#include "QskInputPanel.h"
|
||||
|
||||
#include "QskLinearBox.h"
|
||||
#include <QskDialog.h>
|
||||
#include <QskPopup.h>
|
||||
@ -111,7 +108,7 @@ static void qskSetCandidates( QQuickItem* inputPanel,
|
||||
|
||||
static inline uint qskHashLocale( const QLocale& locale )
|
||||
{
|
||||
return uint( locale.language() + uint( locale.country() ) << 16 );
|
||||
return uint( locale.language() + ( uint( locale.country() ) << 16 ) );
|
||||
}
|
||||
|
||||
class QskInputContext::PrivateData
|
||||
@ -140,13 +137,6 @@ QskInputContext::QskInputContext():
|
||||
{
|
||||
setObjectName( "InputContext" );
|
||||
|
||||
#if 1
|
||||
setCompositionModel( locale(), new QskHunspellCompositionModel( this ) );
|
||||
#endif
|
||||
#if 0
|
||||
setCompositionModel( QLocale::Chinese, new QskPinyinCompositionModel( this ) );
|
||||
#endif
|
||||
|
||||
connect( qskSetup, &QskSetup::inputPanelChanged,
|
||||
this, &QskInputContext::setInputPanel );
|
||||
|
||||
@ -844,8 +834,6 @@ bool QskInputContext::eventFilter( QObject* object, QEvent* event )
|
||||
}
|
||||
case QEvent::Resize:
|
||||
{
|
||||
QQuickItem* panel = m_data->inputPanel;
|
||||
|
||||
if ( m_data->inputPanel )
|
||||
m_data->inputPanel->setSize( m_data->inputWindow->size() );
|
||||
|
||||
@ -866,9 +854,7 @@ bool QskInputContext::eventFilter( QObject* object, QEvent* event )
|
||||
{
|
||||
case QskEvent::GeometryChange:
|
||||
{
|
||||
if ( event->type() == QskEvent::GeometryChange )
|
||||
emitKeyboardRectChanged();
|
||||
|
||||
emitKeyboardRectChanged();
|
||||
break;
|
||||
}
|
||||
case QEvent::DeferredDelete:
|
||||
@ -926,7 +912,6 @@ void QskInputContext::sendText(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QskInputContext::sendKey( int key ) const
|
||||
{
|
||||
if ( m_data->inputItem == nullptr )
|
@ -298,11 +298,15 @@ SOURCES += \
|
||||
dialogs/QskSelectionWindow.cpp
|
||||
|
||||
SOURCES += \
|
||||
inputpanel/QskInputCompositionModel.cpp \
|
||||
inputpanel/QskInputContext.cpp \
|
||||
inputpanel/QskInputPanel.cpp \
|
||||
inputpanel/QskInputSuggestionBar.cpp \
|
||||
inputpanel/QskVirtualKeyboard.cpp
|
||||
|
||||
HEADERS += \
|
||||
inputpanel/QskInputCompositionModel.h \
|
||||
inputpanel/QskInputContext.h \
|
||||
inputpanel/QskInputPanel.h \
|
||||
inputpanel/QskInputSuggestionBar.h \
|
||||
inputpanel/QskVirtualKeyboard.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user