src/tools/moc/generator.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   290 // Build extra array
   290 // Build extra array
   291 //
   291 //
   292     QList<QByteArray> extraList;
   292     QList<QByteArray> extraList;
   293     for (int i = 0; i < cdef->propertyList.count(); ++i) {
   293     for (int i = 0; i < cdef->propertyList.count(); ++i) {
   294         const PropertyDef &p = cdef->propertyList.at(i);
   294         const PropertyDef &p = cdef->propertyList.at(i);
   295         if (!isVariantType(p.type) && !metaTypes.contains(p.type)) {
   295         if (!isVariantType(p.type) && !metaTypes.contains(p.type) && !p.type.contains('*') &&
       
   296                 !p.type.contains('<') && !p.type.contains('>')) {
   296             int s = p.type.lastIndexOf("::");
   297             int s = p.type.lastIndexOf("::");
   297             if (s > 0) {
   298             if (s > 0) {
   298                 QByteArray scope = p.type.left(s);
   299                 QByteArray scope = p.type.left(s);
   299                 if (scope != "Qt" && scope != cdef->classname && !extraList.contains(scope))
   300                 if (scope != "Qt" && scope != cdef->classname && !extraList.contains(scope))
   300                     extraList += scope;
   301                     extraList += scope;
   722             needScriptable |= p.scriptable.endsWith(')');
   723             needScriptable |= p.scriptable.endsWith(')');
   723             needStored |= p.stored.endsWith(')');
   724             needStored |= p.stored.endsWith(')');
   724             needEditable |= p.editable.endsWith(')');
   725             needEditable |= p.editable.endsWith(')');
   725             needUser |= p.user.endsWith(')');
   726             needUser |= p.user.endsWith(')');
   726         }
   727         }
   727         bool needAnything = needGet
       
   728                             | needSet
       
   729                             | needReset
       
   730                             | needDesignable
       
   731                             | needScriptable
       
   732                             | needStored
       
   733                             | needEditable
       
   734                             | needUser;
       
   735         if (!needAnything)
       
   736             goto skip_properties;
       
   737         fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n     ");
   728         fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n     ");
   738 
   729 
   739         if (needElse)
   730         if (needElse)
   740             fprintf(out, " else ");
   731             fprintf(out, " else ");
   741         fprintf(out, "if (_c == QMetaObject::ReadProperty) {\n");
   732         fprintf(out, "if (_c == QMetaObject::ReadProperty) {\n");
   901                 "    }", cdef->propertyList.count());
   892                 "    }", cdef->propertyList.count());
   902 
   893 
   903 
   894 
   904         fprintf(out, "\n#endif // QT_NO_PROPERTIES");
   895         fprintf(out, "\n#endif // QT_NO_PROPERTIES");
   905     }
   896     }
   906  skip_properties:
       
   907     if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size())
   897     if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size())
   908         fprintf(out, "\n    ");
   898         fprintf(out, "\n    ");
   909     fprintf(out,"return _id;\n}\n");
   899     fprintf(out,"return _id;\n}\n");
   910 }
   900 }
   911 
   901