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