qskinny/src/inputpanel/QskInputPanel.h

69 lines
1.6 KiB
C
Raw Normal View History

2018-04-06 15:30:24 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_INPUT_ENGINE_H
#define QSK_INPUT_ENGINE_H
2018-04-06 15:30:24 +00:00
#include "QskGlobal.h"
#include <QObject>
#include <memory>
2018-04-06 15:30:24 +00:00
class QskTextPredictor;
class QskControl;
class QQuickItem;
class QLocale;
class QSK_EXPORT QskInputEngine : public QObject
{
Q_OBJECT
using Inherited = QObject;
public:
QskInputEngine( QObject* parent = nullptr );
virtual ~QskInputEngine() override;
2018-06-02 15:10:41 +00:00
virtual void attachInputItem( QQuickItem* );
virtual void updateInputPanel( Qt::InputMethodQueries );
2018-06-02 15:10:41 +00:00
QskControl* panel( bool doCreate );
virtual Qt::Alignment panelAlignment() const;
virtual QQuickItem* inputProxy() const;
virtual QQuickItem* inputItem() const;
public Q_SLOTS:
void commitKey( int keyCode );
void commitPredictiveText( int index );
Q_SIGNALS:
void activeChanged();
void localeChanged();
2018-06-01 15:26:22 +00:00
protected:
virtual QskControl* createPanel() = 0;
virtual void attachToPanel( QQuickItem* ) = 0;
virtual void setPredictionEnabled( bool on );
virtual void showPrediction( const QStringList& );
void applyInput( bool success );
void applyText( const QString&, bool isFinal );
void applyKey( int keyCode );
private:
void resetPredictor( const QLocale& );
void updatePrediction();
2018-06-01 15:26:22 +00:00
void updatePanel();
void updateLocale( const QLocale& );
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
2018-04-06 15:30:24 +00:00
#endif