From 7a8395dc18a14a4ed356bd69ada5fbf9721ba5fe Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 4 Jan 2016 10:47:41 +0100 Subject: Doc: added missing brief statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia23dede42f669034e6601b92d04876a3777bdc6e Task-number: QTBUG-50261 Reviewed-by: Topi Reiniƶ --- examples/activeqt/simple/doc/src/simple.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/activeqt/simple/doc/src/simple.qdoc b/examples/activeqt/simple/doc/src/simple.qdoc index 02e68d8..1f0a118 100644 --- a/examples/activeqt/simple/doc/src/simple.qdoc +++ b/examples/activeqt/simple/doc/src/simple.qdoc @@ -74,6 +74,9 @@ \example activeqt/simple \title Simple Example (ActiveQt) + \brief The Simple example demonstrates the use + of QAxBindable and QAxFactory. + The Simple example demonstrates the use of QAxBindable::requestPropertyChange() and QAxBindable::propertyChanged(), and the use of the default -- cgit v1.2.3 From bb9ee3a9794b73bb16a4cb0f445fe773e6af79e2 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Wed, 27 Jan 2016 00:36:29 +0100 Subject: Change "argc" variable to have static lifetime. Required, since the QApplication object contains a reference back to "argc". The lifetime of the QApplication object exceeds "argc" on the stack. This in turn causes QApplication to see a corrupted "argc" values later in the function. This fixes a nasty crash during IDC-based IDL generation & DLL registration that was only observed in release build post-build events with VS2012. Change-Id: Ie8e404060deccadc75560748ad7071b41425cf79 Reviewed-by: Friedemann Kleint --- src/activeqt/control/qaxserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index 1703765..74b7c57 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; } @@ -1147,7 +1147,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; } -- cgit v1.2.3 From 79f24c6c788e3fa85af1f0963d2d577b3d9357be Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 28 Jan 2016 10:27:18 +0100 Subject: Add changelog for Qt 5.6.0 release Change-Id: Id1872b3f611c34850f5eb77bb9b18be312541ff7 Reviewed-by: Joerg Bornemann --- dist/changes-5.6.0 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dist/changes-5.6.0 diff --git a/dist/changes-5.6.0 b/dist/changes-5.6.0 new file mode 100644 index 0000000..36c6c10 --- /dev/null +++ b/dist/changes-5.6.0 @@ -0,0 +1,22 @@ +Qt 5.6 introduces many new features and improvements as well as bugfixes +over the 5.5.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +- [QTBUG-46615] Adapted to High DPI scaling. -- cgit v1.2.3 From cb991e69c04726fb46ec8c03d966dcbf159e2fe0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 12 Jan 2016 14:02:34 +0100 Subject: testcon: Add options for application attributes. Make it possible to set Qt::AA_DisableHighDpiScaling and Qt::AA_DontCreateNativeWidgetSiblings. Task-number: QTBUG-50206 Change-Id: Ib5f0e9f29a78b22c99edfef3b6687482150d9896 Reviewed-by: Joerg Bornemann --- tools/testcon/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testcon/main.cpp b/tools/testcon/main.cpp index 863a9e4..ac860bd 100644 --- a/tools/testcon/main.cpp +++ b/tools/testcon/main.cpp @@ -49,6 +49,15 @@ QAXFACTORY_DEFAULT(MainWindow, QT_USE_NAMESPACE +static bool isOptionSet(int argc, char *argv[], const char *option) +{ + for (int i = 1; i < argc; ++i) { + if (!qstrcmp(argv[i], option)) + return true; + } + return false; +} + static void redirectDebugOutput(QtMsgType, const QMessageLogContext &, const QString &msg) { if (MainWindow *mainWindow = MainWindow::instance()) @@ -57,6 +66,11 @@ static void redirectDebugOutput(QtMsgType, const QMessageLogContext &, const QSt int main( int argc, char **argv ) { + if (isOptionSet(argc, argv, "--no-scaling")) + QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + if (isOptionSet(argc, argv, "--no-native-siblings")) + QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + QApplication app( argc, argv ); QCoreApplication::setApplicationName(QLatin1String("TestCon")); QCoreApplication::setOrganizationName(QLatin1String("QtProject")); @@ -72,6 +86,12 @@ int main( int argc, char **argv ) QCommandLineOption noMessageHandlerOption(QLatin1String("no-messagehandler"), QLatin1String("Suppress installation of the message handler.")); parser.addOption(noMessageHandlerOption); + QCommandLineOption noScalingDummy(QLatin1String("no-scaling"), + QLatin1String("Set Qt::AA_DisableHighDpiScaling.")); + parser.addOption(noScalingDummy); + QCommandLineOption noNativeSiblingsDummy(QLatin1String("no-native-siblings"), + QLatin1String("Set Qt::AA_DontCreateNativeWidgetSiblings.")); + parser.addOption(noNativeSiblingsDummy); parser.addPositionalArgument(QLatin1String("clsid/file"), QLatin1String("The clsid/file to show.")); parser.process(app); -- cgit v1.2.3 From fbff938b52051aa9198b4234a0816dd91703a696 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Feb 2016 13:30:03 +0100 Subject: Add missing override declarations. Task-number: QTBUG-50804 Change-Id: I4a926cc80341ecfb4919e72f9a5b9a0c15b0d9dd Reviewed-by: Andreas Holzammer Reviewed-by: Andy Shaw --- src/activeqt/container/qaxobject.h | 4 ++-- src/activeqt/container/qaxwidget.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/activeqt/container/qaxobject.h b/src/activeqt/container/qaxobject.h index fd18c98..5c62303 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(const_cast(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/qaxwidget.h b/src/activeqt/container/qaxwidget.h index 4792d0e..2cfa37f 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(const QObject *o) -- cgit v1.2.3 From 219ea5487f49791e66ee3d1092130236ec67fbd6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Feb 2016 13:29:34 +0100 Subject: Remove unused variable as detected by Clang. Task-number: QTBUG-50804 Change-Id: I94a92a04d4cf412b00e5d52f5a88178bba6218a4 Reviewed-by: Andreas Holzammer Reviewed-by: Andy Shaw --- src/activeqt/control/qaxserverbase.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index b1eac89..aa00823 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; -- cgit v1.2.3 From 03369e63a5e74f096475383d429ac5b57d6f1763 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 8 Feb 2016 14:54:09 +0100 Subject: Bump version Change-Id: Ide81eadba47dcad5c83c3c77c1aea82854255920 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index a9b6a32..9450b83 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.6.0 +MODULE_VERSION = 5.6.1 -- cgit v1.2.3 From de83e48d7908e2f50d9cdbe41207b77a41332f2d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Feb 2016 14:22:07 +0100 Subject: Fix invocation of static methods. Change-Id: Id151e5e43c53ba09d17556e98b5573faa2a98c19 Reviewed-by: Joerg Bornemann --- src/activeqt/container/qaxscript.cpp | 2 +- src/activeqt/container/qaxwidget.cpp | 4 ++-- src/activeqt/control/qaxserverbase.cpp | 12 ++++++------ src/activeqt/control/qaxserverdll.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index 1d1711b..cb1a2c5 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -327,7 +327,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 ae3e3e1..4da3871 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/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index aa00823..1402d32 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -789,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); } @@ -905,7 +905,7 @@ public: int argc = 0; new QApplication(argc, 0); } - qApp->setQuitOnLastWindowClosed(false); + QGuiApplication::setQuitOnLastWindowClosed(false); if (qAxOutProcServer) QAbstractEventDispatcher::instance()->installNativeEventFilter(qax_winEventFilter()); @@ -920,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 @@ -1320,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); @@ -3342,7 +3342,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; } @@ -3581,7 +3581,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 -- cgit v1.2.3 From 3d3b0abf45ad4bf6abd82d022e01080cd423c1c5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Feb 2016 09:56:41 +0100 Subject: Introduce helper functions for ITypeInfo::GetNames(). Move code to axutils. Change-Id: I149d72bba2f250a2c11e144b449b55385fe280e2 Reviewed-by: Joerg Bornemann --- src/activeqt/container/qaxbase.cpp | 74 ++++++++-------------------------- src/activeqt/control/qaxserverbase.cpp | 12 ++---- src/activeqt/shared/qaxutils.cpp | 28 +++++++++++++ src/activeqt/shared/qaxutils_p.h | 3 ++ 4 files changed, 52 insertions(+), 65 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index acc319e..fb1351e 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("); @@ -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 parameters; // parse function description - BSTR bstrNames[256]; - UINT maxNames = 255; - UINT maxNamesOut; - typeinfo->GetNames(funcdesc->memid, (BSTR*)&bstrNames, maxNames, &maxNamesOut); - QList 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 parameters; - // parse event function description - BSTR bstrNames[256]; - UINT maxNames = 255; - UINT maxNamesOut; - eventinfo->GetNames(funcdesc->memid, (BSTR*)&bstrNames, maxNames, &maxNamesOut); - QList 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 += ','; diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 1402d32..583cb76 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -2290,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); } } 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(&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**) -- cgit v1.2.3 From 4db7de9fafb6d4620828ad8ed51c3d22b3efba9f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Feb 2016 15:55:32 +0100 Subject: Remove Q_CC_BOR. Qt no longer builds with the Borland compilers. Change-Id: I3788daa2ef7419f8b23e1594f5c6a409150ea97a Reviewed-by: Joerg Bornemann --- src/activeqt/container/qaxscript.cpp | 2 -- src/activeqt/control/qaxserver.cpp | 15 ++------------- src/activeqt/control/qaxservermain.cpp | 4 ---- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index cb1a2c5..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 diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index 74b7c57..aec88e6 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -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" }, @@ -1082,11 +1080,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; @@ -1172,7 +1166,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; @@ -1203,10 +1196,6 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) out << "\t};" << endl; #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; 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 */) -- cgit v1.2.3 From 1a7b140eb8f3f03354452c4669aabae2f141b9c8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Feb 2016 15:56:40 +0100 Subject: String fixes. - Avoid conversion from QString to QByteArray. - Replace a = a.mid() by a.remove(). - Replace a = a.left() by a.truncate(). - Streamline code extracting an error code. Change-Id: I43c1f04e947632f725bbb86af5abf108b2b02261 Reviewed-by: Oliver Wolff --- src/activeqt/container/qaxbase.cpp | 9 +++++---- src/activeqt/container/qaxdump.cpp | 2 +- src/activeqt/control/qaxserver.cpp | 7 ++++--- src/activeqt/control/qaxserverbase.cpp | 10 +++------- tools/dumpcpp/main.cpp | 4 ++-- tools/testcon/invokemethod.cpp | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index fb1351e..472e041 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -1403,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) { @@ -1413,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); } } @@ -3832,7 +3832,7 @@ bool QAxBase::dynamicCallHelper(const char *name, void *inout, QList & 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(); @@ -4452,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/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index aec88e6..7ba1515 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -948,7 +948,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)) @@ -968,7 +968,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"; @@ -1014,7 +1015,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 parameterTypes(signal.parameterTypes()); diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 583cb76..d6af214 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -1969,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()) @@ -2615,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); diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp index c65d5cd..f516fff 100644 --- a/tools/dumpcpp/main.cpp +++ b/tools/dumpcpp/main.cpp @@ -414,7 +414,7 @@ void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaOb if (slotSignature.endsWith("()")) { // no parameters - no names slotNamedSignature = slotSignature; } else { - slotNamedSignature = slotSignature.left(slotSignature.indexOf('(') + 1); + slotNamedSignature.truncate(slotSignature.indexOf('(') + 1); QByteArray slotSignatureTruncated(slotSignature.mid(slotNamedSignature.length())); slotSignatureTruncated.truncate(slotSignatureTruncated.length() - 1); @@ -1092,7 +1092,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, QByteArray refTypeLib; if (refType.contains("::")) { refTypeLib = refType; - refType = refType.mid(refType.lastIndexOf("::") + 2); + refType.remove(0, refType.lastIndexOf("::") + 2); if (refTypeLib.contains(' ')) { refType = refTypeLib.left(refTypeLib.indexOf(' ')) + ' ' + refType; } diff --git a/tools/testcon/invokemethod.cpp b/tools/testcon/invokemethod.cpp index 0f898b1..ec6024c 100644 --- a/tools/testcon/invokemethod.cpp +++ b/tools/testcon/invokemethod.cpp @@ -114,7 +114,7 @@ void InvokeMethod::on_comboMethods_activated(const QString &method) const QMetaObject *mo = activex->metaObject(); const QMetaMethod slot = mo->method(mo->indexOfSlot(method.toLatin1())); QString signature = QString::fromLatin1(slot.methodSignature()); - signature = signature.mid(signature.indexOf(QLatin1Char('(')) + 1); + signature.remove(0, signature.indexOf(QLatin1Char('(')) + 1); signature.truncate(signature.length()-1); QList pnames = slot.parameterNames(); -- cgit v1.2.3 From 4c17b7a79d1cb209aa63b541d5a45c90d27a7526 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Feb 2016 09:25:05 +0100 Subject: dumpcpp: Introduce flags type ObjectCategories for enum ObjectCategory. The enumeration values are mostly used as flags with some unnecessary casts. Clean this up by introducing flags. Change-Id: Iab03acb9ab83624bd0e3a6812255d7215d502003 Reviewed-by: Joerg Bornemann --- tools/dumpcpp/main.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp index f516fff..5b8c57a 100644 --- a/tools/dumpcpp/main.cpp +++ b/tools/dumpcpp/main.cpp @@ -70,6 +70,9 @@ enum ObjectCategory Licensed = 0x100, }; +Q_DECLARE_FLAGS(ObjectCategories, ObjectCategory) +Q_DECLARE_OPERATORS_FOR_FLAGS(ObjectCategories) + extern QMetaObject *qax_readEnumInfo(ITypeLib *typeLib, const QMetaObject *parentObject); extern QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *typeInfo, const QMetaObject *parentObject); extern QMetaObject *qax_readInterfaceInfo(ITypeLib *typeLib, ITypeInfo *typeInfo, const QMetaObject *parentObject); @@ -154,7 +157,9 @@ QByteArray constRefify(const QByteArray &type) return ctype; } -void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaObject *mo, const QByteArray &className, const QByteArray &nameSpace, ObjectCategory category) +void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaObject *mo, + const QByteArray &className, const QByteArray &nameSpace, + ObjectCategories category) { QList functions; @@ -689,7 +694,8 @@ void generateMethodParameters(QTextStream &out, const QMetaObject *mo, const QMe out << endl; } -void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray &className, const QByteArray &nameSpace, ObjectCategory category) +void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray &className, + const QByteArray &nameSpace, ObjectCategories category) { Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 7, "dumpcpp should generate the same version as moc"); @@ -933,7 +939,7 @@ static QByteArrayList vTableOnlyStubsFromTypeLib(ITypeLib *typelib, const QStrin } bool generateTypeLibrary(QString typeLibFile, QString outname, - const QString &nameSpace, ObjectCategory category) + const QString &nameSpace, ObjectCategories category) { typeLibFile.replace(QLatin1Char('/'), QLatin1Char('\\')); @@ -1170,7 +1176,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, TYPEKIND typekind; typelib->GetTypeInfoType(index, &typekind); - uint object_category = category; + ObjectCategories object_category = category; if (!(typeattr->wTypeFlags & TYPEFLAG_FCANCREATE)) object_category |= SubObject; else if (typeattr->wTypeFlags & TYPEFLAG_FCONTROL) @@ -1224,18 +1230,22 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, if (typeattr->wTypeFlags & TYPEFLAG_FLICENSED) object_category |= Licensed; if (typekind == TKIND_COCLASS) { // write those later... - generateClassDecl(classesOut, guid.toString(), metaObject, className, libName.toLatin1(), (ObjectCategory)(object_category|NoInlines)); + generateClassDecl(classesOut, guid.toString(), metaObject, className, libName.toLatin1(), + object_category | NoInlines); classesOut << endl; } else { - generateClassDecl(declOut, guid.toString(), metaObject, className, libName.toLatin1(), (ObjectCategory)(object_category|NoInlines)); + generateClassDecl(declOut, guid.toString(), metaObject, className, libName.toLatin1(), + object_category | NoInlines); declOut << endl; } subtypes << className; - generateClassDecl(inlinesOut, guid.toString(), metaObject, className, libName.toLatin1(), (ObjectCategory)(object_category|OnlyInlines)); + generateClassDecl(inlinesOut, guid.toString(), metaObject, className, libName.toLatin1(), + object_category | OnlyInlines); inlinesOut << endl; } if (implFile.isOpen()) - generateClassImpl(classImplOut, metaObject, className, libName.toLatin1(), (ObjectCategory)object_category); + generateClassImpl(classImplOut, metaObject, className, libName.toLatin1(), + object_category); } currentTypeInfo = 0; } @@ -1416,7 +1426,7 @@ struct Options Options() : mode(GenerateMode), category(DefaultObject), dispatchEqualsIDispatch(false) {} ProgramMode mode; - uint category; + ObjectCategories category; bool dispatchEqualsIDispatch; QString outname; @@ -1599,7 +1609,7 @@ int main(int argc, char **argv) return -2; } - if (!generateTypeLibrary(typeLib, options.outname, options.nameSpace, (ObjectCategory)options.category)) { + if (!generateTypeLibrary(typeLib, options.outname, options.nameSpace, options.category)) { qWarning("dumpcpp: error processing type library '%s'", qPrintable(typeLib)); return -1; } -- cgit v1.2.3 From 450651e8155bbdec44253a9c282ec385257b2f8a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Feb 2016 17:12:33 +0100 Subject: Further string fixes: Replace ugly STRIPCB macro by static function. Introduce function stripCurlyBraces() to consistently format UUIDs. Change-Id: I9091102d8d5c54efec04d5b4e5d2f84e52276122 Reviewed-by: Oliver Wolff --- src/activeqt/control/qaxserver.cpp | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index 7ba1515..6abf2a7 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -702,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 ¶meterTypes, const QList ¶meterNames, bool *ok) { @@ -802,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())); @@ -1096,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)) @@ -1119,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; -- cgit v1.2.3