uppercase gadget registrations when having enums only

This commit is contained in:
Uwe Rathmann 2022-11-21 17:31:56 +01:00
parent ea8f426d67
commit 1150c8693d
1 changed files with 6 additions and 4 deletions

View File

@ -125,11 +125,9 @@ namespace
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
registerUncreatableType< T >( className ); registerUncreatableType< T >( className );
#else #else
// the class name without the "Qsk" prefix
/* /*
According to the QML naming rules uncreatables have to According to the QML naming rules uncreatables have to
start with a lowercase letter ( since Qt6 ) , while namespaces start with a lowercase letter ( since Qt6 ), while namespaces
and creatable items usually start with a upper letter. and creatable items usually start with a upper letter.
This results in an odd naming scheme for the enums defined inside of gadgets. This results in an odd naming scheme for the enums defined inside of gadgets.
@ -140,7 +138,11 @@ namespace
enums are removed from the first and everything else than the enums from enums are removed from the first and everything else than the enums from
the second. TODO ... the second. TODO ...
*/ */
registerUncreatableMetaObject( T::staticMetaObject, className );
if ( T::staticMetaObject.enumeratorCount() > 0 )
{
registerUncreatableMetaObject( T::staticMetaObject, className );
}
QByteArray name = className; QByteArray name = className;
name.data()[0] = std::tolower( name.data()[0] ); name.data()[0] = std::tolower( name.data()[0] );