diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | examples/activeqt/comapp/main.cpp | 3 | ||||
-rw-r--r-- | src/activeqt/container/qaxbase.cpp | 47 | ||||
-rw-r--r-- | src/activeqt/container/qaxdump.cpp | 71 | ||||
-rw-r--r-- | src/activeqt/container/qaxscript.cpp | 5 | ||||
-rw-r--r-- | src/activeqt/container/qaxselect.cpp | 8 | ||||
-rw-r--r-- | src/activeqt/container/qaxwidget.cpp | 15 | ||||
-rw-r--r-- | src/activeqt/control/qaxserver.cpp | 292 | ||||
-rw-r--r-- | src/activeqt/control/qaxserverbase.cpp | 35 | ||||
-rw-r--r-- | src/activeqt/shared/qaxtypefunctions.cpp | 2 | ||||
-rw-r--r-- | src/activeqt/shared/qaxtypes.cpp | 2 | ||||
-rw-r--r-- | tools/dumpcpp/main.cpp | 464 | ||||
-rw-r--r-- | tools/testcon/ambientproperties.cpp | 2 | ||||
-rw-r--r-- | tools/testcon/changeproperties.cpp | 4 | ||||
-rw-r--r-- | tools/testcon/invokemethod.cpp | 6 | ||||
-rw-r--r-- | tools/testcon/mainwindow.cpp | 10 | ||||
-rw-r--r-- | tools/testcon/mainwindow.h | 3 |
17 files changed, 483 insertions, 488 deletions
diff --git a/.qmake.conf b/.qmake.conf index 35dba54..b3c7403 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST -MODULE_VERSION = 5.14.2 +MODULE_VERSION = 5.15.0 diff --git a/examples/activeqt/comapp/main.cpp b/examples/activeqt/comapp/main.cpp index 74b7fa3..62f92b8 100644 --- a/examples/activeqt/comapp/main.cpp +++ b/examples/activeqt/comapp/main.cpp @@ -53,6 +53,7 @@ #include <QTabWidget> #include <QScopedPointer> #include <QTimer> +#include <QVector> class Application; class DocumentList; @@ -104,7 +105,7 @@ public slots: Document *item(int index) const; private: - QList<Document *> m_list; + QVector<Document *> m_list; }; //! [1] diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index cdaef30..42ccffc 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -143,7 +143,7 @@ struct QAxMetaObject : public QMetaObject private: friend class MetaObjectGenerator; // save information about QAxEventSink connections, and connect when found in cache - QList<QUuid> connectionInterfaces; + QVector<QUuid> connectionInterfaces; // DISPID -> signal name QMap< QUuid, QMap<DISPID, QByteArray> > sigs; // DISPID -> property changed signal name @@ -152,7 +152,7 @@ private: QMap< QUuid, QMap<DISPID, QByteArray> > props; // Prototype -> member info - QHash<QByteArray, QList<QByteArray> > memberInfo; + QHash<QByteArray, QByteArrayList> memberInfo; QMap<QByteArray, QByteArray> realPrototype; // DISPID cache @@ -165,12 +165,10 @@ void QAxMetaObject::parsePrototype(const QByteArray &prototype) QByteArray parameters = realProto.mid(realProto.indexOf('(') + 1); parameters.truncate(parameters.length() - 1); - if (parameters.isEmpty()) { - memberInfo.insert(prototype, QList<QByteArray>()); - } else { - QList<QByteArray> plist = parameters.split(','); - memberInfo.insert(prototype, plist); - } + if (parameters.isEmpty()) + memberInfo.insert(prototype, {}); + else + memberInfo.insert(prototype, parameters.split(',')); } inline QByteArray QAxMetaObject::propertyType(const QByteArray &propertyName) @@ -194,7 +192,7 @@ QByteArray QAxMetaObject::paramType(const QByteArray &prototype, int index, bool if (out) *out = false; - QList<QByteArray> plist = memberInfo.value(prototype); + const auto plist = memberInfo.value(prototype); if (index > plist.count() - 1) return QByteArray(); @@ -1570,8 +1568,8 @@ private: QMetaObject *tryCache(); - QByteArray createPrototype(FUNCDESC *funcdesc, ITypeInfo *typeinfo, const QList<QByteArray> &names, - QByteArray &type, QList<QByteArray> ¶meters); + QByteArray createPrototype(FUNCDESC *funcdesc, ITypeInfo *typeinfo, const QByteArrayList &names, + QByteArray &type, QByteArrayList ¶meters); QByteArray usertypeToString(const TYPEDESC &tdesc, ITypeInfo *info, const QByteArray &function); QByteArray guessTypes(const TYPEDESC &tdesc, ITypeInfo *info, const QByteArray &function); @@ -1583,12 +1581,12 @@ private: Bindable = 0x02000000 }; - static inline QList<QByteArray> paramList(const QByteArray &prototype) + static inline QByteArrayList paramList(const QByteArray &prototype) { QByteArray parameters = prototype.mid(prototype.indexOf('(') + 1); parameters.truncate(parameters.length() - 1); if (parameters.isEmpty() || parameters == "void") - return QList<QByteArray>(); + return {}; return parameters.split(','); } @@ -1614,9 +1612,8 @@ private: { QByteArray proto(prototype); - QList<QByteArray> plist = paramList(prototype); - for (int p = 0; p < plist.count(); ++p) { - const QByteArray ¶m = plist.at(p); + const auto plist = paramList(prototype); + for (const QByteArray ¶m : plist) { if (param != replaceType(param)) { int type = 0; while (type_conversion[type][0]) { @@ -1902,7 +1899,7 @@ MetaObjectGenerator::~MetaObjectGenerator() } bool qax_dispatchEqualsIDispatch = true; -QList<QByteArray> qax_qualified_usertypes; +QByteArrayList qax_qualified_usertypes; QByteArray MetaObjectGenerator::usertypeToString(const TYPEDESC &tdesc, ITypeInfo *info, const QByteArray &function) { @@ -2401,8 +2398,8 @@ void MetaObjectGenerator::addSetterSlot(const QByteArray &property) } } -QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *typeinfo, const QList<QByteArray> &names, - QByteArray &type, QList<QByteArray> ¶meters) +QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *typeinfo, const QByteArrayList &names, + QByteArray &type, QByteArrayList ¶meters) { const QByteArray &function = names.at(0); const QByteArray hresult("HRESULT"); @@ -2490,7 +2487,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) QByteArray type; QByteArray prototype; - QList<QByteArray> parameters; + QByteArrayList parameters; // parse function description const QByteArrayList names = qaxTypeInfoNames(typeinfo, funcdesc->memid); @@ -2813,7 +2810,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo } QByteArray prototype; - QList<QByteArray> parameters; + QByteArrayList parameters; // parse event function description, get event function prototype const QByteArrayList names = qaxTypeInfoNames(eventinfo, funcdesc->memid); @@ -3090,9 +3087,9 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co for (QMap<QByteArray, Method>::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it) { QByteArray prototype(QMetaObject::normalizedSignature(it.key())); QByteArray name = prototype.left(prototype.indexOf('(')); - QList<QByteArray> paramTypeNames = paramList(prototype); - const QList<QByteArray> paramNames = it.value().parameters.isEmpty() ? - QList<QByteArray>() : it.value().parameters.split(','); + const auto paramTypeNames = paramList(prototype); + const QByteArrayList paramNames = it.value().parameters.isEmpty() + ? QByteArrayList() : it.value().parameters.split(','); Q_ASSERT(paramTypeNames.size() == paramNames.size()); if (!it.value().realPrototype.isEmpty()) metaobj->realPrototype.insert(prototype, it.value().realPrototype); @@ -4202,7 +4199,7 @@ QAxObject *QAxBase::querySubObject(const char *name, const QVariant &var7, const QVariant &var8) { - QList<QVariant> vars; + QVariantList vars; QVariant var = var1; int argc = 1; while(var.isValid()) { diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp index e2122c3..2313306 100644 --- a/src/activeqt/container/qaxdump.cpp +++ b/src/activeqt/container/qaxdump.cpp @@ -96,7 +96,7 @@ static inline QString docuFromName(ITypeInfo *typeInfo, const QString &name) return QLatin1String("<p>") + qax_docuFromName(typeInfo, name) + QLatin1String("\n"); } -static QByteArray namedPrototype(const QList<QByteArray> ¶meterTypes, const QList<QByteArray> ¶meterNames, int numDefArgs = 0) +static QByteArray namedPrototype(const QByteArrayList ¶meterTypes, const QByteArrayList ¶meterNames, int numDefArgs = 0) { QByteArray prototype("("); for (int p = 0; p < parameterTypes.count(); ++p) { @@ -154,35 +154,36 @@ QString qax_generateDocumentation(QAxBase *that) const QMetaObject *mo = that->metaObject(); QString coClass = QLatin1String(mo->classInfo(mo->indexOfClassInfo("CoClass")).value()); - stream << "<h1 align=center>" << coClass << " Reference</h1>" << endl; + stream << "<h1 align=center>" << coClass << " Reference</h1>" << Qt::endl; stream << "<p>The " << coClass << " COM object is a " << that->qObject()->metaObject()->className(); - stream << " with the CLSID " << that->control() << ".</p>" << endl; + stream << " with the CLSID " << that->control() << ".</p>" << Qt::endl; - stream << "<h3>Interfaces</h3>" << endl; - stream << "<ul>" << endl; + stream << "<h3>Interfaces</h3>" << Qt::endl; + stream << "<ul>" << Qt::endl; const char *inter = nullptr; UINT interCount = 1; while ((inter = mo->classInfo(mo->indexOfClassInfo("Interface " + QByteArray::number(interCount))).value())) { - stream << "<li>" << inter << endl; + stream << "<li>" << inter << Qt::endl; interCount++; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; - stream << "<h3>Event Interfaces</h3>" << endl; - stream << "<ul>" << endl; + stream << "<h3>Event Interfaces</h3>" << Qt::endl; + stream << "<ul>" << Qt::endl; interCount = 1; while ((inter = mo->classInfo(mo->indexOfClassInfo("Event Interface " + QByteArray::number(interCount))).value())) { - stream << "<li>" << inter << endl; + stream << "<li>" << inter << Qt::endl; interCount++; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; - QList<QString> methodDetails, propDetails; + QStringList methodDetails; + QStringList propDetails; const int slotCount = mo->methodCount(); if (slotCount) { - stream << "<h2>Public Slots:</h2>" << endl; - stream << "<ul>" << endl; + stream << "<h2>Public Slots:</h2>" << Qt::endl; + stream << "<ul>" << Qt::endl; int defArgCount = 0; for (int islot = mo->methodOffset(); islot < slotCount; ++islot) { @@ -201,14 +202,14 @@ QString qax_generateDocumentation(QAxBase *that) QByteArray prototype = namedPrototype(slot.parameterTypes(), slot.parameterNames(), defArgCount); QByteArray signature = slot.methodSignature(); QByteArray name = signature.left(signature.indexOf('(')); - stream << "<li>" << returntype << " <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl; + stream << "<li>" << returntype << " <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << Qt::endl; prototype = namedPrototype(slot.parameterTypes(), slot.parameterNames()); QString detail = QString::fromLatin1("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") + QLatin1String(returntype.constData()) + QLatin1Char(' ') + QLatin1String(name.constData()) + QLatin1Char(' ') + QString::fromLatin1(prototype.constData()) + QLatin1String("<tt> [slot]</tt></h3>\n"); - prototype = namedPrototype(slot.parameterTypes(), QList<QByteArray>()); + prototype = namedPrototype(slot.parameterTypes(), {}); detail += docuFromName(typeInfo, QString::fromLatin1(name.constData())); detail += QLatin1String("<p>Connect a signal to this slot:<pre>\n"); detail += QString::fromLatin1("\tQObject::connect(sender, SIGNAL(someSignal") + QString::fromLatin1(prototype.constData()) + @@ -242,7 +243,7 @@ QString qax_generateDocumentation(QAxBase *that) defArgCount = 0; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; } int signalCount = mo->methodCount(); if (signalCount) { @@ -254,8 +255,8 @@ QString qax_generateDocumentation(QAxBase *that) } typeInfo = nullptr; - stream << "<h2>Signals:</h2>" << endl; - stream << "<ul>" << endl; + stream << "<h2>Signals:</h2>" << Qt::endl; + stream << "<ul>" << Qt::endl; for (int isignal = mo->methodOffset(); isignal < signalCount; ++isignal) { const QMetaMethod signal(mo->method(isignal)); @@ -265,7 +266,7 @@ QString qax_generateDocumentation(QAxBase *that) QByteArray prototype = namedPrototype(signal.parameterTypes(), signal.parameterNames()); QByteArray signature = signal.methodSignature(); QByteArray name = signature.left(signature.indexOf('(')); - stream << "<li>void <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl; + stream << "<li>void <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << Qt::endl; QString detail = QLatin1String("<h3><a name=") + QLatin1String(name.constData()) + QLatin1String("></a>void ") + QLatin1String(name.constData()) + QLatin1Char(' ') + @@ -284,7 +285,7 @@ QString qax_generateDocumentation(QAxBase *that) } } while (typeInfo); } - prototype = namedPrototype(signal.parameterTypes(), QList<QByteArray>()); + prototype = namedPrototype(signal.parameterTypes(), {}); detail += QLatin1String("<p>Connect a slot to this signal:<pre>\n"); detail += QLatin1String("\tQObject::connect(object, SIGNAL(") + QString::fromLatin1(name.constData()) + QString::fromLatin1(prototype.constData()) + @@ -296,7 +297,7 @@ QString qax_generateDocumentation(QAxBase *that) typeInfo->Release(); typeInfo = nullptr; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; if (typeLib) typeLib->Release(); @@ -306,15 +307,15 @@ QString qax_generateDocumentation(QAxBase *that) if (propCount) { if (dispatch) dispatch->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeInfo); - stream << "<h2>Properties:</h2>" << endl; - stream << "<ul>" << endl; + stream << "<h2>Properties:</h2>" << Qt::endl; + stream << "<ul>" << Qt::endl; for (int iprop = 0; iprop < propCount; ++iprop) { const QMetaProperty prop = mo->property(iprop); QByteArray name(prop.name()); QByteArray type(prop.typeName()); - stream << "<li>" << type << " <a href=\"#" << name << "\"><b>" << name << "</b></a>;</li>" << endl; + stream << "<li>" << type << " <a href=\"#" << name << "\"><b>" << name << "</b></a>;</li>" << Qt::endl; QString detail = QLatin1String("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") + QLatin1String(type.constData()) + QLatin1Char(' ') + QLatin1String(name.constData()) + QLatin1String("</h3>\n"); @@ -371,31 +372,31 @@ QString qax_generateDocumentation(QAxBase *that) propDetails << detail; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; } const int enumCount = mo->enumeratorCount(); if (enumCount) { - stream << "<hr><h2>Member Type Documentation</h2>" << endl; + stream << "<hr><h2>Member Type Documentation</h2>" << Qt::endl; for (int i = 0; i < enumCount; ++i) { const QMetaEnum enumdata = mo->enumerator(i); - stream << "<h3><a name=" << enumdata.name() << "></a>" << enumdata.name() << "</h3>" << endl; - stream << "<ul>" << endl; + stream << "<h3><a name=" << enumdata.name() << "></a>" << enumdata.name() << "</h3>" << Qt::endl; + stream << "<ul>" << Qt::endl; for (int e = 0; e < enumdata.keyCount(); ++e) { - stream << "<li>" << enumdata.key(e) << "\t=" << enumdata.value(e) << "</li>" << endl; + stream << "<li>" << enumdata.key(e) << "\t=" << enumdata.value(e) << "</li>" << Qt::endl; } - stream << "</ul>" << endl; + stream << "</ul>" << Qt::endl; } } if (methodDetails.count()) { - stream << "<hr><h2>Member Function Documentation</h2>" << endl; + stream << "<hr><h2>Member Function Documentation</h2>" << Qt::endl; for (int i = 0; i < methodDetails.count(); ++i) - stream << methodDetails.at(i) << endl; + stream << methodDetails.at(i) << Qt::endl; } if (propDetails.count()) { - stream << "<hr><h2>Property Documentation</h2>" << endl; + stream << "<hr><h2>Property Documentation</h2>" << Qt::endl; for (int i = 0; i < propDetails.count(); ++i) - stream << propDetails.at(i) << endl; + stream << propDetails.at(i) << Qt::endl; } if (typeInfo) diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index 5179204..07c0669 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -63,6 +63,7 @@ #include <qmetaobject.h> #include <quuid.h> #include <qwidget.h> +#include <qvector.h> #include <qt_windows.h> #ifndef QT_NO_QAXSCRIPT @@ -75,7 +76,7 @@ QT_BEGIN_NAMESPACE struct QAxEngineDescriptor { QString name, extension, code; }; -static QList<QAxEngineDescriptor> engines; +static QVector<QAxEngineDescriptor> engines; class QAxScriptManagerPrivate { @@ -1187,7 +1188,7 @@ QVariant QAxScriptManager::call(const QString &function, QList<QVariant> &argume return QVariant(); } - QList<QVariant> args(arguments); + QVariantList args(arguments); return s->call(function, args); } diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp index 1caae35..30af521 100644 --- a/src/activeqt/container/qaxselect.cpp +++ b/src/activeqt/container/qaxselect.cpp @@ -171,7 +171,7 @@ QString Control::toolTip() const str << "<tr><th>" << (type == InProcessControl ? QAxSelect::tr("DLL:") : QAxSelect::tr("Binary:")) << "</th><td"; - if (!QFileInfo(dll).exists()) + if (!QFileInfo::exists(dll)) str << " style=\"color:red\""; str << '>' << nonbreakingSpace(dll) << "</td></tr>"; } @@ -208,9 +208,9 @@ static bool querySubKeyValue(HKEY hKey, const QString &subKeyName, LPBYTE lpDat return result; } -static QList<Control> readControls(const wchar_t *rootKey, unsigned wordSize) +static QVector<Control> readControls(const wchar_t *rootKey, unsigned wordSize) { - QList<Control> controls; + QVector<Control> controls; HKEY classesKey; RegOpenKeyEx(HKEY_CLASSES_ROOT, rootKey, 0, KEY_READ, &classesKey); if (!classesKey) { @@ -282,7 +282,7 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const override ; private: - QList<Control> m_controls; + QVector<Control> m_controls; }; QVariant ControlList::data(const QModelIndex &index, int role) const diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index f07d5ad..69875d2 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -449,7 +449,7 @@ static const ushort mouseTbl[] = { static Qt::MouseButtons translateMouseButtonState(int s) { - Qt::MouseButtons bst = nullptr; + Qt::MouseButtons bst; if (s & MK_LBUTTON) bst |= Qt::LeftButton; if (s & MK_MBUTTON) @@ -462,7 +462,7 @@ static Qt::MouseButtons translateMouseButtonState(int s) static Qt::KeyboardModifiers translateModifierState(int s) { - Qt::KeyboardModifiers bst = nullptr; + Qt::KeyboardModifiers bst; if (s & MK_SHIFT) bst |= Qt::ShiftModifier; if (s & MK_CONTROL) @@ -1205,9 +1205,8 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW QMenu *fileMenu = nullptr; QMenu *viewMenu = nullptr; QMenu *windowMenu = nullptr; - QList<QAction*> actions = menuBar->actions(); - for (int i = 0; i < actions.count(); ++i) { - QAction *action = actions.at(i); + const auto actions = menuBar->actions(); + for (QAction *action : actions) { QString text = action->text().remove(QLatin1Char('&')); if (text == QLatin1String("File")) { fileMenu = action->menu(); @@ -1395,8 +1394,7 @@ HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND } } else if (menuBar) { m_menuOwner = nullptr; - const MenuItemMap::Iterator mend = menuItemMap.end(); - for (MenuItemMap::Iterator it = menuItemMap.begin(); it != mend; ++it) + for (auto it = menuItemMap.begin(), mend = menuItemMap.end(); it != mend; ++it) delete it.key(); menuItemMap.clear(); } @@ -1426,8 +1424,7 @@ int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv) HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/) { AX_DEBUG(QAxClientSite::RemoveMenus); - const MenuItemMap::Iterator mend = menuItemMap.end(); - for (MenuItemMap::Iterator it = menuItemMap.begin(); it != mend; ++it) { + for (auto it = menuItemMap.begin(), mend = menuItemMap.end(); it != mend; ++it) { it.key()->setVisible(false); delete it.key(); } diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index bc93ee3..af6fbb2 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -333,7 +333,7 @@ static void UpdateRegistryKeys(bool bRegister, const QString keyPath, QScopedPoi qCDebug(lcAxRegistration).nospace().noquote() << "Registered \"" << progId << "\"/" << classId << ", \"" << file << "\" at \"" << keyPath << "\", insertable=" << insertable << ", control=" << control - << ", olemisc=" << hex << showbase << olemisc + << ", olemisc=" << Qt::hex << Qt::showbase << olemisc << ", mime=" << mime; } @@ -499,9 +499,9 @@ HRESULT UpdateRegistry(bool bRegister, bool perUser) // IDL generator ///////////////////////////////////////////////////////////////////////////// -static QList<QByteArray> enums; -static QList<QByteArray> enumValues; -static QList<QByteArray> subtypes; +static QByteArrayList enums; +static QByteArrayList enumValues; +static QByteArrayList subtypes; static const char* const type_map[][2] = { @@ -754,7 +754,7 @@ static QString stripCurlyBraces(const QUuid &uuid) return result; } -static QByteArray prototype(const QList<QByteArray> ¶meterTypes, const QList<QByteArray> ¶meterNames, bool *ok) +static QByteArray prototype(const QByteArrayList ¶meterTypes, const QByteArrayList ¶meterNames, bool *ok) { QByteArray prototype; @@ -872,7 +872,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN enums.append(enumerator.name()); - out << "\tenum " << enumerator.name() << " {" << endl; + out << "\tenum " << enumerator.name() << " {" << Qt::endl; for (int j = 0; j < enumerator.keyCount(); ++j) { QByteArray key(enumerator.key(j)); @@ -889,54 +889,54 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN out << value; if (j < enumerator.keyCount()-1) out << ", "; - out << endl; + out << Qt::endl; } - out << "\t};" << endl << endl; + out << "\t};" << Qt::endl << Qt::endl; } // mouse cursor enum for QCursor support if (!enums.contains("MousePointer")) { enums.append("MousePointer"); - out << "\tenum MousePointer {" << endl; - out << "\t\tArrowCursor = " << Qt::ArrowCursor << ',' << endl; - out << "\t\tUpArrowCursor = " << Qt::UpArrowCursor << ',' << endl; - out << "\t\tCrossCursor = " << Qt::CrossCursor << ',' << endl; - out << "\t\tWaitCursor = " << Qt::WaitCursor << ',' << endl; - out << "\t\tIBeamCursor = " << Qt::IBeamCursor << ',' << endl; - out << "\t\tSizeVerCursor = " << Qt::SizeVerCursor << ',' << endl; - out << "\t\tSizeHorCursor = " << Qt::SizeHorCursor << ',' << endl; - out << "\t\tSizeBDiagCursor = " << Qt::SizeBDiagCursor << ',' << endl; - out << "\t\tSizeFDiagCursor = " << Qt::SizeFDiagCursor << ',' << endl; - out << "\t\tSizeAllCursor = " << Qt::SizeAllCursor << ',' << endl; - out << "\t\tBlankCursor = " << Qt::BlankCursor << ',' << endl; - out << "\t\tSplitVCursor = " << Qt::SplitVCursor << ',' << endl; - out << "\t\tSplitHCursor = " << Qt::SplitHCursor << ',' << endl; - out << "\t\tPointingHandCursor = " << Qt::PointingHandCursor << ',' << endl; - out << "\t\tForbiddenCursor = " << Qt::ForbiddenCursor << ',' << endl; - out << "\t\tWhatsThisCursor = " << Qt::WhatsThisCursor << ',' << endl; - out << "\t\tBusyCursor\t= " << Qt::BusyCursor << endl; - out << "\t};" << endl << endl; + out << "\tenum MousePointer {" << Qt::endl; + out << "\t\tArrowCursor = " << Qt::ArrowCursor << ',' << Qt::endl; + out << "\t\tUpArrowCursor = " << Qt::UpArrowCursor << ',' << Qt::endl; + out << "\t\tCrossCursor = " << Qt::CrossCursor << ',' << Qt::endl; + out << "\t\tWaitCursor = " << Qt::WaitCursor << ',' << Qt::endl; + out << "\t\tIBeamCursor = " << Qt::IBeamCursor << ',' << Qt::endl; + out << "\t\tSizeVerCursor = " << Qt::SizeVerCursor << ',' << Qt::endl; + out << "\t\tSizeHorCursor = " << Qt::SizeHorCursor << ',' << Qt::endl; + out << "\t\tSizeBDiagCursor = " << Qt::SizeBDiagCursor << ',' << Qt::endl; + out << "\t\tSizeFDiagCursor = " << Qt::SizeFDiagCursor << ',' << Qt::endl; + out << "\t\tSizeAllCursor = " << Qt::SizeAllCursor << ',' << Qt::endl; + out << "\t\tBlankCursor = " << Qt::BlankCursor << ',' << Qt::endl; + out << "\t\tSplitVCursor = " << Qt::SplitVCursor << ',' << Qt::endl; + out << "\t\tSplitHCursor = " << Qt::SplitHCursor << ',' << Qt::endl; + out << "\t\tPointingHandCursor = " << Qt::PointingHandCursor << ',' << Qt::endl; + out << "\t\tForbiddenCursor = " << Qt::ForbiddenCursor << ',' << Qt::endl; + out << "\t\tWhatsThisCursor = " << Qt::WhatsThisCursor << ',' << Qt::endl; + out << "\t\tBusyCursor\t= " << Qt::BusyCursor << Qt::endl; + out << "\t};" << Qt::endl << Qt::endl; } if (!enums.contains("FocusPolicy")) { enums.append("FocusPolicy"); - out << "\tenum FocusPolicy {" << endl; - out << "\t\tNoFocus = " << Qt::NoFocus << ',' << endl; - out << "\t\tTabFocus = " << Qt::TabFocus << ',' << endl; - out << "\t\tClickFocus = " << Qt::ClickFocus << ',' << endl; - out << "\t\tStrongFocus = " << Qt::StrongFocus << ',' << endl; - out << "\t\tWheelFocus = " << Qt::WheelFocus << endl; - out << "\t};" << endl << endl; + out << "\tenum FocusPolicy {" << Qt::endl; + out << "\t\tNoFocus = " << Qt::NoFocus << ',' << Qt::endl; + out << "\t\tTabFocus = " << Qt::TabFocus << ',' << Qt::endl; + out << "\t\tClickFocus = " << Qt::ClickFocus << ',' << Qt::endl; + out << "\t\tStrongFocus = " << Qt::StrongFocus << ',' << Qt::endl; + out << "\t\tWheelFocus = " << Qt::WheelFocus << Qt::endl; + out << "\t};" << Qt::endl << Qt::endl; } - out << endl; - out << "\t[" << endl; - out << "\t\tuuid(" << interfaceID << ")," << endl; - out << "\t\thelpstring(\"" << cleanClassName << " Interface\")" << endl; - out << "\t]" << endl; - out << "\tdispinterface I" << cleanClassName << endl; - out << "\t{" << endl; + out << Qt::endl; + out << "\t[" << Qt::endl; + out << "\t\tuuid(" << interfaceID << ")," << Qt::endl; + out << "\t\thelpstring(\"" << cleanClassName << " Interface\")" << Qt::endl; + out << "\t]" << Qt::endl; + out << "\tdispinterface I" << cleanClassName << Qt::endl; + out << "\t{" << Qt::endl; - out << "\tproperties:" << endl; + out << "\tproperties:" << Qt::endl; for (i = propoff; i < mo->propertyCount(); ++i) { const QMetaProperty property = mo->property(i); /* if (property.testFlags(QMetaProperty::Override)) @@ -951,7 +951,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN QByteArray name(replaceKeyword(property.name())); if (!ok) - out << "\t/****** Property is of unsupported datatype" << endl; + out << "\t/****** Property is of unsupported datatype" << Qt::endl; out << "\t\t[id(" << id << ')'; if (!property.isWritable()) @@ -964,14 +964,14 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN out << ", requestedit"; if (defProp == QLatin1String(name)) out << ", uidefault"; - out << "] " << type << ' ' << name << ';' << endl; + out << "] " << type << ' ' << name << ';' << Qt::endl; if (!ok) - out << "\t******/" << endl; + out << "\t******/" << Qt::endl; ++id; } - out << endl; - out << "\tmethods:" << endl; + out << Qt::endl; + out << "\tmethods:" << Qt::endl; int numDefArgs = 0; QByteArray outBuffer; for (i = methodoff; i < mo->methodCount(); ++i) { @@ -1001,8 +1001,8 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (ignoreSlots(name)) continue; - QList<QByteArray> parameterTypes(slot.parameterTypes()); - QList<QByteArray> parameterNames(slot.parameterNames()); + const auto parameterTypes = slot.parameterTypes(); + const auto parameterNames = slot.parameterNames(); bool ok = true; QByteArray type = slot.typeName(); @@ -1028,31 +1028,31 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN out << outBuffer; outBuffer = QByteArray(); } - out << "\t};" << endl << endl; + out << "\t};" << Qt::endl << Qt::endl; mapping.clear(); id = 1; if (hasEvents) { - out << "\t[" << endl; - out << "\t\tuuid(" << eventsID << ")," << endl; - out << "\t\thelpstring(\"" << cleanClassName << " Events Interface\")" << endl; - out << "\t]" << endl; - out << "\tdispinterface I" << cleanClassName << "Events" << endl; - out << "\t{" << endl; - out << "\tproperties:" << endl; - out << "\tmethods:" << endl; + out << "\t[" << Qt::endl; + out << "\t\tuuid(" << eventsID << ")," << Qt::endl; + out << "\t\thelpstring(\"" << cleanClassName << " Events Interface\")" << Qt::endl; + out << "\t]" << Qt::endl; + out << "\tdispinterface I" << cleanClassName << "Events" << Qt::endl; + out << "\t{" << Qt::endl; + out << "\tproperties:" << Qt::endl; + out << "\tmethods:" << Qt::endl; if (hasStockEvents) { - out << "\t/****** Stock events ******/" << endl; - out << "\t\t[id(DISPID_CLICK)] void Click();" << endl; - out << "\t\t[id(DISPID_DBLCLICK)] void DblClick();" << endl; - out << "\t\t[id(DISPID_KEYDOWN)] void KeyDown(short* KeyCode, short Shift);" << endl; - out << "\t\t[id(DISPID_KEYPRESS)] void KeyPress(short* KeyAscii);" << endl; - out << "\t\t[id(DISPID_KEYUP)] void KeyUp(short* KeyCode, short Shift);" << endl; - out << "\t\t[id(DISPID_MOUSEDOWN)] void MouseDown(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl; - out << "\t\t[id(DISPID_MOUSEMOVE)] void MouseMove(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl; - out << "\t\t[id(DISPID_MOUSEUP)] void MouseUp(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << endl << endl; + out << "\t/****** Stock events ******/" << Qt::endl; + out << "\t\t[id(DISPID_CLICK)] void Click();" << Qt::endl; + out << "\t\t[id(DISPID_DBLCLICK)] void DblClick();" << Qt::endl; + out << "\t\t[id(DISPID_KEYDOWN)] void KeyDown(short* KeyCode, short Shift);" << Qt::endl; + out << "\t\t[id(DISPID_KEYPRESS)] void KeyPress(short* KeyAscii);" << Qt::endl; + out << "\t\t[id(DISPID_KEYUP)] void KeyUp(short* KeyCode, short Shift);" << Qt::endl; + out << "\t\t[id(DISPID_MOUSEDOWN)] void MouseDown(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << Qt::endl; + out << "\t\t[id(DISPID_MOUSEMOVE)] void MouseMove(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << Qt::endl; + out << "\t\t[id(DISPID_MOUSEUP)] void MouseUp(short Button, short Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);" << Qt::endl << Qt::endl; } for (i = methodoff; i < mo->methodCount(); ++i) { @@ -1065,8 +1065,8 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN signature.remove(0, name.length() + 1); signature.truncate(signature.length() - 1); - QList<QByteArray> parameterTypes(signal.parameterTypes()); - QList<QByteArray> parameterNames(signal.parameterNames()); + const auto parameterTypes = signal.parameterTypes(); + const auto parameterNames = signal.parameterNames(); bool isDefault = defSignal == QLatin1String(name); name = renameOverloads(replaceKeyword(name)); @@ -1078,52 +1078,52 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN QByteArray ptype(prototype(parameterTypes, parameterNames, &ok)); if (!ok) - out << "\t/****** Signal parameter uses unsupported datatype" << endl; + out << "\t/****** Signal parameter uses unsupported datatype" << Qt::endl; out << "\t\t[id(" << id << ')'; if (isDefault) out << ", uidefault"; - out << "] void " << name << '(' << ptype << ");" << endl; + out << "] void " << name << '(' << ptype << ");" << Qt::endl; if (!ok) - out << "\t******/" << endl; + out << "\t******/" << Qt::endl; ++id; } - out << "\t};" << endl << endl; + out << "\t};" << Qt::endl << Qt::endl; } - out << "\t[" << endl; + out << "\t[" << Qt::endl; if (qstricmp(mo->classInfo(mo->indexOfClassInfo("Aggregatable")).value(), "no")) - out << "\t\taggregatable," << endl; + out << "\t\taggregatable," << Qt::endl; if (!qstricmp(mo->classInfo(mo->indexOfClassInfo("RegisterObject")).value(), "yes")) - out << "\t\tappobject," << endl; + out << "\t\tappobject," << Qt::endl; if (mo->classInfo(mo->indexOfClassInfo("LicenseKey")).value()) - out << "\t\tlicensed," << endl; + out << "\t\tlicensed," << Qt::endl; const char *helpString = mo->classInfo(mo->indexOfClassInfo("Description")).value(); if (helpString) - out << "\t\thelpstring(\"" << helpString << "\")," << endl; + out << "\t\thelpstring(\"" << helpString << "\")," << Qt::endl; else - out << "\t\thelpstring(\"" << cleanClassName << " Class\")," << endl; + out << "\t\thelpstring(\"" << cleanClassName << " Class\")," << Qt::endl; const char *classVersion = mo->classInfo(mo->indexOfClassInfo("Version")).value(); if (classVersion) - out << "\t\tversion(" << classVersion << ")," << endl; + out << "\t\tversion(" << classVersion << ")," << Qt::endl; out << "\t\tuuid(" << classID << ')'; if (control) { - out << ", " << endl; + out << ", " << Qt::endl; out << "\t\tcontrol"; } else if (!o) { - out << ", " << endl; + out << ", " << Qt::endl; out << "\t\tnoncreatable"; } - out << endl; - out << "\t]" << endl; - out << "\tcoclass " << cleanClassName << endl; - out << "\t{" << endl; - out << "\t\t[default] dispinterface I" << cleanClassName << ';' << endl; + out << Qt::endl; + out << "\t]" << Qt::endl; + out << "\tcoclass " << cleanClassName << Qt::endl; + out << "\t{" << Qt::endl; + out << "\t\t[default] dispinterface I" << cleanClassName << ';' << Qt::endl; if (hasEvents) - out << "\t\t[default, source] dispinterface I" << cleanClassName << "Events;" << endl; - out << "\t};" << endl; + out << "\t\t[default, source] dispinterface I" << cleanClassName << "Events;" << Qt::endl; + out << "\t};" << Qt::endl; return S_OK; } @@ -1168,18 +1168,18 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) const QString idQSize = stripCurlyBraces(QUuid(CLSID_QSize)); const QString idQPoint = stripCurlyBraces(QUuid(CLSID_QPoint)); - out << "/****************************************************************************" << endl; - out << "** Interface definition generated for ActiveQt project" << endl; - out << "**" << endl; - out << "** '" << QString::fromWCharArray(qAxModuleFilename) << '\'' << endl; - out << "**" << endl; - out << "** Created: " << QDateTime::currentDateTime().toString() << endl; - out << "**" << endl; - out << "** WARNING! All changes made in this file will be lost!" << endl; - out << "****************************************************************************/" << endl << endl; + out << "/****************************************************************************" << Qt::endl; + out << "** Interface definition generated for ActiveQt project" << Qt::endl; + out << "**" << Qt::endl; + out << "** '" << QString::fromWCharArray(qAxModuleFilename) << '\'' << Qt::endl; + out << "**" << Qt::endl; + out << "** Created: " << QDateTime::currentDateTime().toString() << Qt::endl; + out << "**" << Qt::endl; + out << "** WARNING! All changes made in this file will be lost!" << Qt::endl; + out << "****************************************************************************/" << Qt::endl << Qt::endl; - out << "import \"ocidl.idl\";" << endl; - out << "#include <olectl.h>" << endl << endl; + out << "import \"ocidl.idl\";" << Qt::endl; + out << "#include <olectl.h>" << Qt::endl << Qt::endl; // dummy application to create widgets bool delete_qApp = false; @@ -1189,59 +1189,59 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) delete_qApp = true; } - out << '[' << endl; - out << "\tuuid(" << typeLibID << ")," << endl; - out << "\tversion(" << version << ")," << endl; - out << "\thelpstring(\"" << typelib << ' ' << version << " Type Library\")" << endl; - out << ']' << endl; - out << "library " << typelib << "Lib" << endl; - out << '{' << endl; - out << "\timportlib(\"stdole32.tlb\");" << endl; - out << "\timportlib(\"stdole2.tlb\");" << endl << endl; + out << '[' << Qt::endl; + out << "\tuuid(" << typeLibID << ")," << Qt::endl; + out << "\tversion(" << version << ")," << Qt::endl; + out << "\thelpstring(\"" << typelib << ' ' << version << " Type Library\")" << Qt::endl; + out << ']' << Qt::endl; + out << "library " << typelib << "Lib" << Qt::endl; + out << '{' << Qt::endl; + out << "\timportlib(\"stdole32.tlb\");" << Qt::endl; + out << "\timportlib(\"stdole2.tlb\");" << Qt::endl << Qt::endl; const QStringList keys = qAxFactory()->featureList(); - out << "\t/************************************************************************" << endl; - out << "\t** If this causes a compile error in MIDL you need to upgrade the" << endl; - out << "\t** Platform SDK you are using. Download the SDK from msdn.microsoft.com" << endl; - out << "\t** and make sure that both the system and the Visual Studio environment" << endl; - out << "\t** use the correct files." << endl; - out << "\t**" << endl; + out << "\t/************************************************************************" << Qt::endl; + out << "\t** If this causes a compile error in MIDL you need to upgrade the" << Qt::endl; + out << "\t** Platform SDK you are using. Download the SDK from msdn.microsoft.com" << Qt::endl; + out << "\t** and make sure that both the system and the Visual Studio environment" << Qt::endl; + out << "\t** use the correct files." << Qt::endl; + out << "\t**" << Qt::endl; #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; - out << "\t*************************************************************************" << endl; + out << "\t** Required version of MIDL could not be verified. QRect, QSize and QPoint" << Qt::endl; + out << "\t** support needs an updated Platform SDK to be installed." << Qt::endl; + out << "\t*************************************************************************" << Qt::endl; #else - out << "\t************************************************************************/" << endl; + out << "\t************************************************************************/" << Qt::endl; #endif - out << endl; - out << "\t[uuid(" << idQRect << ")]" << endl; - out << "\tstruct QRect {" << endl; - out << "\t\tint left;" << endl; - out << "\t\tint top;" << endl; - out << "\t\tint right;" << endl; - out << "\t\tint bottom;" << endl; - out << "\t};" << endl << endl; - - out << "\t[uuid(" << idQSize << ")]" << endl; - out << "\tstruct QSize {" << endl; - out << "\t\tint width;" << endl; - out << "\t\tint height;" << endl; - out << "\t};" << endl << endl; - - out << "\t[uuid(" << idQPoint << ")]" << endl; - out << "\tstruct QPoint {" << endl; - out << "\t\tint x;" << endl; - out << "\t\tint y;" << endl; - out << "\t};" << endl; + out << Qt::endl; + out << "\t[uuid(" << idQRect << ")]" << Qt::endl; + out << "\tstruct QRect {" << Qt::endl; + out << "\t\tint left;" << Qt::endl; + out << "\t\tint top;" << Qt::endl; + out << "\t\tint right;" << Qt::endl; + out << "\t\tint bottom;" << Qt::endl; + out << "\t};" << Qt::endl << Qt::endl; + + out << "\t[uuid(" << idQSize << ")]" << Qt::endl; + out << "\tstruct QSize {" << Qt::endl; + out << "\t\tint width;" << Qt::endl; + out << "\t\tint height;" << Qt::endl; + out << "\t};" << Qt::endl << Qt::endl; + + out << "\t[uuid(" << idQPoint << ")]" << Qt::endl; + out << "\tstruct QPoint {" << Qt::endl; + out << "\t\tint x;" << Qt::endl; + out << "\t\tint y;" << Qt::endl; + out << "\t};" << Qt::endl; #if __REQUIRED_RPCNDR_H_VERSION__ < Q_REQUIRED_RPCNDR_H_VERSION - out << "\t*/" << endl; + out << "\t*/" << Qt::endl; #endif - out << endl; + out << Qt::endl; - out << "\t/* Forward declaration of classes that might be used as parameters */" << endl << endl; + out << "\t/* Forward declaration of classes that might be used as parameters */" << Qt::endl << Qt::endl; int res = S_OK; for (const QString &className : keys) { @@ -1249,7 +1249,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) // We have meta object information for this type. Forward declare it. if (mo) { QByteArray cleanType = qax_clean_type(className, mo).toLatin1(); - out << "\tcoclass " << cleanType << ';' << endl; + out << "\tcoclass " << cleanType << ';' << Qt::endl; subtypes.append(cleanType); if (!QMetaType::type(cleanType)) qRegisterMetaType<void *>(cleanType); @@ -1259,7 +1259,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) qRegisterMetaType<void *>(cleanType); } } - out << endl; + out << Qt::endl; for (const QString &className : keys) { const QMetaObject *mo = qAxFactory()->metaObject(className); @@ -1273,7 +1273,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) } } - out << endl; + out << Qt::endl; if (res != S_OK) goto ErrorInClass; @@ -1294,7 +1294,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) break; } - out << "};" << endl; + out << "};" << Qt::endl; out.flush(); ErrorInClass: diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index dd64a33..57ca767 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -77,6 +77,7 @@ #include <qabstractnativeeventfilter.h> #include <qcoreapplication.h> +#include <qvector.h> #include <private/qthread_p.h> #include "qaxfactory.h" @@ -424,7 +425,7 @@ private: IUnknown *m_outerUnknown = nullptr; IAdviseSink *m_spAdviseSink = nullptr; - QList<STATDATA> adviseSinks; + QVector<STATDATA> adviseSinks; IOleClientSite *m_spClientSite = nullptr; IOleInPlaceSite *m_spInPlaceSite = nullptr; IOleInPlaceSiteWindowless *m_spInPlaceSiteWindowless = nullptr; @@ -641,7 +642,7 @@ public: QAxConnection(QAxConnection &&) = delete; QAxConnection &operator=(QAxConnection &&) = delete; - using Connections = QList<CONNECTDATA>; + using Connections = QVector<CONNECTDATA>; QAxConnection(QAxServerBase *parent, const QUuid &uuid) : that(parent), iid(uuid) @@ -962,7 +963,7 @@ HRESULT QClassFactory::CreateInstanceHelper(IUnknown *pUnkOuter, REFIID iid, voi if (FAILED(res)) delete activeqt; else - activeqt->registerActiveObject((IUnknown*)(IDispatch*)activeqt); + activeqt->registerActiveObject(static_cast<IUnknown*>(static_cast<IDispatch*>(activeqt))); } return res; } @@ -1581,6 +1582,7 @@ LRESULT QT_WIN_CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM case WM_DISPLAYCHANGE: qaxClearCachedSystemLogicalDpi(); + break; default: break; @@ -1669,10 +1671,8 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu) DeleteMenu(oldMenu, 0, MF_BYPOSITION); } - const QList<QAction*> actions = popup->actions(); - for (int i = 0; i < actions.count(); ++i) { - QAction *action = actions.at(i); - + const auto actions = popup->actions(); + for (QAction *action : actions) { uint flags = action->isEnabled() ? MF_ENABLED : MF_GRAYED; if (action->isSeparator()) flags |= MF_SEPARATOR; @@ -1711,10 +1711,8 @@ void QAxServerBase::createMenu(QMenuBar *menuBar) int object = 0; int help = 0; - const QList<QAction*> actions = menuBar->actions(); - for (int i = 0; i < actions.count(); ++i) { - QAction *action = actions.at(i); - + const auto actions = menuBar->actions(); + for (QAction *action : actions) { uint flags = action->isEnabled() ? MF_ENABLED : MF_GRAYED; if (action->isSeparator()) flags |= MF_SEPARATOR; @@ -1966,7 +1964,7 @@ int QAxServerBase::qt_metacall(QMetaObject::Call call, int index, void **argv) DISPID eventId = index; int pcount = 0; QByteArray type; - QList<QByteArray> ptypes; + QByteArrayList ptypes; switch(index) { case DISPID_KEYDOWN: @@ -2433,7 +2431,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, nameLength = name.indexOf('('); QByteArray prototype = name.mid(nameLength + 1); prototype.truncate(prototype.length() - 1); - QList<QByteArray> ptypes; + QByteArrayList ptypes; if (!prototype.isEmpty()) ptypes = prototype.split(','); UINT pcount = UINT(ptypes.count()); @@ -3839,9 +3837,8 @@ HRESULT QAxServerBase::internalActivate() // Gone active by now, take care of UIACTIVATE canTakeFocus = qt.widget->focusPolicy() != Qt::NoFocus && !inDesignMode; if (!canTakeFocus && !inDesignMode) { - QList<QWidget*> widgets = qt.widget->findChildren<QWidget*>(); - for (int w = 0; w < widgets.count(); ++w) { - QWidget *widget = widgets[w]; + const auto widgets = qt.widget->findChildren<QWidget*>(); + for (const QWidget *widget : widgets) { canTakeFocus = widget->focusPolicy() != Qt::NoFocus; if (canTakeFocus) break; @@ -3865,13 +3862,13 @@ HRESULT QAxServerBase::internalActivate() if (m_spInPlaceFrame) { hr = m_spInPlaceFrame->SetActiveObject(this, reinterpret_cast<const wchar_t *>(class_name.utf16())); if (!FAILED(hr)) { - menuBar = (qt.widget && !qax_disable_inplaceframe) ? qt.widget->findChild<QMenuBar*>() : 0; + menuBar = (qt.widget && !qax_disable_inplaceframe) ? qt.widget->findChild<QMenuBar*>() : nullptr; if (menuBar && !menuBar->isVisible()) { createMenu(menuBar); menuBar->hide(); menuBar->installEventFilter(this); } - statusBar = qt.widget ? qt.widget->findChild<QStatusBar*>() : 0; + statusBar = qt.widget ? qt.widget->findChild<QStatusBar*>() : nullptr; if (statusBar && !statusBar->isVisible()) { const int index = statusBar->metaObject()->indexOfSignal("messageChanged(QString)"); QMetaObject::connect(statusBar, index, this, STATUSBAR_MESSAGE_CHANGED_SLOT_INDEX); @@ -4426,7 +4423,7 @@ bool QAxServerBase::eventFilter(QObject *o, QEvent *e) case QEvent::EnabledChange: if (m_hWnd && o == qt.widget) EnableWindow(m_hWnd, qt.widget->isEnabled()); - // Fall Through + Q_FALLTHROUGH(); case QEvent::FontChange: case QEvent::ActivationChange: case QEvent::StyleChange: diff --git a/src/activeqt/shared/qaxtypefunctions.cpp b/src/activeqt/shared/qaxtypefunctions.cpp index 6190199..db54ecb 100644 --- a/src/activeqt/shared/qaxtypefunctions.cpp +++ b/src/activeqt/shared/qaxtypefunctions.cpp @@ -128,7 +128,7 @@ bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeN break; #endif case QVariant::List: - *reinterpret_cast<QList<QVariant> *>(data) = var.toList(); + *reinterpret_cast<QVariantList *>(data) = var.toList(); break; case QVariant::StringList: *reinterpret_cast<QStringList *>(data) = var.toStringList(); diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index b3d422b..3ee12c3 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -440,7 +440,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type case QVariant::List: { - const QList<QVariant> list = qvar.toList(); + const auto list = qvar.toList(); const int count = list.count(); VARTYPE vt = VT_VARIANT; QVariant::Type listType = QVariant::Type(QMetaType::QVariant); diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp index 86699eb..780d41b 100644 --- a/tools/dumpcpp/main.cpp +++ b/tools/dumpcpp/main.cpp @@ -71,7 +71,7 @@ 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); -extern QList<QByteArray> qax_qualified_usertypes; +extern QByteArrayList qax_qualified_usertypes; extern QString qax_docuFromName(ITypeInfo *typeInfo, const QString &name); extern bool qax_dispatchEqualsIDispatch; extern void qax_deleteMetaObject(QMetaObject *mo); @@ -86,48 +86,48 @@ void writeEnums(QTextStream &out, const QMetaObject *mo) // enums for (int ienum = mo->enumeratorOffset(); ienum < mo->enumeratorCount(); ++ienum) { QMetaEnum metaEnum = mo->enumerator(ienum); - out << " enum " << metaEnum.name() << " {" << endl; + out << " enum " << metaEnum.name() << " {" << Qt::endl; for (int k = 0; k < metaEnum.keyCount(); ++k) { QByteArray key(metaEnum.key(k)); out << " " << key.leftJustified(24) << "= " << metaEnum.value(k); if (k < metaEnum.keyCount() - 1) out << ','; - out << endl; + out << Qt::endl; } - out << " };" << endl; - out << endl; + out << " };" << Qt::endl; + out << Qt::endl; } } void writeHeader(QTextStream &out, const QString &nameSpace, const QString &outFileName) { - out << "#ifndef QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << endl; - out << "#define QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << endl; - out << endl; - out << "// Define this symbol to __declspec(dllexport) or __declspec(dllimport)" << endl; - out << "#ifndef " << nameSpace.toUpper() << "_EXPORT" << endl; - out << "#define " << nameSpace.toUpper() << "_EXPORT" << endl; - out << "#endif" << endl; - out << endl; - out << "#include <qaxobject.h>" << endl; - out << "#include <qaxwidget.h>" << endl; - out << "#include <qdatetime.h>" << endl; - out << "#include <qpixmap.h>" << endl; - out << endl; - out << "struct IDispatch;" << endl; - out << endl; + out << "#ifndef QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << Qt::endl; + out << "#define QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << Qt::endl; + out << Qt::endl; + out << "// Define this symbol to __declspec(dllexport) or __declspec(dllimport)" << Qt::endl; + out << "#ifndef " << nameSpace.toUpper() << "_EXPORT" << Qt::endl; + out << "#define " << nameSpace.toUpper() << "_EXPORT" << Qt::endl; + out << "#endif" << Qt::endl; + out << Qt::endl; + out << "#include <qaxobject.h>" << Qt::endl; + out << "#include <qaxwidget.h>" << Qt::endl; + out << "#include <qdatetime.h>" << Qt::endl; + out << "#include <qpixmap.h>" << Qt::endl; + out << Qt::endl; + out << "struct IDispatch;" << Qt::endl; + out << Qt::endl; } void generateNameSpace(QTextStream &out, const QMetaObject *mo, const QByteArray &nameSpace) { - out << "namespace " << nameSpace << " {" << endl; - out << endl; + out << "namespace " << nameSpace << " {" << Qt::endl; + out << Qt::endl; writeEnums(out, mo); // don't close on purpose } -static QByteArray joinParameterNames(const QList<QByteArray> ¶meterNames) +static QByteArray joinParameterNames(const QByteArrayList ¶meterNames) { QByteArray slotParameters; for (int p = 0; p < parameterNames.count(); ++p) { @@ -189,32 +189,32 @@ static void formatConstructorBody(QTextStream &out, const QByteArray &className, { out << className << "::" << className; formatConstructorSignature(out, category, false); - out << " :" << endl << " "; + out << " :" << Qt::endl << " "; if (category & ActiveX) out << "QAxWidget(parent, f"; else if (category & SubObject) out << "QAxObject(subobject, parent"; else out << "QAxObject(parent"; - out << ')' << endl << '{' << endl; + out << ')' << Qt::endl << '{' << Qt::endl; if (category & SubObject) { - out << " internalRelease();" << endl; + out << " internalRelease();" << Qt::endl; } else if (category & Licensed) { - out << " if (licenseKey.isEmpty())" << endl; - out << " setControl(QStringLiteral(\"" << controlID << "\"));" << endl; - out << " else" << endl; - out << " setControl(QStringLiteral(\"" << controlID << ":\") + licenseKey);" << endl; + out << " if (licenseKey.isEmpty())" << Qt::endl; + out << " setControl(QStringLiteral(\"" << controlID << "\"));" << Qt::endl; + out << " else" << Qt::endl; + out << " setControl(QStringLiteral(\"" << controlID << ":\") + licenseKey);" << Qt::endl; } else { - out << " setControl(QStringLiteral(\"" << controlID << "\"));" << endl; + out << " setControl(QStringLiteral(\"" << controlID << "\"));" << Qt::endl; } - out << '}' << endl << endl; + out << '}' << Qt::endl << Qt::endl; } void generateClassDecl(QTextStream &out, const QMetaObject *mo, const QByteArray &className, const QByteArray &nameSpace, ObjectCategories category) { - QList<QByteArray> functions; + QByteArrayList functions; QByteArray indent; if (!(category & OnlyInlines)) @@ -227,12 +227,12 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, out << "QAxWidget"; else out << "QAxObject"; - out << endl; + out << Qt::endl; - out << '{' << endl; - out << "public:" << endl << " explicit " << className; + out << '{' << Qt::endl; + out << "public:" << Qt::endl << " explicit " << className; formatConstructorSignature(out, category, true); - out << ';' << endl; + out << ';' << Qt::endl; for (int ci = mo->classInfoOffset(); ci < mo->classInfoCount(); ++ci) { QMetaClassInfo info = mo->classInfo(ci); QByteArray iface_name = info.name(); @@ -241,17 +241,17 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, QByteArray iface_class = info.value(); - out << " " << className << '(' << iface_class << " *iface)" << endl; + out << " " << className << '(' << iface_class << " *iface)" << Qt::endl; if (category & ActiveX) - out << " : QAxWidget()" << endl; + out << " : QAxWidget()" << Qt::endl; else - out << " : QAxObject()" << endl; - out << " {" << endl; - out << " initializeFrom(iface);" << endl; - out << " delete iface;" << endl; - out << " }" << endl; - out << endl; + out << " : QAxObject()" << Qt::endl; + out << " {" << Qt::endl; + out << " initializeFrom(iface);" << Qt::endl; + out << " delete iface;" << Qt::endl; + out << " }" << Qt::endl; + out << Qt::endl; } } @@ -261,20 +261,20 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, if (nameSpace.isEmpty() && !(category & OnlyInlines)) { for (int ienum = mo->enumeratorOffset(); ienum < mo->enumeratorCount(); ++ienum) { QMetaEnum metaEnum = mo->enumerator(ienum); - out << " enum " << metaEnum.name() << " {" << endl; + out << " enum " << metaEnum.name() << " {" << Qt::endl; for (int k = 0; k < metaEnum.keyCount(); ++k) { QByteArray key(metaEnum.key(k)); out << " " << key.leftJustified(24) << "= " << metaEnum.value(k); if (k < metaEnum.keyCount() - 1) out << ','; - out << endl; + out << Qt::endl; } - out << " };" << endl; - out << endl; + out << " };" << Qt::endl; + out << Qt::endl; } } // QAxBase public virtual functions. - QList<QByteArray> axBase_vfuncs; + QByteArrayList axBase_vfuncs; axBase_vfuncs.append("metaObject"); axBase_vfuncs.append("qObject"); axBase_vfuncs.append("className"); @@ -292,13 +292,13 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, continue; if (!(category & OnlyInlines)) { - out << indent << "/*" << endl << indent << "Property " << propertyName << endl; + out << indent << "/*" << Qt::endl << indent << "Property " << propertyName << Qt::endl; QString documentation = qax_docuFromName(currentTypeInfo, QString::fromLatin1(propertyName.constData())); if (!documentation.isEmpty()) { - out << endl; - out << indent << documentation << endl; + out << Qt::endl; + out << indent << documentation << Qt::endl; } - out << indent << "*/" << endl; + out << indent << "*/" << Qt::endl; } // Check whether the new function conflicts with any of QAxBase public virtual functions. @@ -331,36 +331,36 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, out << propertyFunctionName << "() const"; if (!(category & NoInlines)) { - out << endl << indent << '{' << endl; + out << Qt::endl << indent << '{' << Qt::endl; if (qax_qualified_usertypes.contains(simplePropType)) { if (foreignNamespace) - out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl; - out << indent << " " << propertyType << " qax_pointer = 0;" << endl; + out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << Qt::endl; + out << indent << " " << propertyType << " qax_pointer = 0;" << Qt::endl; QByteArray simplePropTypeWithNamespace = propertyType; simplePropTypeWithNamespace.replace('*', ""); - out << indent << " qRegisterMetaType<" << propertyType << ">(\"" << property.typeName() << "\", &qax_pointer);" << endl; - out << indent << " qRegisterMetaType<" << simplePropTypeWithNamespace << ">(\"" << simplePropType << "\", qax_pointer);" << endl; + out << indent << " qRegisterMetaType<" << propertyType << ">(\"" << property.typeName() << "\", &qax_pointer);" << Qt::endl; + out << indent << " qRegisterMetaType<" << simplePropTypeWithNamespace << ">(\"" << simplePropType << "\", qax_pointer);" << Qt::endl; } - out << indent << " QVariant qax_result = property(\"" << propertyName << "\");" << endl; + out << indent << " QVariant qax_result = property(\"" << propertyName << "\");" << Qt::endl; if (propertyType.length() && propertyType.at(propertyType.length()-1) == '*') - out << indent << " if (!qax_result.constData()) return 0;" << endl; - out << indent << " Q_ASSERT(qax_result.isValid());" << endl; + out << indent << " if (!qax_result.constData()) return 0;" << Qt::endl; + out << indent << " Q_ASSERT(qax_result.isValid());" << Qt::endl; if (qax_qualified_usertypes.contains(simplePropType)) { simplePropType = propertyType; simplePropType.replace('*', ""); - out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; + out << indent << " return *(" << propertyType << "*)qax_result.constData();" << Qt::endl; if (foreignNamespace) { - out << "#else" << endl; - out << indent << " return 0; // foreign namespace not included" << endl; - out << "#endif" << endl; + out << "#else" << Qt::endl; + out << indent << " return 0; // foreign namespace not included" << Qt::endl; + out << "#endif" << Qt::endl; } } else { - out << indent << " return *(" << propertyType << "*)qax_result.constData();" << endl; + out << indent << " return *(" << propertyType << "*)qax_result.constData();" << Qt::endl; } - out << indent << '}' << endl; + out << indent << '}' << Qt::endl; } else { - out << "; //Returns the value of " << propertyName << endl; + out << "; //Returns the value of " << propertyName << Qt::endl; } functions << propertyName; @@ -381,21 +381,21 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, if (!(category & NoInlines)) { if (propertyType.endsWith('*')) { - out << '{' << endl; - out << " int typeId = qRegisterMetaType<" << propertyType << ">(\"" << propertyType << "\", &value);" << endl; - out << " setProperty(\"" << propertyName << "\", QVariant(typeId, &value));" << endl; - out << '}' << endl; + out << '{' << Qt::endl; + out << " int typeId = qRegisterMetaType<" << propertyType << ">(\"" << propertyType << "\", &value);" << Qt::endl; + out << " setProperty(\"" << propertyName << "\", QVariant(typeId, &value));" << Qt::endl; + out << '}' << Qt::endl; } else { - out << "{ setProperty(\"" << propertyName << "\", QVariant(value)); }" << endl; + out << "{ setProperty(\"" << propertyName << "\", QVariant(value)); }" << Qt::endl; } } else { - out << "; //Sets the value of the " << propertyName << " property" << endl; + out << "; //Sets the value of the " << propertyName << " property" << Qt::endl; } functions << setter; } - out << endl; + out << Qt::endl; } // slots - but not property setters @@ -419,13 +419,13 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, continue; if (!(category & OnlyInlines)) { - out << indent << "/*" << endl << indent << "Method " << slotName << endl; + out << indent << "/*" << Qt::endl << indent << "Method " << slotName << Qt::endl; QString documentation = qax_docuFromName(currentTypeInfo, QString::fromLatin1(slotName.constData())); if (!documentation.isEmpty()) { - out << endl; - out << indent << documentation << endl; + out << Qt::endl; + out << indent << documentation << Qt::endl; } - out << indent << "*/" << endl; + out << indent << "*/" << Qt::endl; } QByteArray slotParameters(joinParameterNames(slot.parameterNames())); @@ -446,8 +446,8 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, QByteArray slotSignatureTruncated(slotSignature.mid(slotNamedSignature.length())); slotSignatureTruncated.truncate(slotSignatureTruncated.length() - 1); - QList<QByteArray> signatureSplit = slotSignatureTruncated.split(','); - QList<QByteArray> parameterSplit; + const auto signatureSplit = slotSignatureTruncated.split(','); + QByteArrayList parameterSplit; if (slotParameters.isEmpty()) { // generate parameter names for (int i = 0; i < signatureSplit.count(); ++i) parameterSplit << QByteArray("p") + QByteArray::number(i); @@ -502,27 +502,27 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, out << slotNamedSignature; if (category & NoInlines) { - out << ';' << endl; + out << ';' << Qt::endl; } else { - out << endl; - out << indent << '{' << endl; + out << Qt::endl; + out << indent << '{' << Qt::endl; if (slotType != QByteArrayLiteral("void")) { out << indent << " " << slotType << " qax_result"; if (slotType.endsWith('*')) out << " = 0"; - out << ';' << endl; + out << ';' << Qt::endl; if (qax_qualified_usertypes.contains(simpleSlotType)) { bool foreignNamespace = simpleSlotType.contains("::"); if (foreignNamespace) - out << "#ifdef QAX_DUMPCPP_" << simpleSlotType.left(simpleSlotType.indexOf(':')).toUpper() << "_H" << endl; + out << "#ifdef QAX_DUMPCPP_" << simpleSlotType.left(simpleSlotType.indexOf(':')).toUpper() << "_H" << Qt::endl; QByteArray simpleSlotTypeWithNamespace = slotType; simpleSlotTypeWithNamespace.replace('*', ""); - out << indent << " qRegisterMetaType<" << simpleSlotTypeWithNamespace << "*>(\"" << simpleSlotType << "*\", &qax_result);" << endl; + out << indent << " qRegisterMetaType<" << simpleSlotTypeWithNamespace << "*>(\"" << simpleSlotType << "*\", &qax_result);" << Qt::endl; if (!vTableOnlyStubs.contains(simpleSlotTypeWithNamespace)) - out << indent << " qRegisterMetaType<" << simpleSlotTypeWithNamespace << ">(\"" << simpleSlotType << "\", qax_result);" << endl; + out << indent << " qRegisterMetaType<" << simpleSlotTypeWithNamespace << ">(\"" << simpleSlotType << "\", qax_result);" << Qt::endl; if (foreignNamespace) - out << "#endif" << endl; + out << "#endif" << Qt::endl; } } out << indent << " void *_a[] = {"; @@ -534,27 +534,27 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo, out << ", (void*)&"; out << slotParameters.replace(",", ", (void*)&"); } - out << "};" << endl; + out << "};" << Qt::endl; - out << indent << " qt_metacall(QMetaObject::InvokeMetaMethod, " << islot << ", _a);" << endl; + out << indent << " qt_metacall(QMetaObject::InvokeMetaMethod, " << islot << ", _a);" << Qt::endl; if (slotType != QByteArrayLiteral("void")) - out << indent << " return qax_result;" << endl; - out << indent << '}' << endl; + out << indent << " return qax_result;" << Qt::endl; + out << indent << '}' << Qt::endl; } - out << endl; + out << Qt::endl; defaultArguments = 0; } if (!(category & OnlyInlines)) { if (!(category & NoMetaObject)) { - out << "// meta object functions" << endl; - out << " static const QMetaObject staticMetaObject;" << endl; - out << " const QMetaObject *metaObject() const override { return &staticMetaObject; }" << endl; - out << " void *qt_metacast(const char *) override;" << endl; + out << "// meta object functions" << Qt::endl; + out << " static const QMetaObject staticMetaObject;" << Qt::endl; + out << " const QMetaObject *metaObject() const override { return &staticMetaObject; }" << Qt::endl; + out << " void *qt_metacast(const char *) override;" << Qt::endl; } - out << "};" << endl; + out << "};" << Qt::endl; } } @@ -658,7 +658,7 @@ void generateMethods(QTextStream &out, const QMetaObject *mo, const QMetaMethod: out << "slot"; funcTypeFlag = MethodSlot; } - out << ": name, argc, parameters, tag, flags" << endl; + out << ": name, argc, parameters, tag, flags" << Qt::endl; int methodCount = mo->methodCount(); for (int i = mo->methodOffset(); i < methodCount; ++i) { @@ -670,10 +670,10 @@ void generateMethods(QTextStream &out, const QMetaObject *mo, const QMetaMethod: out << method.parameterCount() << ", "; out << paramsIndex << ", "; addStringIdx(method.tag()); - out << (AccessProtected | method.attributes() | funcTypeFlag) << ',' << endl; + out << (AccessProtected | method.attributes() | funcTypeFlag) << ',' << Qt::endl; paramsIndex += 1 + method.parameterCount() * 2; } - out << endl; + out << Qt::endl; } void generateMethodParameters(QTextStream &out, const QMetaObject *mo, const QMetaMethod::MethodType funcType) @@ -683,7 +683,7 @@ void generateMethodParameters(QTextStream &out, const QMetaObject *mo, const QMe out << "signal"; else if (funcType == QMetaMethod::Slot) out << "slot"; - out << ": parameters" << endl; + out << ": parameters" << Qt::endl; int methodCount = mo->methodCount(); for (int i = mo->methodOffset(); i < methodCount; ++i) { @@ -700,7 +700,7 @@ void generateMethodParameters(QTextStream &out, const QMetaObject *mo, const QMe out << ','; // Parameter types - const QList<QByteArray> parameterTypes = method.parameterTypes(); + const auto parameterTypes = method.parameterTypes(); for (int j = 0; j < argsCount; ++j) { out << ' '; generateTypeInfo(out, parameterTypes.at(j)); @@ -708,13 +708,13 @@ void generateMethodParameters(QTextStream &out, const QMetaObject *mo, const QMe } // Parameter names - const QList<QByteArray> parameterNames = method.parameterNames(); + const auto parameterNames = method.parameterNames(); for (int j = 0; j < argsCount; ++j) out << ' ' << stridx(parameterNames.at(j)) << ','; - out << endl; + out << Qt::endl; } - out << endl; + out << Qt::endl; } void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray &className, @@ -767,8 +767,8 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray strreg(typeName); strreg(method.tag()); - const QList<QByteArray> parameterNames = method.parameterNames(); - const QList<QByteArray> parameterTypes = method.parameterTypes(); + const auto parameterNames = method.parameterNames(); + const auto parameterTypes = method.parameterTypes(); for (int j = 0; j < argsCount; ++j) { if (!QtPrivate::isBuiltinType(parameterTypes.at(j))) strDetachAndRegister(parameterTypes.at(j)); @@ -789,38 +789,38 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray } // Build data array - out << "static const uint qt_meta_data_" << qualifiedClassNameIdentifier << "[] = {" << endl; - out << endl; - out << " // content:" << endl; - out << " 7, // revision" << endl; + out << "static const uint qt_meta_data_" << qualifiedClassNameIdentifier << "[] = {" << Qt::endl; + out << Qt::endl; + out << " // content:" << Qt::endl; + out << " 7, // revision" << Qt::endl; out << " "; addStringIdx(qualifiedClassName); - out << " // classname" << endl; - out << " " << thisClassInfoCount << ", " << (thisClassInfoCount ? enumStart : 0) << ", // classinfo" << endl; + out << " // classname" << Qt::endl; + out << " " << thisClassInfoCount << ", " << (thisClassInfoCount ? enumStart : 0) << ", // classinfo" << Qt::endl; enumStart += thisClassInfoCount * 2; - out << " " << thisMethodCount << ", " << (thisMethodCount ? enumStart : 0) << ", // methods" << endl; + out << " " << thisMethodCount << ", " << (thisMethodCount ? enumStart : 0) << ", // methods" << Qt::endl; enumStart += thisMethodCount * 5; int paramsIndex = enumStart; enumStart += (combinedParameterCount * 2); // parameter types + names enumStart += thisMethodCount; // return types - out << " " << thisPropertyCount << ", " << (thisPropertyCount ? enumStart : 0) << ", // properties" << endl; + out << " " << thisPropertyCount << ", " << (thisPropertyCount ? enumStart : 0) << ", // properties" << Qt::endl; enumStart += thisPropertyCount * 3; - out << " " << thisEnumCount << ", " << (thisEnumCount ? enumStart : 0) << ", // enums/sets" << endl; - out << " 0, 0, // constructors" << endl; - out << " 0, // flags" << endl; - out << " " << signalCount << ", // signal count" << endl; - out << endl; + out << " " << thisEnumCount << ", " << (thisEnumCount ? enumStart : 0) << ", // enums/sets" << Qt::endl; + out << " 0, 0, // constructors" << Qt::endl; + out << " 0, // flags" << Qt::endl; + out << " " << signalCount << ", // signal count" << Qt::endl; + out << Qt::endl; if (thisClassInfoCount) { - out << " // classinfo: key, value" << endl; + out << " // classinfo: key, value" << Qt::endl; for (int i = mo->classInfoOffset(); i < allClassInfoCount; ++i) { QMetaClassInfo classInfo = mo->classInfo(i); out << " "; addStringIdx(classInfo.name()); addStringIdx(classInfo.value()); - out << endl; + out << Qt::endl; } - out << endl; + out << Qt::endl; } // Signal/Slot arrays @@ -836,7 +836,7 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray generateMethodParameters(out, mo, QMetaMethod::Slot); if (thisPropertyCount) { - out << " // properties: name, type, flags" << endl; + out << " // properties: name, type, flags" << Qt::endl; for (int i = mo->propertyOffset(); i < allPropertyCount; ++i) { QMetaProperty property = mo->property(i); out << " "; @@ -866,24 +866,24 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray out << "0x" << QString::number(flags, 16).rightJustified(8, QLatin1Char('0')) << ", \t\t // " << property.typeName() << ' ' << property.name() - << endl; + << Qt::endl; } - out << endl; + out << Qt::endl; } if (thisEnumCount) { - out << " // enums: name, flags, count, data" << endl; + out << " // enums: name, flags, count, data" << Qt::endl; enumStart += thisEnumCount * 4; for (int i = mo->enumeratorOffset(); i < allEnumCount; ++i) { QMetaEnum enumerator = mo->enumerator(i); out << " "; addStringIdx(enumerator.name()); - out << (enumerator.isFlag() ? "0x1" : "0x0") << ", " << enumerator.keyCount() << ", " << enumStart << ", " << endl; + out << (enumerator.isFlag() ? "0x1" : "0x0") << ", " << enumerator.keyCount() << ", " << enumStart << ", " << Qt::endl; enumStart += enumerator.keyCount() * 2; } - out << endl; + out << Qt::endl; - out << " // enum data: key, value" << endl; + out << " // enum data: key, value" << Qt::endl; for (int i = mo->enumeratorOffset(); i < allEnumCount; ++i) { QMetaEnum enumerator = mo->enumerator(i); for (int j = 0; j < enumerator.keyCount(); ++j) { @@ -894,36 +894,36 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray out << className << "::"; else out << nameSpace << "::"; - out << enumerator.key(j) << ")," << endl; + out << enumerator.key(j) << ")," << Qt::endl; } } } - out << " 0 // eod" << endl; - out << "};" << endl; - out << endl; + out << " 0 // eod" << Qt::endl; + out << "};" << Qt::endl; + out << Qt::endl; formatConstructorBody(out, className, controlID, category); - out << "const QMetaObject " << className << "::staticMetaObject = {" << endl; + out << "const QMetaObject " << className << "::staticMetaObject = {" << Qt::endl; if (category & ActiveX) - out << "{ &QWidget::staticMetaObject," << endl; + out << "{ &QWidget::staticMetaObject," << Qt::endl; else - out << "{ &QObject::staticMetaObject," << endl; - out << "qt_meta_stringdata_all.data," << endl; - out << "qt_meta_data_" << qualifiedClassNameIdentifier << ", nullptr, nullptr, nullptr }" << endl; - out << "};" << endl; - out << endl; - - out << "void *" << className << "::qt_metacast(const char *_clname)" << endl; - out << '{' << endl; - out << " if (!_clname) return nullptr;" << endl; - out << " if (!strcmp(_clname, \"" << qualifiedClassName << "\"))" << endl; - out << " return static_cast<void*>(const_cast<" << className << "*>(this));" << endl; + out << "{ &QObject::staticMetaObject," << Qt::endl; + out << "qt_meta_stringdata_all.data," << Qt::endl; + out << "qt_meta_data_" << qualifiedClassNameIdentifier << ", nullptr, nullptr, nullptr }" << Qt::endl; + out << "};" << Qt::endl; + out << Qt::endl; + + out << "void *" << className << "::qt_metacast(const char *_clname)" << Qt::endl; + out << '{' << Qt::endl; + out << " if (!_clname) return nullptr;" << Qt::endl; + out << " if (!strcmp(_clname, \"" << qualifiedClassName << "\"))" << Qt::endl; + out << " return static_cast<void*>(const_cast<" << className << "*>(this));" << Qt::endl; if (category & ActiveX) - out << " return QAxWidget::qt_metacast(_clname);" << endl; + out << " return QAxWidget::qt_metacast(_clname);" << Qt::endl; else - out << " return QAxObject::qt_metacast(_clname);" << endl; - out << '}' << endl; + out << " return QAxObject::qt_metacast(_clname);" << Qt::endl; + out << '}' << Qt::endl; } static void formatCommentBlockFooter(const QString &typeLibFile, QTextStream &str) @@ -969,12 +969,12 @@ static void writeForwardDeclaration(QTextStream &declOut, const QByteArray &clas { if (className.startsWith("enum ")) { declOut << "#ifndef Q_CC_MINGW\n" - << " " << className << ';' << endl // Only MSVC accepts this + << " " << className << ';' << Qt::endl // Only MSVC accepts this << "#else\n" - << " " << className << " {};" << endl + << " " << className << " {};" << Qt::endl << "#endif\n"; } else { - declOut << " " << className << ';' << endl; + declOut << " " << className << ';' << Qt::endl; } } @@ -1038,13 +1038,13 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, "**\n** Metadata for " << libName; formatCommentBlockFooter(typeLibFile, implOut); - implOut << "#define QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << endl; + implOut << "#define QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << Qt::endl; - implOut << "#include \"" << outname << ".h\"" << endl; - implOut << "#include <OAIdl.h>" << endl; // For IDispatch - implOut << endl; - implOut << "using namespace " << libName << ';' << endl; - implOut << endl; + implOut << "#include \"" << outname << ".h\"" << Qt::endl; + implOut << "#include <OAIdl.h>" << Qt::endl; // For IDispatch + implOut << Qt::endl; + implOut << "using namespace " << libName << ';' << Qt::endl; + implOut << Qt::endl; } QFile declFile(outname + QLatin1String(".h")); @@ -1054,7 +1054,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, QByteArray inlines; QTextStream inlinesOut(&inlines, QIODevice::WriteOnly); - QMap<QByteArray, QList<QByteArray> > namespaces; + QMap<QByteArray, QByteArrayList> namespaces; if(!(category & NoDeclaration)) { if (!declFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -1072,8 +1072,8 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, UINT typeCount = typelib->GetTypeInfoCount(); if (declFile.isOpen()) { QByteArrayList opaquePointerTypes; - declOut << endl; - declOut << "// Referenced namespace" << endl; + declOut << Qt::endl; + declOut << "// Referenced namespace" << Qt::endl; for (UINT index = 0; index < typeCount; ++index) { ITypeInfo *typeinfo = nullptr; typelib->GetTypeInfo(index, &typeinfo); @@ -1155,37 +1155,37 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, for (auto it = namespaces.cbegin(), end = namespaces.cend(); it != end; ++it) { const QByteArray &nspace = it.key(); if (libName != QLatin1String(nspace)) { - declOut << "namespace " << nspace << " {" << endl; + declOut << "namespace " << nspace << " {" << Qt::endl; for (const auto &className : it.value()) { if (className.contains(' ')) { writeForwardDeclaration(declOut, className); namespaceForType.insert(className.mid(className.indexOf(' ') + 1), nspace); } else { - declOut << " class " << className << ';' << endl; + declOut << " class " << className << ';' << Qt::endl; opaquePointerTypes.append(nspace + "::" + className); namespaceForType.insert(className, nspace); namespaceForType.insert(className + '*', nspace); namespaceForType.insert(className + "**", nspace); } } - declOut << '}' << endl << endl; + declOut << '}' << Qt::endl << Qt::endl; } } for (const QByteArray &opaquePointerType : qAsConst(opaquePointerTypes)) - declOut << "Q_DECLARE_OPAQUE_POINTER(" << opaquePointerType << "*)" << endl; - declOut << endl; + declOut << "Q_DECLARE_OPAQUE_POINTER(" << opaquePointerType << "*)" << Qt::endl; + declOut << Qt::endl; } generateNameSpace(declOut, namespaceObject, libNameBa); auto nspIt = namespaces.constFind(libNameBa); if (nspIt != namespaces.constEnd() && !nspIt.value().isEmpty()) { - declOut << "// forward declarations" << endl; + declOut << "// forward declarations" << Qt::endl; for (const auto &className : nspIt.value()) { if (className.contains(' ')) { - declOut << " " << className << ';' << endl; + declOut << " " << className << ';' << Qt::endl; namespaceForType.insert(className.mid(className.indexOf(' ') + 1), libNameBa); } else { - declOut << " class " << className << ';' << endl; + declOut << " class " << className << ';' << Qt::endl; namespaceForType.insert(className, libNameBa); namespaceForType.insert(className + '*', libNameBa); namespaceForType.insert(className + "**", libNameBa); @@ -1193,10 +1193,10 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, } } - declOut << endl; + declOut << Qt::endl; } - QList<QByteArray> subtypes; + QByteArrayList subtypes; UINT typeCount = typelib->GetTypeInfoCount(); for (UINT index = 0; index < typeCount; ++index) { @@ -1263,7 +1263,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, if (!(typeattr->wTypeFlags & TYPEFLAG_FDUAL) && (metaObject->propertyCount() - metaObject->propertyOffset()) == 1 && className.contains("Events")) { - declOut << "// skipping event interface " << className << endl << endl; + declOut << "// skipping event interface " << className << Qt::endl << Qt::endl; } else { if (declFile.isOpen()) { if (typeattr->wTypeFlags & TYPEFLAG_FLICENSED) @@ -1271,16 +1271,16 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, if (typekind == TKIND_COCLASS) { // write those later... generateClassDecl(classesOut, metaObject, className, libNameBa, object_category | NoInlines); - classesOut << endl; + classesOut << Qt::endl; } else { generateClassDecl(declOut, metaObject, className, libNameBa, object_category | NoInlines); - declOut << endl; + declOut << Qt::endl; } subtypes << className; generateClassDecl(inlinesOut, metaObject, className, libNameBa, object_category | OnlyInlines); - inlinesOut << endl; + inlinesOut << Qt::endl; } if (implFile.isOpen()) generateClassImpl(classImplOut, metaObject, className, guid.toString(), libNameBa, @@ -1301,11 +1301,11 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, // // Build stringdata struct // - implOut << "struct qt_meta_stringdata_all_t {" << endl; - implOut << " QByteArrayData data[" << strings.size() << "];" << endl; + implOut << "struct qt_meta_stringdata_all_t {" << Qt::endl; + implOut << " QByteArrayData data[" << strings.size() << "];" << Qt::endl; - QVector<QList<QByteArray> > listVector; - QList<QByteArray> currentList; + QVector<QByteArrayList> listVector; + QByteArrayList currentList; int currentTableLen = 0; for (const auto &s : strings) { @@ -1313,14 +1313,14 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, currentList.append(s); // Split strings into chunks less than 64k to work around compiler limits. if (currentTableLen > 60000) { - implOut << " char stringdata" << listVector.size() << '[' << currentTableLen + 1 << "];" << endl; + implOut << " char stringdata" << listVector.size() << '[' << currentTableLen + 1 << "];" << Qt::endl; listVector.append(currentList); currentList.clear(); currentTableLen = 0; } } - implOut << " char stringdata" << listVector.size() << '[' << currentTableLen + 1 << "];" << endl; - implOut << "};" << endl; + implOut << " char stringdata" << listVector.size() << '[' << currentTableLen + 1 << "];" << Qt::endl; + implOut << "};" << Qt::endl; listVector.append(currentList); // Macro that expands into a QByteArrayData. The offset member is @@ -1328,27 +1328,27 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, // stringdata.stringdata member, and 2) the stringdata.data index of the // QByteArrayData being defined. This calculation relies on the // QByteArrayData::data() implementation returning simply "this + offset". - implOut << "#define QT_MOC_LITERAL(idx, ofs, len, table) \\" << endl - << " Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\" << endl - << " offsetof(qt_meta_stringdata_all_t, stringdata##table) + ofs \\" << endl - << " - idx * sizeof(QByteArrayData) \\" << endl - << " )" << endl; + implOut << "#define QT_MOC_LITERAL(idx, ofs, len, table) \\" << Qt::endl + << " Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\" << Qt::endl + << " offsetof(qt_meta_stringdata_all_t, stringdata##table) + ofs \\" << Qt::endl + << " - idx * sizeof(QByteArrayData) \\" << Qt::endl + << " )" << Qt::endl; - implOut << "static const qt_meta_stringdata_all_t qt_meta_stringdata_all = {" << endl; - implOut << " {" << endl; + implOut << "static const qt_meta_stringdata_all_t qt_meta_stringdata_all = {" << Qt::endl; + implOut << " {" << Qt::endl; int totalStringCount = 0; for (int i = 0; i < listVector.size(); ++i) { int idx = 0; for (int j = 0; j < listVector[i].size(); j++) { if (totalStringCount) - implOut << ',' << endl; + implOut << ',' << Qt::endl; const QByteArray &str = listVector[i].at(j); implOut << "QT_MOC_LITERAL(" << totalStringCount++ << ", " << idx << ", " << str.length() << ", " << i << ')'; idx += str.length() + 1; } } - implOut << endl << " }"; + implOut << Qt::endl << " }"; // // Build stringdata arrays @@ -1356,12 +1356,12 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, for (const auto &l : listVector) { int col = 0; int len = 0; - implOut << ',' << endl; + implOut << ',' << Qt::endl; implOut << " \""; for (const auto &s : l) { len = s.length(); if (col && col + len >= 150) { - implOut << '"' << endl << " \""; + implOut << '"' << Qt::endl << " \""; col = 0; } else if (len && s.at(0) >= '0' && s.at(0) <= '9') { implOut << "\"\""; @@ -1371,7 +1371,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, while (idx < s.length()) { if (idx > 0) { col = 0; - implOut << '"' << endl << " \""; + implOut << '"' << Qt::endl << " \""; } int spanLen = qMin(150, s.length() - idx); implOut << s.mid(idx, spanLen); @@ -1385,13 +1385,13 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, implOut << '"'; } // Terminate stringdata struct - implOut << endl << "};" << endl; + implOut << Qt::endl << "};" << Qt::endl; - implOut << "#undef QT_MOC_LITERAL" << endl << endl; + implOut << "#undef QT_MOC_LITERAL" << Qt::endl << Qt::endl; classImplOut.flush(); copyFileToStream(&classImplFile, &implOut); - implOut << endl; + implOut << Qt::endl; } qax_deleteMetaObject(namespaceObject); @@ -1401,54 +1401,54 @@ bool generateTypeLibrary(QString typeLibFile, QString outname, if (declFile.isOpen()) { if (classes.size()) { - declOut << "// Actual coclasses" << endl; + declOut << "// Actual coclasses" << Qt::endl; declOut << classes; } if (inlines.size()) { - declOut << "// member function implementation" << endl; - declOut << "#ifndef QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << endl; - declOut << inlines << endl; - declOut << "#endif" << endl << endl; + declOut << "// member function implementation" << Qt::endl; + declOut << "#ifndef QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << Qt::endl; + declOut << inlines << Qt::endl; + declOut << "#endif" << Qt::endl << Qt::endl; } // close namespace - declOut << '}' << endl; - declOut << endl; + declOut << '}' << Qt::endl; + declOut << Qt::endl; // partial template specialization for qMetaTypeCreateHelper and qMetaTypeConstructHelper - declOut << "QT_BEGIN_NAMESPACE" << endl << endl; - declOut << "namespace QtMetaTypePrivate {" << endl; + declOut << "QT_BEGIN_NAMESPACE" << Qt::endl << Qt::endl; + declOut << "namespace QtMetaTypePrivate {" << Qt::endl; for (int t = 0; t < subtypes.count(); ++t) { QByteArray subType(subtypes.at(t)); - declOut << "template<>" << endl; - declOut << "struct QMetaTypeFunctionHelper<" << libName << "::" << subType << ", /* Accepted */ true> {" << endl; + declOut << "template<>" << Qt::endl; + declOut << "struct QMetaTypeFunctionHelper<" << libName << "::" << subType << ", /* Accepted */ true> {" << Qt::endl; - declOut << " static void Destruct(void *t)" << endl; - declOut << " {" << endl; - declOut << " Q_UNUSED(t)" << endl; // Silence MSVC that warns for POD types. - declOut << " static_cast<" << libName << "::" << subType << "*>(t)->" << libName << "::" << subType << "::~" << subType << "();" << endl; - declOut << " }" << endl; + declOut << " static void Destruct(void *t)" << Qt::endl; + declOut << " {" << Qt::endl; + declOut << " Q_UNUSED(t)" << Qt::endl; // Silence MSVC that warns for POD types. + declOut << " static_cast<" << libName << "::" << subType << "*>(t)->" << libName << "::" << subType << "::~" << subType << "();" << Qt::endl; + declOut << " }" << Qt::endl; - declOut << " static void *Construct(void *where, const void *t)" << endl; - declOut << " {" << endl; - declOut << " Q_ASSERT(!t);" << endl; - declOut << " Q_UNUSED(t)" << endl; // Silence warnings for release builds - declOut << " return new (where) " << libName << "::" << subType << ';' << endl; - declOut << " }" << endl; + declOut << " static void *Construct(void *where, const void *t)" << Qt::endl; + declOut << " {" << Qt::endl; + declOut << " Q_ASSERT(!t);" << Qt::endl; + declOut << " Q_UNUSED(t)" << Qt::endl; // Silence warnings for release builds + declOut << " return new (where) " << libName << "::" << subType << ';' << Qt::endl; + declOut << " }" << Qt::endl; - declOut << "#ifndef QT_NO_DATASTREAM" << endl; + declOut << "#ifndef QT_NO_DATASTREAM" << Qt::endl; - declOut << " static void Save(QDataStream &stream, const void *t) { stream << *static_cast<const " << libName << "::" << subType << "*>(t); }" << endl; - declOut << " static void Load(QDataStream &stream, void *t) { stream >> *static_cast<" << libName << "::" << subType << "*>(t); }" << endl; + declOut << " static void Save(QDataStream &stream, const void *t) { stream << *static_cast<const " << libName << "::" << subType << "*>(t); }" << Qt::endl; + declOut << " static void Load(QDataStream &stream, void *t) { stream >> *static_cast<" << libName << "::" << subType << "*>(t); }" << Qt::endl; - declOut << "#endif // QT_NO_DATASTREAM" << endl; + declOut << "#endif // QT_NO_DATASTREAM" << Qt::endl; - declOut << "};" << endl << endl; + declOut << "};" << Qt::endl << Qt::endl; } - declOut << "} // namespace QtMetaTypePrivate" << endl; - declOut << "QT_END_NAMESPACE" << endl << endl; - declOut << "#endif" << endl; - declOut << endl; + declOut << "} // namespace QtMetaTypePrivate" << Qt::endl; + declOut << "QT_END_NAMESPACE" << Qt::endl << Qt::endl; + declOut << "#endif" << Qt::endl; + declOut << Qt::endl; } typelib->Release(); diff --git a/tools/testcon/ambientproperties.cpp b/tools/testcon/ambientproperties.cpp index ae759f5..83ef2e2 100644 --- a/tools/testcon/ambientproperties.cpp +++ b/tools/testcon/ambientproperties.cpp @@ -122,7 +122,7 @@ QWidgetList AmbientProperties::mdiAreaWidgets() const QWidgetList result; if (QMdiArea *mdiArea = qobject_cast<QMdiArea*>(container)) { - const QList<QMdiSubWindow *> mdiSubWindows = mdiArea->subWindowList(); + const auto mdiSubWindows = mdiArea->subWindowList(); for (const QMdiSubWindow *subWindow : mdiSubWindows) result.push_back(subWindow->widget()); } diff --git a/tools/testcon/changeproperties.cpp b/tools/testcon/changeproperties.cpp index 4ec1332..e3356ed 100644 --- a/tools/testcon/changeproperties.cpp +++ b/tools/testcon/changeproperties.cpp @@ -144,7 +144,7 @@ void ChangeProperties::on_buttonSet_clicked() case QVariant::List: { QStringList txtList = editValue->text().split(QRegularExpression(QLatin1String("[,;]"))); - QList<QVariant> varList; + QVariantList varList; for (int i = 0; i < txtList.count(); ++i) { QVariant svar(txtList.at(i)); QString str = svar.toString(); @@ -234,7 +234,7 @@ void ChangeProperties::updateProperties() break; case QVariant::List: { - const QList<QVariant> varList = var.toList(); + const auto varList = var.toList(); QStringList strList; for (const auto &var : varList) strList << var.toString(); diff --git a/tools/testcon/invokemethod.cpp b/tools/testcon/invokemethod.cpp index 796f0e7..2c30705 100644 --- a/tools/testcon/invokemethod.cpp +++ b/tools/testcon/invokemethod.cpp @@ -86,7 +86,7 @@ void InvokeMethod::on_buttonInvoke_clicked() on_buttonSet_clicked(); QString method = comboMethods->currentText(); - QList<QVariant> vars; + QVariantList vars; int itemCount = listParameters->topLevelItemCount(); for (int i = 0; i < itemCount; ++i) { @@ -117,8 +117,8 @@ void InvokeMethod::on_comboMethods_activated(const QString &method) signature.remove(0, signature.indexOf(QLatin1Char('(')) + 1); signature.truncate(signature.length()-1); - QList<QByteArray> pnames = slot.parameterNames(); - QList<QByteArray> ptypes = slot.parameterTypes(); + const auto pnames = slot.parameterNames(); + const auto ptypes = slot.parameterTypes(); for (int p = 0; p < ptypes.count(); ++p) { QString ptype(QString::fromLatin1(ptypes.at(p))); diff --git a/tools/testcon/mainwindow.cpp b/tools/testcon/mainwindow.cpp index 14db741..8e483b3 100644 --- a/tools/testcon/mainwindow.cpp +++ b/tools/testcon/mainwindow.cpp @@ -105,10 +105,10 @@ QAxWidget *MainWindow::activeAxWidget() const return nullptr; } -QList<QAxWidget *> MainWindow::axWidgets() const +QVector<QAxWidget *> MainWindow::axWidgets() const { - QList<QAxWidget *> result; - const QList<QMdiSubWindow *> mdiSubWindows = m_mdiArea->subWindowList(); + QVector<QAxWidget *> result; + const auto mdiSubWindows = m_mdiArea->subWindowList(); for (const QMdiSubWindow *subWindow : mdiSubWindows) if (QAxWidget *axWidget = qobject_cast<QAxWidget *>(subWindow->widget())) result.push_back(axWidget); @@ -463,7 +463,7 @@ bool MainWindow::loadScript(const QString &file) m_scripts->addObject(this); } - const QList<QAxWidget *> axw = axWidgets(); + const auto axw = axWidgets(); for (QAxWidget *axWidget : axw) { QAxBase *ax = axWidget; m_scripts->addObject(ax); @@ -547,7 +547,7 @@ void MainWindow::updateGUI() if (m_dlgProperties) m_dlgProperties->setControl(hasControl ? container : nullptr); - const QList<QAxWidget *> axw = axWidgets(); + const auto axw = axWidgets(); for (QAxWidget *container : axw) { container->disconnect(SIGNAL(signal(QString,int,void*))); if (actionLogSignals->isChecked()) diff --git a/tools/testcon/mainwindow.h b/tools/testcon/mainwindow.h index b3be5c0..8975201 100644 --- a/tools/testcon/mainwindow.h +++ b/tools/testcon/mainwindow.h @@ -30,6 +30,7 @@ #define MAINWINDOW_H #include <ActiveQt/QAxSelect> +#include <QVector> #include "ui_mainwindow.h" @@ -96,7 +97,7 @@ protected slots: private: QAxWidget *activeAxWidget() const; - QList<QAxWidget *> axWidgets() const; + QVector<QAxWidget *> axWidgets() const; static MainWindow *m_instance; |