QskAbstractButton::Flat removed, using QskAspect::Header instead
This commit is contained in:
parent
bd312249c0
commit
3c5b6f9f01
@ -96,8 +96,7 @@ Qsk.Window
|
|||||||
{
|
{
|
||||||
text: "Check Me"
|
text: "Check Me"
|
||||||
|
|
||||||
flat: true
|
section: Qsk.Aspect.Header
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,14 +104,14 @@ Qsk.Window
|
|||||||
{
|
{
|
||||||
text: "Push Me"
|
text: "Push Me"
|
||||||
|
|
||||||
flat: true
|
section: Qsk.Aspect.Header
|
||||||
}
|
}
|
||||||
|
|
||||||
TestButton
|
TestButton
|
||||||
{
|
{
|
||||||
text: "Disabled"
|
text: "Disabled"
|
||||||
|
|
||||||
flat: true
|
section: Qsk.Aspect.Header
|
||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ namespace
|
|||||||
MenuButton( const QString& text, QQuickItem* parent = nullptr )
|
MenuButton( const QString& text, QQuickItem* parent = nullptr )
|
||||||
: QskPushButton( text, parent )
|
: QskPushButton( text, parent )
|
||||||
{
|
{
|
||||||
setFlat( true ); // until we have the section bit in QskAspect
|
|
||||||
|
|
||||||
connect( this, &QskPushButton::pressed, this, &MenuButton::openMenu );
|
connect( this, &QskPushButton::pressed, this, &MenuButton::openMenu );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,14 +89,13 @@ namespace
|
|||||||
{
|
{
|
||||||
initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed );
|
initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed );
|
||||||
|
|
||||||
|
setSection( QskAspect::Header );
|
||||||
|
|
||||||
setMargins( 10 );
|
setMargins( 10 );
|
||||||
setBackgroundColor( Qt::lightGray );
|
setBackgroundColor( Qt::lightGray );
|
||||||
|
|
||||||
{
|
{
|
||||||
auto button = new QskPushButton( "Skin", this );
|
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 ...
|
// transition leads to errors, when changing the tab before being completed. TODO ...
|
||||||
connect( button, &QskSwitchButton::clicked,
|
connect( button, &QskSwitchButton::clicked,
|
||||||
|
@ -75,7 +75,7 @@ class Thumbnail : public QskPushButton
|
|||||||
setGraphic( thumbnailGraphic( color, shape, size ) );
|
setGraphic( thumbnailGraphic( color, shape, size ) );
|
||||||
setFixedSize( size );
|
setFixedSize( size );
|
||||||
|
|
||||||
setFlat( true );
|
setSection( QskAspect::Header ); // to make them flat
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -458,7 +458,7 @@ void Editor::setupPushButton()
|
|||||||
setBoxBorderColors( Q::Panel, noBorderColors );
|
setBoxBorderColors( Q::Panel, noBorderColors );
|
||||||
|
|
||||||
setGradient( Q::Panel, White );
|
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, m_pal.textColor );
|
||||||
setColor( Q::Text | Q::Disabled, qskShadedColor( m_pal.textColor, 0.6 ) );
|
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 } )
|
for ( auto state1 : { A::NoState, Q::Focused } )
|
||||||
{
|
{
|
||||||
setBoxBorderColors( Q::Panel | Q::Hovered | state1, borderColors );
|
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 } )
|
for ( auto state2 : { A::NoState, Q::Hovered } )
|
||||||
{
|
{
|
||||||
@ -479,8 +479,8 @@ void Editor::setupPushButton()
|
|||||||
setGradient( Q::Panel | states, m_pal.accentColor );
|
setGradient( Q::Panel | states, m_pal.accentColor );
|
||||||
setColor( Q::Text | states, White );
|
setColor( Q::Text | states, White );
|
||||||
|
|
||||||
setGradient( Q::Panel | Q::Flat | states, m_pal.accentColor );
|
setGradient( Q::Panel | A::Header | states, m_pal.accentColor );
|
||||||
setColor( Q::Text | Q::Flat | states, White );
|
setColor( Q::Text | A::Header | states, White );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -574,15 +574,15 @@ void Editor::setupPushButton()
|
|||||||
setMetric( Q::Panel | A::Spacing, 4 );
|
setMetric( Q::Panel | A::Spacing, 4 );
|
||||||
|
|
||||||
setButton( Q::Panel, Raised );
|
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 | A::Header, Flat );
|
||||||
setButton( Q::Panel | Q::Flat | Q::Disabled, Flat );
|
setButton( Q::Panel | A::Header | Q::Disabled, Flat );
|
||||||
|
|
||||||
for ( auto state : { Q::Pressed, Q::Checked } )
|
for ( auto state : { Q::Pressed, Q::Checked } )
|
||||||
{
|
{
|
||||||
setButton( Q::Panel | state, Sunken );
|
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 );
|
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
#include <qbasictimer.h>
|
#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, Checked, QskAspect::LastSystemState >> 3 )
|
||||||
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )
|
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskAbstractButton : public QskControl
|
|||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_STATES( Flat, Checked, Pressed )
|
QSK_STATES( Checked, Pressed )
|
||||||
|
|
||||||
QskAbstractButton( QQuickItem* parent = nullptr );
|
QskAbstractButton( QQuickItem* parent = nullptr );
|
||||||
~QskAbstractButton() override;
|
~QskAbstractButton() override;
|
||||||
|
@ -100,20 +100,6 @@ QskBoxShapeMetrics QskPushButton::shape() const
|
|||||||
return boxShapeHint( Panel );
|
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 )
|
void QskPushButton::setText( const QString& text )
|
||||||
{
|
{
|
||||||
if ( text != m_data->text )
|
if ( text != m_data->text )
|
||||||
|
@ -36,8 +36,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
|||||||
Q_PROPERTY( bool checkable READ isCheckable
|
Q_PROPERTY( bool checkable READ isCheckable
|
||||||
WRITE setCheckable NOTIFY checkableChanged FINAL )
|
WRITE setCheckable NOTIFY checkableChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL )
|
|
||||||
|
|
||||||
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
||||||
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
||||||
|
|
||||||
@ -70,9 +68,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
|||||||
|
|
||||||
void resetGraphicSourceSize();
|
void resetGraphicSourceSize();
|
||||||
|
|
||||||
void setFlat( bool );
|
|
||||||
bool isFlat() const;
|
|
||||||
|
|
||||||
QFont font() const;
|
QFont font() const;
|
||||||
|
|
||||||
QRectF layoutRectForSize( const QSizeF& ) const override;
|
QRectF layoutRectForSize( const QSizeF& ) const override;
|
||||||
@ -89,7 +84,6 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
|||||||
void shapeChanged();
|
void shapeChanged();
|
||||||
void textChanged();
|
void textChanged();
|
||||||
void textOptionsChanged();
|
void textOptionsChanged();
|
||||||
void flatChanged();
|
|
||||||
void graphicChanged();
|
void graphicChanged();
|
||||||
void graphicSourceChanged();
|
void graphicSourceChanged();
|
||||||
void graphicSourceSizeChanged();
|
void graphicSourceSizeChanged();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user