@@ -113,6 +113,11 static QStringList getOperatorCodes(const AbstractMetaClass* cls) { | |||||
113 | return result; |
|
113 | return result; | |
114 | } |
|
114 | } | |
115 |
|
115 | |||
|
116 | static bool class_less_than(const AbstractMetaClass *a, const AbstractMetaClass *b) | |||
|
117 | { | |||
|
118 | return a->name() < b->name(); | |||
|
119 | } | |||
|
120 | ||||
116 | void SetupGenerator::generate() |
|
121 | void SetupGenerator::generate() | |
117 | { |
|
122 | { | |
118 | AbstractMetaClassList classes_with_polymorphic_id; |
|
123 | AbstractMetaClassList classes_with_polymorphic_id; | |
@@ -128,6 +133,7 void SetupGenerator::generate() | |||||
128 | } |
|
133 | } | |
129 | } |
|
134 | } | |
130 | } |
|
135 | } | |
|
136 | qSort(classes_with_polymorphic_id.begin(), classes_with_polymorphic_id.end(), class_less_than); | |||
131 |
|
137 | |||
132 | QHashIterator<QString, QList<const AbstractMetaClass*> > pack(packHash); |
|
138 | QHashIterator<QString, QList<const AbstractMetaClass*> > pack(packHash); | |
133 | while (pack.hasNext()) { |
|
139 | while (pack.hasNext()) { | |
@@ -135,6 +141,7 void SetupGenerator::generate() | |||||
135 | QList<const AbstractMetaClass*> list = pack.value(); |
|
141 | QList<const AbstractMetaClass*> list = pack.value(); | |
136 | if (list.isEmpty()) |
|
142 | if (list.isEmpty()) | |
137 | continue; |
|
143 | continue; | |
|
144 | qSort(list.begin(), list.end(), class_less_than); | |||
138 |
|
145 | |||
139 | QString packKey = pack.key(); |
|
146 | QString packKey = pack.key(); | |
140 | QString packName = pack.key(); |
|
147 | QString packName = pack.key(); | |
@@ -176,7 +183,7 void SetupGenerator::generate() | |||||
176 |
|
183 | |||
177 | QStringList polymorphicHandlers; |
|
184 | QStringList polymorphicHandlers; | |
178 | if (!packName.endsWith("_builtin")) { |
|
185 | if (!packName.endsWith("_builtin")) { | |
179 | polymorphicHandlers = writePolymorphicHandler(s, list.at(0)->package(), classes_with_polymorphic_id); |
|
186 | polymorphicHandlers = writePolymorphicHandler(s, list.at(0)->package(), classes_with_polymorphic_id, list); | |
180 | s << endl; |
|
187 | s << endl; | |
181 | } |
|
188 | } | |
182 |
|
189 | |||
@@ -225,18 +232,17 void SetupGenerator::generate() | |||||
225 | } |
|
232 | } | |
226 |
|
233 | |||
227 | QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QString &package, |
|
234 | QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QString &package, | |
228 | const AbstractMetaClassList &classes) |
|
235 | const AbstractMetaClassList &polybase, QList<const AbstractMetaClass*>& allClasses) | |
229 | { |
|
236 | { | |
230 | QStringList handlers; |
|
237 | QStringList handlers; | |
231 |
foreach (AbstractMetaClass *cls, |
|
238 | foreach (AbstractMetaClass *cls, polybase) { | |
232 | const ComplexTypeEntry *centry = cls->typeEntry(); |
|
239 | const ComplexTypeEntry *centry = cls->typeEntry(); | |
233 | if (!centry->isPolymorphicBase()) |
|
240 | if (!centry->isPolymorphicBase()) | |
234 | continue; |
|
241 | continue; | |
235 | bool isGraphicsItem = (cls->qualifiedCppName()=="QGraphicsItem"); |
|
242 | bool isGraphicsItem = (cls->qualifiedCppName()=="QGraphicsItem"); | |
236 |
|
243 | |||
237 | AbstractMetaClassList classList = this->classes(); |
|
|||
238 | bool first = true; |
|
244 | bool first = true; | |
239 |
foreach (AbstractMetaClass *clazz, |
|
245 | foreach (const AbstractMetaClass *clazz, allClasses) { | |
240 | bool inherits = false; |
|
246 | bool inherits = false; | |
241 | if (isGraphicsItem) { |
|
247 | if (isGraphicsItem) { | |
242 | foreach(AbstractMetaClass* interfaze, clazz->interfaces()) { |
|
248 | foreach(AbstractMetaClass* interfaze, clazz->interfaces()) { |
General Comments 0
You need to be logged in to leave comments.
Login now