thickness -> extent
This commit is contained in:
parent
1527f46d51
commit
3004b8b74f
@ -8,11 +8,6 @@
|
||||
|
||||
QSK_SUBCONTROL( QskSeparator, Panel )
|
||||
|
||||
static inline QskAspect::Aspect qskAspectThickness()
|
||||
{
|
||||
return QskSeparator::Panel | QskAspect::Metric | QskAspect::Size;
|
||||
}
|
||||
|
||||
QskSeparator::QskSeparator( QQuickItem* parent )
|
||||
: QskSeparator( Qt::Horizontal, parent )
|
||||
{
|
||||
@ -55,36 +50,36 @@ Qt::Orientation QskSeparator::orientation() const
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
void QskSeparator::setThickness( qreal thickness )
|
||||
void QskSeparator::setExtent( qreal extent )
|
||||
{
|
||||
thickness = qMax( thickness, 0.0 );
|
||||
extent = qMax( extent, 0.0 );
|
||||
|
||||
const auto aspect = qskAspectThickness();
|
||||
const auto aspect = Panel | QskAspect::Size;
|
||||
|
||||
if ( thickness != metric( aspect ) )
|
||||
if ( extent != metric( aspect ) )
|
||||
{
|
||||
setMetric( aspect, thickness );
|
||||
setMetric( aspect, extent );
|
||||
|
||||
resetImplicitSize();
|
||||
update();
|
||||
|
||||
Q_EMIT thicknessChanged( thickness );
|
||||
Q_EMIT extentChanged( extent );
|
||||
}
|
||||
}
|
||||
|
||||
qreal QskSeparator::thickness() const
|
||||
qreal QskSeparator::extent() const
|
||||
{
|
||||
return metric( qskAspectThickness() );
|
||||
return metric( Panel | QskAspect::Size );
|
||||
}
|
||||
|
||||
void QskSeparator::resetThickness()
|
||||
void QskSeparator::resetExtent()
|
||||
{
|
||||
if ( resetHint( qskAspectThickness() ) )
|
||||
if ( resetMetric( Panel | QskAspect::Size ) )
|
||||
{
|
||||
resetImplicitSize();
|
||||
update();
|
||||
|
||||
Q_EMIT thicknessChanged( thickness() );
|
||||
Q_EMIT extentChanged( extent() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +89,7 @@ QSizeF QskSeparator::contentsSizeHint(
|
||||
if ( which != Qt::PreferredSize )
|
||||
return QSizeF();
|
||||
|
||||
const qreal m = thickness();
|
||||
const qreal m = extent();
|
||||
|
||||
if ( m_orientation == Qt::Horizontal )
|
||||
return QSizeF( -1, m );
|
||||
|
@ -15,8 +15,8 @@ class QSK_EXPORT QskSeparator : public QskControl
|
||||
Q_PROPERTY( Qt::Orientation orientation READ orientation
|
||||
WRITE setOrientation NOTIFY orientationChanged )
|
||||
|
||||
Q_PROPERTY( qreal thickness READ thickness
|
||||
WRITE setThickness RESET resetThickness NOTIFY thicknessChanged )
|
||||
Q_PROPERTY( qreal extent READ extent
|
||||
WRITE setExtent RESET resetExtent NOTIFY extentChanged )
|
||||
|
||||
using Inherited = QskControl;
|
||||
|
||||
@ -31,15 +31,15 @@ class QSK_EXPORT QskSeparator : public QskControl
|
||||
void setOrientation( Qt::Orientation );
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
void setThickness( qreal thickness );
|
||||
void resetThickness();
|
||||
qreal thickness() const;
|
||||
void setExtent( qreal thickness );
|
||||
void resetExtent();
|
||||
qreal extent() const;
|
||||
|
||||
QskAspect::Placement effectivePlacement() const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void orientationChanged( Qt::Orientation );
|
||||
void thicknessChanged( qreal );
|
||||
void extentChanged( qreal );
|
||||
|
||||
protected:
|
||||
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user