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
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-06-12 06:20:48 +00:00
|
|
|
#ifndef QSK_INPUT_PANEL_H
|
|
|
|
#define QSK_INPUT_PANEL_H
|
2018-04-06 15:30:24 +00:00
|
|
|
|
2018-06-12 06:20:48 +00:00
|
|
|
#include "QskControl.h"
|
2018-06-11 16:55:48 +00:00
|
|
|
#include <memory>
|
2018-04-06 15:30:24 +00:00
|
|
|
|
2018-06-11 16:55:48 +00:00
|
|
|
class QskTextPredictor;
|
2018-06-12 06:20:48 +00:00
|
|
|
class QString;
|
2018-04-10 14:51:35 +00:00
|
|
|
|
2018-06-12 06:20:48 +00:00
|
|
|
class QSK_EXPORT QskInputPanel : public QskControl
|
2018-04-10 14:51:35 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-06-12 06:20:48 +00:00
|
|
|
using Inherited = QskControl;
|
2018-04-18 17:41:46 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
public:
|
2018-06-12 06:20:48 +00:00
|
|
|
QskInputPanel( QQuickItem* parent = nullptr );
|
2018-07-31 15:32:25 +00:00
|
|
|
~QskInputPanel() override;
|
2018-06-02 15:10:41 +00:00
|
|
|
|
2018-06-12 06:20:48 +00:00
|
|
|
void attachInputItem( QQuickItem* );
|
|
|
|
void updateInputPanel( Qt::InputMethodQueries );
|
2018-04-10 14:51:35 +00:00
|
|
|
|
2018-06-11 16:55:48 +00:00
|
|
|
virtual QQuickItem* inputProxy() const;
|
2018-06-12 06:20:48 +00:00
|
|
|
QQuickItem* inputItem() const;
|
|
|
|
|
|
|
|
virtual Qt::Alignment alignment() const;
|
2018-04-26 12:42:33 +00:00
|
|
|
|
2022-02-04 15:10:44 +00:00
|
|
|
QStringList candidates() const;
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
public Q_SLOTS:
|
2018-06-11 16:55:48 +00:00
|
|
|
void commitKey( int keyCode );
|
|
|
|
void commitPredictiveText( int index );
|
2018-04-26 12:42:33 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
Q_SIGNALS:
|
2018-06-12 06:20:48 +00:00
|
|
|
void keySelected( int keyCode );
|
|
|
|
void predictiveTextSelected( int );
|
2019-03-30 18:17:45 +00:00
|
|
|
void inputItemDestroyed();
|
2018-04-18 17:41:46 +00:00
|
|
|
|
2022-02-04 15:10:44 +00:00
|
|
|
void predictionReset();
|
|
|
|
void predictionRequested( const QString& text );
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
public Q_SLOTS:
|
2018-06-12 06:20:48 +00:00
|
|
|
virtual void setPrompt( const QString& );
|
|
|
|
virtual void setPrediction( const QStringList& );
|
|
|
|
virtual void setPredictionEnabled( bool );
|
2018-04-18 17:41:46 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
protected:
|
2018-06-12 06:20:48 +00:00
|
|
|
virtual void attachItem( QQuickItem* ) = 0;
|
2018-04-18 17:41:46 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
private:
|
2022-03-23 10:54:34 +00:00
|
|
|
void updatePrediction( const QString&, const QStringList& candidates );
|
2018-06-11 16:55:48 +00:00
|
|
|
void resetPredictor( const QLocale& );
|
|
|
|
void updateLocale( const QLocale& );
|
2018-05-01 09:52:29 +00:00
|
|
|
|
2018-04-10 14:51:35 +00:00
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
|
|
|
};
|
2018-04-06 15:30:24 +00:00
|
|
|
|
|
|
|
#endif
|