emphasis added
This commit is contained in:
parent
0c2bc32abd
commit
c9b83ff689
|
@ -26,6 +26,7 @@ class QskPushButton::PrivateData
|
||||||
: text( txt )
|
: text( txt )
|
||||||
, isCheckable( false )
|
, isCheckable( false )
|
||||||
, isGraphicSourceDirty( false )
|
, isGraphicSourceDirty( false )
|
||||||
|
, emphasis( Emphasis3 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ class QskPushButton::PrivateData
|
||||||
|
|
||||||
bool isCheckable : 1;
|
bool isCheckable : 1;
|
||||||
bool isGraphicSourceDirty : 1;
|
bool isGraphicSourceDirty : 1;
|
||||||
|
int emphasis : 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskPushButton::QskPushButton( QQuickItem* parent )
|
QskPushButton::QskPushButton( QQuickItem* parent )
|
||||||
|
@ -79,6 +81,20 @@ bool QskPushButton::isCheckable() const
|
||||||
return m_data->isCheckable;
|
return m_data->isCheckable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskPushButton::setEmphasis( Emphasis emphasis )
|
||||||
|
{
|
||||||
|
if ( emphasis != m_data->emphasis )
|
||||||
|
{
|
||||||
|
m_data->emphasis = emphasis;
|
||||||
|
Q_EMIT emphasisChanged( emphasis );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QskPushButton::Emphasis QskPushButton::emphasis() const
|
||||||
|
{
|
||||||
|
return static_cast< Emphasis >( m_data->emphasis );
|
||||||
|
}
|
||||||
|
|
||||||
void QskPushButton::setShape( const QskBoxShapeMetrics& shape )
|
void QskPushButton::setShape( const QskBoxShapeMetrics& shape )
|
||||||
{
|
{
|
||||||
if ( setBoxShapeHint( Panel, shape ) )
|
if ( setBoxShapeHint( Panel, shape ) )
|
||||||
|
@ -227,7 +243,23 @@ void QskPushButton::updateResources()
|
||||||
|
|
||||||
QskAspect::Variation QskPushButton::effectiveVariation() const
|
QskAspect::Variation QskPushButton::effectiveVariation() const
|
||||||
{
|
{
|
||||||
return Inherited::effectiveVariation();
|
switch( m_data->emphasis )
|
||||||
|
{
|
||||||
|
case Emphasis1:
|
||||||
|
return QskAspect::Tiny;
|
||||||
|
|
||||||
|
case Emphasis2:
|
||||||
|
return QskAspect::Small;
|
||||||
|
|
||||||
|
case Emphasis4:
|
||||||
|
return QskAspect::Large;
|
||||||
|
|
||||||
|
case Emphasis5:
|
||||||
|
return QskAspect::Huge;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QskAspect::NoVariation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskPushButton::layoutRectForSize( const QSizeF& size ) const
|
QRectF QskPushButton::layoutRectForSize( const QSizeF& size ) const
|
||||||
|
|
|
@ -36,6 +36,9 @@ 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( Emphasis emphasis READ emphasis
|
||||||
|
WRITE setEmphasis NOTIFY emphasisChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
Q_PROPERTY( QskBoxShapeMetrics shape READ shape
|
||||||
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
WRITE setShape RESET resetShape NOTIFY shapeChanged )
|
||||||
|
|
||||||
|
@ -44,11 +47,24 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Ripple, Text, Graphic )
|
QSK_SUBCONTROLS( Panel, Ripple, Text, Graphic )
|
||||||
|
|
||||||
|
enum Emphasis
|
||||||
|
{
|
||||||
|
Emphasis1 = -2,
|
||||||
|
Emphasis2 = -1,
|
||||||
|
Emphasis3 = 0,
|
||||||
|
Emphasis4 = 1,
|
||||||
|
Emphasis5 = 2
|
||||||
|
};
|
||||||
|
Q_ENUM( Emphasis )
|
||||||
|
|
||||||
QskPushButton( QQuickItem* parent = nullptr );
|
QskPushButton( QQuickItem* parent = nullptr );
|
||||||
QskPushButton( const QString& text, QQuickItem* parent = nullptr );
|
QskPushButton( const QString& text, QQuickItem* parent = nullptr );
|
||||||
|
|
||||||
~QskPushButton() override;
|
~QskPushButton() override;
|
||||||
|
|
||||||
|
void setEmphasis( Emphasis );
|
||||||
|
Emphasis emphasis() const;
|
||||||
|
|
||||||
void setCheckable( bool );
|
void setCheckable( bool );
|
||||||
bool isCheckable() const override final;
|
bool isCheckable() const override final;
|
||||||
|
|
||||||
|
@ -83,6 +99,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void checkableChanged( bool );
|
void checkableChanged( bool );
|
||||||
|
void emphasisChanged( Emphasis ) const;
|
||||||
void shapeChanged();
|
void shapeChanged();
|
||||||
|
|
||||||
void textChanged();
|
void textChanged();
|
||||||
|
|
Loading…
Reference in New Issue