QskAbstractButton::Flat removed, using QskAspect::Header instead

This commit is contained in:
Uwe Rathmann 2022-06-29 16:21:54 +02:00
parent bd312249c0
commit 3c5b6f9f01
9 changed files with 15 additions and 42 deletions

View File

@ -96,8 +96,7 @@ Qsk.Window
{
text: "Check Me"
flat: true
section: Qsk.Aspect.Header
checkable: true
}
@ -105,14 +104,14 @@ Qsk.Window
{
text: "Push Me"
flat: true
section: Qsk.Aspect.Header
}
TestButton
{
text: "Disabled"
flat: true
section: Qsk.Aspect.Header
enabled: false
}

View File

@ -52,8 +52,6 @@ namespace
MenuButton( const QString& text, QQuickItem* parent = nullptr )
: QskPushButton( text, parent )
{
setFlat( true ); // until we have the section bit in QskAspect
connect( this, &QskPushButton::pressed, this, &MenuButton::openMenu );
}
@ -91,14 +89,13 @@ namespace
{
initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed );
setSection( QskAspect::Header );
setMargins( 10 );
setBackgroundColor( Qt::lightGray );
{
auto button = new QskPushButton( "Skin", this );
#if 1
button->setFlat( true ); // until we have the section bit in QskAspect
#endif
// transition leads to errors, when changing the tab before being completed. TODO ...
connect( button, &QskSwitchButton::clicked,

View File

@ -75,7 +75,7 @@ class Thumbnail : public QskPushButton
setGraphic( thumbnailGraphic( color, shape, size ) );
setFixedSize( size );
setFlat( true );
setSection( QskAspect::Header ); // to make them flat
}
private:

View File

@ -458,7 +458,7 @@ void Editor::setupPushButton()
setBoxBorderColors( Q::Panel, noBorderColors );
setGradient( Q::Panel, White );
setGradient( Q::Panel | Q::Flat, White & ColorMask );
setGradient( Q::Panel | A::Header, White & ColorMask );
setColor( Q::Text, m_pal.textColor );
setColor( Q::Text | Q::Disabled, qskShadedColor( m_pal.textColor, 0.6 ) );
@ -468,7 +468,7 @@ void Editor::setupPushButton()
for ( auto state1 : { A::NoState, Q::Focused } )
{
setBoxBorderColors( Q::Panel | Q::Hovered | state1, borderColors );
setBoxBorderColors( Q::Panel | Q::Hovered | Q::Flat | state1, borderColors );
setBoxBorderColors( Q::Panel | Q::Hovered | A::Header | state1, borderColors );
for ( auto state2 : { A::NoState, Q::Hovered } )
{
@ -479,8 +479,8 @@ void Editor::setupPushButton()
setGradient( Q::Panel | states, m_pal.accentColor );
setColor( Q::Text | states, White );
setGradient( Q::Panel | Q::Flat | states, m_pal.accentColor );
setColor( Q::Text | Q::Flat | states, White );
setGradient( Q::Panel | A::Header | states, m_pal.accentColor );
setColor( Q::Text | A::Header | states, White );
}
}
}

View File

@ -574,15 +574,15 @@ void Editor::setupPushButton()
setMetric( Q::Panel | A::Spacing, 4 );
setButton( Q::Panel, Raised );
setButton( Q::Panel | Q::Flat | Q::Hovered, Raised );
setButton( Q::Panel | A::Header | Q::Hovered, Raised );
setButton( Q::Panel | Q::Flat, Flat );
setButton( Q::Panel | Q::Flat | Q::Disabled, Flat );
setButton( Q::Panel | A::Header, Flat );
setButton( Q::Panel | A::Header | Q::Disabled, Flat );
for ( auto state : { Q::Pressed, Q::Checked } )
{
setButton( Q::Panel | state, Sunken );
setButton( Q::Panel | Q::Flat | state, Sunken );
setButton( Q::Panel | A::Header | state, Sunken );
}
setAnimation( Q::Panel | A::Color, qskDuration );

View File

@ -10,9 +10,6 @@
#include <qbasictimer.h>
// Flat is no state - we need to get rid of it. TODO ...
QSK_SYSTEM_STATE( QskAbstractButton, Flat, QskAspect::FirstSystemState << 1 )
QSK_SYSTEM_STATE( QskAbstractButton, Checked, QskAspect::LastSystemState >> 3 )
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )

View File

@ -33,7 +33,7 @@ class QSK_EXPORT QskAbstractButton : public QskControl
using Inherited = QskControl;
public:
QSK_STATES( Flat, Checked, Pressed )
QSK_STATES( Checked, Pressed )
QskAbstractButton( QQuickItem* parent = nullptr );
~QskAbstractButton() override;

View File

@ -100,20 +100,6 @@ QskBoxShapeMetrics QskPushButton::shape() const
return boxShapeHint( Panel );
}
void QskPushButton::setFlat( bool on )
{
if ( on != isFlat() )
{
setSkinStateFlag( Flat, on );
Q_EMIT flatChanged();
}
}
bool QskPushButton::isFlat() const
{
return hasSkinState( Flat );
}
void QskPushButton::setText( const QString& text )
{
if ( text != m_data->text )

View File

@ -36,8 +36,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
Q_PROPERTY( bool checkable READ isCheckable
WRITE setCheckable NOTIFY checkableChanged FINAL )
Q_PROPERTY( bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL )
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
WRITE setShape RESET resetShape NOTIFY shapeChanged )
@ -70,9 +68,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
void resetGraphicSourceSize();
void setFlat( bool );
bool isFlat() const;
QFont font() const;
QRectF layoutRectForSize( const QSizeF& ) const override;
@ -89,7 +84,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
void shapeChanged();
void textChanged();
void textOptionsChanged();
void flatChanged();
void graphicChanged();
void graphicSourceChanged();
void graphicSourceSizeChanged();