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_COMPOSITION_MODEL_H
|
|
|
|
#define QSK_INPUT_COMPOSITION_MODEL_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <memory>
|
|
|
|
|
2018-04-04 15:19:51 +02:00
|
|
|
class QskInputContext;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
class QskInputCompositionModel : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-04-04 15:19:51 +02:00
|
|
|
QskInputCompositionModel( QskInputContext* context );
|
2017-07-21 18:21:34 +02:00
|
|
|
virtual ~QskInputCompositionModel();
|
|
|
|
|
2018-03-30 01:15:05 -07:00
|
|
|
// to determine whether to show the suggestion bar:
|
|
|
|
virtual bool supportsSuggestions() const;
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
void commit( const QString& );
|
2018-03-30 01:15:05 -07:00
|
|
|
virtual void commitCandidate( int );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-04-13 16:32:48 +02:00
|
|
|
void composeKey( int key );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
virtual int candidateCount() const;
|
2018-03-30 01:15:05 -07:00
|
|
|
virtual QString candidate( int ) const;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool hasIntermediate() const;
|
|
|
|
virtual QString polishPreedit( const QString& preedit );
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void candidatesChanged();
|
|
|
|
|
|
|
|
private:
|
2018-04-11 11:02:29 +02:00
|
|
|
void clearPreedit();
|
|
|
|
QskInputContext* context() const;
|
|
|
|
|
|
|
|
void sendPreeditTextEvent( const QString& );
|
2018-04-04 15:19:51 +02:00
|
|
|
void sendKeyEvents( int key );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
|
|
|
};
|
|
|
|
|
2018-03-30 18:31:13 +02:00
|
|
|
#endif
|