Respect focused and pressed state in the skinlet
This commit is contained in:
parent
d510570943
commit
bfc172c04f
|
@ -66,6 +66,10 @@ int QskRadioBox::focusedIndex() const {
|
|||
return m_data->focusedIndex;
|
||||
}
|
||||
|
||||
int QskRadioBox::pressedIndex() const {
|
||||
return m_data->pressedIndex;
|
||||
}
|
||||
|
||||
void QskRadioBox::setSelectedIndex( int index ) {
|
||||
if( index == m_data->selectedIndex
|
||||
|| index >= m_data->items.count() ) {
|
||||
|
|
|
@ -29,9 +29,10 @@ class QSK_EXPORT QskRadioBox : public QskControl
|
|||
QskRadioBox( const QStringList&, QQuickItem* parent = nullptr );
|
||||
QskRadioBox( const QStringList&, int, QQuickItem* parent = nullptr );
|
||||
|
||||
int selectedIndex() const;
|
||||
const QStringList& items() const;
|
||||
int selectedIndex() const;
|
||||
int focusedIndex() const;
|
||||
int pressedIndex() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setSelectedIndex( int );
|
||||
|
|
|
@ -170,7 +170,15 @@ QskAspect::States QskRadioBoxSkinlet::sampleStates( const QskSkinnable* skinnabl
|
|||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
||||
|
||||
if( radio->selectedIndex() == index ) {
|
||||
return states | Q::Selected;
|
||||
states |= Q::Selected;
|
||||
}
|
||||
|
||||
if( radio->pressedIndex() == index ) {
|
||||
states |= Q::Pressed;
|
||||
}
|
||||
|
||||
if( radio->focusedIndex() == index ) {
|
||||
states |= Q::Focused;
|
||||
}
|
||||
|
||||
return states;
|
||||
|
|
Loading…
Reference in New Issue