Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.5.0
-
None
Description
Running 'dumpcpp -n sldworks sldworks.tlb' (SolidWorks 2008 API) produces code with at least two types of compilation errors:
1) pointers to references such as:
return *(double&*)qax_result.constData();
2) cases where compilation of:
qRegisterMetaType("ISomeInterface", qax_pointer);
fail because the object pointed to by qax_pointer derives from QAxObject and the compiler tries to create a copy constructor for QAxObject which it cannot do.
-----------------------------------------
1) This seems to be caused by an unsupported property defenition in the type library.
property get ==> HRESULT XXXXXPropertyValues([out, retval] double* Retval); property put ==> HRESULT XXXXXlPropertyValues([in] double* Retval);
- Note that both parameters for put & get of same type. ActiveQt dosen't support this type of constructs.
2) ActiveQt supports only dispatch interfaces (of type kind TKIND_DISPATCH). Try this patch for dumpcpp, it will generate a dummy function instead.
diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp index 05f1f19..45c7ee8 100644 --- a/tools/activeqt/dumpcpp/main.cpp +++ b/tools/activeqt/dumpcpp/main.cpp @@ -110,6 +110,7 @@ extern bool qax_dispatchEqualsIDispatch; QByteArray nameSpace; QMap<QByteArray, QByteArray> namespaceForType; +QStringList vtableOnlyInterfaces; void writeEnums(QTextStream &out, const QMetaObject *mo) { @@ -333,33 +334,38 @@ void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaOb if (!(category & NoInlines)) { out << endl << indent << "{" << endl; - if (qax_qualified_usertypes.contains(simplePropType)) { - out << indent << " " << propertyType << " qax_pointer = 0;" << endl; - out << indent << " qRegisterMetaType(\"" << property.typeName() << "\", &qax_pointer);" << endl; - if (foreignNamespace) - out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl; - out << indent << " qRegisterMetaType(\"" << simplePropType << "\", qax_pointer);" << endl; - if (foreignNamespace) - out << "#endif" << endl; - } - out << indent << " QVariant qax_result = property(\"" << propertyName << "\");" << endl; - if (propertyType.length() && propertyType.at(propertyType.length()-1) == '*') - out << indent << " if (!qax_result.constData()) return 0;" << endl; - out << indent << " Q_ASSERT(qax_result.isValid());" << endl; - if (qax_qualified_usertypes.contains(simplePropType)) { - simplePropType = propertyType; - simplePropType.replace('*', ""); - if (foreignNamespace) - out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl; - out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; - if (foreignNamespace) { - out << "#else" << endl; - out << indent << " return 0; // foreign namespace not included" << endl; - out << "#endif" << endl; + if (qax_qualified_usertypes.contains(simplePropType) && vtableOnlyInterfaces.contains(simplePropType)) { + out << indent << " // vtable-only interface is not supported by ActiveQt" << endl; + out << indent << " return 0;" << endl; + } else { + if (qax_qualified_usertypes.contains(simplePropType)) { + out << indent << " " << propertyType << " qax_pointer = 0;" << endl; + out << indent << " qRegisterMetaType(\"" << property.typeName() << "\", &qax_pointer);" << endl; + if (foreignNamespace) + out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl; + out << indent << " qRegisterMetaType(\"" << simplePropType << "\", qax_pointer);" << endl; + if (foreignNamespace) + out << "#endif" << endl; } + out << indent << " QVariant qax_result = property(\"" << propertyName << "\");" << endl; + if (propertyType.length() && propertyType.at(propertyType.length()-1) == '*') + out << indent << " if (!qax_result.constData()) return 0;" << endl; + out << indent << " Q_ASSERT(qax_result.isValid());" << endl; + if (qax_qualified_usertypes.contains(simplePropType)) { + simplePropType = propertyType; + simplePropType.replace('*', ""); + if (foreignNamespace) + out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl; + out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; + if (foreignNamespace) { + out << "#else" << endl; + out << indent << " return 0; // foreign namespace not included" << endl; + out << "#endif" << endl; + } - } else { - out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; + } else { + out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; + } } out << indent << "}" << endl; } else { @@ -1095,6 +1101,9 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O case TKIND_ENUM: className = "enum " + className; break; + case TKIND_INTERFACE: + vtableOnlyInterfaces.append(className); + break; default: break; }