diff options
Diffstat (limited to 'src/activeqt')
-rw-r--r-- | src/activeqt/container/qaxbase.cpp | 83 | ||||
-rw-r--r-- | src/activeqt/container/qaxdump.cpp | 2 | ||||
-rw-r--r-- | src/activeqt/container/qaxobject.h | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxscript.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxwidget.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxwidget.h | 4 | ||||
-rw-r--r-- | src/activeqt/control/qaxserver.cpp | 70 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverbase.cpp | 37 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverdll.cpp | 2 | ||||
-rw-r--r-- | src/activeqt/control/qaxservermain.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/shared/qaxutils.cpp | 28 | ||||
-rw-r--r-- | src/activeqt/shared/qaxutils_p.h | 3 |
12 files changed, 106 insertions, 139 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index acc319e..472e041 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -663,13 +663,10 @@ QByteArray QAxEventSink::findProperty(DISPID dispID) if (!typeinfo) return propname; - BSTR names; - UINT cNames; - typeinfo->GetNames(dispID, &names, 1, &cNames); - if (cNames) { - propname = QString::fromWCharArray(names).toLatin1(); - SysFreeString(names); - } + + const QByteArray propnameI = qaxTypeInfoName(typeinfo, dispID); + if (!propnameI.isEmpty()) + propname = propnameI; typeinfo->Release(); QByteArray propsignal(propname + "Changed("); @@ -1406,7 +1403,7 @@ bool QAxBase::initializeRemote(IUnknown** ptr) at = server.indexOf(QChar::fromLatin1('@')); if (at != -1) { user = server.left(at); - server = server.mid(at+1); + server.remove(0, at + 1); at = user.indexOf(QChar::fromLatin1(':')); if (at != -1) { @@ -1416,7 +1413,7 @@ bool QAxBase::initializeRemote(IUnknown** ptr) at = user.indexOf(QChar::fromLatin1('/')); if (at != -1) { domain = user.left(at); - user = user.mid(at+1); + user.remove(0, at + 1); } } @@ -2298,17 +2295,9 @@ void MetaObjectGenerator::readEnumInfo() int value = vardesc->lpvarValue->lVal; int memid = vardesc->memid; // Get the name of the value - BSTR valuename; - QByteArray valueName; - UINT maxNamesOut; - enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut); - if (maxNamesOut) { - valueName = QString::fromWCharArray(valuename).toLatin1(); - SysFreeString(valuename); - } else { + QByteArray valueName = qaxTypeInfoName(enuminfo, memid); + if (valueName.isEmpty()) valueName = "value" + QByteArray::number(valueindex++); - } - if (clashCheck.contains(QString::fromLatin1(valueName))) valueName += QByteArray::number(++clashIndex); @@ -2457,25 +2446,15 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) if (!funcdesc) break; - QByteArray function; QByteArray type; QByteArray prototype; QList<QByteArray> parameters; // parse function description - BSTR bstrNames[256]; - UINT maxNames = 255; - UINT maxNamesOut; - typeinfo->GetNames(funcdesc->memid, (BSTR*)&bstrNames, maxNames, &maxNamesOut); - QList<QByteArray> names; - int p; - for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromWCharArray(bstrNames[p]).toLatin1(); - SysFreeString(bstrNames[p]); - } - + const QByteArrayList names = qaxTypeInfoNames(typeinfo, funcdesc->memid); + const int maxNamesOut = names.size(); // function name - function = names.at(0); + const QByteArray &function = names.at(0); if ((maxNamesOut == 3 && function == "QueryInterface") || (maxNamesOut == 1 && function == "AddRef") || (maxNamesOut == 1 && function == "Release") || @@ -2574,7 +2553,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) bool defargs; do { QByteArray pnames; - for (p = 0; p < parameters.count(); ++p) { + for (int p = 0; p < parameters.count(); ++p) { pnames += parameters.at(p); if (p < parameters.count() - 1) pnames += ','; @@ -2640,24 +2619,17 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) } // get variable name - BSTR bstrName; - UINT maxNames = 1; - UINT maxNamesOut; - typeinfo->GetNames(vardesc->memid, &bstrName, maxNames, &maxNamesOut); - if (maxNamesOut != 1 || !bstrName) { + const QByteArray variableName = qaxTypeInfoName(typeinfo, vardesc->memid); + if (variableName.isEmpty()) { typeinfo->ReleaseVarDesc(vardesc); continue; } - QByteArray variableType; - QByteArray variableName; - uint flags = 0; - variableName = QString::fromWCharArray(bstrName).toLatin1(); - SysFreeString(bstrName); + uint flags = 0; // get variable type TYPEDESC typedesc = vardesc->elemdescVar.tdesc; - variableType = guessTypes(typedesc, typeinfo, variableName); + const QByteArray variableType = guessTypes(typedesc, typeinfo, variableName); // generate meta property if (!hasProperty(variableName)) { @@ -2798,29 +2770,17 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo continue; } - QByteArray function; QByteArray prototype; QList<QByteArray> parameters; - // parse event function description - BSTR bstrNames[256]; - UINT maxNames = 255; - UINT maxNamesOut; - eventinfo->GetNames(funcdesc->memid, (BSTR*)&bstrNames, maxNames, &maxNamesOut); - QList<QByteArray> names; - int p; - for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromWCharArray(bstrNames[p]).toLatin1(); - SysFreeString(bstrNames[p]); - } + // parse event function description, get event function prototype + const QByteArrayList names = qaxTypeInfoNames(eventinfo, funcdesc->memid); - // get event function prototype - function = names.at(0); QByteArray type; // dummy - we don't care about return values for signals prototype = createPrototype(/*in*/ funcdesc, eventinfo, names, /*out*/type, parameters); if (!hasSignal(prototype)) { QByteArray pnames; - for (p = 0; p < parameters.count(); ++p) { + for (int p = 0; p < parameters.count(); ++p) { pnames += parameters.at(p); if (p < parameters.count() - 1) pnames += ','; @@ -3872,7 +3832,7 @@ bool QAxBase::dynamicCallHelper(const char *name, void *inout, QList<QVariant> & parse = !varc && normFunction.length() > function.length() + 2; if (parse) { QString args = QLatin1String(normFunction); - args = args.mid(function.length() + 1); + args.remove(0, function.length() + 1); // parse argument string int list of arguments QString curArg; const QChar *c = args.unicode(); @@ -4492,7 +4452,8 @@ QVariant QAxBase::asVariant() const else if (d->ptr) qvar.setValue(d->ptr); } else { - cn = cn.mid(cn.lastIndexOf(':') + 1) + '*'; + cn.remove(0, cn.lastIndexOf(':') + 1); + cn += '*'; QObject *object = qObject(); int typeId = QMetaType::type(cn); if (typeId == QMetaType::UnknownType) diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp index db124d4..be22892 100644 --- a/src/activeqt/container/qaxdump.cpp +++ b/src/activeqt/container/qaxdump.cpp @@ -113,7 +113,7 @@ static QByteArray toType(const QByteArray &t) type = "int"; if (type.at(0) == 'Q') - type = type.mid(1); + type.remove(0, 1); type[0] = toupper(type.at(0)); if (type == "VariantList") type = "List"; diff --git a/src/activeqt/container/qaxobject.h b/src/activeqt/container/qaxobject.h index 5ce5835..fc09a70 100644 --- a/src/activeqt/container/qaxobject.h +++ b/src/activeqt/container/qaxobject.h @@ -50,8 +50,8 @@ class QAxObject : public QObject, public QAxBase friend class QAxEventSink; Q_OBJECT_FAKE public: - QObject* qObject() const { return (QObject*)this; } - const char *className() const; + QObject* qObject() const Q_DECL_OVERRIDE { return static_cast<QObject *>(const_cast<QAxObject *>(this)); } + const char *className() const Q_DECL_OVERRIDE; QAxObject(QObject *parent = 0); QAxObject(const QString &c, QObject *parent = 0); diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index 1d1711b..861edab 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -45,8 +45,6 @@ // Workaround for mingw-w64 bug #464 // See https://sourceforge.net/p/mingw-w64/bugs/464/ # define _NO_SCRIPT_GUIDS -#elif defined(Q_CC_BOR) && __BORLANDC__ < 0x560 -# define QT_NO_QAXSCRIPT #endif #include <qapplication.h> @@ -327,7 +325,7 @@ QWidget *QAxScriptSite::window() const if (w) w = w->window(); if (!w && qApp) - w = qApp->activeWindow(); + w = QApplication::activeWindow(); return w; } diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index f85e2c9..22febc9 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -517,7 +517,7 @@ bool QAxNativeEventFilter::nativeEventFilter(const QByteArray &, void *m, long * QMouseEvent e(type, pos, gpos, (Qt::MouseButton)button, translateMouseButtonState(msg->wParam), translateModifierState(msg->wParam)); - QApplication::sendEvent(ax, &e); + QCoreApplication::sendEvent(ax, &e); } } } @@ -1391,7 +1391,7 @@ HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/) HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText) { QStatusTipEvent tip(QString::fromWCharArray(pszStatusText)); - QApplication::sendEvent(widget, &tip); + QCoreApplication::sendEvent(widget, &tip); return S_OK; } diff --git a/src/activeqt/container/qaxwidget.h b/src/activeqt/container/qaxwidget.h index 421933d..ce5efd3 100644 --- a/src/activeqt/container/qaxwidget.h +++ b/src/activeqt/container/qaxwidget.h @@ -73,7 +73,7 @@ public: virtual QAxAggregated *createAggregate(); protected: - bool initialize(IUnknown**); + bool initialize(IUnknown **) Q_DECL_OVERRIDE; virtual bool createHostWindow(bool); bool createHostWindow(bool, const QByteArray&); @@ -89,7 +89,7 @@ private: QAxClientSite *container; QAxWidgetPrivate *d; - const QMetaObject *parentMetaObject() const; + const QMetaObject *parentMetaObject() const Q_DECL_OVERRIDE; }; template <> inline QAxWidget *qobject_cast<QAxWidget*>(const QObject *o) diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index 1703765..6abf2a7 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -248,7 +248,7 @@ HRESULT UpdateRegistry(BOOL bRegister) // we try to create the ActiveX widgets later on... bool delete_qApp = false; if (!qApp) { - int argc = 0; + static int argc = 0; // static lifetime, since it's passed as reference to QApplication, which has a lifetime exceeding the stack frame (void)new QApplication(argc, 0); delete_qApp = true; } @@ -496,13 +496,11 @@ static const char* const type_map[][2] = // Userdefined Qt datatypes - some not on Borland though { "QCursor", "enum MousePointer" }, { "Qt::FocusPolicy", "enum FocusPolicy" }, -#ifndef Q_CC_BOR -# if __REQUIRED_RPCNDR_H_VERSION__ >= Q_REQUIRED_RPCNDR_H_VERSION +#if __REQUIRED_RPCNDR_H_VERSION__ >= Q_REQUIRED_RPCNDR_H_VERSION { "QRect", "struct QRect" }, { "QSize", "struct QSize" }, { "QPoint", "struct QPoint" }, -# endif -#endif +#endif // __REQUIRED_RPCNDR_H_VERSION__ >= Q_REQUIRED_RPCNDR_H_VERSION // And we support COM data types { "BOOL", "BOOL" }, { "BSTR", "BSTR" }, @@ -704,7 +702,15 @@ bool ignoreProps(const char *test) return ignore(test, ignore_props); } -#define STRIPCB(x) x = x.mid(1, x.length()-2) +static QString stripCurlyBraces(const QUuid &uuid) +{ + if (uuid.isNull()) + return QString(); + QString result = uuid.toString().toUpper(); + result.chop(1); + result.remove(0, 1); + return result; +} static QByteArray prototype(const QList<QByteArray> ¶meterTypes, const QList<QByteArray> ¶meterNames, bool *ok) { @@ -804,17 +810,14 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN control = true; } - QString classID = qAxFactory()->classID(className).toString().toUpper(); - if (QUuid(classID).isNull()) + const QString classID = stripCurlyBraces(qAxFactory()->classID(className)); + if (classID.isEmpty()) return 4; - STRIPCB(classID); - QString interfaceID = qAxFactory()->interfaceID(className).toString().toUpper(); - if (QUuid(interfaceID).isNull()) + const QString interfaceID = stripCurlyBraces(qAxFactory()->interfaceID(className)); + if (interfaceID.isEmpty()) return 5; - STRIPCB(interfaceID); - QString eventsID = qAxFactory()->eventsID(className).toString().toUpper(); - bool hasEvents = !QUuid(eventsID).isNull(); - STRIPCB(eventsID); + const QString eventsID = stripCurlyBraces(qAxFactory()->eventsID(className)); + const bool hasEvents = !eventsID.isEmpty(); QString cleanClassName = qax_clean_type(className, mo); QString defProp(QLatin1String(mo->classInfo(mo->indexOfClassInfo("DefaultProperty")).value())); @@ -950,7 +953,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (i <= qtSlots && ignoreSlots(name)) continue; - signature = signature.mid(name.length() + 1); + signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); name = renameOverloads(replaceKeyword(name)); if (ignoreSlots(name)) @@ -970,7 +973,8 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (!ok) outBuffer += "\t/****** Slot parameter uses unsupported datatype\n"; - outBuffer += "\t\t[id(" + QString::number(id).toLatin1() + ")] " + type + ' ' + name + '(' + ptype + ");\n"; + outBuffer += "\t\t[id(" + QByteArray::number(id) + ")] " + type + ' ' + + name + '(' + ptype + ");\n"; if (!ok) outBuffer += "\t******/\n"; @@ -1016,7 +1020,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN QByteArray signature(signal.methodSignature()); QByteArray name(signature.left(signature.indexOf('('))); - signature = signature.mid(name.length() + 1); + signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); QList<QByteArray> parameterTypes(signal.parameterTypes()); @@ -1082,11 +1086,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN return S_OK; } -#if defined(Q_CC_BOR) -extern "C" __stdcall HRESULT DumpIDL(const QString &outfile, const QString &ver) -#else extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) -#endif { qAxIsServer = false; QTextStream out; @@ -1101,14 +1101,12 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) QString filebase = QString::fromWCharArray(qAxModuleFilename); filebase.truncate(filebase.lastIndexOf(QLatin1Char('.'))); - QString appID = qAxFactory()->appID().toString().toUpper(); - if (QUuid(appID).isNull()) + const QString appID = stripCurlyBraces(qAxFactory()->appID()); + if (appID.isEmpty()) return 1; - STRIPCB(appID); - QString typeLibID = qAxFactory()->typeLibID().toString().toUpper(); - if (QUuid(typeLibID).isNull()) + const QString typeLibID = stripCurlyBraces(qAxFactory()->typeLibID()); + if (typeLibID.isEmpty()) return 2; - STRIPCB(typeLibID); QString typelib = filebase.right(filebase.length() - filebase.lastIndexOf(QLatin1String("\\"))-1); if (!file.open(QIODevice::WriteOnly)) @@ -1124,12 +1122,9 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) if (version.isEmpty()) version = QLatin1String("1.0"); - QString idQRect(QUuid(CLSID_QRect).toString()); - STRIPCB(idQRect); - QString idQSize(QUuid(CLSID_QSize).toString()); - STRIPCB(idQSize); - QString idQPoint(QUuid(CLSID_QPoint).toString()); - STRIPCB(idQPoint); + const QString idQRect = stripCurlyBraces(QUuid(CLSID_QRect)); + const QString idQSize = stripCurlyBraces(QUuid(CLSID_QSize)); + const QString idQPoint = stripCurlyBraces(QUuid(CLSID_QPoint)); out << "/****************************************************************************" << endl; out << "** Interface definition generated for ActiveQt project" << endl; @@ -1147,7 +1142,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) // dummy application to create widgets bool delete_qApp = false; if (!qApp) { - int argc=0; + static int argc = 0; // static lifetime, since it's passed as reference to QApplication, which has a lifetime exceeding the stack frame (void)new QApplication(argc, 0); delete_qApp = true; } @@ -1172,7 +1167,6 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) out << "\t** use the correct files." << endl; out << "\t**" << endl; -#ifndef Q_CC_BOR #if __REQUIRED_RPCNDR_H_VERSION__ < Q_REQUIRED_RPCNDR_H_VERSION out << "\t** Required version of MIDL could not be verified. QRect, QSize and QPoint" << endl; out << "\t** support needs an updated Platform SDK to be installed." << endl; @@ -1204,10 +1198,6 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) #if __REQUIRED_RPCNDR_H_VERSION__ < Q_REQUIRED_RPCNDR_H_VERSION out << "\t*/" << endl; #endif -#else - out << "\t** Custom data types not supported with Borland." << endl; - out << "\t*************************************************************************" << endl; -#endif out << endl; out << "\t/* Forward declaration of classes that might be used as parameters */" << endl << endl; diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index b1eac89..d6af214 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -433,7 +433,7 @@ class QAxServerAggregate : public IUnknown { public: QAxServerAggregate(const QString &className, IUnknown *outerUnknown) - : m_outerUnknown(outerUnknown), ref(0) + : ref(0) { object = new QAxServerBase(className, outerUnknown); object->registerActiveObject(this); @@ -476,7 +476,6 @@ public: private: QAxServerBase *object; - IUnknown *m_outerUnknown; LONG ref; CRITICAL_SECTION refCountSection; @@ -790,7 +789,7 @@ private: LRESULT QT_WIN_CALLBACK axs_FilterProc(int nCode, WPARAM wParam, LPARAM lParam) { if (qApp && !invokeCount) - qApp->sendPostedEvents(); + QCoreApplication::sendPostedEvents(); return CallNextHookEx(qax_hhook, nCode, wParam, lParam); } @@ -906,7 +905,7 @@ public: int argc = 0; new QApplication(argc, 0); } - qApp->setQuitOnLastWindowClosed(false); + QGuiApplication::setQuitOnLastWindowClosed(false); if (qAxOutProcServer) QAbstractEventDispatcher::instance()->installNativeEventFilter(qax_winEventFilter()); @@ -921,7 +920,7 @@ public: // If we created QApplication instance, ensure native event loop starts properly // by calling processEvents. if (qax_ownQApp) - qApp->processEvents(); + QCoreApplication::processEvents(); HRESULT res; // Create the ActiveX wrapper - aggregate if requested @@ -1321,7 +1320,7 @@ bool QAxServerBase::internalCreate() if (isWidget) { if (!stayTopLevel) { QEvent e(QEvent::EmbeddingControl); - QApplication::sendEvent(qt.widget, &e); + QCoreApplication::sendEvent(qt.widget, &e); } qt.widget->setAttribute(Qt::WA_QuitOnClose, false); qt.widget->move(0, 0); @@ -1970,7 +1969,7 @@ int QAxServerBase::qt_metacall(QMetaObject::Call call, int index, void **argv) } } - signature = signature.mid(name.length() + 1); + signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); if (!signature.isEmpty()) @@ -2291,15 +2290,11 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, index = mo->indexOfProperty(name); } } else { - BSTR bname; - UINT cname = 0; - if (m_spTypeInfo) - m_spTypeInfo->GetNames(dispidMember, &bname, 1, &cname); - if (!cname) + if (!m_spTypeInfo) + return res; + name = qaxTypeInfoName(m_spTypeInfo, dispidMember); + if (name.isEmpty()) return res; - - name = QString::fromWCharArray(bname).toLatin1(); - SysFreeString(bname); } } @@ -2620,13 +2615,9 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, if (!exception->context.isNull()) { QString context = exception->context; int contextID = 0; - int br = context.indexOf(QLatin1Char('[')); + const int br = context.indexOf(QLatin1Char('[')); // "error[42]" if (br != -1) { - context = context.mid(br+1); - context.chop(1); - contextID = context.toInt(); - - context = exception->context; + contextID = context.midRef(br + 1, context.size() - br - 2).toInt(); context.truncate(br-1); } pexcepinfo->bstrHelpFile = QStringToBSTR(context); @@ -3343,7 +3334,7 @@ HRESULT WINAPI QAxServerBase::OnAmbientPropertyChange(DISPID dispID) case DISPID_AMBIENT_RIGHTTOLEFT: if (var.vt != VT_BOOL) break; - qApp->setLayoutDirection(var.boolVal?Qt::RightToLeft:Qt::LeftToRight); + QGuiApplication::setLayoutDirection(var.boolVal ? Qt::RightToLeft : Qt::LeftToRight); break; } @@ -3582,7 +3573,7 @@ HRESULT WINAPI QAxServerBase::TranslateAcceleratorW(MSG *pMsg) QKeyEvent override(QEvent::ShortcutOverride, key, (Qt::KeyboardModifiers)state); override.ignore(); - QApplication::sendEvent(qt.widget->focusWidget(), &override); + QCoreApplication::sendEvent(qt.widget->focusWidget(), &override); if (override.isAccepted()) return S_FALSE; } diff --git a/src/activeqt/control/qaxserverdll.cpp b/src/activeqt/control/qaxserverdll.cpp index fa4619b..7117cbb 100644 --- a/src/activeqt/control/qaxserverdll.cpp +++ b/src/activeqt/control/qaxserverdll.cpp @@ -96,7 +96,7 @@ STDAPI DllCanUnloadNow() return S_OK; // check if qApp still runs widgets (in other DLLs) - QWidgetList widgets = qApp->allWidgets(); + QWidgetList widgets = QApplication::allWidgets(); int count = widgets.count(); for (int w = 0; w < widgets.count(); ++w) { // remove all Qt generated widgets diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp index 96cd503..8adb504 100644 --- a/src/activeqt/control/qaxservermain.cpp +++ b/src/activeqt/control/qaxservermain.cpp @@ -73,11 +73,7 @@ extern HRESULT GetClassObject(const GUID &clsid, const GUID &iid, void **ppUnk); extern ulong qAxLockCount(); extern bool qax_winEventFilter(void *message); -#if defined(Q_CC_BOR) -extern "C" __stdcall HRESULT DumpIDL(const QString &outfile, const QString &ver); -#else STDAPI DumpIDL(const QString &outfile, const QString &ver); -#endif // Monitors the shutdown event static DWORD WINAPI MonitorProc(void* /* pv */) diff --git a/src/activeqt/shared/qaxutils.cpp b/src/activeqt/shared/qaxutils.cpp index 9f94835..7c7e967 100644 --- a/src/activeqt/shared/qaxutils.cpp +++ b/src/activeqt/shared/qaxutils.cpp @@ -346,4 +346,32 @@ HRGN qaxHrgnFromQRegion(const QRegion ®ion, const QWidget *widget) #endif // QT_WIDGETS_LIB +QByteArray qaxTypeInfoName(ITypeInfo *typeInfo, MEMBERID memId) +{ + QByteArray result; + BSTR names; + UINT cNames = 0; + typeInfo->GetNames(memId, &names, 1, &cNames); + if (cNames && names) { + result = QString::fromWCharArray(names).toLatin1(); + SysFreeString(names); + } + return result; +} + +QByteArrayList qaxTypeInfoNames(ITypeInfo *typeInfo, MEMBERID memId) +{ + QByteArrayList result; + BSTR bstrNames[256]; + UINT maxNames = 255; + UINT maxNamesOut = 0; + typeInfo->GetNames(memId, reinterpret_cast<BSTR *>(&bstrNames), maxNames, &maxNamesOut); + result.reserve(maxNamesOut); + for (UINT p = 0; p < maxNamesOut; ++p) { + result.append(QString::fromWCharArray(bstrNames[p]).toLatin1()); + SysFreeString(bstrNames[p]); + } + return result; +} + QT_END_NAMESPACE diff --git a/src/activeqt/shared/qaxutils_p.h b/src/activeqt/shared/qaxutils_p.h index acd0eb8..f2576c1 100644 --- a/src/activeqt/shared/qaxutils_p.h +++ b/src/activeqt/shared/qaxutils_p.h @@ -120,6 +120,9 @@ QRect qaxFromNativeRect(const RECT &r, const QWidget *w); HRGN qaxHrgnFromQRegion(const QRegion ®ion, const QWidget *widget); #endif // QT_WIDGETS_LIB +QByteArray qaxTypeInfoName(ITypeInfo *typeInfo, MEMBERID memId); +QByteArrayList qaxTypeInfoNames(ITypeInfo *typeInfo, MEMBERID memId); + QT_END_NAMESPACE Q_DECLARE_METATYPE(IDispatch**) |