I have to use ActiveQt (qt 4.8.6 windows7). I have a problem with out-of-process server (.exe). It's registered successfully, it's responding to container's signals with its slots, but i can't make server emit signals (or to make container accept them).
pro file:
TARGET = object_mkpa
TEMPLATE = app
CONFIG += qt warn_off qaxserver
RC_FILE = qaxserver.rc
DEF_FILE = qaxserver.def
SOURCES += src/object_mkpa.cpp \
src/main.cpp
HEADERS += src/object_mkpa.h
header:
#include <QObject>
#include <QAxBindable>
class Object_mkpa : public QObject, public QAxBindable
{
Q_OBJECT
Q_CLASSINFO("RegisterObject", "yes")
public:
Object_mkpa(QObject* parent = 0 );
public slots:
...
signals:
...
};
source:
#include "object_mkpa.h"
#include <QAxFactory>
Object_mkpa::Object_mkpa(QObject* parent) : QObject(parent) { }
QAXFACTORY_DEFAULT(Object_mkpa, //widget class
"{69dfccf5-697f-497f-8aa9-d1ecfb64c1bf}", //class ID
"{e276cc69-3bf8-4932-b341-bdcb1045901b}", //interface ID
"{60b215f0-7f16-4f79-bac8-6b8d3cb14a00}", //event interface
"{110d3945-cfe7-4ae7-872c-02757e8dde91}", //type library ID
"{88dec6e0-4a5a-4c0b-bcdd-3f18dea9d86d}") //app ID
...
and main, which is actually not essential (does it even executes?..)
#include "object_mkpa.h"
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
return app.exec();
}
I've tested in-process server (dll) and signals work there, but it has another problem - it instantiates COM-object for every container that uses dll. I think that's how it's supposed to be (which is the opposite of what i do need), but if you know any hack - please tell me.
the difference with out-of-process is lack of main.cpp and slightly changed .pro file
TARGET = object_mkpa_dll
TEMPLATE = lib
CONFIG += qt warn_off dll qaxserver
RC_FILE = qaxserver.rc
DEF_FILE = qaxserver.def
LIBS += -lQAxServerd
HEADERS += \
object_mkpa_dll.h
SOURCES += \
object_mkpa_dll.cpp
After building using qt creator native build steps i do use dumpcpp on .exe or .dll and copy generated files to client directory.
important part of .pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
CONFIG += qaxcontainer
Finally that is how i use it:
object_mkpaLib::Object_mkpa interface; //this is in class declaration
QObject::connect(&interface, SIGNAL(test(int)), SLOT(testTester(int)));
QObject::connect(this, SIGNAL(test(QString)), &interface, SLOT(test2(QString)));