2018-02-06 14:55:35 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
#ifndef QSK_INPUT_CONTEXT_H
|
|
|
|
#define QSK_INPUT_CONTEXT_H
|
|
|
|
|
|
|
|
#include <qpa/qplatforminputcontext.h>
|
2018-03-30 01:15:05 -07:00
|
|
|
#include <QHash>
|
2018-03-14 17:30:39 +01:00
|
|
|
#include <QQuickItem>
|
2018-03-30 01:15:05 -07:00
|
|
|
#include <QPointer>
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2018-03-28 09:01:25 -07:00
|
|
|
class QskVirtualKeyboard;
|
2017-07-21 18:21:34 +02:00
|
|
|
class QskInputCompositionModel;
|
|
|
|
|
|
|
|
class QskInputContext : public QPlatformInputContext
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
using Inherited = QPlatformInputContext;
|
|
|
|
|
|
|
|
public:
|
|
|
|
QskInputContext();
|
2018-03-14 18:00:55 +01:00
|
|
|
~QskInputContext() override;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
bool isValid() const override;
|
|
|
|
void update( Qt::InputMethodQueries ) override;
|
|
|
|
void invokeAction( QInputMethod::Action, int ) override;
|
|
|
|
QRectF keyboardRect() const override;
|
|
|
|
bool isAnimating() const override;
|
|
|
|
void showInputPanel() override;
|
|
|
|
void hideInputPanel() override;
|
|
|
|
bool isInputPanelVisible() const override;
|
|
|
|
QLocale locale() const override;
|
|
|
|
void setFocusObject( QObject* ) override;
|
|
|
|
|
2018-03-30 01:15:05 -07:00
|
|
|
QskInputCompositionModel* compositionModelForLocale( const QLocale& locale ) const;
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
private Q_SLOTS:
|
|
|
|
void emitAnimatingChanged();
|
|
|
|
void handleCandidatesChanged();
|
2018-03-28 09:01:25 -07:00
|
|
|
void setInputPanel( QskVirtualKeyboard* );
|
2018-03-30 01:15:05 -07:00
|
|
|
void inputMethodRegistered( const QLocale& locale, QskInputCompositionModel* model );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
private:
|
2018-03-30 01:15:05 -07:00
|
|
|
QskInputCompositionModel* currentInputCompositionModel() const;
|
|
|
|
void resetCandidates();
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
QPointer< QObject > m_focusObject;
|
2018-03-14 17:30:39 +01:00
|
|
|
QPointer< QQuickItem > m_inputItem;
|
2018-03-28 09:01:25 -07:00
|
|
|
QPointer< QskVirtualKeyboard > m_inputPanel;
|
2018-03-30 01:15:05 -07:00
|
|
|
QskInputCompositionModel* m_defaultInputCompositionModel;
|
|
|
|
QHash< QLocale, QskInputCompositionModel* > m_inputModels;
|
2017-07-21 18:21:34 +02:00
|
|
|
};
|
|
|
|
|
2018-03-30 18:31:13 +02:00
|
|
|
#endif
|