qskinny/src/controls/QskRadioBox.h

65 lines
1.5 KiB
C
Raw Normal View History

2023-02-08 21:49:04 +01:00
#ifndef QSK_RADIO_BOX_H
#define QSK_RADIO_BOX_H
#include "QskControl.h"
#include <QStringList>
class QSK_EXPORT QskRadioBox : public QskControl
{
Q_OBJECT
Q_PROPERTY( int selectedIndex
READ selectedIndex
WRITE setSelectedIndex
NOTIFY selectedIndexChanged FINAL )
Q_PROPERTY( QStringList items
READ items
WRITE setItems
NOTIFY itemsChanged FINAL )
using Inherited = QskControl;
public:
2023-02-11 21:13:32 +01:00
QSK_SUBCONTROLS( Panel, Button, Symbol, Text, Ripple )
2023-02-08 21:49:04 +01:00
QSK_STATES( Selected, Pressed, Focused )
QskRadioBox( QQuickItem* parent = nullptr );
QskRadioBox( const QStringList&, QQuickItem* parent = nullptr );
QskRadioBox( const QStringList&, int, QQuickItem* parent = nullptr );
2023-02-15 00:20:19 +01:00
QRectF focusIndicatorRect() const override;
2023-02-08 21:49:04 +01:00
const QStringList& items() const;
int selectedIndex() const;
int pressedIndex() const;
2023-02-08 21:49:04 +01:00
public Q_SLOTS:
void setSelectedIndex( int );
void setItems( const QStringList& );
Q_SIGNALS:
void selectedIndexChanged( int );
void itemsChanged( const QStringList& );
protected:
void keyPressEvent( QKeyEvent* ) override;
void keyReleaseEvent( QKeyEvent* ) override;
void mousePressEvent( QMouseEvent* ) override;
void mouseReleaseEvent( QMouseEvent* ) override;
void focusInEvent( QFocusEvent* ) override;
void focusOutEvent( QFocusEvent* ) override;
int indexAt( const QPointF& ) const;
private:
2023-02-15 00:20:19 +01:00
void setFocusedIndex( int index );
2023-02-08 21:49:04 +01:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif