resetThickness added
This commit is contained in:
parent
05cb42a7ea
commit
3ec404385c
@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
QSK_SUBCONTROL( QskSeparator, Panel )
|
QSK_SUBCONTROL( QskSeparator, Panel )
|
||||||
|
|
||||||
|
static inline QskAspect::Aspect qskAspectThickness()
|
||||||
|
{
|
||||||
|
using namespace QskAspect;
|
||||||
|
return QskSeparator::Panel | Metric | Size;
|
||||||
|
}
|
||||||
|
|
||||||
QskSeparator::QskSeparator( QQuickItem* parent )
|
QskSeparator::QskSeparator( QQuickItem* parent )
|
||||||
: QskSeparator( Qt::Horizontal, parent )
|
: QskSeparator( Qt::Horizontal, parent )
|
||||||
{
|
{
|
||||||
@ -54,20 +60,31 @@ void QskSeparator::setThickness( qreal thickness )
|
|||||||
{
|
{
|
||||||
thickness = qMax( thickness, 0.0 );
|
thickness = qMax( thickness, 0.0 );
|
||||||
|
|
||||||
if ( thickness != metric( QskSeparator::Panel | QskAspect::Size ) )
|
if ( thickness != metric( qskAspectThickness() ) )
|
||||||
{
|
{
|
||||||
setMetric( QskSeparator::Panel | QskAspect::Size, thickness );
|
setMetric( QskSeparator::Panel | QskAspect::Size, thickness );
|
||||||
|
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
update();
|
update();
|
||||||
|
|
||||||
Q_EMIT thicknessChanged();
|
Q_EMIT thicknessChanged( thickness );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskSeparator::thickness() const
|
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(
|
QSizeF QskSeparator::contentsSizeHint(
|
||||||
|
@ -16,7 +16,7 @@ class QSK_EXPORT QskSeparator : public QskControl
|
|||||||
WRITE setOrientation NOTIFY orientationChanged )
|
WRITE setOrientation NOTIFY orientationChanged )
|
||||||
|
|
||||||
Q_PROPERTY( qreal thickness READ thickness
|
Q_PROPERTY( qreal thickness READ thickness
|
||||||
WRITE setThickness NOTIFY thicknessChanged )
|
WRITE setThickness RESET resetThickness NOTIFY thicknessChanged )
|
||||||
|
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
@ -32,13 +32,14 @@ class QSK_EXPORT QskSeparator : public QskControl
|
|||||||
Qt::Orientation orientation() const;
|
Qt::Orientation orientation() const;
|
||||||
|
|
||||||
void setThickness( qreal thickness );
|
void setThickness( qreal thickness );
|
||||||
|
void resetThickness();
|
||||||
qreal thickness() const;
|
qreal thickness() const;
|
||||||
|
|
||||||
QskAspect::Placement effectivePlacement() const override;
|
QskAspect::Placement effectivePlacement() const override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void orientationChanged( Qt::Orientation );
|
void orientationChanged( Qt::Orientation );
|
||||||
void thicknessChanged();
|
void thicknessChanged( qreal );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user