diff --git a/src/controls/QskSeparator.cpp b/src/controls/QskSeparator.cpp index 435d2aab..78211244 100644 --- a/src/controls/QskSeparator.cpp +++ b/src/controls/QskSeparator.cpp @@ -8,6 +8,12 @@ QSK_SUBCONTROL( QskSeparator, Panel ) +static inline QskAspect::Aspect qskAspectThickness() +{ + using namespace QskAspect; + return QskSeparator::Panel | Metric | Size; +} + QskSeparator::QskSeparator( QQuickItem* parent ) : QskSeparator( Qt::Horizontal, parent ) { @@ -54,20 +60,31 @@ void QskSeparator::setThickness( qreal thickness ) { thickness = qMax( thickness, 0.0 ); - if ( thickness != metric( QskSeparator::Panel | QskAspect::Size ) ) + if ( thickness != metric( qskAspectThickness() ) ) { setMetric( QskSeparator::Panel | QskAspect::Size, thickness ); resetImplicitSize(); update(); - Q_EMIT thicknessChanged(); + Q_EMIT thicknessChanged( thickness ); } } qreal QskSeparator::thickness() const { - return metric( QskSeparator::Panel | QskAspect::Size ); + return metric( qskAspectThickness() ); +} + +void QskSeparator::resetThickness() +{ + if ( resetHint( qskAspectThickness() ) ) + { + resetImplicitSize(); + update(); + + Q_EMIT thicknessChanged( thickness() ); + } } QSizeF QskSeparator::contentsSizeHint( diff --git a/src/controls/QskSeparator.h b/src/controls/QskSeparator.h index e95a3d48..09e0652f 100644 --- a/src/controls/QskSeparator.h +++ b/src/controls/QskSeparator.h @@ -16,7 +16,7 @@ class QSK_EXPORT QskSeparator : public QskControl WRITE setOrientation NOTIFY orientationChanged ) Q_PROPERTY( qreal thickness READ thickness - WRITE setThickness NOTIFY thicknessChanged ) + WRITE setThickness RESET resetThickness NOTIFY thicknessChanged ) using Inherited = QskControl; @@ -32,13 +32,14 @@ class QSK_EXPORT QskSeparator : public QskControl Qt::Orientation orientation() const; void setThickness( qreal thickness ); + void resetThickness(); qreal thickness() const; QskAspect::Placement effectivePlacement() const override; Q_SIGNALS: void orientationChanged( Qt::Orientation ); - void thicknessChanged(); + void thicknessChanged( qreal ); protected: QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;