qskinny/src/inputpanel/QskInputPanelBox.h

81 lines
1.9 KiB
C
Raw Normal View History

/******************************************************************************
* 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_BOX_H
#define QSK_INPUT_PANEL_BOX_H
#include "QskBox.h"
class QskInputEngine;
class QString;
class QLocale;
2018-06-12 06:20:48 +00:00
class QSK_EXPORT QskInputPanelBox : public QskBox
{
Q_OBJECT
using Inherited = QskBox;
Q_PROPERTY( PanelHints panelHints READ panelHints
WRITE setPanelHints NOTIFY panelHintsChanged )
Q_PROPERTY( QString inputPrompt READ inputPrompt
WRITE setInputPrompt NOTIFY inputPromptChanged )
2018-08-03 06:15:28 +00:00
public:
QSK_SUBCONTROLS( Panel, ProxyPanel, ProxyText )
enum PanelHint
{
InputProxy = 1 << 0,
Prediction = 1 << 1
};
Q_ENUM( PanelHint )
Q_DECLARE_FLAGS( PanelHints, PanelHint )
2018-06-12 06:20:48 +00:00
QskInputPanelBox( QQuickItem* parent = nullptr );
2018-07-31 15:32:25 +00:00
~QskInputPanelBox() override;
void attachInputItem( QQuickItem* );
QQuickItem* attachedInputItem() const;
void setPanelHint( PanelHint, bool on );
void setPanelHints( PanelHints );
PanelHints panelHints() const;
QQuickItem* inputProxy() const;
QString inputPrompt() const;
2018-07-31 15:32:25 +00:00
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol ) const override;
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
void panelHintsChanged();
void inputPromptChanged( const QString& );
void keySelected( int keyCode );
void predictiveTextSelected( int );
2018-08-03 06:15:28 +00:00
public Q_SLOTS:
void setInputPrompt( const QString& );
void setPrediction( const QStringList& );
2018-08-03 06:15:28 +00:00
protected:
2018-07-31 15:32:25 +00:00
void keyPressEvent( QKeyEvent* ) override;
2018-08-03 06:15:28 +00:00
private:
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
2018-06-12 06:20:48 +00:00
Q_DECLARE_OPERATORS_FOR_FLAGS( QskInputPanelBox::PanelHints )
Q_DECLARE_METATYPE( QskInputPanelBox::PanelHints )
#endif