using QskSeparator::Panel | QskAspect::Size for the thickness of a
separator
This commit is contained in:
parent
16585a708d
commit
d6902f144c
|
@ -50,9 +50,29 @@ Qt::Orientation QskSeparator::orientation() const
|
|||
return m_orientation;
|
||||
}
|
||||
|
||||
void QskSeparator::setThickness( qreal thickness )
|
||||
{
|
||||
thickness = qMax( thickness, 0.0 );
|
||||
|
||||
if ( thickness != metric( QskSeparator::Panel | QskAspect::Size ) )
|
||||
{
|
||||
setMetric( QskSeparator::Panel | QskAspect::Size, thickness );
|
||||
|
||||
resetImplicitSize();
|
||||
update();
|
||||
|
||||
Q_EMIT thicknessChanged();
|
||||
}
|
||||
}
|
||||
|
||||
qreal QskSeparator::thickness() const
|
||||
{
|
||||
return metric( QskSeparator::Panel | QskAspect::Size );
|
||||
}
|
||||
|
||||
QSizeF QskSeparator::contentsSizeHint() const
|
||||
{
|
||||
const qreal m = metric( Panel );
|
||||
const qreal m = thickness();
|
||||
|
||||
if ( m_orientation == Qt::Horizontal )
|
||||
return QSizeF( -1, m );
|
||||
|
|
|
@ -16,6 +16,9 @@ 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 NOTIFY thicknessChanged )
|
||||
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
|
@ -23,15 +26,20 @@ public:
|
|||
|
||||
QskSeparator( QQuickItem* parent = nullptr );
|
||||
QskSeparator( Qt::Orientation, QQuickItem* parent = nullptr );
|
||||
|
||||
virtual ~QskSeparator();
|
||||
|
||||
void setOrientation( Qt::Orientation );
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
void setThickness( qreal thickness );
|
||||
qreal thickness() const;
|
||||
|
||||
virtual QSizeF contentsSizeHint() const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void orientationChanged( Qt::Orientation );
|
||||
void thicknessChanged() const;
|
||||
|
||||
private:
|
||||
Qt::Orientation m_orientation;
|
||||
|
|
|
@ -51,7 +51,7 @@ QSGNode* QskSeparatorSkinlet::updateSubNode(
|
|||
QRectF QskSeparatorSkinlet::panelRect( const QskSeparator* separator ) const
|
||||
{
|
||||
const QRectF cr = separator->contentsRect();
|
||||
const qreal m = separator->metric( QskSeparator::Panel );
|
||||
const qreal m = separator->metric( QskSeparator::Panel | QskAspect::Size );
|
||||
|
||||
QRectF r;
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ void QskMaterialSkin::initSeparatorHints()
|
|||
|
||||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setMetric( Q::Panel, 4 );
|
||||
setMetric( Q::Panel | Size, 4 );
|
||||
setColor( Q::Panel, pal.baseColor );
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ void QskSquiekSkin::initSeparatorHints()
|
|||
|
||||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setMetric( Q::Panel, 4 );
|
||||
setMetric( Q::Panel | Size, 4 );
|
||||
setColor( Q::Panel | TopCorners, pal.lighter150 );
|
||||
setColor( Q::Panel | BottomCorners, pal.lighter125 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue