registering of subcontrols has to start with 1, 0 is reserved for QskAspect::Control

This commit is contained in:
Uwe Rathmann 2017-07-27 15:49:21 +02:00
parent 5e6397cdd3
commit 8a806a5386

View File

@ -65,7 +65,8 @@ QskAspect::Subcontrol QskAspect::nextSubcontrol(
names += name; names += name;
const auto subControl = static_cast< Subcontrol >( names.size() - 1 ); // 0 is QskAspect::Control, we hav to start with 1
const auto subControl = static_cast< Subcontrol >( names.size() );
hashTable[ metaObject ] += subControl; hashTable[ metaObject ] += subControl;
return subControl; return subControl;
@ -76,8 +77,8 @@ QByteArray QskAspect::subControlName( Subcontrol subControl )
const auto& names = qskAspectRegistry->subControlNames; const auto& names = qskAspectRegistry->subControlNames;
const int index = subControl; const int index = subControl;
if ( index >= 0 && index < names.size() ) if ( index > 0 && index < names.size() )
return names[ index ]; return names[ index - 1 ];
return QByteArray(); return QByteArray();
} }