@@ -86,7 +86,7 @@ PythonQtClassInfo::~PythonQtClassInfo()
86
86
if (_destructor) {
87
87
_destructor->deleteOverloadsAndThis ();
88
88
}
89
- Q_FOREACH ( PythonQtSlotInfo* info, _decoratorSlots) {
89
+ for ( PythonQtSlotInfo* info : _decoratorSlots ) {
90
90
info->deleteOverloadsAndThis ();
91
91
}
92
92
}
@@ -178,7 +178,7 @@ bool PythonQtClassInfo::lookForPropertyAndCache(const char* memberName)
178
178
PythonQtSlotInfo* PythonQtClassInfo::recursiveFindDecoratorSlotsFromDecoratorProvider (const char * memberName, PythonQtSlotInfo* inputInfo, bool &found, QHash<QByteArray, PythonQtMemberInfo>& memberCache, int upcastingOffset)
179
179
{
180
180
inputInfo = findDecoratorSlotsFromDecoratorProvider (memberName, inputInfo, found, memberCache, upcastingOffset);
181
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
181
+ for ( const ParentClassInfo& info : _parentClasses ) {
182
182
inputInfo = info._parent ->recursiveFindDecoratorSlotsFromDecoratorProvider (memberName, inputInfo, found, memberCache, upcastingOffset+info._upcastingOffset );
183
183
}
184
184
return inputInfo;
@@ -333,7 +333,7 @@ PythonQtMemberInfo PythonQtClassInfo::member(const char* memberName)
333
333
// look for dynamic decorators in this class and in derived classes
334
334
QList<QObject*> decoObjects;
335
335
recursiveCollectDecoratorObjects (decoObjects);
336
- Q_FOREACH ( QObject* deco, decoObjects) {
336
+ for ( QObject* deco : decoObjects ) {
337
337
// call on ourself for caching, but with different metaObject():
338
338
found = lookForEnumAndCache (deco->metaObject (), memberName);
339
339
if (found) {
@@ -352,7 +352,7 @@ PythonQtMemberInfo PythonQtClassInfo::member(const char* memberName)
352
352
found = true ;
353
353
}
354
354
// maybe it is a nested class?
355
- Q_FOREACH ( PythonQtClassInfo* nestedClass, _nestedClasses) {
355
+ for ( PythonQtClassInfo* nestedClass : _nestedClasses ) {
356
356
PyObject* pyClass = nestedClass->pythonQtClassWrapper ();
357
357
if (pyClass) {
358
358
if (strcmp (memberName, nestedClass->unscopedClassName ().constData ()) == 0 ) {
@@ -394,14 +394,14 @@ void PythonQtClassInfo::recursiveCollectDecoratorObjects(QList<QObject*>& decora
394
394
if (deco) {
395
395
decoratorObjects.append (deco);
396
396
}
397
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
397
+ for ( const ParentClassInfo& info : _parentClasses ) {
398
398
info._parent ->recursiveCollectDecoratorObjects (decoratorObjects);
399
399
}
400
400
}
401
401
402
402
void PythonQtClassInfo::recursiveCollectClassInfos (QList<PythonQtClassInfo*>& classInfoObjects) {
403
403
classInfoObjects.append (this );
404
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
404
+ for ( const ParentClassInfo& info : _parentClasses ) {
405
405
info._parent ->recursiveCollectClassInfos (classInfoObjects);
406
406
}
407
407
}
@@ -496,7 +496,7 @@ QStringList PythonQtClassInfo::propertyList()
496
496
}
497
497
}
498
498
QStringList members = memberList ();
499
- foreach ( QString member, members) {
499
+ for ( const QString& member : members) {
500
500
if (member.startsWith (" py_get_" )) {
501
501
l << member.mid (7 );
502
502
}
@@ -527,7 +527,7 @@ QStringList PythonQtClassInfo::memberList()
527
527
// look for dynamic decorators in this class and in derived classes
528
528
QList<PythonQtClassInfo*> infos;
529
529
recursiveCollectClassInfos (infos);
530
- Q_FOREACH ( PythonQtClassInfo* info, infos) {
530
+ for ( PythonQtClassInfo* info : infos ) {
531
531
info->listDecoratorSlotsFromDecoratorProvider (l, false );
532
532
}
533
533
}
@@ -540,11 +540,11 @@ QStringList PythonQtClassInfo::memberList()
540
540
// check enums in the class hierachy of CPP classes
541
541
QList<QObject*> decoObjects;
542
542
recursiveCollectDecoratorObjects (decoObjects);
543
- Q_FOREACH ( QObject* deco, decoObjects) {
543
+ for ( QObject* deco : decoObjects ) {
544
544
enumMetaObjects << deco->metaObject ();
545
545
}
546
546
547
- Q_FOREACH ( const QMetaObject* meta, enumMetaObjects) {
547
+ for ( const QMetaObject* meta : enumMetaObjects ) {
548
548
for (int i = 0 ; i<meta->enumeratorCount (); i++) {
549
549
QMetaEnum e = meta->enumerator (i);
550
550
l << e.name ();
@@ -554,7 +554,7 @@ QStringList PythonQtClassInfo::memberList()
554
554
}
555
555
}
556
556
557
- Q_FOREACH ( PythonQtClassInfo* nestedClass, _nestedClasses) {
557
+ for ( PythonQtClassInfo* nestedClass : _nestedClasses ) {
558
558
PyObject* pyClass = nestedClass->pythonQtClassWrapper ();
559
559
if (pyClass) {
560
560
QByteArray name = nestedClass->unscopedClassName ();
@@ -583,7 +583,7 @@ void* PythonQtClassInfo::castTo(void* ptr, const char* classname)
583
583
if (_wrappedClassName == classname) {
584
584
return ptr;
585
585
}
586
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
586
+ for ( const ParentClassInfo& info : _parentClasses ) {
587
587
void * result = info._parent ->castTo ((char *)ptr + info._upcastingOffset , classname);
588
588
if (result) {
589
589
return result;
@@ -597,7 +597,7 @@ bool PythonQtClassInfo::inherits(const char* name)
597
597
if (_wrappedClassName == name) {
598
598
return true ;
599
599
}
600
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
600
+ for ( const ParentClassInfo& info : _parentClasses ) {
601
601
if (info._parent ->inherits (name)) {
602
602
return true ;
603
603
}
@@ -610,7 +610,7 @@ bool PythonQtClassInfo::inherits(PythonQtClassInfo* classInfo)
610
610
if (classInfo == this ) {
611
611
return true ;
612
612
}
613
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
613
+ for ( const ParentClassInfo& info : _parentClasses ) {
614
614
if (info._parent ->inherits (classInfo)) {
615
615
return true ;
616
616
}
@@ -767,14 +767,14 @@ QObject* PythonQtClassInfo::decorator()
767
767
void * PythonQtClassInfo::recursiveCastDownIfPossible (void * ptr, const char ** resultClassName)
768
768
{
769
769
if (!_polymorphicHandlers.isEmpty ()) {
770
- Q_FOREACH ( PythonQtPolymorphicHandlerCB* cb, _polymorphicHandlers) {
770
+ for ( PythonQtPolymorphicHandlerCB* cb : _polymorphicHandlers ) {
771
771
void * resultPtr = (*cb)(ptr, resultClassName);
772
772
if (resultPtr) {
773
773
return resultPtr;
774
774
}
775
775
}
776
776
}
777
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
777
+ for ( const ParentClassInfo& info : _parentClasses ) {
778
778
if (!info._parent ->isQObject ()) {
779
779
void * resultPtr = info._parent ->recursiveCastDownIfPossible ((char *)ptr + info._upcastingOffset , resultClassName);
780
780
if (resultPtr) {
@@ -818,7 +818,7 @@ void* PythonQtClassInfo::castDownIfPossible(void* ptr, PythonQtClassInfo** resul
818
818
// we only do downcasting on the base object, not on the whole inheritance tree...
819
819
void * resultPtr = nullptr ;
820
820
if (!_polymorphicHandlers.isEmpty ()) {
821
- Q_FOREACH ( PythonQtPolymorphicHandlerCB* cb, _polymorphicHandlers) {
821
+ for ( PythonQtPolymorphicHandlerCB* cb : _polymorphicHandlers ) {
822
822
resultPtr = (*cb)(ptr, &className);
823
823
if (resultPtr) {
824
824
break ;
@@ -897,7 +897,7 @@ void PythonQtClassInfo::createEnumWrappers(const QObject* decoratorProvider)
897
897
if (decoratorProvider) {
898
898
createEnumWrappers (decoratorProvider->metaObject ());
899
899
}
900
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
900
+ for ( const ParentClassInfo& info : _parentClasses ) {
901
901
// trigger decorator() instead of createEnumWrappers(),
902
902
// which will then call createEnumWrappers().
903
903
info._parent ->decorator ();
@@ -912,13 +912,13 @@ PyObject* PythonQtClassInfo::findEnumWrapper(const char* name) {
912
912
// which will then call createEnumWrappers().
913
913
decorator ();
914
914
}
915
- Q_FOREACH ( const PythonQtObjectPtr& p, _enumWrappers) {
915
+ for ( const PythonQtObjectPtr& p : _enumWrappers ) {
916
916
const char * className = ((PyTypeObject*)p.object ())->tp_name ;
917
917
if (qstrcmp (className, name)==0 ) {
918
918
return p.object ();
919
919
}
920
920
}
921
- Q_FOREACH ( const ParentClassInfo& info, _parentClasses) {
921
+ for ( const ParentClassInfo& info : _parentClasses ) {
922
922
PyObject* p = info._parent ->findEnumWrapper (name);
923
923
if (p) return p;
924
924
}
0 commit comments