resetThickness added
This commit is contained in:
parent
05cb42a7ea
commit
3ec404385c
@ -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(
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user