Qt 4.8
|
The QAxFactory class defines a factory for the creation of COM components. More...
#include <qaxfactory.h>
Public Types | |
enum | ServerType { SingleInstance, MultipleInstances } |
This enum specifies the different types of servers that can be started with startServer. More... | |
Public Functions | |
virtual QUuid | appID () const |
Reimplement this function to return the ActiveX server's application identifier. More... | |
virtual QUuid | classID (const QString &key) const |
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. More... | |
virtual QObject * | createObject (const QString &key)=0 |
Reimplement this function to return a new object for key, or 0 if this factory doesn't support the value of key. More... | |
virtual bool | createObjectWrapper (QObject *object, IDispatch **wrapper) |
Reimplement this function to provide the COM object for object in wrapper. More... | |
virtual QUuid | eventsID (const QString &key) const |
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. More... | |
virtual QString | exposeToSuperClass (const QString &key) const |
Reimplement this function to return the name of the super class of key up to which methods and properties should be exposed by the ActiveX control. More... | |
virtual QStringList | featureList () const =0 |
Reimplement this function to return a list of the widgets (class names) supported by this factory. More... | |
virtual bool | hasStockEvents (const QString &key) const |
Reimplement this function to return true if the ActiveX control key should support the standard ActiveX events. More... | |
virtual QUuid | interfaceID (const QString &key) const |
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. More... | |
virtual bool | isService () const |
Reimplement this function to return true if the server is running as a persistent service (e.g. More... | |
virtual const QMetaObject * | metaObject (const QString &key) const =0 |
Reimplement this function to return the QMetaObject corresponding to key, or 0 if this factory doesn't support the value of key. More... | |
QAxFactory (const QUuid &libId, const QUuid &appId) | |
Constructs a QAxFactory object that returns libid and appid in the implementation of the respective interface functions. More... | |
virtual void | registerClass (const QString &key, QSettings *) const |
Registers additional values for the class key in the system registry using the settings object. More... | |
virtual bool | stayTopLevel (const QString &key) const |
Reimplement this function to return true if the ActiveX control key should be a top level window, e.g. More... | |
virtual QUuid | typeLibID () const |
Reimplement this function to return the ActiveX server's type library identifier. More... | |
virtual void | unregisterClass (const QString &key, QSettings *) const |
Unregisters any additional values for the class key from the system registry using the settings object. More... | |
virtual bool | validateLicenseKey (const QString &key, const QString &licenseKey) const |
Reimplement this function to return true if licenseKey is a valid license for the class key, or if the current machine is licensed. More... | |
virtual | ~QAxFactory () |
Destroys the QAxFactory object. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Static Public Functions | |
static bool | isServer () |
Returns true if the application has been started (by COM) as an ActiveX server, otherwise returns false. More... | |
static bool | registerActiveObject (QObject *object) |
Registers the QObject object with COM as a running object, and returns true if the registration succeeded, otherwise returns false. More... | |
static QString | serverDirPath () |
Returns the directory that contains the server binary. More... | |
static QString | serverFilePath () |
Returns the file path of the server binary. More... | |
static bool | startServer (ServerType type=MultipleInstances) |
Starts the COM server with type and returns true if successful, otherwise returns false. More... | |
static bool | stopServer () |
Stops the COM server and returns true if successful, otherwise returns false. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Properties | |
QUuid | app |
QUuid | typelib |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QAxFactory class defines a factory for the creation of COM components.
Implement this factory once in your COM server to provide information about the components the server can create. Subclass QAxFactory and implement the pure virtual functions in any implementation file (e.g. main.cpp), and export the factory using the QAXFACTORY_EXPORT()
macro.
If you use the Q_CLASSINFO()
macro to provide the unique identifiers or other attributes for your class you can use the QAXFACTORY_BEGIN()
, QAXCLASS()
and QAXFACTORY_END()
macros to expose one or more classes as COM objects.
If your server supports just a single COM object, you can use a default factory implementation through the QAXFACTORY_DEFAULT()
macro.
Only one QAxFactory implementation may be instantiated and exported by an ActiveX server application. This instance is accessible through the global qAxFactory() function.
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().
Definition at line 64 of file qaxfactory.h.
This enum specifies the different types of servers that can be started with startServer.
Enumerator | |
---|---|
SingleInstance | |
MultipleInstances |
Definition at line 93 of file qaxfactory.h.
Constructs a QAxFactory object that returns libid and appid in the implementation of the respective interface functions.
Definition at line 103 of file qaxfactory.cpp.
|
virtual |
|
virtual |
Reimplement this function to return the ActiveX server's application identifier.
Definition at line 138 of file qaxfactory.cpp.
Referenced by DumpIDL(), and UpdateRegistry().
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.
The default implementation interprets key as the class name, and returns the value of the Q_CLASSINFO() entry "ClassID".
Definition at line 191 of file qaxfactory.cpp.
Referenced by ActiveObject::ActiveObject(), classIDL(), QAxServerBase::GetClassID(), QAxServerBase::GetUserClassID(), qax_startServer(), and QClassFactory::QClassFactory().
Reimplement this function to return a new object for key, or 0 if this factory doesn't support the value of key.
If the object returned is a QWidget it will be exposed as an ActiveX control, otherwise the returned object will be exposed as a simple COM object.
Implemented in QAxClass< T >.
Referenced by QAxServerBase::internalCreate().
|
virtual |
Reimplement this function to provide the COM object for object in wrapper.
Return true if the function was successful; otherwise return false.
The default implementation creates a generic automation wrapper based on the meta object information of object.
Definition at line 478 of file qaxserverbase.cpp.
Referenced by ActiveObject::ActiveObject(), qax_create_object_wrapper(), and QVariantToVARIANT().
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 interprets key as the class name, and returns the value of the Q_CLASSINFO() entry "EventsID".
Definition at line 228 of file qaxfactory.cpp.
Referenced by classIDL(), QAxServerBase::GetGUID(), QAxServerBase::internalConnect(), and QAxServerBase::qt_metacall().
Reimplement this function to return the name of the super class of key up to which methods and properties should be exposed by the ActiveX control.
The default implementation interprets key as the class name, and returns the value of the Q_CLASSINFO()
entry "ToSuperClass". If no such value is set the null-string is returned, and 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.
Definition at line 317 of file qaxfactory.cpp.
Referenced by classIDL().
|
pure virtual |
Reimplement this function to return a list of the widgets (class names) supported by this factory.
Implemented in QAxClass< T >.
Referenced by qax_startServer(), qax_stopServer(), qAxFactory(), and QClassFactory::QClassFactory().
|
virtual |
Reimplement this function to return true if the ActiveX control key should support the standard ActiveX events.
The default implementation interprets key as the class name, and returns true if the value of the Q_CLASSINFO()
entry "StockEvents" is "yes". Otherwise this function returns false.
Definition at line 353 of file qaxfactory.cpp.
Referenced by classIDL(), and QAxServerBase::internalCreate().
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.
The default implementation interprets key as the class name, and returns the value of the Q_CLASSINFO() entry "InterfaceID".
Definition at line 209 of file qaxfactory.cpp.
Referenced by classIDL().
|
static |
Returns true if the application has been started (by COM) as an ActiveX server, otherwise returns false.
Definition at line 371 of file qaxfactory.cpp.
|
virtual |
Reimplement this function to return true if the server is running as a persistent service (e.g.
an NT service) and should not terminate even when all objects provided have been released.
The default implementation returns false.
Definition at line 410 of file qaxfactory.cpp.
Referenced by qax_startServer().
|
pure virtual |
Reimplement this function to return the QMetaObject corresponding to key, or 0 if this factory doesn't support the value of key.
Implemented in QAxClass< T >.
Referenced by convertTypes(), QClassFactory::CreateInstanceHelper(), QClassFactory::GetLicInfo(), QAxServerBase::InternalQueryInterface(), and QClassFactory::QClassFactory().
|
static |
Registers the QObject object with COM as a running object, and returns true if the registration succeeded, otherwise returns false.
The object is unregistered automatically when it is destroyed.
This function should only be called if the application has been started by the user (i.e. not by COM to respond to a request), and only for one object, usually the toplevel object of the application's object hierarchy.
This function does nothing and returns false if the object's class info for "RegisterObject" is not set to "yes", or if the server is an in-process server.
Definition at line 512 of file qaxfactory.cpp.
Registers additional values for the class key in the system registry using the settings object.
The standard values have already been registered by the framework, but additional values, e.g. implemented categories, can be added in an implementation of this function.
If you reimplement this function you must also reimplement unregisterClass() to remove the additional registry values.
Definition at line 252 of file qaxfactory.cpp.
|
static |
Returns the directory that contains the server binary.
For out-of-process servers this is the same as QApplication::applicationDirPath(). For in-process servers that function returns the directory that contains the hosting application.
Definition at line 386 of file qaxfactory.cpp.
|
static |
Returns the file path of the server binary.
For out-of-process servers this is the same as QApplication::applicationFilePath(). For in-process servers that function returns the file path of the hosting application.
Definition at line 398 of file qaxfactory.cpp.
|
inlinestatic |
Starts the COM server with type and returns true if successful, otherwise returns false.
Calling this function if the server is already running (or for an in-process server) does nothing and returns true.
The server is started automatically with type set to MultipleInstances
if the server executable has been started with the -activex
command line parameter. To switch to SingleInstance, call
in your own main() entry point function.
Definition at line 115 of file qaxfactory.h.
Referenced by main(), and WinMain().
|
virtual |
Reimplement this function to return true if the ActiveX control key should be a top level window, e.g.
a dialog. The default implementation returns false.
Definition at line 330 of file qaxfactory.cpp.
Referenced by QAxServerBase::internalCreate().
|
inlinestatic |
Stops the COM server and returns true if successful, otherwise returns false.
Calling this function if the server is not running (or for an in-process server) does nothing and returns true.
Stopping the server will not invalidate existing objects, but no new objects can be created from the existing server process. Usually COM will start a new server process if additional objects are requested.
The server is stopped automatically when the main() function returns.
Definition at line 123 of file qaxfactory.h.
Referenced by WinMain().
|
virtual |
Reimplement this function to return the ActiveX server's type library identifier.
Definition at line 124 of file qaxfactory.cpp.
Referenced by DumpIDL(), and UpdateRegistry().
Unregisters any additional values for the class key from the system registry using the settings object.
Definition at line 266 of file qaxfactory.cpp.
|
virtual |
Reimplement this function to return true if licenseKey is a valid license for the class key, or if the current machine is licensed.
The default implementation returns true if the class key is not licensed (ie. no Q_CLASSINFO()
attribute "LicenseKey"), or if licenseKey matches the value of the "LicenseKey" attribute, or if the machine is licensed through a .LIC file with the same filename as this COM server.
Definition at line 282 of file qaxfactory.cpp.
Referenced by QClassFactory::GetLicInfo().
|
private |
Definition at line 108 of file qaxfactory.h.
Referenced by appID().
|
private |
Definition at line 107 of file qaxfactory.h.
Referenced by typeLibID().