9static void qskRegisterMargins()
11 qRegisterMetaType< QskMargins >();
13 QMetaType::registerConverter< int, QskMargins >(
14 [](
int value ) {
return QskMargins( value ); } );
16 QMetaType::registerConverter< qreal, QskMargins >(
17 []( qreal value ) {
return QskMargins( value ); } );
19#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
20 QMetaType::registerEqualsComparator< QskMargins >();
24Q_CONSTRUCTOR_FUNCTION( qskRegisterMargins )
26static inline qreal qskInterpolated( qreal from, qreal to, qreal ratio )
28 return from + ( to - from ) * ratio;
34 const qreal left = qskInterpolated( m1.left(), m2.left(), progress );
35 const qreal top = qskInterpolated( m1.top(), m2.top(), progress );
36 const qreal right = qskInterpolated( m1.right(), m2.right(), progress );
37 const qreal bottom = qskInterpolated( m1.bottom(), m2.bottom(), progress );
43 const QskMargins& to, qreal progress )
const noexcept
45 return qskInterpolateMargins( *
this, to, progress );
48QVariant QskMargins::interpolate(
51 return QVariant::fromValue( qskInterpolateMargins( m1, m2, progress ) );
54void QskMargins::setMarginsAt( Qt::Edges edges, qreal value )
noexcept
56 if ( edges & Qt::LeftEdge )
59 if ( edges & Qt::TopEdge )
62 if ( edges & Qt::RightEdge )
65 if ( edges & Qt::BottomEdge )
69qreal QskMargins::marginAt( Qt::Edge edge )
const noexcept
89#include "moc_QskMargins.cpp"