QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskRadioBox.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_RADIO_BOX_H
7#define QSK_RADIO_BOX_H
8
9#include "QskControl.h"
10#include <qstringlist.h>
11
12class QSK_EXPORT QskRadioBox : public QskControl
13{
14 Q_OBJECT
15
16 Q_PROPERTY( int selectedIndex READ selectedIndex
17 WRITE setSelectedIndex NOTIFY selectedIndexChanged FINAL )
18
19 Q_PROPERTY( QStringList options READ options
20 WRITE setOptions NOTIFY optionsChanged FINAL )
21
22 using Inherited = QskControl;
23
24 public:
25 QSK_SUBCONTROLS( Panel, Button, CheckIndicatorPanel, CheckIndicator, Text )
26 QSK_STATES( Selected, Pressed )
27
28 QskRadioBox( QQuickItem* parent = nullptr );
29 QskRadioBox( const QStringList&, QQuickItem* parent = nullptr );
30 QskRadioBox( const QStringList&, int, QQuickItem* parent = nullptr );
31
32 ~QskRadioBox() override;
33
34 QRectF focusIndicatorRect() const override;
35
36 QStringList options() const;
37 QString optionAt( int ) const;
38
39 int selectedIndex() const;
40 int pressedIndex() const;
41
42 public Q_SLOTS:
43 void setSelectedIndex( int );
44 void setOptions( const QStringList& );
45
46 Q_SIGNALS:
47 void selectedIndexChanged( int );
48 void optionsChanged( const QStringList& );
49
50 protected:
51 void keyPressEvent( QKeyEvent* ) override;
52 void keyReleaseEvent( QKeyEvent* ) override;
53
54 void mousePressEvent( QMouseEvent* ) override;
55 void mouseReleaseEvent( QMouseEvent* ) override;
56 void mouseUngrabEvent() override;
57
58 void hoverEnterEvent( QHoverEvent* ) override;
59 void hoverMoveEvent( QHoverEvent* ) override;
60 void hoverLeaveEvent( QHoverEvent* ) override;
61
62 void focusInEvent( QFocusEvent* ) override;
63 void focusOutEvent( QFocusEvent* ) override;
64
65 int indexAt( const QPointF& ) const;
66
67 private:
68 void setHoveredIndex( int index );
69 void setFocusedIndex( int index );
70
71 class PrivateData;
72 std::unique_ptr< PrivateData > m_data;
73};
74
75#endif
Base class of all controls.
Definition QskControl.h:23
void hoverLeaveEvent(QHoverEvent *) override
virtual QRectF focusIndicatorRect() const
void hoverEnterEvent(QHoverEvent *) override
void mouseUngrabEvent() override
Definition QskItem.cpp:1044