Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QAxFactory class defines a factory for the creation of ActiveX components. More...
This class is part of the Qt ActiveQt Extension.
#include <qaxfactory.h>
This class is defined in the Qt ActiveQt Extension, which can be found in the qt/extensions directory. It is not included in the main Qt API.
The QAxFactory class defines a factory for the creation of ActiveX components.
Implement this factory once in your ActiveX server to provide information about the components the server can create. If your server supports just a single ActiveX control, you can use the default factory implementation instead of implementing the factory yourself. Use the QAXFACTORY_DEFAULT macro in any implementation file (e.g. main.cpp) to instantiate and export the default factory:
#include <qapplication.h> #include <qaxfactory.h> #include "theactivex.h" QAXFACTORY_DEFAULT( TheActiveX, // widget class "{01234567-89AB-CDEF-0123-456789ABCDEF}", // class ID "{01234567-89AB-CDEF-0123-456789ABCDEF}", // interface ID "{01234567-89AB-CDEF-0123-456789ABCDEF}", // event interface ID "{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID "{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID )
If you implement your own factory reimplement the pure virtual functions to provide the unique identifiers for the ActiveX controls, and use the QAXFACTORY_EXPORT macro to instantiate and export it:
QStringList ActiveQtFactory::featureList() const { QStringList list; list << "ActiveX1"; list << "ActiveX2"; ... return list; } QWidget *ActiveQtFactory::create( const QString &key, QWidget *parent, const char *name ) { if ( key == "ActiveX1" ) return new ActiveX1( parent, name ); if ( key == "ActiveX2" ) return new ActiveX2( parent, name ); ... return 0; } QUuid ActiveQtFactory::classID( const QString &key ) const { if ( key == "ActiveX1" ) return "{01234567-89AB-CDEF-0123-456789ABCDEF}"; ... return QUuid(); } QUuid ActiveQtFactory::interfaceID( const QString &key ) const { if ( key == "ActiveX1" ) return "{01234567-89AB-CDEF-0123-456789ABCDEF}"; ... return QUuid(); } QUuid ActiveQtFactory::eventsID( const QString &key ) const { if ( key == "ActiveX1" ) return "{01234567-89AB-CDEF-0123-456789ABCDEF}"; ... return QUuid(); } QAXFACTORY_EXPORT( MyFactory, // factory class "{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID "{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID )
Only one QAxFactory implementation may be instantiated and exported by an ActiveX server application.
A factory can also reimplement the registerClass() and unregisterClass() functions to set additional flags for an ActiveX control in the registry. To limit the number of methods or properties a widget class exposes from its parent classes reimplement exposeToSuperClass().
Reimplement this function to return the ActiveX server's application identifier.
Reimplement this function to return the class identifier for each key returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of key.
Reimplement this function to return a new widget for each key returned by the featureList() implementation. Propagate parent and name to the QWidget constructor. Return 0 if this factory doesn't support the value of key.
Reimplement this function to return the identifier of the event interface for each key returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of key.
The default implementation returns "QWidget" which means that all the functions and properties of all the super classes including QWidget will be exposed.
To only expose the functions and properties of the class itself, reimplement this function to return key.
Reimplement this function to return a list of the widgets (class names) supported by this factory.
The default implementation returns FALSE.
Reimplement this function to return the interface identifier for each key returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of key.
int main( int argc, char**argv ) { QApplication app( argc, argv ); if ( !QAxFactory::isServer() ) { // initialize for stand-alone execution } return app.exec() // standard event processing }
The default implementation returns FALSE.
settings->writeEntry( "/CLSID/" + classID(key) + "/Implemented Categories/{00000000-0000-0000-000000000000}/.", QString::null );
If you reimplement this function you must also reimplement unregisterClass() to remove the additional registry values.
See also QSettings.
Reimplement this function to return the ActiveX server's type library identifier.
settings->removeEntry( "/CLSID/" + classID(key) + "/Implemented Categories/{00000000-0000-0000-000000000000}/." );
See also registerClass() and QSettings.
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Copyright © 2003 Trolltech | Trademarks | Qt 3.2.3
|