QVariant qVariantFromValue ( const T & value )
QVariant QVariant::fromValue ( const T & value ) [static]
?
and
QVariant::QVariant ( int typeOrUserType, const void * copy )
void QVariant::setValue ( const T & value )
T QVariant::value () const
?
QVariant qVariantFromValue ( const T & value )
QVariant QVariant::fromValue ( const T & value ) [static]
?
and
QVariant::QVariant ( int typeOrUserType, const void * copy )
void QVariant::setValue ( const T & value )
T QVariant::value () const
?
east or west home is best
show your code please
east or west home is best
Qt Code:
mint->dynamicCall("DoGo(int, QVariant)", QVariantList()<<3<<QVariant(QVariantList()<<0<<1<<2));To copy to clipboard, switch view to plain text mode
Or
Qt Code:
short aaa[3] = {0,1,2}; mint->dynamicCall("DoGo(int, QVariant)", QVariantList()<<3<<QVariant(QMetaType::Short,(void *)aaa));To copy to clipboard, switch view to plain text mode
will get runtime error:
QAxBase: Error calling IDispatch member DoGo: Unknown error
Qt Code:
short aaa[3] = {0,1,2}; QVariant params; params.setValue(aa);To copy to clipboard, switch view to plain text mode
will get compile error:
error C2039: 'qt_metatype_id' : is not a member of 'QMetaTypeId<T>'
may be.
Qt Code:
QVector<int> vec; vec<<10<<20<<30; QVariant var; var.setValue(vec);To copy to clipboard, switch view to plain text mode
east or west home is best
Qt Code:
QVector<int> vec; vec<<10<<20<<30; QVariant var; var.setValue(vec);To copy to clipboard, switch view to plain text mode
but the code still does not work
Qt Code:
d:\qt\4.5.2-msvc\include\qtcore\../../src/corelib/kernel/qmetatype.h(189) : error C2039: 'qt_metatype_id' : is not a member of 'QMetaTypeId<T>' with [ T=QVector<int> ]To copy to clipboard, switch view to plain text mode
oh-ho-ho
read about setValue().
assistant tell you about it.
east or west home is best
The function info:
and i try to use queryInterface.DoGo
Named Params = u'nNumberOfAxes, nAxisArray'
Return Type = 'Void'
Argument = 'Integer 2'
Argument = 'Variant'
Function kind = 'Dispatch'
Invoke Kind = 'Function'
Number Optional Params = 0
Other function which without a VARIANT parameter works fine.
But this one, I still do not know how to deal with the VARIANT
Qt Code:
IUnknown *iface = 0; mint->queryInterface(IID_IUnknown, (void**)&iface); if (iface) { short axes[3]={0,1,2}; VARIANTARG v[2]; v[1].iVal = 3; v[1].vt = VT_I2; v[0].piVal = axes v[0].vt = VT_BYREF|VT_I2; DISPPARAMS params = {v, NULL, 2, 0}; iface->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD,¶ms ,NULL, NULL, NULL); }To copy to clipboard, switch view to plain text mode
any idea?
The following code works now.
Qt Code:
IUnknown *iface = 0; mint->queryInterface(IID_IUnknown, (void**)&iface); if (iface) { DISPID dispid; OLECHAR * dispname = L"DoGo"; iface->GetIDsOfNames(IID_NULL, &dispname, 1, LOCALE_USER_DEFAULT, &dispid); short axes0[3]={0,1,2}; SAFEARRAY *axes; SAFEARRAYBOUND axesbound[1]; axesbound[0].lLbound = 0; axesbound[0].cElements = 3; axes = ::SafeArrayCreate(VT_I2, 1, axesbound); for(long index=0;index<3;index++) { ::SafeArrayPutElement(axes,&index,axes0+index); } VARIANTARG v[2]; v[1].iVal = 3; //number of axes v[1].vt = VT_I2; v[0].parray = axes; v[0].vt = VT_ARRAY|VT_I2; DISPPARAMS params = {v, NULL, 2, 0}; iface->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD,¶ms ,NULL, NULL, NULL); }To copy to clipboard, switch view to plain text mode
but I still do not know hou to deal with it through ActiveQt method.
Qt Code:
QVariantList params = ... object->dynamicCall("DoGo(int, QVariant)", params);To copy to clipboard, switch view to plain text mode
Maxbester (19th June 2013)
in files
E:\Qt\4.5.2\src\activeqt\shared\qaxtypes.cpp
function
QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type)
help you to understand how yuo must do it.
see the code.
east or west home is best
east or west home is best
Bookmarks