From b2a1066e108678aa66d7e6f22cadf9c01d646ec9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Jun 2017 10:27:44 +0200 Subject: Qt Designer: Suppress QEvent::LayoutRequest when changing layout span QTabWidget activates its parent layout when resizing, which prevents it from smoothly resizing when changing item spans. Suppress the QEvent::LayoutRequest when the widget handle is in a span-changing mode. Task-number: QTBUG-61439 Change-Id: I87b2c9d5e3e6796983b730907cf3bfe8c7ed2292 Reviewed-by: Jarek Kobus --- src/designer/src/components/formeditor/formwindow.h | 11 +++++++++++ .../src/components/formeditor/formwindowmanager.cpp | 8 ++++++++ src/designer/src/components/formeditor/widgetselection.cpp | 13 +++++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/designer/src/components/formeditor/formwindow.h b/src/designer/src/components/formeditor/formwindow.h index d2502f4a7..86027a625 100644 --- a/src/designer/src/components/formeditor/formwindow.h +++ b/src/designer/src/components/formeditor/formwindow.h @@ -70,6 +70,13 @@ class QT_FORMEDITOR_EXPORT FormWindow: public FormWindowBase Q_OBJECT public: + enum HandleOperation + { + NoHandleOperation, + ResizeHandleOperation, + ChangeLayoutSpanHandleOperation + }; + explicit FormWindow(FormEditor *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); virtual ~FormWindow(); @@ -199,6 +206,9 @@ public: bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + HandleOperation handleOperation() const { return m_handleOperation; } + void setHandleOperation(HandleOperation o) { m_handleOperation = o; } + signals: void contextMenuRequested(QMenu *menu, QWidget *widget); @@ -354,6 +364,7 @@ private: QStringList m_includeHints; QPoint m_contextMenuPosition; + HandleOperation m_handleOperation = NoHandleOperation; private: friend class WidgetEditorTool; diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp index 498160f8a..1650e1450 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.cpp +++ b/src/designer/src/components/formeditor/formwindowmanager.cpp @@ -209,6 +209,14 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) return true; } switch (eventType) { + case QEvent::LayoutRequest: + // QTBUG-61439: Suppress layout request while changing the QGridLayout + // span of a QTabWidget, which sends LayoutRequest in resizeEvent(). + if (fw->handleOperation() == FormWindow::ChangeLayoutSpanHandleOperation) { + e->ignore(); + return true; + } + break; case QEvent::WindowActivate: { if (fw->parentWidget()->isWindow() && fw->isMainContainer(managedWidget) && activeFormWindow() != fw) { diff --git a/src/designer/src/components/formeditor/widgetselection.cpp b/src/designer/src/components/formeditor/widgetselection.cpp index eda77e213..fcb54de92 100644 --- a/src/designer/src/components/formeditor/widgetselection.cpp +++ b/src/designer/src/components/formeditor/widgetselection.cpp @@ -178,6 +178,17 @@ void WidgetHandle::mousePressEvent(QMouseEvent *e) m_origPressPos = container->mapFromGlobal(e->globalPos()); m_geom = m_origGeom = m_widget->geometry(); + + switch (WidgetSelection::widgetState(m_formWindow->core(), m_widget)) { + case WidgetSelection::UnlaidOut: + case WidgetSelection::LaidOut: + m_formWindow->setHandleOperation(FormWindow::ResizeHandleOperation); + break; + case WidgetSelection::ManagedGridLayout: + case WidgetSelection::ManagedFormLayout: + m_formWindow->setHandleOperation(FormWindow::ChangeLayoutSpanHandleOperation); + break; + } } void WidgetHandle::mouseMoveEvent(QMouseEvent *e) @@ -326,6 +337,8 @@ void WidgetHandle::mouseMoveEvent(QMouseEvent *e) void WidgetHandle::mouseReleaseEvent(QMouseEvent *e) { + m_formWindow->setHandleOperation(FormWindow::NoHandleOperation); + if (e->button() != Qt::LeftButton || !m_active) return; -- cgit v1.2.1 From b6735d4519be3d551c6dd5074615c058570df872 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 6 Jul 2017 10:53:24 +0200 Subject: Fix remaining GPL-EXCEPT license header in Qt UI Tools Was forgotten in 30c10900ade. Change-Id: Ib85259a7dacfd255419da411e5a2db981fe4ffbf Reviewed-by: Friedemann Kleint --- src/designer/src/uitools/quiloader_p.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/designer/src/uitools/quiloader_p.h b/src/designer/src/uitools/quiloader_p.h index f9371fac4..86e970f49 100644 --- a/src/designer/src/uitools/quiloader_p.h +++ b/src/designer/src/uitools/quiloader_p.h @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Designer of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,13 +14,24 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** -- cgit v1.2.1 From 181e45964dda281c456db3d3315d53782f918962 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 17 Jul 2017 13:18:10 +0200 Subject: windeployqt: Fall back comparing names of QML modules when their class name is empty QtWebEngine and some other modules have empty class names, so they are dropped when concatenating QML imports. Task-number: QTBUG-61957 Change-Id: I06ccf8ab54b2d3ffba04f15746722f5b3596d5d9 Reviewed-by: Joerg Bornemann --- src/windeployqt/qmlutils.cpp | 16 ++++++---------- src/windeployqt/qmlutils.h | 2 ++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/windeployqt/qmlutils.cpp b/src/windeployqt/qmlutils.cpp index 9e8bb09e2..52f044068 100644 --- a/src/windeployqt/qmlutils.cpp +++ b/src/windeployqt/qmlutils.cpp @@ -39,6 +39,11 @@ QT_BEGIN_NAMESPACE +bool operator==(const QmlImportScanResult::Module &m1, const QmlImportScanResult::Module &m2) +{ + return m1.className.isEmpty() ? m1.name == m2.name : m1.className == m2.className; +} + // Return install path (cp -r semantics) QString QmlImportScanResult::Module::installPath(const QString &root) const { @@ -153,19 +158,10 @@ QmlImportScanResult runQmlImportScanner(const QString &directory, const QString return result; } -static inline bool contains(const QList &modules, const QString &className) -{ - for (const QmlImportScanResult::Module &m : modules) { - if (m.className == className) - return true; - } - return false; -} - void QmlImportScanResult::append(const QmlImportScanResult &other) { for (const QmlImportScanResult::Module &module : other.modules) { - if (!contains(modules, module.className)) + if (std::find(modules.cbegin(), modules.cend(), module) == modules.cend()) modules.append(module); } for (const QString &plugin : other.plugins) { diff --git a/src/windeployqt/qmlutils.h b/src/windeployqt/qmlutils.h index 5e1ddc619..895c7f1de 100644 --- a/src/windeployqt/qmlutils.h +++ b/src/windeployqt/qmlutils.h @@ -55,6 +55,8 @@ struct QmlImportScanResult { QStringList plugins; }; +bool operator==(const QmlImportScanResult::Module &m1, const QmlImportScanResult::Module &m2); + QmlImportScanResult runQmlImportScanner(const QString &directory, const QString &qmlImportPath, bool usesWidgets, int platform, DebugMatchMode debugMatchMode, QString *errorMessage); -- cgit v1.2.1 From b307d12957422f9b8118dead4cc1dfe72bbdbf29 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 19 Jul 2017 15:11:40 +0200 Subject: winrtrunner: print verbose error after failed deployment operation Just remove an early return in the case that the deployment operation was not successful. Printing out the verbose error message was already implemented. Task-number: QTBUG-61441 Change-Id: I54f22879ec84f4a984af49c9e43e4f9e88732d6e Reviewed-by: Maurice Kalinowski --- src/winrtrunner/appxlocalengine.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/winrtrunner/appxlocalengine.cpp b/src/winrtrunner/appxlocalengine.cpp index 3c89d715c..a3bee8bc7 100644 --- a/src/winrtrunner/appxlocalengine.cpp +++ b/src/winrtrunner/appxlocalengine.cpp @@ -412,18 +412,6 @@ bool AppxLocalEngine::installPackage(IAppxManifestReader *reader, const QString return false; } - ComPtr asyncInfo; - hr = deploymentOperation.As(&asyncInfo); - RETURN_FALSE_IF_FAILED("Failed to cast deployment operation to info."); - AsyncStatus status; - hr = asyncInfo->get_Status(&status); - RETURN_FALSE_IF_FAILED("Failed to retrieve deployment operation's status."); - - if (status != Completed) { - qCWarning(lcWinRtRunner) << "Deployment operation did not succeed."; - return false; - } - ComPtr results; hr = deploymentOperation->GetResults(&results); RETURN_FALSE_IF_FAILED("Failed to retrieve package registration results."); -- cgit v1.2.1 From b936ce085f74fa7c563fb942290c5e8ad9517e42 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 19 Jul 2017 15:17:40 +0200 Subject: winrtrunner: Give additional hint in case of missing prerequisite If the user has not added additional dependencies, winrt projects only depend on Windows.Universal and we have seen some cases, where its MinVersion was not met by the user's Windows version. We can give an additional hint if this error occurs and it might even push the user into the right direction if he has added his own dependencies. Task-number: QTBUG-61441 Change-Id: I54bbc424087dad2ffd626e58cc6f3a493b60f44e Reviewed-by: Leena Miettinen Reviewed-by: Maurice Kalinowski --- src/winrtrunner/appxlocalengine.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/winrtrunner/appxlocalengine.cpp b/src/winrtrunner/appxlocalengine.cpp index a3bee8bc7..d7cf35b31 100644 --- a/src/winrtrunner/appxlocalengine.cpp +++ b/src/winrtrunner/appxlocalengine.cpp @@ -421,10 +421,15 @@ bool AppxLocalEngine::installPackage(IAppxManifestReader *reader, const QString RETURN_FALSE_IF_FAILED("Failed to retrieve extended error code."); if (FAILED(errorCode)) { - HString errorText; - if (SUCCEEDED(results->get_ErrorText(errorText.GetAddressOf()))) { - qCWarning(lcWinRtRunner) << "Unable to register package:" - << QString::fromWCharArray(errorText.GetRawBuffer(NULL)); + if (HRESULT_CODE(errorCode) == ERROR_INSTALL_PREREQUISITE_FAILED) { + qCWarning(lcWinRtRunner) << "Unable to register package: A requirement for installation was not met. " + "Check that your Windows version matches TargetDeviceFamily's MinVersion set in your AppxManifest.xml."; + } else { + HString errorText; + if (SUCCEEDED(results->get_ErrorText(errorText.GetAddressOf()))) { + qCWarning(lcWinRtRunner) << "Unable to register package:" + << QString::fromWCharArray(errorText.GetRawBuffer(NULL)); + } } if (HRESULT_CODE(errorCode) == ERROR_INSTALL_POLICY_FAILURE) { // The user's license has expired. Give them the opportunity to renew it. -- cgit v1.2.1 From b6f9aa2222dc9995c438346a735a6de7670fc718 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 24 Jul 2017 07:22:37 +0200 Subject: windeployqt: Deploy the geometryloaders plugins for Qt3DRender Change-Id: Ibf296ae7ccb4373512298eef7cfd92b21891af76 Reviewed-by: Friedemann Kleint --- src/windeployqt/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index b987a64f3..7047395c4 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -816,7 +816,8 @@ static const PluginModuleMapping pluginModuleMappings[] = {"texttospeech", QtTextToSpeechModule}, {"qtwebengine", QtWebEngineModule | QtWebEngineCoreModule | QtWebEngineWidgetsModule}, {"sceneparsers", Qt3DRendererModule}, - {"renderplugins", Qt3DRendererModule} + {"renderplugins", Qt3DRendererModule}, + {"geometryloaders", Qt3DRendererModule} }; static inline quint64 qtModuleForPlugin(const QString &subDirName) -- cgit v1.2.1 From 061e1a8bbe5fb05b8f85811d55e805f54327d1d6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 27 Jul 2017 09:15:46 +0200 Subject: windeployqt: Check folder "onecore" for MSVC debug redistributable files It seems to be required depending on MSVC edition and installed toolchains. Task-number: QTBUG-61549 Change-Id: Iae800e9f37f1ca301731011e72f8d3223f3585c1 Reviewed-by: Oliver Wolff --- src/windeployqt/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 7047395c4..090277ab4 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -1048,7 +1048,10 @@ static QString vcRedistDir() const QFileInfoList subDirs = QDir(vc2017RedistDirName).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (const QFileInfo &f : subDirs) { - const QString path = f.absoluteFilePath(); + QString path = f.absoluteFilePath(); + if (QFileInfo(path + slash + vcDebugRedistDir()).isDir()) + return path; + path += QStringLiteral("/onecore"); if (QFileInfo(path + slash + vcDebugRedistDir()).isDir()) return path; } -- cgit v1.2.1 From 50a1efcb170f4df0f4602805b7a07b80798d68ab Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 1 Aug 2017 09:23:45 +0200 Subject: Fix crash regression when using ANDROID_DEPLOYMENT_DEPENDENCIES Change 919d07e6809a6705941a9819ba145062a947fa39 introduced a splitRef() on a temporary string, which will cause dangling pointers as documented. This caused crashes for everyone using ANDROID_DEPLOYMENT_DEPENDENCIES. [ChangeLog][androiddeployqt] Fixed a crash when using ANDROID_DEPLOYMENT_DEPENDENCIES to specify the files to deploy. Task-number: QTBUG-61636 Change-Id: I16dc84f76667e9b8af5edf79d7c6498657176247 Reviewed-by: BogDan Vatra --- src/androiddeployqt/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp index dd5b74bd6..51b514f51 100644 --- a/src/androiddeployqt/main.cpp +++ b/src/androiddeployqt/main.cpp @@ -774,7 +774,8 @@ bool readInputFile(Options *options) { const QJsonValue deploymentDependencies = jsonObject.value(QStringLiteral("deployment-dependencies")); if (!deploymentDependencies.isUndefined()) { - const auto dependencies = deploymentDependencies.toString().splitRef(QLatin1Char(',')); + QString deploymentDependenciesString = deploymentDependencies.toString(); + const auto dependencies = deploymentDependenciesString.splitRef(QLatin1Char(',')); for (const QStringRef &dependency : dependencies) { QString path = options->qtInstallDirectory + QLatin1Char('/') + dependency; if (QFileInfo(path).isDir()) { -- cgit v1.2.1 From fdc5749b5603653c5d0c59db267f44fd1609457e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 4 Aug 2017 16:39:21 +0200 Subject: Install missing qtwebengine_devtools_resources.pak file for WebEngine Task-number: QTBUG-59251 Change-Id: I1e1b3c3301755aaabcccb85af1ca1b2dee52a59b Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/windeployqt/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 090277ab4..69ab76441 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -1550,6 +1550,7 @@ static bool deployWebEngineCore(const QMap &qmakeVariables, const Options &options, bool isDebug, QString *errorMessage) { static const char *installDataFiles[] = {"icudtl.dat", + "qtwebengine_devtools_resources.pak", "qtwebengine_resources.pak", "qtwebengine_resources_100p.pak", "qtwebengine_resources_200p.pak"}; -- cgit v1.2.1 From 78722f6c6c89de6b0c49d9d6ce49db8506104aaf Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 24 Aug 2017 17:41:39 +0200 Subject: Don't create unused IndexItemTable Change-Id: I0fa1ea9a1b6b6d1b1da481880f7a620284456487 Reviewed-by: Karsten Heimrich --- src/assistant/help/qhelpgenerator.cpp | 3 --- tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp | 6 ------ 2 files changed, 9 deletions(-) diff --git a/src/assistant/help/qhelpgenerator.cpp b/src/assistant/help/qhelpgenerator.cpp index c8722499e..d341a04de 100644 --- a/src/assistant/help/qhelpgenerator.cpp +++ b/src/assistant/help/qhelpgenerator.cpp @@ -311,9 +311,6 @@ bool QHelpGenerator::createTables() "NamespaceId INTEGER, " "FileId INTEGER, " "Anchor TEXT )") - << QLatin1String("CREATE TABLE IndexItemTable (" - "Id INTEGER, " - "IndexId INTEGER )") << QLatin1String("CREATE TABLE IndexFilterTable (" "FilterAttributeId INTEGER, " "IndexId INTEGER )") diff --git a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp index da7e03779..10cfff9ac 100644 --- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp +++ b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp @@ -137,12 +137,6 @@ void tst_QHelpGenerator::checkIndices() || m_query->value(1).toString() != QLatin1String("foo")) QFAIL("Index Error!"); - /* - m_query->exec("SELECT COUNT(DISTINCT Id) FROM IndexItemTable"); - if (!m_query->next() || m_query->value(0).toInt() != 7) - QFAIL("Index Error!"); - */ - m_query->exec("SELECT COUNT(a.Id) FROM IndexTable a, " "IndexFilterTable b, FilterAttributeTable c WHERE a.Id=b.IndexId " "AND b.FilterAttributeId=c.Id AND c.Name=\'filter2\'"); -- cgit v1.2.1 From e5de0f5b308fb4f5357633279816f211c799e8bb Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 4 Aug 2017 08:54:31 +0200 Subject: qtattributionsscanner: Allow to use it for one single file This allows a saner use with qbs, where we can and should actually handle the dependencies correctly. In addition, this patch adds an optional '--basedir' argument that is needed to correctly root relative paths that are printed in the documentation. Change-Id: I0abf769ad5c0a3ac15b6907f83b77d369eb78d1f GPush-Base: 5c8d5742dc7b5e00a6aed447e8f288680b58e225 Reviewed-by: Christian Kandeler --- src/qtattributionsscanner/main.cpp | 49 ++++++++++++++++------ src/qtattributionsscanner/scanner.cpp | 2 +- src/qtattributionsscanner/scanner.h | 1 + .../testdata/good/minimal/expected.error | 0 .../testdata/good/minimal/expected.json | 21 ++++++++++ .../tst_qtattributionsscanner.cpp | 44 ++++++++++++++----- 6 files changed, 92 insertions(+), 25 deletions(-) create mode 100644 tests/auto/qtattributionsscanner/testdata/good/minimal/expected.error create mode 100644 tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json diff --git a/src/qtattributionsscanner/main.cpp b/src/qtattributionsscanner/main.cpp index cd9bc1fed..700bf8814 100644 --- a/src/qtattributionsscanner/main.cpp +++ b/src/qtattributionsscanner/main.cpp @@ -44,12 +44,13 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); a.setApplicationName(QStringLiteral("Qt Attributions Scanner")); - a.setApplicationVersion(QStringLiteral("1.0")); + a.setApplicationVersion(QStringLiteral("1.1")); QCommandLineParser parser; - parser.setApplicationDescription(tr("Searches and processes qt_attribution.json files in Qt sources.")); - parser.addPositionalArgument(QStringLiteral("directory"), - tr("The directory to scan recursively.")); + parser.setApplicationDescription(tr("Processes qt_attribution.json files in Qt sources.")); + parser.addPositionalArgument(QStringLiteral("path"), + tr("Path to a qt_attribution.json file, " + "or a directory to be scannned recursively.")); parser.addHelpOption(); parser.addVersionOption(); @@ -60,6 +61,10 @@ int main(int argc, char *argv[]) QCommandLineOption filterOption(QStringLiteral("filter"), tr("Filter packages according to (e.g. QDocModule=qtcore)"), QStringLiteral("expression")); + QCommandLineOption baseDirOption(QStringLiteral("basedir"), + tr("Paths in documentation are made relative to this " + "directory."), + QStringLiteral("directory")); QCommandLineOption outputOption({ QStringLiteral("o"), QStringLiteral("output") }, tr("Write generated data to ."), QStringLiteral("file")); @@ -70,6 +75,7 @@ int main(int argc, char *argv[]) parser.addOption(generatorOption); parser.addOption(filterOption); + parser.addOption(baseDirOption); parser.addOption(outputOption); parser.addOption(verboseOption); parser.addOption(silentOption); @@ -90,13 +96,22 @@ int main(int argc, char *argv[]) if (parser.positionalArguments().size() != 1) parser.showHelp(2); - const QString directory = parser.positionalArguments().last(); - - if (logLevel == VerboseLog) - std::cerr << qPrintable(tr("Recursively scanning %1 for qt_attribution.json files...").arg( - QDir::toNativeSeparators(directory))) << std::endl; - - QVector packages = Scanner::scanDirectory(directory, logLevel); + const QString path = parser.positionalArguments().last(); + + QVector packages; + const QFileInfo pathInfo(path); + if (pathInfo.isDir()) { + if (logLevel == VerboseLog) + std::cerr << qPrintable(tr("Recursively scanning %1 for qt_attribution.json files...").arg( + QDir::toNativeSeparators(path))) << std::endl; + packages = Scanner::scanDirectory(path, logLevel); + } else if (pathInfo.isFile()) { + packages = Scanner::readFile(path, logLevel); + } else { + std::cerr << qPrintable(tr("%1 is not a valid file or directory.").arg( + QDir::toNativeSeparators(path))) << std::endl << std::endl; + parser.showHelp(7); + } if (parser.isSet(filterOption)) { PackageFilter filter(parser.value(filterOption)); @@ -124,8 +139,16 @@ int main(int argc, char *argv[]) QString generator = parser.value(generatorOption); if (generator == QLatin1String("qdoc")) { - // include top level module name in printed paths - QString baseDirectory = QDir(directory).absoluteFilePath(QStringLiteral("..")); + QString baseDirectory = parser.value(baseDirOption); + if (baseDirectory.isEmpty()) { + if (pathInfo.isDir()) { + // include top level module name in printed paths + baseDirectory = pathInfo.dir().absoluteFilePath(QStringLiteral("..")); + } else { + baseDirectory = pathInfo.absoluteDir().absoluteFilePath(QStringLiteral("..")); + } + } + QDocGenerator::generate(out, packages, baseDirectory, logLevel); } else if (generator == QLatin1String("json")) { JsonGenerator::generate(out, packages, logLevel); diff --git a/src/qtattributionsscanner/scanner.cpp b/src/qtattributionsscanner/scanner.cpp index 488417e89..d7d958138 100644 --- a/src/qtattributionsscanner/scanner.cpp +++ b/src/qtattributionsscanner/scanner.cpp @@ -140,7 +140,7 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L return p; } -static QVector readFile(const QString &filePath, LogLevel logLevel) +QVector readFile(const QString &filePath, LogLevel logLevel) { if (logLevel == VerboseLog) { std::cerr << qPrintable(tr("Reading file %1...").arg( diff --git a/src/qtattributionsscanner/scanner.h b/src/qtattributionsscanner/scanner.h index 5d93cb8ee..f3ae9f0ea 100644 --- a/src/qtattributionsscanner/scanner.h +++ b/src/qtattributionsscanner/scanner.h @@ -37,6 +37,7 @@ namespace Scanner { +QVector readFile(const QString &filePath, LogLevel logLevel); QVector scanDirectory(const QString &directory, LogLevel logLevel); } diff --git a/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.error b/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.error new file mode 100644 index 000000000..e69de29bb diff --git a/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json b/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json new file mode 100644 index 000000000..6a75269c0 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json @@ -0,0 +1,21 @@ +[ + { + "Copyright": "Copyright", + "Description": "", + "Homepage": "", + "Id": "minimal", + "License": "License", + "LicenseFile": "", + "LicenseId": "", + "Name": "Minimal", + "Path": "%{PWD}", + "Files": "", + "QDocModule": "qtest", + "QtParts": [ + "libs" + ], + "QtUsage": "Usage", + "Version": "", + "DownloadLocation": "" + } +] diff --git a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp index c3e8bb9b6..7740fde9b 100644 --- a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp +++ b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp @@ -47,6 +47,8 @@ private slots: void test(); private: + void readExpectedFile(const QString &baseDir, const QString &fileName, QByteArray *content); + QString m_cmd; QString m_basePath; }; @@ -62,25 +64,45 @@ tst_qtattributionsscanner::tst_qtattributionsscanner() void tst_qtattributionsscanner::test_data() { - QTest::addColumn("directory"); - QTest::newRow("good") << QStringLiteral("good"); - QTest::newRow("warnings (incomplete)") << QStringLiteral("warnings/incomplete"); - QTest::newRow("warnings (unknown attribute)") << QStringLiteral("warnings/unknown"); + QTest::addColumn("input"); + QTest::addColumn("stdout_file"); + QTest::addColumn("stderr_file"); + + QTest::newRow("good") + << QStringLiteral("good") + << QStringLiteral("good/expected.json") + << QStringLiteral("good/expected.error"); + QTest::newRow("warnings (incomplete)") + << QStringLiteral("warnings/incomplete") + << QStringLiteral("warnings/incomplete/expected.json") + << QStringLiteral("warnings/incomplete/expected.error"); + QTest::newRow("warnings (unknown attribute)") + << QStringLiteral("warnings/unknown") + << QStringLiteral("warnings/unknown/expected.json") + << QStringLiteral("warnings/unknown/expected.error"); + QTest::newRow("singlefile") + << QStringLiteral("good/minimal/qt_attribution.json") + << QStringLiteral("good/minimal/expected.json") + << QStringLiteral("good/minimal/expected.error"); } -static void readExpectedFile(const QString &dir, const QString &fileName, QByteArray *content) +void tst_qtattributionsscanner::readExpectedFile(const QString &baseDir, const QString &fileName, QByteArray *content) { - QFile file(QDir(dir).absoluteFilePath(fileName)); + QFile file(QDir(m_basePath).absoluteFilePath(fileName)); QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), "Could not open " + file.fileName().toLocal8Bit()); *content = file.readAll(); - content->replace("%{PWD}", dir.toUtf8()); + content->replace("%{PWD}", baseDir.toUtf8()); } void tst_qtattributionsscanner::test() { - QFETCH(QString, directory); + QFETCH(QString, input); + QFETCH(QString, stdout_file); + QFETCH(QString, stderr_file); - QString dir = QDir(m_basePath).absoluteFilePath(directory); + QString dir = QDir(m_basePath).absoluteFilePath(input); + if (QFileInfo(dir).isFile()) + dir = QFileInfo(dir).absolutePath(); QProcess proc; QString command = m_cmd + " " + dir + " --output-format json"; @@ -100,7 +122,7 @@ void tst_qtattributionsscanner::test() stdErr.replace(QDir::separator(), "/"); QByteArray expectedErrorOutput; - readExpectedFile(dir, "expected.error", &expectedErrorOutput); + readExpectedFile(dir, stderr_file, &expectedErrorOutput); QCOMPARE(stdErr, expectedErrorOutput); } @@ -113,7 +135,7 @@ void tst_qtattributionsscanner::test() QVERIFY2(!actualJson.isNull(), "Invalid output: " + jsonError.errorString().toLatin1()); QByteArray expectedOutput; - readExpectedFile(dir, "expected.json", &expectedOutput); + readExpectedFile(dir, stdout_file, &expectedOutput); QJsonDocument expectedJson = QJsonDocument::fromJson(expectedOutput); if (!QTest::qCompare(actualJson, expectedJson, "actualJson", "expectedJson", __FILE__, __LINE__)) { -- cgit v1.2.1 From 066affc7c709c8a124a4c031ca2bb5ad3f91e6ff Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Aug 2017 08:47:47 +0200 Subject: Qt Designer: Add C++ guards to precompiled header Task-number: QTBUG-62872 Change-Id: I637ee1bf7c733c4ccaf45745837fda2966fe2482 Reviewed-by: Simon Hausmann --- src/designer/src/components/lib/lib_pch.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/designer/src/components/lib/lib_pch.h b/src/designer/src/components/lib/lib_pch.h index f2f226797..d03a498c2 100644 --- a/src/designer/src/components/lib/lib_pch.h +++ b/src/designer/src/components/lib/lib_pch.h @@ -26,5 +26,7 @@ ** ****************************************************************************/ +#if defined __cplusplus #include #include +#endif -- cgit v1.2.1 From cfe5b8686e58e4f4e0020dd2a7d2972acc421f43 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 4 Sep 2017 18:08:28 +0200 Subject: Bump version Change-Id: I402b6dd923139e90867663e7c50c4bb429de07e7 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 138038d54..dc68d3884 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.10.0 +MODULE_VERSION = 5.11.0 -- cgit v1.2.1