QskSkinnable::hasSkinState added

This commit is contained in:
Uwe Rathmann 2021-08-30 15:30:41 +02:00
parent 95731d9432
commit 9ebb5ae0a2
8 changed files with 16 additions and 10 deletions

View File

@ -85,7 +85,7 @@ void QskAbstractButton::releaseButton()
// maybe there is more work to have the signals coming // maybe there is more work to have the signals coming
// in a logical order. TODO ... // in a logical order. TODO ...
setCheckedState( !( skinState() & Checked ) ); setCheckedState( !hasSkinState( Checked ) );
} }
setPressed( false ); setPressed( false );
@ -99,12 +99,12 @@ void QskAbstractButton::setCheckedState( bool on )
void QskAbstractButton::toggle() void QskAbstractButton::toggle()
{ {
setChecked( !( skinState() & Checked ) ); setChecked( !isChecked() );
} }
bool QskAbstractButton::isPressed() const bool QskAbstractButton::isPressed() const
{ {
return skinState() & Pressed; return hasSkinState( Pressed );
} }
void QskAbstractButton::setPressed( bool on ) void QskAbstractButton::setPressed( bool on )
@ -171,7 +171,7 @@ void QskAbstractButton::setChecked( bool on )
bool QskAbstractButton::isChecked() const bool QskAbstractButton::isChecked() const
{ {
return skinState() & Checked; return hasSkinState( Checked );
} }
void QskAbstractButton::setAutoRepeat( bool on ) void QskAbstractButton::setAutoRepeat( bool on )

View File

@ -173,7 +173,7 @@ void QskBoundedInput::setReadOnly( bool readOnly )
bool QskBoundedInput::isReadOnly() const bool QskBoundedInput::isReadOnly() const
{ {
return skinState() & ReadOnly; return hasSkinState( ReadOnly );
} }
void QskBoundedInput::keyPressEvent( QKeyEvent* event ) void QskBoundedInput::keyPressEvent( QKeyEvent* event )

View File

@ -207,7 +207,7 @@ void QskPopup::setOpen( bool on )
bool QskPopup::isOpen() const bool QskPopup::isOpen() const
{ {
return !( skinState() & QskPopup::Closed ); return !hasSkinState( QskPopup::Closed );
} }
bool QskPopup::isFading() const bool QskPopup::isFading() const

View File

@ -115,7 +115,7 @@ void QskPushButton::setFlat( bool on )
bool QskPushButton::isFlat() const bool QskPushButton::isFlat() const
{ {
return skinState() & Flat; return hasSkinState( Flat );
} }
void QskPushButton::setText( const QString& text ) void QskPushButton::setText( const QString& text )

View File

@ -888,6 +888,11 @@ const QVariant& QskSkinnable::storedHint(
return hintInvalid; return hintInvalid;
} }
bool QskSkinnable::hasSkinState( QskAspect::State state ) const
{
return ( m_data->skinState & state ) == state;
}
QskAspect::State QskSkinnable::skinState() const QskAspect::State QskSkinnable::skinState() const
{ {
return m_data->skinState; return m_data->skinState;

View File

@ -132,6 +132,7 @@ class QSK_EXPORT QskSkinnable
void replaceSkinState( QskAspect::State ); void replaceSkinState( QskAspect::State );
bool hasSkinState( QskAspect::State ) const;
QskAspect::State skinState() const; QskAspect::State skinState() const;
const char* skinStateAsPrintable() const; const char* skinStateAsPrintable() const;

View File

@ -62,7 +62,7 @@ QskSlider::~QskSlider()
bool QskSlider::isPressed() const bool QskSlider::isPressed() const
{ {
return skinState() & Pressed; return hasSkinState( Pressed );
} }
void QskSlider::setOrientation( Qt::Orientation orientation ) void QskSlider::setOrientation( Qt::Orientation orientation )

View File

@ -648,7 +648,7 @@ void QskTextInput::setReadOnly( bool on )
void QskTextInput::setEditing( bool on ) void QskTextInput::setEditing( bool on )
{ {
if ( isReadOnly() || on == ( skinState() & Editing ) ) if ( isReadOnly() || on == isEditing() )
return; return;
setSkinStateFlag( Editing, on ); setSkinStateFlag( Editing, on );
@ -678,7 +678,7 @@ void QskTextInput::setEditing( bool on )
bool QskTextInput::isEditing() const bool QskTextInput::isEditing() const
{ {
return skinState() & Editing; return hasSkinState( Editing );
} }
void QskTextInput::ensureVisible( int position ) void QskTextInput::ensureVisible( int position )