2018-04-06 17:30:24 +02: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_PANEL_H
|
|
|
|
#define QSK_INPUT_PANEL_H
|
|
|
|
|
|
|
|
#include "QskGlobal.h"
|
2018-04-18 19:41:46 +02:00
|
|
|
#include "QskBox.h"
|
2018-04-06 17:30:24 +02:00
|
|
|
|
|
|
|
class QString;
|
2018-04-10 16:51:35 +02:00
|
|
|
class QLocale;
|
|
|
|
|
|
|
|
template class QVector< QString >;
|
|
|
|
|
2018-04-18 19:41:46 +02:00
|
|
|
class QSK_EXPORT QskInputPanel: public QskBox
|
2018-04-10 16:51:35 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-04-18 19:41:46 +02:00
|
|
|
using Inherited = QskBox;
|
|
|
|
|
|
|
|
Q_PROPERTY( bool inputProxy READ hasInputProxy
|
|
|
|
WRITE setInputProxy NOTIFY inputProxyChanged )
|
|
|
|
|
|
|
|
Q_PROPERTY( QString inputPrompt READ inputPrompt
|
|
|
|
WRITE setInputPrompt NOTIFY inputPromptChanged )
|
|
|
|
|
2018-04-10 16:51:35 +02:00
|
|
|
|
|
|
|
public:
|
2018-04-18 19:41:46 +02:00
|
|
|
QSK_SUBCONTROLS( Panel )
|
|
|
|
|
2018-04-10 16:51:35 +02:00
|
|
|
enum Action
|
|
|
|
{
|
|
|
|
Compose = 0x10,
|
2018-04-18 19:41:46 +02:00
|
|
|
SelectCandidate = 0x11
|
2018-04-10 16:51:35 +02:00
|
|
|
};
|
|
|
|
Q_ENUM( Action )
|
|
|
|
|
|
|
|
QskInputPanel( QQuickItem* parent = nullptr );
|
|
|
|
virtual ~QskInputPanel() override;
|
|
|
|
|
2018-04-18 19:41:46 +02:00
|
|
|
bool hasInputProxy() const;
|
|
|
|
QString inputPrompt() const;
|
|
|
|
|
2018-04-10 16:51:35 +02:00
|
|
|
bool isCandidatesEnabled() const;
|
|
|
|
QVector< QString > candidates() const;
|
|
|
|
|
2018-04-12 12:03:51 +02:00
|
|
|
virtual qreal heightForWidth( qreal width ) const override;
|
|
|
|
virtual qreal widthForHeight( qreal height ) const override;
|
|
|
|
|
2018-04-18 19:41:46 +02:00
|
|
|
virtual QskAspect::Subcontrol effectiveSubcontrol(
|
|
|
|
QskAspect::Subcontrol ) const override;
|
|
|
|
|
2018-04-23 14:06:40 +02:00
|
|
|
void updateInputProxy( const QQuickItem* );
|
|
|
|
|
2018-04-18 19:41:46 +02:00
|
|
|
Q_SIGNALS:
|
|
|
|
void inputProxyChanged( bool );
|
|
|
|
void inputPromptChanged( const QString& );
|
|
|
|
|
2018-04-10 16:51:35 +02:00
|
|
|
public Q_SLOTS:
|
2018-04-18 19:41:46 +02:00
|
|
|
void setInputPrompt( const QString& );
|
|
|
|
void setInputProxy( bool );
|
2018-04-10 16:51:35 +02:00
|
|
|
void setCandidatesEnabled( bool );
|
|
|
|
void setCandidates( const QVector< QString >& );
|
|
|
|
|
2018-04-13 16:32:48 +02:00
|
|
|
protected:
|
|
|
|
virtual void keyPressEvent( QKeyEvent* ) override;
|
|
|
|
virtual void keyReleaseEvent( QKeyEvent* ) override;
|
|
|
|
|
2018-04-10 16:51:35 +02:00
|
|
|
private:
|
2018-04-13 16:32:48 +02:00
|
|
|
void commitKey( int key );
|
2018-04-10 16:51:35 +02:00
|
|
|
void commitCandidate( int );
|
|
|
|
|
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
|
|
|
};
|
2018-04-06 17:30:24 +02:00
|
|
|
|
|
|
|
QSK_EXPORT QString qskNativeLocaleString( const QLocale& );
|
|
|
|
|
|
|
|
#endif
|