extent property fixed

This commit is contained in:
Uwe Rathmann 2020-12-17 08:52:30 +01:00
parent 1f2617fe86
commit 72dfde05a1
4 changed files with 31 additions and 12 deletions

View File

@ -188,25 +188,39 @@ QskGradient QskProgressBar::barGradient() const
return gradientHint( QskProgressBar::Bar );
}
void QskProgressBar::setThickness( qreal thickness )
void QskProgressBar::setExtent( qreal extent )
{
// effectiveSubcontrol( QskProgressBar::Groove ) ???
const auto aspect = QskProgressBar::Groove | QskAspect::Size;
extent = qMax( extent, 0.0 );
if ( thickness != metric( aspect ) )
const auto aspect = effectiveSubcontrol( Groove ) | QskAspect::Size;
if ( extent != metric( aspect ) )
{
setMetric( aspect, thickness );
setMetric( aspect, extent );
resetImplicitSize();
update();
Q_EMIT extentChanged( extent );
}
}
qreal QskProgressBar::thickness() const
qreal QskProgressBar::extent() const
{
return metric( Groove | QskAspect::Size );
}
void QskProgressBar::resetExtent()
{
if ( resetMetric( Groove | QskAspect::Size ) )
{
resetImplicitSize();
update();
Q_EMIT extentChanged( extent() );
}
}
void QskProgressBar::setOrigin( qreal origin )
{
if ( isComponentComplete() )
@ -272,9 +286,9 @@ QSizeF QskProgressBar::contentsSizeHint( Qt::SizeHint which, const QSizeF& ) con
return QSizeF();
if ( orientation() == Qt::Horizontal )
return QSizeF( -1, thickness() );
return QSizeF( -1, extent() );
else
return QSizeF( thickness(), -1 );
return QSizeF( extent(), -1 );
}
void QskProgressBar::componentComplete()

View File

@ -17,6 +17,9 @@ class QSK_EXPORT QskProgressBar : public QskBoundedControl
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged )
Q_PROPERTY( qreal extent READ extent
WRITE setExtent RESET resetExtent NOTIFY extentChanged )
Q_PROPERTY( bool indeterminate READ isIndeterminate
WRITE setIndeterminate NOTIFY indeterminateChanged )
@ -52,8 +55,9 @@ class QSK_EXPORT QskProgressBar : public QskBoundedControl
void resetBarGradient();
QskGradient barGradient() const;
void setThickness( qreal );
qreal thickness() const;
void setExtent( qreal );
void resetExtent();
qreal extent() const;
void resetOrigin();
qreal origin() const;
@ -69,6 +73,7 @@ class QSK_EXPORT QskProgressBar : public QskBoundedControl
Q_SIGNALS:
void orientationChanged( Qt::Orientation );
void extentChanged( qreal );
void indeterminateChanged( bool );
void valueChanged( qreal );
void originChanged( qreal );

View File

@ -54,7 +54,7 @@ void QskSeparator::setExtent( qreal extent )
{
extent = qMax( extent, 0.0 );
const auto aspect = Panel | QskAspect::Size;
const auto aspect = effectiveSubcontrol( Panel ) | QskAspect::Size;
if ( extent != metric( aspect ) )
{

View File

@ -31,7 +31,7 @@ class QSK_EXPORT QskSeparator : public QskControl
void setOrientation( Qt::Orientation );
Qt::Orientation orientation() const;
void setExtent( qreal thickness );
void setExtent( qreal );
void resetExtent();
qreal extent() const;