Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.2
-
None
-
Win 7 64 bit
-
37f55a5b3be480a8b6ef405bf162dc8015e971b0 (activeqt/5.4, 37f55a5b3be480a8b6ef405bf162dc8015e971b0 , 15.1.2015)
Description
My application is ActiveX server that implements custom COM object. If the COM object provides a method (in 'public slots' section) that returns QVariant then calling such a method results in 'type mismatch' error. The problem appeared after switching from Qt 4.8 to Qt 5.3. The COM object is created and used in VBScript.
The example COM object implementation:
class TestObject: public QObject { //Q_OBJECT, Q_CLASSINFO, constructor etc ... public slots: QVariant getValue() const; };
The VBScript that reproduces the problem:
'theTestObject - the COM object representing TestObject object defined above
theValue = theTestObject.getValue() ' generates type mismatch error
I think (but did not try) that the problem can be reproduced using this example https://qt-project.org/doc/qt-5-snapshot/activeqt-activeqt-comapp-example.html after changing the line
QString title() const;
into
QVariant title() const;
in Document class. This method is 'public', and not 'public slot' but it should not be important.
Additional investigation shows that the problem is because QVariant type interpretation changed in Qt 5. In Qt 4 it was 'QMetaType::UserType' and in Qt 5 it is 'QMetaType::QVariant' type. Some places in ActiveQt were adapted to this change (by adding extra check for QMetaType::QVariant in the places where only QVariant::UserType was checked in Qt4), but not all of them. The following fix helped me to solve the issue:
(line 2465 in QtActiveQt/qtactiveqt-opensource-src/src/activeqt/control/qaxserverbase.cpp)
changed
if (vt == QVariant::UserType)
into
if (vt == QVariant::UserType || vt == int(QMetaType::QVariant))
But there are other places where similar change may be required.
Attachments
Issue Links
- relates to
-
QTBUG-26587 ActiveQt: TYPELIBS qmake variable doesn't produce correct files
- Closed
For Gerrit Dashboard: QTBUG-43446 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
103037,2 | Fix invocation of QVariant-return type verbs. | 5.4 | qt/qtactiveqt | Status: MERGED | +2 | 0 |