@@ -147,10 +147,14 void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c | |||
|
147 | 147 | |
|
148 | 148 | AbstractMetaEnumList enums1 = meta_class->enums(); |
|
149 | 149 | AbstractMetaEnumList enums; |
|
150 | QList<FlagsTypeEntry*> flags; | |
|
150 | 151 | foreach(AbstractMetaEnum* enum1, enums1) { |
|
151 | 152 | // catch gadgets and enums that are not exported on QObjects... |
|
152 | 153 | if (enum1->wasPublic() && (!meta_class->isQObject() || !enum1->hasQEnumsDeclaration())) { |
|
153 | 154 | enums << enum1; |
|
155 | if (enum1->typeEntry()->flags()) { | |
|
156 | flags << enum1->typeEntry()->flags(); | |
|
157 | } | |
|
154 | 158 | } |
|
155 | 159 | } |
|
156 | 160 | if (enums.count()) { |
@@ -159,7 +163,20 void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c | |||
|
159 | 163 | s << enum1->name() << " "; |
|
160 | 164 | } |
|
161 | 165 | s << ")" << endl; |
|
162 | ||
|
166 | ||
|
167 | if (flags.count()) { | |
|
168 | s << "Q_FLAGS("; | |
|
169 | foreach(FlagsTypeEntry* flag1, flags) { | |
|
170 | QString origName = flag1->originalName(); | |
|
171 | int idx = origName.lastIndexOf("::"); | |
|
172 | if (idx!= -1) { | |
|
173 | origName = origName.mid(idx+2); | |
|
174 | } | |
|
175 | s << origName << " "; | |
|
176 | } | |
|
177 | s << ")" << endl; | |
|
178 | } | |
|
179 | ||
|
163 | 180 |
|
|
164 | 181 | s << "enum " << enum1->name() << "{" << endl; |
|
165 | 182 | bool first = true; |
@@ -170,8 +187,19 void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c | |||
|
170 | 187 | } |
|
171 | 188 | s << "};" << endl; |
|
172 | 189 | } |
|
190 | if (flags.count()) { | |
|
191 | foreach(AbstractMetaEnum* enum1, enums) { | |
|
192 | if (enum1->typeEntry()->flags()) { | |
|
193 | QString origName = enum1->typeEntry()->flags()->originalName(); | |
|
194 | int idx = origName.lastIndexOf("::"); | |
|
195 | if (idx!= -1) { | |
|
196 | origName = origName.mid(idx+2); | |
|
197 | } | |
|
198 | s << "Q_DECLARE_FLAGS("<< origName << ", " << enum1->name() <<")"<<endl; | |
|
199 | } | |
|
200 | } | |
|
201 | } | |
|
173 | 202 | } |
|
174 | ||
|
175 | 203 | s << "public slots:" << endl; |
|
176 | 204 | if (meta_class->generateShellClass() || !meta_class->isAbstract()) { |
|
177 | 205 |
General Comments 0
You need to be logged in to leave comments.
Login now