A Brief introduction:
1.ActiveQt contains Qaxcontainer and qaxserver components.
1) Qaxcontainer allows COM objects to be used, and ActiveX controls can be embedded in the QT program.
Qaxcontainer is made up of three classes. respectively:
Qaxobject Encapsulation of COM objects
Qaxwidget Encapsulation of ActiveX controls
Qaxbase is the parent class of Qaxobject and Qaxwidget, which implements the core function of encapsulating com.
You can get and set the properties of an ActiveX control by calling the property () method of Qaxwidget and the SetProperty method.
Calling the ActiveX control's Method property requires a conversion of the data type in COM and the data type in QT. A table that corresponds to the data type in COM and the data type in QT:
2) Qaxserver can export the QT control we wrote as a COM object or an ActiveX control.
3) A simple example:
#include <QApplication> #include <QtGui> #include <QAxWidget> int main (int argc, char *argv[]) { qapplication A (argc, argv); Qaxwidget *flash = new Qaxwidget (0,0); Flash->resize (500,80); Flash->setcontrol (Qstring::fromutf8 ("{d27cdb6e-ae6d-11cf-96b8-444553540000}")); Flash->dynamiccall ("Loadmovie (long,string)", 0, "f:/1.swf"); Flash->show (); return A.exec (); }
Two Method
1. First register Idldrawx3.ocx in Windows
Go to cmd and enter the following command: (note the trailing path with double quotes)
regsvr32 "C:\Program files\itt\idl\idl81\bin\bin.x86\idldrawx3.ocx"
ActiveX is called in 2.Qt:
1) The Qaxwidget is placed on the interface through the QT designer;
2) Right-click Settings control;
3) Select the ActiveX controls registered in the System Idldrawwidget control 3.0;
4) If ACTIVEQT support is not added to the project, you can QT->QT project SETTINGS->QT Modules and then tick ACTIVEQT container support, if it is a Qt Creator project, You need it in the. Pro file
Added: CONFIG + = Qaxcontainer
3. The invocation of an interface in ActiveX, implemented by Dynamiccall ();
Dynamiccall () passes a parameter of up to eight qvariant types, and the return type is also qvariant.
QT calls IDL under Visual Studio