qskinny/src/inputpanel/QskInputPanel.h

82 lines
1.9 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_PANEL_H
#define QSK_INPUT_PANEL_H
#include "QskGlobal.h"
#include "QskBox.h"
2018-04-06 15:30:24 +00:00
class QskInputEngine;
2018-04-06 15:30:24 +00:00
class QString;
class QLocale;
2018-04-27 11:48:51 +00:00
class QSK_EXPORT QskInputPanel : public QskBox
{
Q_OBJECT
using Inherited = QskBox;
2018-06-02 15:10:41 +00:00
Q_PROPERTY( PanelHints panelHints READ panelHints
WRITE setPanelHints NOTIFY panelHintsChanged )
Q_PROPERTY( QString inputPrompt READ inputPrompt
WRITE setInputPrompt NOTIFY inputPromptChanged )
public:
QSK_SUBCONTROLS( Panel )
2018-06-02 15:10:41 +00:00
enum PanelHint
{
InputProxy = 1 << 0,
Prediction = 1 << 1
};
Q_ENUM( PanelHint )
Q_DECLARE_FLAGS( PanelHints, PanelHint )
QskInputPanel( QQuickItem* parent = nullptr );
virtual ~QskInputPanel() override;
void attachInputItem( QQuickItem* );
QQuickItem* attachedInputItem() const;
2018-06-02 15:10:41 +00:00
void setPanelHint( PanelHint, bool on );
void setPanelHints( PanelHints );
PanelHints panelHints() const;
2018-06-01 15:26:22 +00:00
QQuickItem* inputProxy() const;
QString inputPrompt() const;
virtual QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol ) const override;
Q_SIGNALS:
2018-06-02 15:10:41 +00:00
void panelHintsChanged();
void inputPromptChanged( const QString& );
2018-06-02 15:10:41 +00:00
void keySelected( int keyCode );
void predictiveTextSelected( int );
2018-06-01 15:26:22 +00:00
public Q_SLOTS:
void setInputPrompt( const QString& );
2018-06-02 15:10:41 +00:00
void setPrediction( const QStringList& );
2018-04-13 14:32:48 +00:00
protected:
virtual void keyPressEvent( QKeyEvent* ) override;
private:
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
2018-04-06 15:30:24 +00:00
2018-06-02 15:10:41 +00:00
Q_DECLARE_OPERATORS_FOR_FLAGS( QskInputPanel::PanelHints )
Q_DECLARE_METATYPE( QskInputPanel::PanelHints )
2018-04-06 15:30:24 +00:00
#endif