metatype registrations moved to class implementations
This commit is contained in:
parent
5356f0ce88
commit
116b835906
@ -60,7 +60,6 @@ QSK_QT_PRIVATE_END
|
|||||||
qmlRegisterType< className >( QSK_MODULE_NAME, 1, 0, typeName );
|
qmlRegisterType< className >( QSK_MODULE_NAME, 1, 0, typeName );
|
||||||
|
|
||||||
#define QSK_REGISTER_GADGET( className, typeName ) \
|
#define QSK_REGISTER_GADGET( className, typeName ) \
|
||||||
qRegisterMetaType< className >(); \
|
|
||||||
qmlRegisterUncreatableType< className >( QSK_MODULE_NAME, 1, 0, typeName, QString() )
|
qmlRegisterUncreatableType< className >( QSK_MODULE_NAME, 1, 0, typeName, QString() )
|
||||||
|
|
||||||
// Required for QFlags to be constructed from an enum value
|
// Required for QFlags to be constructed from an enum value
|
||||||
@ -208,6 +207,7 @@ void QskQml::registerTypes()
|
|||||||
// Support (lists of) GradientStop
|
// Support (lists of) GradientStop
|
||||||
QMetaType::registerConverter< QJSValue, QskGradientStop >( qskToGradientStop );
|
QMetaType::registerConverter< QJSValue, QskGradientStop >( qskToGradientStop );
|
||||||
|
|
||||||
|
#if 0
|
||||||
QMetaType::registerConverter< QJSValue, QskGradientStops >(
|
QMetaType::registerConverter< QJSValue, QskGradientStops >(
|
||||||
|
|
||||||
[]( const QJSValue& value )
|
[]( const QJSValue& value )
|
||||||
@ -223,6 +223,7 @@ void QskQml::registerTypes()
|
|||||||
return stops;
|
return stops;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 2, 0 )
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 2, 0 )
|
||||||
// how to do this with >= 6.2 TODO ...
|
// how to do this with >= 6.2 TODO ...
|
||||||
|
@ -17,6 +17,17 @@
|
|||||||
static_assert( sizeof( QskAspect ) == sizeof( quint64 ),
|
static_assert( sizeof( QskAspect ) == sizeof( quint64 ),
|
||||||
"QskAspect::Aspect has to match quint64" );
|
"QskAspect::Aspect has to match quint64" );
|
||||||
|
|
||||||
|
static void qskRegisterAspect()
|
||||||
|
{
|
||||||
|
qRegisterMetaType< QskAspect >();
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMetaType::registerEqualsComparator< QskAspect >();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterAspect )
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
#include "QskMargins.h"
|
#include "QskMargins.h"
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
|
|
||||||
static void qskRegisterConverter()
|
static void qskRegisterMargins()
|
||||||
{
|
{
|
||||||
|
qRegisterMetaType< QskMargins >();
|
||||||
|
|
||||||
QMetaType::registerConverter< int, QskMargins >(
|
QMetaType::registerConverter< int, QskMargins >(
|
||||||
[]( int value ) { return QskMargins( value ); } );
|
[]( int value ) { return QskMargins( value ); } );
|
||||||
|
|
||||||
QMetaType::registerConverter< qreal, QskMargins >(
|
QMetaType::registerConverter< qreal, QskMargins >(
|
||||||
[]( qreal value ) { return QskMargins( value ); } );
|
[]( qreal value ) { return QskMargins( value ); } );
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMetaType::registerEqualsComparator< QskMargins >();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterConverter )
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterMargins )
|
||||||
|
|
||||||
static inline qreal qskInterpolated( qreal from, qreal to, qreal ratio )
|
static inline qreal qskInterpolated( qreal from, qreal to, qreal ratio )
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
static void qskRegisterSizePolicy()
|
||||||
|
{
|
||||||
|
qRegisterMetaType< QskSizePolicy >();
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMetaType::registerEqualsComparator< QskSizePolicy >();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterSizePolicy )
|
||||||
|
|
||||||
QskSizePolicy::ConstraintType QskSizePolicy::constraintType() const noexcept
|
QskSizePolicy::ConstraintType QskSizePolicy::constraintType() const noexcept
|
||||||
{
|
{
|
||||||
constexpr unsigned char mask = IgnoreFlag | ConstrainedFlag;
|
constexpr unsigned char mask = IgnoreFlag | ConstrainedFlag;
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
static void qskRegisterTextOptions()
|
static void qskRegisterTextOptions()
|
||||||
{
|
{
|
||||||
qRegisterMetaType< QskTextOptions >();
|
qRegisterMetaType< QskTextOptions >();
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMetaType::registerEqualsComparator< QskTextOptions >();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterTextOptions )
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterTextOptions )
|
||||||
|
@ -8,6 +8,17 @@
|
|||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
static void qskRegisterLayoutMetrics()
|
||||||
|
{
|
||||||
|
qRegisterMetaType< QskLayoutMetrics >();
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMetaType::registerEqualsComparator< QskLayoutMetrics >();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterLayoutMetrics )
|
||||||
|
|
||||||
void QskLayoutMetrics::setMetric( int which, qreal metric ) noexcept
|
void QskLayoutMetrics::setMetric( int which, qreal metric ) noexcept
|
||||||
{
|
{
|
||||||
switch (which)
|
switch (which)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user