.BI "bool \fBstartServer\fR ( ServerType type = MultipleInstances )"
.br
.ti -1c
.BI "bool \fBstopServer\fR ()"
.br
.in -1c
.SH DESCRIPTION
This class is defined in the \fBQt ActiveQt Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main Qt API.
.PP
The QAxFactory class defines a factory for the creation of COM components.
.PP
.PP
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:
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // class ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // interface ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // event interface ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
.br
)
.br
.fi
.PP
If you implement your own factory reimplement the pure virtual functions, provide the unique identifiers for the ActiveX controls, and use the QAXFACTORY_EXPORT macro to instantiate and export it:
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
.br
)
.br
.fi
.PP
If you use the \fCQ_CLASSINFO\fR 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.
.PP
.nf
.br
QAXFACTORY_BEGIN(
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}", // type library ID
.br
"{01234567-89AB-CDEF-0123-456789ABCDEF}" // application ID
.br
)
.br
QAXCLASS(Class1)
.br
QAXCLASS(Class2)
.br
QAXFACTORY_END()
.br
.fi
.PP
Only one QAxFactory implementation may be instantiated and exported by an ActiveX server application. This instance is accessible through the global qAxFactory() function.
.PP
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().
.SS "Member Type Documentation"
.SH "QAxFactory::ServerType"
This enum specifies the different types of servers that can be started with startServer.
.TP
\fCQAxFactory::SingleInstance\fR - The server can create only one instance of each supplied class.
.TP
\fCQAxFactory::MultipleInstances\fR - The server can create multiple instances of each supplied class.
Reimplement this function to return the class identifier for each \fIkey\fR returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of \fIkey\fR.
.PP
The default implementation interprets \fIkey\fR as the class name, and returns the value of the Q_CLASSINFO entry "ClassID".
Reimplement this function to return a new widget for \fIkey\fR. Propagate \fIparent\fR and \fIname\fR to the QWidget constructor. Return 0 if this factory doesn't support the value of \fIkey\fR.
.PP
The returned widget will be exposed as an ActiveX control, e.g. a COM object that can be embedded as a control into applications.
Reimplement this function to return a new object for \fIkey\fR. Propagate \fIparent\fR and \fIname\fR to the QWidget constructor. Return 0 if this factory doesn't support the value of \fIkey\fR.
.PP
If the object returned is a QWidget it will be exposed as an ActiveX control, otherwise the returned object will be exposed as a COM object.
.PP
The default implementation returns the result QAxFactory::create() if \fIparent\fR is 0 or a widget, otherwise returns 0.
Reimplement this function to provide the COM object for \fIobject\fR in \fIwrapper\fR. Return TRUE if the function was successfull, otherwise return FALSE.
.PP
The default implementation creates a generic automation wrapper based on the meta object information of \fIobject\fR.
Reimplement this function to return the identifier of the event interface for each \fIkey\fR returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of \fIkey\fR.
.PP
The default implementation interprets \fIkey\fR as the class name, and returns the value of the Q_CLASSINFO entry "EventsID".
Reimplement this function to return the name of the super class of \fIkey\fR up to which methods and properties should be exposed by the ActiveX control.
.PP
The default implementation interprets \fIkey\fR 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.
.PP
To only expose the functions and properties of the class itself, reimplement this function to return \fIkey\fR.
Reimplement this function to return TRUE if the ActiveX control \fIkey\fR should support the standard ActiveX events
.TP
Click
.TP
DblClick
.TP
KeyDown
.TP
KeyPress
.TP
KeyUp
.TP
MouseDown
.TP
MouseUp
.TP
MouseMove
.PP
The default implementation interprets \fIkey\fR as the class name, and returns TRUE if the value of the Q_CLASSINFO entry "StockEvents" is "yes". Otherwise this function returns FALSE.
Reimplement this function to return the interface identifier for each \fIkey\fR returned by the featureList() implementation, or an empty QUuid if this factory doesn't support the value of \fIkey\fR.
.PP
The default implementation interprets \fIkey\fR as the class name, and returns the value of the Q_CLASSINFO entry "InterfaceID".
.SH "bool QAxFactory::isServer ()\fC [static]\fR"
Returns TRUE if the application has been started (by COM) as an ActiveX server, otherwise returns FALSE.
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.
Registers additional values for the class \fIkey\fR in the system registry using the \fIsettings\fR object. The standard values have already been registed by the framework, but additional values, e.g. implemented categories, can be added in an implementation of this function.
Returns the directory that contains the server binary.
.PP
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.
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.
.SH "bool QAxFactory::startServer ( ServerType type = MultipleInstances )\fC [static]\fR"
Starts the COM server with \fItype\fR and returns TRUE if successful, otherwise returns FALSE.
.PP
Calling this function if the server is already running (or for an in-process server) does nothing and returns TRUE.
.PP
The server is started automatically with \fItype\fR set to MultipleUse if the server executable has been started with the \fC-activex\fR command line parameter.
Reimplement this function to return TRUE if the ActiveX control \fIkey\fR should be a top level window, e.g. a dialog. The default implementation returns FALSE.
Stops the COM server and returns TRUE if successful, otherwise returns FALSE.
.PP
Calling this function if the server is not running (or for an in-process server) does nothing and returns TRUE.
.PP
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.
.PP
The server is stopped automatically when the main() function returns.