From 31e0d171d605159a83dbee3379a38e4dcd1f4b19 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Aug 2019 09:52:34 +0200 Subject: Fix qinstall on Windows for directories containing read-only files Initial patch by: Vlad Lipskiy Fixes: QTBUG-77299 Change-Id: I803b809d1f23d844252b701cb070f6e4ba34eca1 Reviewed-by: Oliver Wolff --- qmake/main.cpp | 42 ++++++++++++++++++++++++++++++------ tests/auto/tools/qmake/tst_qmake.cpp | 3 --- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/qmake/main.cpp b/qmake/main.cpp index a598296898..dd1cca9633 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -242,6 +242,39 @@ static int doLink(int argc, char **argv) #endif +static bool setFilePermissions(QFile &file, QFileDevice::Permissions permissions) +{ + if (file.setPermissions(permissions)) + return true; + fprintf(stderr, "Error setting permissions on %s: %s\n", + qPrintable(file.fileName()), qPrintable(file.errorString())); + return false; +} + +static bool copyFileTimes(QFile &targetFile, const QString &sourceFilePath, + bool mustEnsureWritability, QString *errorString) +{ +#ifdef Q_OS_WIN + bool mustRestorePermissions = false; + QFileDevice::Permissions targetPermissions; + if (mustEnsureWritability) { + targetPermissions = targetFile.permissions(); + if (!targetPermissions.testFlag(QFileDevice::WriteUser)) { + mustRestorePermissions = true; + if (!setFilePermissions(targetFile, targetPermissions | QFileDevice::WriteUser)) + return false; + } + } +#endif + if (!IoUtils::touchFile(targetFile.fileName(), sourceFilePath, errorString)) + return false; +#ifdef Q_OS_WIN + if (mustRestorePermissions && !setFilePermissions(targetFile, targetPermissions)) + return false; +#endif + return true; +} + static int installFile(const QString &source, const QString &target, bool exe = false, bool preservePermissions = false) { @@ -270,18 +303,15 @@ static int installFile(const QString &source, const QString &target, bool exe = targetPermissions |= QFileDevice::ExeOwner | QFileDevice::ExeUser | QFileDevice::ExeGroup | QFileDevice::ExeOther; } - if (!targetFile.setPermissions(targetPermissions)) { - fprintf(stderr, "Error setting permissions on %s: %s\n", - qPrintable(target), qPrintable(targetFile.errorString())); + if (!setFilePermissions(targetFile, targetPermissions)) return 3; - } - // Copy file times QString error; - if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) { + if (!copyFileTimes(targetFile, sourceFile.fileName(), preservePermissions, &error)) { fprintf(stderr, "%s", qPrintable(error)); return 3; } + return 0; } diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 8ca367773d..09e725f98a 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -679,9 +679,6 @@ void tst_qmake::qinstall() QFile srcfile(src.filePath("main.cpp")); QVERIFY(srcfile.setPermissions(srcfile.permissions() & ~writeFlags)); QDir dst("zort"); -#ifdef Q_OS_WIN - QEXPECT_FAIL("", "QTBUG-77299", Abort); -#endif QVERIFY(qinstall(src.absolutePath(), dst.absolutePath())); QCOMPARE(src.entryList(QDir::Files, QDir::Name), dst.entryList(QDir::Files, QDir::Name)); } -- cgit v1.2.3 From a547404c12b50b8c9ab6a078fce5ce9a7300586f Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 18 Feb 2019 13:09:58 +0100 Subject: QTextureFileReader: backport ASTC support Add support for astc format files as an experimental feature. To enable, configure with "-feature-texture_format_astc_experimental" (Backported from commit 5a4db421bd94acd12a4ac1f77031996b95f85dbf) Change-Id: I9a2f7b1fa20ba344b79637bafb50ff2bd0596747 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/configure.json | 5 + src/gui/util/qastchandler.cpp | 168 +++++++++++++++++++++ src/gui/util/qastchandler_p.h | 73 +++++++++ src/gui/util/qtexturefilereader.cpp | 10 +- src/gui/util/util.pri | 5 + .../util/qtexturefilereader/qtexturefilereader.qrc | 2 + .../qtexturefilereader/texturefiles/newlogo.astc | Bin 0 -> 2512 bytes .../texturefiles/newlogo_srgb.astc | Bin 0 -> 2512 bytes .../qtexturefilereader/tst_qtexturefilereader.cpp | 73 ++++++--- 9 files changed, 311 insertions(+), 25 deletions(-) create mode 100644 src/gui/util/qastchandler.cpp create mode 100644 src/gui/util/qastchandler_p.h create mode 100644 tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc create mode 100644 tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc diff --git a/src/gui/configure.json b/src/gui/configure.json index c51e3ceee3..6dd6f5b16c 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1748,6 +1748,11 @@ "section": "Images", "output": [ "publicFeature", "feature" ] }, + "texture_format_astc_experimental" : { + "label": "ASTC Texture format (experimental)", + "autoDetect": "false", + "output": [ "privateFeature" ] + }, "picture": { "label": "QPicture", "purpose": "Supports recording and replaying QPainter commands.", diff --git a/src/gui/util/qastchandler.cpp b/src/gui/util/qastchandler.cpp new file mode 100644 index 0000000000..6d163c6701 --- /dev/null +++ b/src/gui/util/qastchandler.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** 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 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qastchandler_p.h" +#include "qtexturefiledata_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +struct AstcHeader +{ + quint8 magic[4]; + quint8 blockDimX; + quint8 blockDimY; + quint8 blockDimZ; + quint8 xSize[3]; + quint8 ySize[3]; + quint8 zSize[3]; +}; + +bool QAstcHandler::canRead(const QByteArray &suffix, const QByteArray &block) +{ + Q_UNUSED(suffix) + + return block.startsWith("\x13\xAB\xA1\x5C"); +} + +quint32 QAstcHandler::astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const +{ + static const quint32 glFormatRGBABase = 0x93B0; // GL_COMPRESSED_RGBA_ASTC_4x4_KHR + static const quint32 glFormatSRGBBase = 0x93D0; // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + + static QSize dims[14] = { + { 4, 4 }, // GL_COMPRESSED_xxx_ASTC_4x4_KHR + { 5, 4 }, // GL_COMPRESSED_xxx_ASTC_5x4_KHR + { 5, 5 }, // GL_COMPRESSED_xxx_ASTC_5x5_KHR + { 6, 5 }, // GL_COMPRESSED_xxx_ASTC_6x5_KHR + { 6, 6 }, // GL_COMPRESSED_xxx_ASTC_6x6_KHR + { 8, 5 }, // GL_COMPRESSED_xxx_ASTC_8x5_KHR + { 8, 6 }, // GL_COMPRESSED_xxx_ASTC_8x6_KHR + { 8, 8 }, // GL_COMPRESSED_xxx_ASTC_8x8_KHR + { 10, 5 }, // GL_COMPRESSED_xxx_ASTC_10x5_KHR + { 10, 6 }, // GL_COMPRESSED_xxx_ASTC_10x6_KHR + { 10, 8 }, // GL_COMPRESSED_xxx_ASTC_10x8_KHR + { 10, 10 }, // GL_COMPRESSED_xxx_ASTC_10x10_KHR + { 12, 10 }, // GL_COMPRESSED_xxx_ASTC_12x10_KHR + { 12, 12 } // GL_COMPRESSED_xxx_ASTC_12x12_KHR + }; + + const QSize dim(xBlockDim, yBlockDim); + int index = -1; + for (int i = 0; i < 14; i++) { + if (dim == dims[i]) { + index = i; + break; + } + } + if (index < 0) + return 0; + + bool useSrgb = qEnvironmentVariableIsSet("QT_ASTCHANDLER_USE_SRGB") + || logName().toLower().contains("srgb"); + + return useSrgb ? (glFormatSRGBBase + index) : (glFormatRGBABase + index); +} + +QTextureFileData QAstcHandler::read() +{ + QTextureFileData nullData; + QTextureFileData res; + + if (!device()) + return nullData; + + QByteArray fileData = device()->readAll(); + if (fileData.size() < int(sizeof(AstcHeader)) || !canRead(QByteArray(), fileData)) { + qCDebug(lcQtGuiTextureIO, "Not an ASTC file: %s", logName().constData()); + return nullData; + } + res.setData(fileData); + + const AstcHeader *header = reinterpret_cast(fileData.constData()); + + int xSz = int(header->xSize[0]) | int(header->xSize[1]) << 8 | int(header->xSize[2]) << 16; + int ySz = int(header->ySize[0]) | int(header->ySize[1]) << 8 | int(header->ySize[2]) << 16; + int zSz = int(header->zSize[0]) | int(header->zSize[1]) << 8 | int(header->zSize[2]) << 16; + + quint32 glFmt = astcGLFormat(header->blockDimX, header->blockDimY); + + if (!xSz || !ySz || !zSz || !glFmt || header->blockDimZ != 1) { + qCDebug(lcQtGuiTextureIO, "Invalid ASTC header data in file %s", logName().constData()); + return nullData; + } + + res.setSize(QSize(xSz, ySz)); + res.setGLFormat(0); // 0 for compressed textures + res.setGLInternalFormat(glFmt); + //? BaseInternalFormat + + int xBlocks = (xSz + header->blockDimX - 1) / header->blockDimX; + int yBlocks = (ySz + header->blockDimY - 1) / header->blockDimY; + int zBlocks = (zSz + header->blockDimZ - 1) / header->blockDimZ; + + int byteCount = 0; + bool oob = mul_overflow(xBlocks, yBlocks, &byteCount) + || mul_overflow(byteCount, zBlocks, &byteCount) + || mul_overflow(byteCount, 16, &byteCount); + + + res.setDataOffset(sizeof(AstcHeader)); + res.setNumLevels(1); + res.setDataLength(byteCount); + + if (oob || !res.isValid()) { + qCDebug(lcQtGuiTextureIO, "Invalid ASTC file %s", logName().constData()); + return nullData; + } + + res.setLogName(logName()); + +#if 0 + qDebug() << "ASTC file handler read" << res << res.dataOffset() << res.dataLength(); +#endif + return res; +} + +QT_END_NAMESPACE diff --git a/src/gui/util/qastchandler_p.h b/src/gui/util/qastchandler_p.h new file mode 100644 index 0000000000..398f1833b6 --- /dev/null +++ b/src/gui/util/qastchandler_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** 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 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QASTCHANDLER_H +#define QASTCHANDLER_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qtexturefilehandler_p.h" + +QT_BEGIN_NAMESPACE + +class QAstcHandler : public QTextureFileHandler +{ +public: + using QTextureFileHandler::QTextureFileHandler; + + static bool canRead(const QByteArray &suffix, const QByteArray &block); + + QTextureFileData read() override; + +private: + quint32 astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const; +}; + +QT_END_NAMESPACE + +#endif // QASTCHANDLER_H diff --git a/src/gui/util/qtexturefilereader.cpp b/src/gui/util/qtexturefilereader.cpp index 5d4bd600e0..73d6b6811a 100644 --- a/src/gui/util/qtexturefilereader.cpp +++ b/src/gui/util/qtexturefilereader.cpp @@ -37,10 +37,14 @@ ** ****************************************************************************/ +#include #include "qtexturefilereader_p.h" #include "qpkmhandler_p.h" #include "qktxhandler_p.h" +#if QT_CONFIG(texture_format_astc_experimental) +#include "qastchandler_p.h" +#endif #include @@ -80,6 +84,10 @@ bool QTextureFileReader::canRead() m_handler = new QPkmHandler(m_device, logName); } else if (QKtxHandler::canRead(suffix, headerBlock)) { m_handler = new QKtxHandler(m_device, logName); +#if QT_CONFIG(texture_format_astc_experimental) + } else if (QAstcHandler::canRead(suffix, headerBlock)) { + m_handler = new QAstcHandler(m_device, logName); +#endif } // else if OtherHandler::canRead() ...etc. } @@ -89,7 +97,7 @@ bool QTextureFileReader::canRead() QList QTextureFileReader::supportedFileFormats() { // Hardcoded for now - return {QByteArrayLiteral("pkm"), QByteArrayLiteral("ktx")}; + return {QByteArrayLiteral("pkm"), QByteArrayLiteral("ktx"), QByteArrayLiteral("astc")}; } bool QTextureFileReader::init() diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index 6324642505..b36ee60a97 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -39,3 +39,8 @@ SOURCES += \ util/qtexturefilereader.cpp \ util/qpkmhandler.cpp \ util/qktxhandler.cpp + +qtConfig(texture_format_astc_experimental) { + HEADERS += util/qastchandler_p.h + SOURCES += util/qastchandler.cpp +} diff --git a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc index ab882b5db2..8aab86e1ff 100644 --- a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc +++ b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc @@ -3,5 +3,7 @@ texturefiles/car.ktx texturefiles/pattern.pkm texturefiles/car_mips.ktx + texturefiles/newlogo_srgb.astc + texturefiles/newlogo.astc diff --git a/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc new file mode 100644 index 0000000000..39bf3f1734 Binary files /dev/null and b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc differ diff --git a/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc new file mode 100644 index 0000000000..38e876829b Binary files /dev/null and b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc differ diff --git a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp index 9ff4f0ccf2..7939b688af 100644 --- a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp +++ b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include +#include #include class tst_qtexturefilereader : public QObject @@ -49,33 +50,57 @@ void tst_qtexturefilereader::checkHandlers_data() QTest::addColumn>("dataOffsets"); QTest::addColumn>("dataLengths"); - QTest::addRow("pattern.pkm") << QStringLiteral(":/texturefiles/pattern.pkm") - << QSize(64, 64) - << quint32(0x0) - << quint32(0x8d64) - << quint32(0x0) - << 1 - << (QList() << 16) - << (QList() << 2048); + QTest::addRow("pattern.pkm") + << QStringLiteral(":/texturefiles/pattern.pkm") + << QSize(64, 64) + << quint32(0x0) + << quint32(0x8d64) + << quint32(0x0) + << 1 + << (QList() << 16) + << (QList() << 2048); - QTest::addRow("car.ktx") << QStringLiteral(":/texturefiles/car.ktx") - << QSize(146, 80) - << quint32(0x0) - << quint32(0x9278) - << quint32(0x1908) - << 1 - << (QList() << 68) - << (QList() << 11840); + QTest::addRow("car.ktx") + << QStringLiteral(":/texturefiles/car.ktx") + << QSize(146, 80) + << quint32(0x0) + << quint32(0x9278) + << quint32(0x1908) + << 1 + << (QList() << 68) + << (QList() << 11840); - QTest::addRow("car_mips.ktx") << QStringLiteral(":/texturefiles/car_mips.ktx") - << QSize(146, 80) - << quint32(0x0) - << quint32(0x9274) - << quint32(0x1907) - << 8 - << (QList() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080) - << (QList() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8); + QTest::addRow("car_mips.ktx") + << QStringLiteral(":/texturefiles/car_mips.ktx") + << QSize(146, 80) + << quint32(0x0) + << quint32(0x9274) + << quint32(0x1907) + << 8 + << (QList() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080) + << (QList() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8); +#if QT_CONFIG(texture_format_astc_experimental) + QTest::addRow("newlogo.astc") + << QStringLiteral(":/texturefiles/newlogo.astc") + << QSize(111, 78) + << quint32(0x0) + << quint32(0x93b9) + << quint32(0x0) + << 1 + << (QList() << 16) + << (QList() << 2496); + + QTest::addRow("newlogo_srgb.astc") + << QStringLiteral(":/texturefiles/newlogo_srgb.astc") + << QSize(111, 78) + << quint32(0x0) + << quint32(0x93d9) + << quint32(0x0) + << 1 + << (QList() << 16) + << (QList() << 2496); +#endif // QT_CONFIG(texture_format_astc_experimental) } void tst_qtexturefilereader::checkHandlers() -- cgit v1.2.3 From 80e7120feb5ddf9d5f0c9ed12bb8580898b18db8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Aug 2019 15:29:01 +0200 Subject: eglfs/kms: Re-enable drm/gbm format overrides in the config file Follow up to 091a386eaf91ad8932332a8aefc2df793de59f6c Defaulting to querying from the egl config is fine, but dropping support for the "format" key in the output list in the json config file is not ideal. Task-number: QTBUG-76748 Change-Id: I25dc99369d118c300cdef25b464426f6be85453b Reviewed-by: Johan Helsing --- src/platformsupport/kmsconvenience/qkmsdevice.cpp | 12 +++++-- src/platformsupport/kmsconvenience/qkmsdevice_p.h | 1 + .../eglfs_kms/qeglfskmsgbmscreen.cpp | 37 +++++++++++++++------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index 7e3a870421..fec59cfc7b 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -342,10 +342,14 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, } qCDebug(qLcKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName; - const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QStringLiteral("xrgb8888")) + const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QString()) .toByteArray().toLower(); uint32_t drmFormat; - if (formatStr == "xrgb8888") { + bool drmFormatExplicit = true; + if (formatStr.isEmpty()) { + drmFormat = DRM_FORMAT_XRGB8888; + drmFormatExplicit = false; + } else if (formatStr == "xrgb8888") { drmFormat = DRM_FORMAT_XRGB8888; } else if (formatStr == "xbgr8888") { drmFormat = DRM_FORMAT_XBGR8888; @@ -368,7 +372,10 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, } else { qWarning("Invalid pixel format \"%s\" for output %s", formatStr.constData(), connectorName.constData()); drmFormat = DRM_FORMAT_XRGB8888; + drmFormatExplicit = false; } + qCDebug(qLcKmsDebug) << "Format is" << hex << drmFormat << dec << "requested_by_user =" << drmFormatExplicit + << "for output" << connectorName; const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString(); if (!cloneSource.isEmpty()) @@ -411,6 +418,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, output.forced_plane_id = 0; output.forced_plane_set = false; output.drm_format = drmFormat; + output.drm_format_requested_by_user = drmFormatExplicit; output.clone_source = cloneSource; output.size = framebufferSize; diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h index 403972fbb8..14da6bb947 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h +++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h @@ -201,6 +201,7 @@ struct QKmsOutput uint32_t forced_plane_id = 0; bool forced_plane_set = false; uint32_t drm_format = DRM_FORMAT_XRGB8888; + bool drm_format_requested_by_user = false; QString clone_source; QVector available_planes; struct QKmsPlane *eglfs_plane = nullptr; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 24f82e7843..3a2951efbd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -155,20 +155,33 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig) qCDebug(qLcEglfsKmsDebug, "Creating gbm_surface for screen %s", qPrintable(name())); const auto gbmDevice = static_cast(device())->gbmDevice(); - EGLint native_format = -1; - EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format); - qCDebug(qLcEglfsKmsDebug) << "Got native format" << hex << native_format << dec << "from eglGetConfigAttrib() with return code" << bool(success); - - if (success) - m_gbm_surface = gbm_surface_create(gbmDevice, - rawGeometry().width(), - rawGeometry().height(), - native_format, - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + // If there was no format override given in the config file, + // query the native (here, gbm) format from the EGL config. + const bool queryFromEgl = !m_output.drm_format_requested_by_user; + if (queryFromEgl) { + EGLint native_format = -1; + EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format); + qCDebug(qLcEglfsKmsDebug) << "Got native format" << hex << native_format << dec + << "from eglGetConfigAttrib() with return code" << bool(success); + + if (success) { + m_gbm_surface = gbm_surface_create(gbmDevice, + rawGeometry().width(), + rawGeometry().height(), + native_format, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + if (m_gbm_surface) + m_output.drm_format = gbmFormatToDrmFormat(native_format); + } + } - if (!m_gbm_surface) { // fallback for older drivers + // Fallback for older drivers, and when "format" is explicitly specified + // in the output config. (not guaranteed that the requested format works + // of course, but do what we are told to) + if (!m_gbm_surface) { uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format); - qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat); + if (queryFromEgl) + qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat); m_gbm_surface = gbm_surface_create(gbmDevice, rawGeometry().width(), rawGeometry().height(), -- cgit v1.2.3 From 5dc318d5e80b5ec415e981f3e655cc6cdfdab3ba Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 15 Jul 2019 14:50:33 +0200 Subject: Fix typo in description of feature datestring Change-Id: I858512af94b5160a0008789ca972cd57307cc9e2 Reviewed-by: Tasuku Suzuki Reviewed-by: Paul Wicking --- src/corelib/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 5f5a00a64f..de8d26a12b 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -814,7 +814,7 @@ }, "datestring": { "label": "QDate/QTime/QDateTime", - "purpose": "Provides convertion between dates and strings.", + "purpose": "Provides conversion between dates and strings.", "section": "Data structures", "condition": "features.textdate", "output": [ "publicFeature", "feature" ] -- cgit v1.2.3 From 12d37e70a71cf4c6b802cb95f2e85351b2648692 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Mon, 24 Jun 2019 14:59:20 -0400 Subject: Make the inputRejected test compatible with -no-feature-clipboard Qt for QNX is, by default, built without the clipboard feature. Change-Id: Ie8a36ceb0c0f0a695ae7d0fcf6f0bd70d2a43e0c Reviewed-by: Richard Moe Gustavsen Reviewed-by: Dan Cape Reviewed-by: Rafael Roquetto --- tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 95799905de..27cc385df4 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -4842,6 +4842,7 @@ void tst_QLineEdit::inputRejected() QCOMPARE(spyInputRejected.count(), 0); QTest::keyClicks(testWidget, "fgh"); QCOMPARE(spyInputRejected.count(), 3); +#if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); QApplication::clipboard()->setText("ijklmno"); @@ -4849,6 +4850,7 @@ void tst_QLineEdit::inputRejected() // The first 5 characters are accepted, but // the last 2 are not. QCOMPARE(spyInputRejected.count(), 1); +#endif testWidget->setMaxLength(INT_MAX); testWidget->clear(); @@ -4859,11 +4861,13 @@ void tst_QLineEdit::inputRejected() QCOMPARE(spyInputRejected.count(), 0); QTest::keyClicks(testWidget, "a#"); QCOMPARE(spyInputRejected.count(), 2); +#if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); QApplication::clipboard()->setText("a#"); testWidget->paste(); QCOMPARE(spyInputRejected.count(), 1); +#endif testWidget->clear(); testWidget->setValidator(0); -- cgit v1.2.3 From ec940f898b42f16bb0727f807b72488fad6d6d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 14 Aug 2019 14:20:03 +0200 Subject: SSL: ALPN: Don't include empty, too long or truncated names As is said in RFC7301 in section 3.1 [1]: Protocols are named by IANA-registered, opaque, non-empty byte strings [...]. Empty strings MUST NOT be included and byte strings MUST NOT be truncated. [1]: https://tools.ietf.org/html/rfc7301#section-3.1 Change-Id: I2c41fa99984a53cc58803e5a264d06edac964cc6 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcontext_openssl.cpp | 44 ++++++++++++++++++--------------- src/network/ssl/qsslsocket_mac.cpp | 7 ++++++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index 35cca9f01a..675d5f8e62 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -157,32 +157,36 @@ SSL* QSslContext::createSsl() for (int a = 0; a < protocols.count(); ++a) { if (protocols.at(a).size() > 255) { qCWarning(lcSsl) << "TLS NPN extension" << protocols.at(a) - << "is too long and will be truncated to 255 characters."; - protocols[a] = protocols.at(a).left(255); + << "is too long and will be ignored."; + continue; + } else if (protocols.at(a).isEmpty()) { + continue; } m_supportedNPNVersions.append(protocols.at(a).size()).append(protocols.at(a)); } - m_npnContext.data = reinterpret_cast(m_supportedNPNVersions.data()); - m_npnContext.len = m_supportedNPNVersions.count(); - m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone; + if (m_supportedNPNVersions.size()) { + m_npnContext.data = reinterpret_cast(m_supportedNPNVersions.data()); + m_npnContext.len = m_supportedNPNVersions.count(); + m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone; #if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) { - // Callback's type has a parameter 'const unsigned char ** out' - // since it was introduced in 1.0.2. Internally, OpenSSL's own code - // (tests/examples) cast it to unsigned char * (since it's 'out'). - // We just re-use our NPN callback and cast here: - typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *, - const unsigned char *, unsigned int, void *); - // With ALPN callback is for a server side only, for a client m_npnContext.status - // will stay in NextProtocolNegotiationNone. - q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext); - // Client: - q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len); - } + if (QSslSocket::sslLibraryVersionNumber() >= 0x10002000L) { + // Callback's type has a parameter 'const unsigned char ** out' + // since it was introduced in 1.0.2. Internally, OpenSSL's own code + // (tests/examples) cast it to unsigned char * (since it's 'out'). + // We just re-use our NPN callback and cast here: + typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *, + const unsigned char *, unsigned int, void *); + // With ALPN callback is for a server side only, for a client m_npnContext.status + // will stay in NextProtocolNegotiationNone. + q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext); + // Client: + q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len); + } #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ... - // And in case our peer does not support ALPN, but supports NPN: - q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); + // And in case our peer does not support ALPN, but supports NPN: + q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext); + } } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 7c5f4310f8..e6b71b293e 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -928,6 +928,13 @@ bool QSslSocketBackendPrivate::initSslContext() QCFType cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks)); if (cfNames) { for (const QByteArray &name : protocolNames) { + if (name.size() > 255) { + qCWarning(lcSsl) << "TLS ALPN extension" << name + << "is too long and will be ignored."; + continue; + } else if (name.isEmpty()) { + continue; + } QCFString cfName(QString::fromLatin1(name).toCFString()); CFArrayAppendValue(cfNames, cfName); } -- cgit v1.2.3 From 88d1909871ce1a3016ff61edd8bc2062a79f35fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Wed, 14 Aug 2019 15:40:26 +0200 Subject: Fix macOS build with -no-feature-accessibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id16b102feb7b57efcf1a36385a009774cb023f41 Reviewed-by: Jörg Bornemann --- src/plugins/platforms/cocoa/cocoa.pro | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 02e00039ae..f0dd013922 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -21,8 +21,6 @@ SOURCES += main.mm \ qcocoamenuloader.mm \ qcocoahelpers.mm \ qmultitouch_mac.mm \ - qcocoaaccessibilityelement.mm \ - qcocoaaccessibility.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ qcocoadrag.mm \ @@ -57,8 +55,6 @@ HEADERS += qcocoaintegration.h \ qcocoamenuloader.h \ qcocoahelpers.h \ qmultitouch_mac_p.h \ - qcocoaaccessibilityelement.h \ - qcocoaaccessibility.h \ qcocoacursor.h \ qcocoaclipboard.h \ qcocoadrag.h \ @@ -83,13 +79,21 @@ qtConfig(vulkan) { HEADERS += qcocoavulkaninstance.h } +qtConfig(accessibility) { + QT += accessibility_support-private + SOURCES += qcocoaaccessibilityelement.mm \ + qcocoaaccessibility.mm + HEADERS += qcocoaaccessibilityelement.h \ + qcocoaaccessibility.h +} + RESOURCES += qcocoaresources.qrc LIBS += -framework AppKit -framework CoreServices -framework Carbon -framework IOKit -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups QT += \ core-private gui-private \ - accessibility_support-private clipboard_support-private theme_support-private \ + clipboard_support-private theme_support-private \ fontdatabase_support-private graphics_support-private qtConfig(vulkan): QT += vulkan_support-private -- cgit v1.2.3 From 0d81667f87e80f7d0a866df3b0ee4a164f47e26d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Aug 2019 14:26:32 +0200 Subject: Describe the -egl option in configure's help output Change-Id: Ibb47cfc2dd0b85c33a062d03aa4d43374f71ebb1 Fixes: QTBUG-54811 Reviewed-by: Laszlo Agocs --- config_help.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/config_help.txt b/config_help.txt index fb37cbaed9..63ba289941 100644 --- a/config_help.txt +++ b/config_help.txt @@ -277,6 +277,7 @@ Gui, printing, widget options: es2 (default on Windows), desktop (default on Unix), dynamic (Windows only) -opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto] + -egl ................. Enable EGL support [auto] -angle ............... Use bundled ANGLE to support OpenGL ES 2.0 [auto] (Windows only) -combined-angle-lib .. Merge LibEGL and LibGLESv2 into LibANGLE (Windows only) -- cgit v1.2.3 From c7b1cbdea9a9ec3d9af9331d2704390d3bb0fafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 14 Aug 2019 15:01:57 +0200 Subject: Schannel: ALPN: Don't include empty, too long or truncated names As is said in RFC7301 in section 3.1 [1]: Protocols are named by IANA-registered, opaque, non-empty byte strings [...]. Empty strings MUST NOT be included and byte strings MUST NOT be truncated. [1]: https://tools.ietf.org/html/rfc7301#section-3.1 Change-Id: I38168ac570a433807e16121d5dec46d4ac73c4bf Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/ssl/qsslsocket_schannel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_schannel.cpp b/src/network/ssl/qsslsocket_schannel.cpp index 1314b432a4..c5ba823832 100644 --- a/src/network/ssl/qsslsocket_schannel.cpp +++ b/src/network/ssl/qsslsocket_schannel.cpp @@ -408,13 +408,17 @@ QByteArray createAlpnString(const QByteArrayList &nextAllowedProtocols) for (QByteArray proto : nextAllowedProtocols) { if (proto.size() > 255) { qCWarning(lcSsl) << "TLS ALPN extension" << proto - << "is too long and will be truncated to 255 characters."; - proto = proto.left(255); + << "is too long and will be ignored."; + continue; + } else if (proto.isEmpty()) { + continue; } protocolString += char(proto.length()) + proto; } return protocolString; }(); + if (names.isEmpty()) + return alpnString; const quint16 namesSize = names.size(); const quint32 alpnId = SecApplicationProtocolNegotiationExt_ALPN; -- cgit v1.2.3 From 6d3a4546934827955f0eb2b07a9928f82790ba37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 13 Aug 2019 15:17:40 +0200 Subject: DBus: fix deadlock when destroying QDBusServer Observed infrequently in the QDBus tests, it would deadlock when destroying QDBusServer at the same time as qDBusNewConnection was being executed as they were locking the same locks, but in opposite order. QDBusServer locks d->lock, then QDBusConnectionManager::instance()->mutex. While qDBusNewConnection locks QDBusConnectionManager::instance()->mutex, then serverConnection->lock (and serverConnection here is QDBusServer's d-pointer). QOrderedMutexLocker cannot be used in this situation because it operates on QMutex*, which d->lock (QReadWriteLock) is not. Change the code to lock QDBusConnectionManager's mutex before d->lock and then unlock the QMutexLocker where it would previously destruct. If QDBusConnectionManager has already been destroyed then we pass a nullptr to the QMutexLocker which is fine and will not do anything. Fixes: QTBUG-74635 Change-Id: I7f02d7759da67377996ef042c81b0969ccb8aadb Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne --- src/dbus/qdbusserver.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index a2dfb86164..3ac5c794e1 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -109,12 +109,16 @@ QDBusServer::QDBusServer(QObject *parent) */ QDBusServer::~QDBusServer() { - QWriteLocker locker(&d->lock); + QMutex *managerMutex = nullptr; + if (QDBusConnectionManager::instance()) + managerMutex = &QDBusConnectionManager::instance()->mutex; + QMutexLocker locker(managerMutex); + QWriteLocker writeLocker(&d->lock); if (QDBusConnectionManager::instance()) { - QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); for (const QString &name : qAsConst(d->serverConnectionNames)) QDBusConnectionManager::instance()->removeConnection(name); d->serverConnectionNames.clear(); + locker.unlock(); } d->serverObject = nullptr; d->ref.store(0); -- cgit v1.2.3 From 257bd49c1f47ba5fca6930082fdcf108f9d24e3f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 14 Aug 2019 19:45:17 +0200 Subject: Guard with a mutex in QOpenGLProgramBinaryCache where needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While there is likely no example of it in Qt itself, applications can use QOpenGLShaderProgram instances on different threads. These instances have nothing to do with each other but they do share a global cache object. This becomes problematic without proper synchronization. Change-Id: I80faf73f34af7e67349eee916bb3f216e22c07fd Fixes: QTBUG-77469 Reviewed-by: Christian Strømme --- src/gui/opengl/qopenglprogrambinarycache.cpp | 2 ++ src/gui/opengl/qopenglprogrambinarycache_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index af48cdacc7..40237b9935 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -263,6 +263,7 @@ public: bool QOpenGLProgramBinaryCache::load(const QByteArray &cacheKey, uint programId) { + QMutexLocker lock(&m_mutex); if (m_memCache.contains(cacheKey)) { const MemCacheEntry *e = m_memCache[cacheKey]; return setProgramBinary(programId, e->format, e->blob.constData(), e->blob.size()); @@ -401,6 +402,7 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) GLint outSize = 0; #if defined(QT_OPENGL_ES_2) if (context->isOpenGLES() && context->format().majorVersion() < 3) { + QMutexLocker lock(&m_mutex); initializeProgramBinaryOES(context); getProgramBinaryOES(programId, blobSize, &outSize, &blobFormat, p); } else diff --git a/src/gui/opengl/qopenglprogrambinarycache_p.h b/src/gui/opengl/qopenglprogrambinarycache_p.h index 9fade08e66..e181a6ab81 100644 --- a/src/gui/opengl/qopenglprogrambinarycache_p.h +++ b/src/gui/opengl/qopenglprogrambinarycache_p.h @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -99,6 +100,7 @@ private: void initializeProgramBinaryOES(QOpenGLContext *context); bool m_programBinaryOESInitialized = false; #endif + QMutex m_mutex; }; QT_END_NAMESPACE -- cgit v1.2.3 From 5d7e9c9667d60490ffbbf33ddb38736960eae1d9 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 19 Jun 2019 17:43:19 +0200 Subject: CMake: Fix prl and library names on macOS for debug configurations The paths to the libraries and prl files should have the "_debug" suffix for the debug configuration. This prefix is added to the TARGET when by qt_module.prf when doing a debug build, but not during a debug_and_release build. Make sure to strip the _debug suffix if it's there, and re-add it later always, to be consistent in both debug_and_release builds and in debug builds. Amends a12b6e7bf6688021c6af809d024958b59dfa3555. Task-number: QTBUG-38913 Task-number: QTBUG-75520 Task-number: QTBUG-77092 Change-Id: I29e88f2b991e2be06b23652d64edc768fa35a5ae (cherry picked from qt/78d67d17a6c108a419816b8bd47f78864ddbb07f) Reviewed-by: Alexandru Croitor --- mkspecs/features/create_cmake.prf | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index c9910dda53..00da9bd33f 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -34,10 +34,20 @@ CMAKE_INCLUDE_NAME = $$eval(QT.$${MODULE}.name) # TARGET here is the one changed at the end of qt_module.prf, # which already contains the Qt5 prefix and QT_LIBINFIX suffix : -# Qt5Core_suffix, Qt5Network_suffix, Foo_suffix -# (or QtCore_suffix, Foo_suffix on macos with -framework) +# Qt5Core_{libinfix_suffix}, Qt5Network_{libinfix_suffix}, Foo_{libinfix_suffix} +# (or QtCore_{libinfix_suffix}, Foo_{libinfix_suffix} on macos with -framework). CMAKE_QT_STEM = $${TARGET} +# On macOS when building just a debug configuration which is not part of debug_and_release, +# $${TARGET} already contains a _debug suffix, as per the following call chain: +# qt_module.prf -> qt5LibraryTarget -> qtLibraryTarget -> qtPlatformTargetSuffix. +# Remove the _debug suffix in the stem, to keep all further uses of CMAKE_QT_STEM consistent. +# The _debug suffix is then re-added where needed regardless if it's a debug_and_release build +# or just debug. +darwin:!qt_framework:!debug_and_release:CONFIG(debug, debug|release) { + CMAKE_QT_STEM = $$replace(CMAKE_QT_STEM, _debug$, ) +} + !generated_privates { isEmpty(SYNCQT.INJECTED_PRIVATE_HEADER_FILES):isEmpty(SYNCQT.PRIVATE_HEADER_FILES): \ CMAKE_NO_PRIVATE_INCLUDES = true @@ -211,18 +221,18 @@ CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";") mac { !isEmpty(CMAKE_STATIC_TYPE) { - CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.a + CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a - CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.prl + CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.prl CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl } else { qt_framework { - CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM} + CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}_debug CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM} CMAKE_BUILD_IS_FRAMEWORK = "true" } else { - CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib + CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.$$eval(QT.$${MODULE}.VERSION).dylib CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$$eval(QT.$${MODULE}.VERSION).dylib } } -- cgit v1.2.3 From 70e7445dbeba9bd24de963e7e431c4698b6b4569 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 30 Jul 2019 10:27:41 +0200 Subject: Simplify QBezier::addPolygon() implementation Makes the code a little cleaner, avoiding an issue caused by UB and/or optimization bug in msvc2019. Fixes: QTBUG-77119 Fixes: QTBUG-77230 Change-Id: I9bc8f427a90e6fe32b3c26301bbb703a3c4ad846 Reviewed-by: Friedemann Kleint Reviewed-by: Ville Voutilainen --- src/gui/painting/qbezier.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 8cda4b4072..65e6063fe4 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -122,10 +122,10 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold int levels[10]; beziers[0] = *this; levels[0] = 9; - QBezier *b = beziers; - int *lvl = levels; + int top = 0; - while (b >= beziers) { + while (top >= 0) { + QBezier *b = &beziers[top]; // check if we can pop the top bezier curve from the stack qreal y4y1 = b->y4 - b->y1; qreal x4x1 = b->x4 - b->x1; @@ -139,17 +139,15 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3); l = 1.; } - if (d < bezier_flattening_threshold*l || *lvl == 0) { + if (d < bezier_flattening_threshold * l || levels[top] == 0) { // good enough, we pop it off and add the endpoint polygon->append(QPointF(b->x4, b->y4)); - --b; - --lvl; + --top; } else { // split, second half of the polygon goes lower into the stack b->split(b+1, b); - lvl[1] = --lvl[0]; - ++b; - ++lvl; + levels[top + 1] = --levels[top]; + ++top; } } } @@ -160,10 +158,10 @@ void QBezier::addToPolygon(QDataBuffer &polygon, qreal bezier_flattenin int levels[10]; beziers[0] = *this; levels[0] = 9; - QBezier *b = beziers; - int *lvl = levels; + int top = 0; - while (b >= beziers) { + while (top >= 0) { + QBezier *b = &beziers[top]; // check if we can pop the top bezier curve from the stack qreal y4y1 = b->y4 - b->y1; qreal x4x1 = b->x4 - b->x1; @@ -177,17 +175,15 @@ void QBezier::addToPolygon(QDataBuffer &polygon, qreal bezier_flattenin qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3); l = 1.; } - if (d < bezier_flattening_threshold*l || *lvl == 0) { + if (d < bezier_flattening_threshold * l || levels[top] == 0) { // good enough, we pop it off and add the endpoint polygon.add(QPointF(b->x4, b->y4)); - --b; - --lvl; + --top; } else { // split, second half of the polygon goes lower into the stack b->split(b+1, b); - lvl[1] = --lvl[0]; - ++b; - ++lvl; + levels[top + 1] = --levels[top]; + ++top; } } } -- cgit v1.2.3 From fa7d7ae658e60a84a711401430cefbff4b6b0693 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Aug 2019 15:13:13 +0200 Subject: Fix -no-feature-mimetype build Change-Id: I282f630d6e8a0b2b10fd1286d7a185a068abc9f1 Reviewed-by: Alexandru Croitor --- src/plugins/printsupport/cups/qppdprintdevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp index ea6336c4d1..8bfa239dbe 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.cpp +++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp @@ -40,11 +40,11 @@ #include "qppdprintdevice.h" #include "qcupsprintersupport_p.h" +#include "private/qcups_p.h" // Only needed for PDPK_* +#if QT_CONFIG(mimetype) #include -#include - -#include "private/qcups_p.h" // Only needed for PDPK_* +#endif #ifndef QT_LINUXBASE // LSB merges everything into cups.h #include -- cgit v1.2.3 From fc049052812bfa0b63af1f3c5fcadf1eb582e775 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 19 Aug 2019 15:04:42 +0200 Subject: macOS: Bail out early in case a popup is closed by a mouseDown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It can happen that AppKit calls -mouseDown: on a popup's view, but we consider the click to be outside of popup's area (happens on the 1-pixel edge of a 'geometry', QRect::contains() returns false). If we send close event to essentially 'self', m_platformWindow is becoming nullptr. So we bail out early, no further processing is needed. Fixes: QTBUG-77348 Change-Id: I224943e6bcf4ae052412ef7dc7b23a94f999aa19 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview_mouse.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm index a887cb841d..3a5a074264 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -389,14 +389,16 @@ } // Close the popups if the click was outside. if (!inside) { + bool selfClosed = false; Qt::WindowType type = QCocoaIntegration::instance()->activePopupWindow()->window()->type(); while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) { + selfClosed = self == popup->view(); QWindowSystemInterface::handleCloseEvent(popup->window()); QWindowSystemInterface::flushWindowSystemEvents(); } // Consume the mouse event when closing the popup, except for tool tips // were it's expected that the event is processed normally. - if (type != Qt::ToolTip) + if (type != Qt::ToolTip || selfClosed) return; } } -- cgit v1.2.3 From 1f3ade1d9b096cc05ae5878be0cb903ab0dba753 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Aug 2019 15:28:38 +0200 Subject: Fix disabling bearermanagement The source code is still only using the old negative define check. Change-Id: I7e2775d6d4664cb5b802b0a40fb3f1711c8f6915 Reviewed-by: Alexandru Croitor --- src/network/configure.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/configure.json b/src/network/configure.json index 07d46b790e..f74c481f38 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -360,7 +360,11 @@ "purpose": "Provides bearer management for the network stack.", "section": "Networking", "condition": "features.thread && features.library && features.networkinterface && features.properties", - "output": [ "publicFeature", "feature" ] + "output": [ + "publicFeature", + "feature", + { "type": "define", "negative": true, "name": "QT_NO_BEARERMANAGEMENT" } + ] }, "localserver": { "label": "QLocalServer", -- cgit v1.2.3 From a847f5cd8562d3d42fb4cbdb42367466119f8d5f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Aug 2019 08:51:10 -0700 Subject: Fix qErrnoWarning() printing no error in some conditions Because it allocates memory, it may call system functions that set errno or Win32's GetLastError(). [ChangeLog][QtCore] Fixed a bug that made qErrnoWarning() say there was no error when generating the error message. Fixes: QTBUG-77322 Change-Id: Ife213d861bb14c1787e1fffd15b811a4f83cf3e7 Reviewed-by: Friedemann Kleint --- src/corelib/global/qlogging.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 1a74757032..bf9c2ed2be 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1923,12 +1923,14 @@ void qErrnoWarning(const char *msg, ...) { // qt_error_string() will allocate anyway, so we don't have // to be careful here (like we do in plain qWarning()) + QString error_string = qt_error_string(-1); // before vasprintf changes errno/GetLastError() + va_list ap; va_start(ap, msg); QString buf = QString::vasprintf(msg, ap); va_end(ap); - buf += QLatin1String(" (") + qt_error_string(-1) + QLatin1Char(')'); + buf += QLatin1String(" (") + error_string + QLatin1Char(')'); QMessageLogContext context; qt_message_output(QtCriticalMsg, context, buf); } -- cgit v1.2.3 From fe2aaf1b904ad0cb6246813430aeb7ea1a137609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 6 Aug 2019 14:31:54 +0200 Subject: qmake: Quote path to project file in Xcode project Makefile rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I40aba757486548ef9f319d3176e89eb7129a007e Reviewed-by: Jörg Bornemann --- mkspecs/features/mac/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 60b2eb2117..26bd3e2e98 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -270,7 +270,7 @@ xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identif QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting !macx-xcode { - generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) $$QMAKE_ARGS + generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS generate_xcode_project.target = xcodeproj QMAKE_EXTRA_VARIABLES += _PRO_FILE_ QMAKE_EXTRA_TARGETS += generate_xcode_project -- cgit v1.2.3 From 7595a02b577d1a9eb3e19a22d3ac4caacd6cb1ac Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Aug 2019 15:39:46 +0200 Subject: Fix building with -no-feature-codecs Change-Id: Ifce31a5ef07101f5ef8aabbc81b42eee47153961 Reviewed-by: Alexandru Croitor --- src/corelib/codecs/qicucodec.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index 101c3a3278..5a778c2638 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -42,14 +42,17 @@ #include "qtextcodec_p.h" #include "qutfcodec_p.h" #include "qlatincodec_p.h" -#include "qtsciicodec_p.h" -#include "qisciicodec_p.h" #include "qsimplecodec_p.h" #include "private/qcoreglobaldata_p.h" #include "qdebug.h" #include "unicode/ucnv.h" +#if QT_CONFIG(codecs) +#include "qtsciicodec_p.h" +#include "qisciicodec_p.h" +#endif + QT_BEGIN_NAMESPACE typedef QList::ConstIterator TextCodecListConstIt; -- cgit v1.2.3 From 626340d45882c7dcb9e56e7bdbae38f04a5b1cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 20 Aug 2019 15:05:19 +0200 Subject: iOS: Fix NSUInteger vs NSInteger comparison warning Change-Id: I700132084c208f4ce63e0fc0516ebc3df7881ab0 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/ios/quiview_accessibility.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/quiview_accessibility.mm b/src/plugins/platforms/ios/quiview_accessibility.mm index 458ddcc9b8..6612dc131e 100644 --- a/src/plugins/platforms/ios/quiview_accessibility.mm +++ b/src/plugins/platforms/ios/quiview_accessibility.mm @@ -101,7 +101,7 @@ - (id)accessibilityElementAtIndex:(NSInteger)index { [self initAccessibility]; - if (index >= [m_accessibleElements count]) + if (NSUInteger(index) >= [m_accessibleElements count]) return nil; return m_accessibleElements[index]; } -- cgit v1.2.3 From c4aa90cb566a58ce3e2a18de134b83d0a959fed2 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 21 Aug 2019 10:05:33 +0200 Subject: Point out that dynamically modified meta objects are not threadsafe Given that this is an exception, it doesn't invalidate the general thread-safety of static meta objects, and putting a locking mechanism into Qt for this would be complete over- (and performance-)kill. Task-number: QTBUG-70915 Change-Id: I4a538b977f5c2e8173cb236023e5d9ca34add5b5 Reviewed-by: Ulf Hermann --- src/corelib/kernel/qmetaobject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 666bb6eace..927d03f830 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -112,6 +112,13 @@ QT_BEGIN_NAMESPACE are returned by classInfo(), and you can search for pairs with indexOfClassInfo(). + \note Operations that use the meta object system are generally thread- + safe, as QMetaObjects are typically static read-only instances + generated at compile time. However, if meta objects are dynamically + modified by the application (for instance, when using QQmlPropertyMap), + then the application has to explicitly synchronize access to the + respective meta object. + \sa QMetaClassInfo, QMetaEnum, QMetaMethod, QMetaProperty, QMetaType, {Meta-Object System} */ -- cgit v1.2.3 From 987cca7bca559295e69bc4c34f76651732fd4c8f Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 19 Jun 2019 15:54:48 +1000 Subject: wasm: allow setting total memory for non thread builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using WASM_OBJECT_FILES does not allow memory growth, so we need to just explicitly check for QMAKE_WASM_TOTAL_MEMORY Change-Id: I447113972dfc3df4ee4073e8cc25481646d1507b Reviewed-by: Morten Johan Sørvig --- mkspecs/features/wasm/wasm.prf | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf index 54d351bfd5..25413d7470 100644 --- a/mkspecs/features/wasm/wasm.prf +++ b/mkspecs/features/wasm/wasm.prf @@ -6,16 +6,6 @@ exists($$QMAKE_QT_CONFIG) { qtConfig(thread) { EMCC_THREAD_LFLAGS += -s USE_PTHREADS=1 - # Hardcode wasm memory size. Emscripten does not currently support memory growth - # (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size - # at build time. Further, browsers limit the maximum initial memory size to 1GB. - TOTAL_MEMORY = 1GB - !isEmpty(QMAKE_WASM_TOTAL_MEMORY) { - TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY - } - - message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY) - EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY # Create worker threads at startup. This is supposed to be an optimization, # however exceeding the pool size has been obesverved to hang the application. @@ -29,6 +19,20 @@ exists($$QMAKE_QT_CONFIG) { } else { EMCC_THREAD_LFLAGS += -s ALLOW_MEMORY_GROWTH=1 } + + qtConfig(thread) | !isEmpty(QMAKE_WASM_TOTAL_MEMORY) { + + # Hardcode wasm memory size. Emscripten does not currently support memory growth + # (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size + # at build time. Further, browsers limit the maximum initial memory size to 1GB. + # QMAKE_WASM_TOTAL_MEMORY must be a multiple of 64KB + TOTAL_MEMORY = 1GB + !isEmpty(QMAKE_WASM_TOTAL_MEMORY) { + TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY + } + message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY) + EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY + } QMAKE_LFLAGS += $$EMCC_THREAD_LFLAGS QMAKE_LFLAGS_DEBUG += $$EMCC_THREAD_LFLAGS QMAKE_CFLAGS += $$EMCC_THREAD_LFLAGS -- cgit v1.2.3 From ee82f866152a27ef7a0d69f3aa41608d4a058610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 21 Aug 2019 16:37:16 +0200 Subject: macOS: Don't ask for a NSWindow background unless we need one This allow halfway transparent windows, even with a border, which is a bit of a weird use-case, but matches what we do on other platforms. We don't need the explicit call to NSDrawWindowBackground in the QNSWindowBackingStore implementation, as the NSThemeFrame will draw this background on our behalf. Fixes: QTBUG-77637 Change-Id: I012d845fa957c40aa713adaecbb1601a848e3534 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 3 --- src/plugins/platforms/cocoa/qnswindow.mm | 14 ++------------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index af50aabe15..02f56b4516 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -212,9 +212,6 @@ void QNSWindowBackingStore::flush(QWindow *window, const QRegion ®ion, const CGRect viewRect = viewLocalRect.toCGRect(); - if (windowHasUnifiedToolbar()) - NSDrawWindowBackground(viewRect); - [backingStoreImage drawInRect:viewRect fromRect:backingStoreRect.toCGRect() operation:compositingOperation fraction:1.0 respectFlipped:YES hints:nil]; diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 52f765eb31..68cb270457 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -253,20 +253,10 @@ static bool isMouseEvent(NSEvent *ev) return m_platformWindow ? m_platformWindow->isOpaque() : [super isOpaque]; } -/*! - Borderless windows need a transparent background - - Technically windows with NSWindowStyleMaskTexturedBackground - (such as windows with unified toolbars) need to draw the textured - background of the NSWindow, and can't have a transparent - background, but as NSWindowStyleMaskBorderless is 0, you can't - have a window with NSWindowStyleMaskTexturedBackground that is - also borderless. -*/ - (NSColor *)backgroundColor { - return self.styleMask == NSWindowStyleMaskBorderless - ? [NSColor clearColor] : [super backgroundColor]; + return self.styleMask & NSWindowStyleMaskTexturedBackground ? + [super backgroundColor] : [NSColor clearColor]; } - (void)sendEvent:(NSEvent*)theEvent -- cgit v1.2.3 From e688e28ee5e154baa03dbafdad06f8db69ef880c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 21 Aug 2019 12:36:21 +0200 Subject: macOS: Invalidate backingstore and trigger expose on color space changes Fixes: QTBUG-77749 Change-Id: I677a71152e4a218c08d8863d4f886d158a79e809 Reviewed-by: Volker Hilsheimer Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoabackingstore.h | 5 +++++ src/plugins/platforms/cocoa/qcocoabackingstore.mm | 22 ++++++++++++++++++++++ src/plugins/platforms/cocoa/qcocoawindow.h | 1 + src/plugins/platforms/cocoa/qcocoawindow.mm | 11 +++++++++++ 4 files changed, 39 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h index 9be6814ae7..a874936ce6 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -54,6 +54,8 @@ class QCocoaBackingStore : public QRasterBackingStore protected: QCocoaBackingStore(QWindow *window); QCFType colorSpace() const; + QMacNotificationObserver m_backingPropertiesObserver; + virtual void backingPropertiesChanged() = 0; }; class QNSWindowBackingStore : public QCocoaBackingStore @@ -69,6 +71,7 @@ private: bool windowHasUnifiedToolbar() const; QImage::Format format() const override; void redrawRoundedBottomCorners(CGRect) const; + void backingPropertiesChanged() override; }; class QCALayerBackingStore : public QCocoaBackingStore @@ -115,6 +118,8 @@ private: bool recreateBackBufferIfNeeded(); bool prepareForFlush(); + void backingPropertiesChanged() override; + std::list> m_buffers; }; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 02f56b4516..5d5e406d8a 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -51,6 +51,17 @@ QT_BEGIN_NAMESPACE QCocoaBackingStore::QCocoaBackingStore(QWindow *window) : QRasterBackingStore(window) { + // Ideally this would be plumbed from the platform layer to QtGui, and + // the QBackingStore would be recreated, but we don't have that code yet, + // so at least make sure we invalidate our backingstore when the backing + // properties (color space e.g.) are changed. + NSView *view = static_cast(window->handle())->view(); + m_backingPropertiesObserver = QMacNotificationObserver(view.window, + NSWindowDidChangeBackingPropertiesNotification, [this]() { + qCDebug(lcQpaBackingStore) << "Backing properties for" + << this->window() << "did change"; + backingPropertiesChanged(); + }); } QCFType QCocoaBackingStore::colorSpace() const @@ -299,6 +310,11 @@ void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const #endif } +void QNSWindowBackingStore::backingPropertiesChanged() +{ + m_image = QImage(); +} + // ---------------------------------------------------------------------------- // https://stackoverflow.com/a/52722575/2761869 @@ -574,6 +590,12 @@ QImage QCALayerBackingStore::toImage() const return imageCopy; } +void QCALayerBackingStore::backingPropertiesChanged() +{ + m_buffers.clear(); + m_buffers.resize(1); +} + QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const { return m_buffers.back().get(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index fef72bc496..c6ce6e6819 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -161,6 +161,7 @@ public: Q_NOTIFICATION_HANDLER(NSWindowDidOrderOffScreenNotification) void windowDidOrderOffScreen(); Q_NOTIFICATION_HANDLER(NSWindowDidChangeOcclusionStateNotification) void windowDidChangeOcclusionState(); Q_NOTIFICATION_HANDLER(NSWindowDidChangeScreenNotification) void windowDidChangeScreen(); + Q_NOTIFICATION_HANDLER(NSWindowDidChangeBackingPropertiesNotification) void windowDidChangeBackingProperties(); Q_NOTIFICATION_HANDLER(NSWindowWillCloseNotification) void windowWillClose(); bool windowShouldClose(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index d6f88b4f23..3008a056a2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1261,6 +1261,17 @@ void QCocoaWindow::windowDidChangeScreen() currentScreen->requestUpdate(); } } +/* + The window's backing scale factor or color space has changed. +*/ +void QCocoaWindow::windowDidChangeBackingProperties() +{ + // Ideally we would plumb this thought QPA in a way that lets clients + // invalidate their own caches, and recreate QBackingStore. For now we + // trigger an expose, and let QCocoaBackingStore deal with its own + // buffer invalidation. + [m_view setNeedsDisplay:YES]; +} void QCocoaWindow::windowWillClose() { -- cgit v1.2.3 From c47f4361751a13cf729e9f0ea8d9646391732e5d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 16 Aug 2019 11:39:20 +0200 Subject: Avoid double QCache lookup in QOpenGLProgramBinaryCache Change-Id: I4384a15f0b89e1f6d7f59bff1816fc2e6fc6adfe Reviewed-by: Marc Mutz --- src/gui/opengl/qopenglprogrambinarycache.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 40237b9935..c3fb375a20 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -264,10 +264,8 @@ public: bool QOpenGLProgramBinaryCache::load(const QByteArray &cacheKey, uint programId) { QMutexLocker lock(&m_mutex); - if (m_memCache.contains(cacheKey)) { - const MemCacheEntry *e = m_memCache[cacheKey]; + if (const MemCacheEntry *e = m_memCache.object(cacheKey)) return setProgramBinary(programId, e->format, e->blob.constData(), e->blob.size()); - } QByteArray buf; const QString fn = cacheFileName(cacheKey); -- cgit v1.2.3 From b1db1dd655788fb685949959c99c901515bfd8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 23 Jul 2019 12:44:45 +0200 Subject: Fix build with -no-feature-printer on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-62675 Change-Id: I3bfcd6d78c3124769ff8662941472333c795fdbe Reviewed-by: Jörg Bornemann --- src/plugins/platforms/cocoa/cocoa.pro | 27 ++++++++++++---------- .../platforms/cocoa/qcocoanativeinterface.mm | 10 ++++---- src/plugins/platforms/cocoa/qpaintengine_mac.mm | 4 ++++ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index f0dd013922..4cf9e64447 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -103,17 +103,20 @@ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { QT_FOR_CONFIG += widgets - SOURCES += \ - qpaintengine_mac.mm \ - qprintengine_mac.mm \ - qcocoaprintersupport.mm \ - qcocoaprintdevice.mm \ - - HEADERS += \ - qpaintengine_mac_p.h \ - qprintengine_mac_p.h \ - qcocoaprintersupport.h \ - qcocoaprintdevice.h \ + SOURCES += qpaintengine_mac.mm + HEADERS += qpaintengine_mac_p.h + + qtHaveModule(printsupport) { + QT += printsupport-private + SOURCES += \ + qprintengine_mac.mm \ + qcocoaprintersupport.mm \ + qcocoaprintdevice.mm + HEADERS += \ + qcocoaprintersupport.h \ + qcocoaprintdevice.h \ + qprintengine_mac_p.h + } qtConfig(colordialog) { SOURCES += qcocoacolordialoghelper.mm @@ -130,7 +133,7 @@ qtHaveModule(widgets) { HEADERS += qcocoafontdialoghelper.h } - QT += widgets-private printsupport-private + QT += widgets-private } OTHER_FILES += cocoa.json diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 9bd19dd07c..d0e69bdca5 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -59,7 +59,7 @@ #include "qguiapplication.h" #include -#ifndef QT_NO_WIDGETS +#if !defined(QT_NO_WIDGETS) && defined(QT_PRINTSUPPORT_LIB) #include "qcocoaprintersupport.h" #include "qprintengine_mac_p.h" #include @@ -153,24 +153,24 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport() { -#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) +#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB) return new QCocoaPrinterSupport(); #else - qFatal("Printing is not supported when Qt is configured with -no-widgets"); + qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer"); return nullptr; #endif } void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine) { -#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) +#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB) QMacPrintEnginePrivate *macPrintEnginePriv = static_cast(printEngine)->d_func(); if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized()) macPrintEnginePriv->initialize(); return macPrintEnginePriv->printInfo; #else Q_UNUSED(printEngine); - qFatal("Printing is not supported when Qt is configured with -no-widgets"); + qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer"); return nullptr; #endif } diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 3677877538..00b2267f0d 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -38,14 +38,18 @@ ****************************************************************************/ #include "qpaintengine_mac_p.h" +#if defined(QT_PRINTSUPPORT_LIB) #include "qprintengine_mac_p.h" +#endif #include #include #include #include #include +#if defined(QT_PRINTSUPPORT_LIB) #include +#endif #include #include #include -- cgit v1.2.3 From 536cab1a93850c80e18f44872ecca7decdeb7eea Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 29 Jul 2019 10:07:31 +1000 Subject: wasm: add network object checking This should help when things are moving fast, and downloads and network object are destroyed before the callbacks finishes. Change-Id: I1f65965bd61efc2e641d03eb071f23e684dd5c44 Reviewed-by: Edward Welbourne --- src/network/access/qnetworkreplywasmimpl.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index 53784407d8..f28b8415d1 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -63,6 +63,8 @@ static void q_requestErrorCallback(val event) return; val xhr = event["target"]; + if (xhr.isNull() || xhr.isUndefined()) + return; quintptr func = xhr["data-handler"].as(); QNetworkReplyWasmImplPrivate *reply = reinterpret_cast(func); @@ -84,6 +86,8 @@ static void q_progressCallback(val event) return; val xhr = event["target"]; + if (xhr.isNull() || xhr.isUndefined()) + return; QNetworkReplyWasmImplPrivate *reply = reinterpret_cast(xhr["data-handler"].as()); @@ -99,6 +103,8 @@ static void q_loadCallback(val event) return; val xhr = event["target"]; + if (xhr.isNull() || xhr.isUndefined()) + return; QNetworkReplyWasmImplPrivate *reply = reinterpret_cast(xhr["data-handler"].as()); @@ -123,8 +129,13 @@ static void q_loadCallback(val event) } else if (responseType == "arraybuffer" || responseType == "blob") { // handle this data in the FileReader, triggered by the call to readAsArrayBuffer val blob = xhr["response"]; + if (blob.isNull() || blob.isUndefined()) + return; val reader = val::global("FileReader").new_(); + if (reader.isNull() || reader.isUndefined()) + return; + reader.set("onload", val::module_property("qt_QNetworkReplyWasmImplPrivate_readBinary")); reader.set("data-handler", xhr["data-handler"]); @@ -151,6 +162,8 @@ static void q_responseHeadersCallback(val event) return; val xhr = event["target"]; + if (xhr.isNull() || xhr.isUndefined()) + return; if (xhr["readyState"].as() == 2) { // HEADERS_RECEIVED std::string responseHeaders = xhr.call("getAllResponseHeaders"); @@ -170,6 +183,8 @@ static void q_readBinary(val event) return; val fileReader = event["target"]; + if (fileReader.isNull() || fileReader.isUndefined()) + return; QNetworkReplyWasmImplPrivate *reply = reinterpret_cast(fileReader["data-handler"].as()); @@ -180,6 +195,9 @@ static void q_readBinary(val event) // Set up source typed array val result = fileReader["result"]; // ArrayBuffer + if (result.isNull() || result.isUndefined()) + return; + val Uint8Array = val::global("Uint8Array"); val sourceTypedArray = Uint8Array.new_(result); -- cgit v1.2.3 From 96ff6e8ebe80215a0d35055c7382bb1cf58fc660 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Aug 2019 09:35:20 +0200 Subject: QGuiApplication: drop mutex before emitting fontChanged() Emitting a signal executes an unknowable amount of code. We shouldn't hold a mutex while doing so. E.g., if the signal emission causes another call to QGuiApplication::setFont(), the old code would deadlock, since applicationFontMutex is not recursive. Fix by taking a copy of the application font under mutex protection, then dropping the lock for the emission of the signal. Change-Id: Ib2569b3a08af6ef5f38459a19f74cb0db27b7772 Reviewed-by: Volker Hilsheimer Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5014878bd2..359d182dd9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3284,8 +3284,11 @@ void QGuiApplication::setFont(const QFont &font) *QGuiApplicationPrivate::app_font = font; applicationResourceFlags |= ApplicationFontExplicitlySet; - if (emitChange && qGuiApp) - emit qGuiApp->fontChanged(*QGuiApplicationPrivate::app_font); + if (emitChange && qGuiApp) { + auto font = *QGuiApplicationPrivate::app_font; + locker.unlock(); + emit qGuiApp->fontChanged(font); + } } /*! -- cgit v1.2.3 From 92f4523c8a257fae5331583a023fb9a9f3393ca4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 23 Aug 2019 08:47:31 +0200 Subject: Fix classical strcmp misuse in VS project generator The conditions were wrong, they must compare against zero. Also, use qstricmp to avoid the platform #ifdef. Change-Id: I7e5ef1b9ae8e2e1d3d9ce90a645ee568b370ab57 Reviewed-by: Oliver Wolff Reviewed-by: Marc Mutz --- qmake/generators/win32/msvc_objectmodel.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 68f62c8dda..4c7ad4b291 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1567,21 +1567,12 @@ bool VCLinkerTool::parseOption(const char* option) const char* str = option+6; if (*str == 'S') ShowProgress = linkProgressAll; -#ifndef Q_OS_WIN - else if (strncasecmp(str, "pginstrument", 12)) + else if (qstricmp(str, "pginstrument") == 0) LinkTimeCodeGeneration = optLTCGInstrument; - else if (strncasecmp(str, "pgoptimize", 10)) + else if (qstricmp(str, "pgoptimize") == 0) LinkTimeCodeGeneration = optLTCGOptimize; - else if (strncasecmp(str, "pgupdate", 8 )) + else if (qstricmp(str, "pgupdate") == 0) LinkTimeCodeGeneration = optLTCGUpdate; -#else - else if (_stricmp(str, "pginstrument")) - LinkTimeCodeGeneration = optLTCGInstrument; - else if (_stricmp(str, "pgoptimize")) - LinkTimeCodeGeneration = optLTCGOptimize; - else if (_stricmp(str, "pgupdate")) - LinkTimeCodeGeneration = optLTCGUpdate; -#endif } } else { AdditionalOptions.append(option); -- cgit v1.2.3 From f8d41309c8a62345c32da180507bcd60316dbb0c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 14:44:13 -0700 Subject: Use qsizetype for qt_memfill functions Just in case the image is larger than 2 GB (512 megapixels). Change-Id: I343f2beed55440a7ac0bfffd15636cbc68dfa13d Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 1e2bf51d3e5d891db3c1383e6567d1c77dfc8973) Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 17 ++++++++++------- src/gui/painting/qdrawhelper_mips_dsp.cpp | 2 +- src/gui/painting/qdrawhelper_mips_dsp_p.h | 2 +- src/gui/painting/qdrawhelper_neon.cpp | 2 +- src/gui/painting/qdrawhelper_neon_p.h | 2 +- src/gui/painting/qdrawhelper_p.h | 26 +++++++++++++------------- src/gui/painting/qdrawhelper_sse2.cpp | 6 +++--- src/gui/painting/qdrawhelper_x86_p.h | 4 ++-- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 6265d51037..7b8104914c 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6278,7 +6278,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = #if defined(Q_CC_MSVC) && !defined(_MIPS_) template -inline void qt_memfill_template(T *dest, T color, int count) +inline void qt_memfill_template(T *dest, T color, qsizetype count) { while (count--) *dest++ = color; @@ -6287,9 +6287,12 @@ inline void qt_memfill_template(T *dest, T color, int count) #else template -inline void qt_memfill_template(T *dest, T color, int count) +inline void qt_memfill_template(T *dest, T color, qsizetype count) { - int n = (count + 7) / 8; + if (!count) + return; + + qsizetype n = (count + 7) / 8; switch (count & 0x07) { case 0: do { *dest++ = color; Q_FALLTHROUGH(); @@ -6305,7 +6308,7 @@ inline void qt_memfill_template(T *dest, T color, int count) } template <> -inline void qt_memfill_template(quint16 *dest, quint16 value, int count) +inline void qt_memfill_template(quint16 *dest, quint16 value, qsizetype count) { if (count < 3) { switch (count) { @@ -6327,19 +6330,19 @@ inline void qt_memfill_template(quint16 *dest, quint16 value, int count) } #endif -void qt_memfill64(quint64 *dest, quint64 color, int count) +void qt_memfill64(quint64 *dest, quint64 color, qsizetype count) { qt_memfill_template(dest, color, count); } #if !defined(__SSE2__) -void qt_memfill16(quint16 *dest, quint16 color, int count) +void qt_memfill16(quint16 *dest, quint16 color, qsizetype count) { qt_memfill_template(dest, color, count); } #endif #if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__) -void qt_memfill32(quint32 *dest, quint32 color, int count) +void qt_memfill32(quint32 *dest, quint32 color, qsizetype count) { qt_memfill_template(dest, color, count); } diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index e92a6606de..17597deb1d 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE -void qt_memfill32(quint32 *dest, quint32 color, int count) +void qt_memfill32(quint32 *dest, quint32 color, qsizetype count) { qt_memfill32_asm_mips_dsp(dest, color, count); } diff --git a/src/gui/painting/qdrawhelper_mips_dsp_p.h b/src/gui/painting/qdrawhelper_mips_dsp_p.h index 36c4af2732..a3d0410274 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp_p.h +++ b/src/gui/painting/qdrawhelper_mips_dsp_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) -extern "C" void qt_memfill32_asm_mips_dsp(quint32 *dest, quint32 value, int count); +extern "C" void qt_memfill32_asm_mips_dsp(quint32 *dest, quint32 value, qsizetype count); extern "C" void comp_func_SourceOver_asm_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha); diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 3fbd651f96..0d99bd54fb 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -void qt_memfill32(quint32 *dest, quint32 value, int count) +void qt_memfill32(quint32 *dest, quint32 value, qsizetype count) { const int epilogueSize = count % 16; #if defined(Q_CC_GHS) || defined(Q_CC_MSVC) diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index 40475a9bde..19e1f21a3b 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -123,7 +123,7 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); -void qt_memfill32_neon(quint32 *dest, quint32 value, int count); +void qt_memfill32_neon(quint32 *dest, quint32 value, qsizetype count); void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index fb08261205..f2e0819bea 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -163,9 +163,9 @@ extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::N extern DrawHelper qDrawHelper[QImage::NImageFormats]; void qBlendTexture(int count, const QSpan *spans, void *userData); -extern void qt_memfill64(quint64 *dest, quint64 value, int count); -extern void qt_memfill32(quint32 *dest, quint32 value, int count); -extern void qt_memfill16(quint16 *dest, quint16 value, int count); +extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count); +extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); +extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha); typedef void (QT_FASTCALL *CompositionFunction64)(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha); @@ -888,35 +888,35 @@ inline quint24::operator uint() const } template Q_STATIC_TEMPLATE_FUNCTION -void qt_memfill(T *dest, T value, int count); +void qt_memfill(T *dest, T value, qsizetype count); -template<> inline void qt_memfill(quint64 *dest, quint64 color, int count) +template<> inline void qt_memfill(quint64 *dest, quint64 color, qsizetype count) { qt_memfill64(dest, color, count); } -template<> inline void qt_memfill(quint32 *dest, quint32 color, int count) +template<> inline void qt_memfill(quint32 *dest, quint32 color, qsizetype count) { qt_memfill32(dest, color, count); } -template<> inline void qt_memfill(quint16 *dest, quint16 color, int count) +template<> inline void qt_memfill(quint16 *dest, quint16 color, qsizetype count) { qt_memfill16(dest, color, count); } -template<> inline void qt_memfill(quint8 *dest, quint8 color, int count) +template<> inline void qt_memfill(quint8 *dest, quint8 color, qsizetype count) { memset(dest, color, count); } template -inline void qt_memfill(T *dest, T value, int count) +inline void qt_memfill(T *dest, T value, qsizetype count) { if (!count) return; - int n = (count + 7) / 8; + qsizetype n = (count + 7) / 8; switch (count & 0x07) { case 0: do { *dest++ = value; Q_FALLTHROUGH(); @@ -937,7 +937,7 @@ inline void qt_rectfill(T *dest, T value, { char *d = reinterpret_cast(dest + x) + y * stride; if (uint(stride) == (width * sizeof(T))) { - qt_memfill(reinterpret_cast(d), value, width * height); + qt_memfill(reinterpret_cast(d), value, qsizetype(width) * height); } else { for (int j = 0; j < height; ++j) { dest = reinterpret_cast(d); @@ -958,7 +958,7 @@ do { \ /* Duff's device */ \ uint *_d = (uint*)(dest) + length; \ const uint *_s = (uint*)(src) + length; \ - int n = ((length) + 7) / 8; \ + qsizetype n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *--_d = *--_s; Q_FALLTHROUGH(); \ @@ -978,7 +978,7 @@ do { \ /* Duff's device */ \ ushort *_d = (ushort*)(dest); \ const ushort *_s = (const ushort*)(src); \ - int n = ((length) + 7) / 8; \ + qsizetype n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *_d++ = *_s++; Q_FALLTHROUGH(); \ diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 3212ffdd2d..2ae8a092df 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -233,7 +233,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u } } -void qt_memfill32(quint32 *dest, quint32 value, int count) +void qt_memfill32(quint32 *dest, quint32 value, qsizetype count) { if (count < 7) { switch (count) { @@ -263,7 +263,7 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) } } - int count128 = count / 4; + qsizetype count128 = count / 4; __m128i *dst128 = reinterpret_cast<__m128i*>(dest); __m128i *end128 = dst128 + count128; const __m128i value128 = _mm_set_epi32(value, value, value, value); @@ -314,7 +314,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u } } -void qt_memfill16(quint16 *dest, quint16 value, int count) +void qt_memfill16(quint16 *dest, quint16 value, qsizetype count) { if (count < 3) { switch (count) { diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h index cefc213999..964d522fd2 100644 --- a/src/gui/painting/qdrawhelper_x86_p.h +++ b/src/gui/painting/qdrawhelper_x86_p.h @@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE #ifdef __SSE2__ -void qt_memfill32(quint32 *dest, quint32 value, int count); -void qt_memfill16(quint16 *dest, quint16 value, int count); +void qt_memfill32(quint32 *dest, quint32 value, qsizetype count); +void qt_memfill16(quint16 *dest, quint16 value, qsizetype count); void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *src, int width, int height, int stride); -- cgit v1.2.3 From e1b0dfc1d406e132fd42ecebcc7bd260e9ef8f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 14:14:00 +0200 Subject: macOS: Choose appropriate NSWindow depth based on surface format Change-Id: I67e63412096ca11a8f056f5755525311756906ef Reviewed-by: Andy Nichols Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 31 +++++++++++++++++++++++ src/plugins/platforms/cocoa/qcocoawindow.mm | 15 ----------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 5d5e406d8a..cb453f7613 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -75,6 +75,37 @@ QCFType QCocoaBackingStore::colorSpace() const QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window) : QCocoaBackingStore(window) { + // Choose an appropriate window depth based on the requested surface format. + // On deep color displays the default bit depth is 16-bit, so unless we need + // that level of precision we opt out of it (and the expensive RGB32 -> RGB64 + // conversions that come with it if our backingstore depth does not match). + + NSWindow *nsWindow = static_cast(window->handle())->view().window; + auto colorSpaceName = NSColorSpaceFromDepth(nsWindow.depthLimit); + + static const int kDefaultBitDepth = 8; + auto surfaceFormat = window->requestedFormat(); + auto bitsPerSample = qMax(kDefaultBitDepth, qMax(surfaceFormat.redBufferSize(), + qMax(surfaceFormat.greenBufferSize(), surfaceFormat.blueBufferSize()))); + + // NSBestDepth does not seem to guarantee a window depth deep enough for the + // given bits per sample, even if documented as such. For example, requesting + // 10 bits per sample will not give us a 16-bit format, even if that's what's + // available. Work around this by manually bumping the bit depth. + bitsPerSample = !(bitsPerSample & (bitsPerSample - 1)) + ? bitsPerSample : qNextPowerOfTwo(bitsPerSample); + + auto bestDepth = NSBestDepth(colorSpaceName, bitsPerSample, 0, NO, nullptr); + + // Disable dynamic depth limit, otherwise our depth limit will be overwritten + // by AppKit if the window moves to a screen with a different depth. We call + // this before setting the depth limit, as the call will reset the depth to 0. + [nsWindow setDynamicDepthLimit:NO]; + + qCDebug(lcQpaBackingStore) << "Using" << NSBitsPerSampleFromDepth(bestDepth) + << "bit window depth for" << nsWindow; + + nsWindow.depthLimit = bestDepth; } QNSWindowBackingStore::~QNSWindowBackingStore() diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 3008a056a2..a3120f4ccc 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1659,21 +1659,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) applyContentBorderThickness(nsWindow); - // Prevent CoreGraphics RGB32 -> RGB64 backing store conversions on deep color - // displays by forcing 8-bit components, unless a deep color format has been - // requested. This conversion uses significant CPU time. - QSurface::SurfaceType surfaceType = QPlatformWindow::window()->surfaceType(); - bool usesCoreGraphics = surfaceType == QSurface::RasterSurface || surfaceType == QSurface::RasterGLSurface; - QSurfaceFormat surfaceFormat = QPlatformWindow::window()->format(); - bool usesDeepColor = surfaceFormat.redBufferSize() > 8 || - surfaceFormat.greenBufferSize() > 8 || - surfaceFormat.blueBufferSize() > 8; - bool usesLayer = view().layer; - if (usesCoreGraphics && !usesDeepColor && !usesLayer) { - [nsWindow setDynamicDepthLimit:NO]; - [nsWindow setDepthLimit:NSWindowDepthTwentyfourBitRGB]; - } - if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace) nsWindow.colorSpace = NSColorSpace.sRGBColorSpace; -- cgit v1.2.3 From 29b1ac069721e3ebfd883685c9dce0524125ec39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 14:10:56 +0200 Subject: Don't defer platform backingstore creation if we already have a platform window The creation was made lazy in 18f415e46d592f, for those platforms (macOS) that need a platform window to successfully create a platform backingstore. But we don't need to delay creation if we actually have a platform window at the time of constructing the QBackingStore. Change-Id: I6367736ddca82900dec2751a85a8bc35cc742bb5 Reviewed-by: Volker Hilsheimer Reviewed-by: Lars Knoll Reviewed-by: Timur Pocheptsov --- src/gui/painting/qbackingstore.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index b9ed3d4995..f86dfbfba1 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -95,6 +95,11 @@ public: QBackingStore::QBackingStore(QWindow *window) : d_ptr(new QBackingStorePrivate(window)) { + if (window->handle()) { + // Create platform backingstore up front if we have a platform window, + // otherwise delay the creation until absolutely necessary. + handle(); + } } /*! -- cgit v1.2.3 From 09bfc52dde56cd525cfad4437b26ab534f72a86c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Aug 2019 22:01:09 +0200 Subject: Remove broken wild card list from QMake's help output The description of the project mode looked like this: -project Put qmake into project file generation mode In this mode qmake interprets files as files to be built, defaults to *; *; *; *.ts; *.xlf; *.qrc The list of wildcards is incomplete. Unfortunately the file extensions are defined in QMAKE_EXT_* variables in mkspecs, and the help display code has no access to that data. This went unnoticed for quite some time, and fixing this is too involved considering the gain. Replace the text above with the static text below: -project Put qmake into project file generation mode In this mode qmake interprets [files] as files to be added to the .pro file. By default, all files with known source extensions are added. Change-Id: I815a50957c05dccc45e1cd6657f568599d1911f6 Reviewed-by: Oliver Wolff --- qmake/generators/projectgenerator.cpp | 2 +- qmake/option.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index f45a90b851..9611d3fc30 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE -QString project_builtin_regx() //calculate the builtin regular expression.. +static QString project_builtin_regx() //calculate the builtin regular expression.. { QString ret; QStringList builtin_exts; diff --git a/qmake/option.cpp b/qmake/option.cpp index dcebeadcb8..626a2cec0d 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -122,7 +122,6 @@ static QString detectProjectFile(const QString &path) return ret; } -QString project_builtin_regx(); bool usage(const char *a0) { fprintf(stdout, "Usage: %s [mode] [options] [files]\n" @@ -134,9 +133,9 @@ bool usage(const char *a0) "\n" "Mode:\n" " -project Put qmake into project file generation mode%s\n" - " In this mode qmake interprets files as files to\n" - " be built,\n" - " defaults to %s\n" + " In this mode qmake interprets [files] as files to\n" + " be added to the .pro file. By default, all files with\n" + " known source extensions are added.\n" " Note: The created .pro file probably will \n" " need to be edited. For example add the QT variable to \n" " specify what modules are required.\n" @@ -184,7 +183,7 @@ bool usage(const char *a0) " -nomoc Don't generate moc targets [makefile mode only]\n" " -nopwd Don't look for files in pwd [project mode only]\n" ,a0, - default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", project_builtin_regx().toLatin1().constData(), + default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", default_mode(a0) == Option::QMAKE_GENERATE_MAKEFILE ? " (default)" : "" ); return false; -- cgit v1.2.3 From 23cfdf74cb57fcd29d3732b0b405452a488b3adc Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 16 Aug 2019 18:59:03 +0200 Subject: Also fall back to direct write for Android content: URLs in QSaveFile We cannot rename into content: URLs, so that is the only option, and this is particularly relevant here as the native file dialog will give us content: URLs by default for saving to. Change-Id: Ie96fcfc404a0842d397c7d1554e3c76f06bb3074 Reviewed-by: Thiago Macieira --- src/corelib/io/qsavefile.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index fac8892da2..7ee9142e14 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -244,9 +244,15 @@ bool QSaveFile::open(OpenMode mode) return false; }; + bool requiresDirectWrite = false; #ifdef Q_OS_WIN // check if it is an Alternate Data Stream - if (d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1) { + requiresDirectWrite = d->finalFileName == d->fileName && d->fileName.indexOf(QLatin1Char(':'), 2) > 1; +#elif defined(Q_OS_ANDROID) + // check if it is a content:// URL + requiresDirectWrite = d->fileName.startsWith(QLatin1String("content://")); +#endif + if (requiresDirectWrite) { // yes, we can't rename onto it... if (d->directWriteFallback) { if (openDirectly()) @@ -256,14 +262,12 @@ bool QSaveFile::open(OpenMode mode) d->fileEngine = 0; } else { QString msg = - QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback " - "enabled: path contains an Alternate Data Stream specifier") - .arg(QDir::toNativeSeparators(d->fileName)); + QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback enabled.") + .arg(QDir::toNativeSeparators(d->fileName)); d->setError(QFileDevice::OpenError, msg); } return false; } -#endif d->fileEngine = new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared); // if the target file exists, we'll copy its permissions below, -- cgit v1.2.3 From b3dc0c13e88f3bd859c96144a9d4280c675665bc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 24 Aug 2019 06:47:41 +0200 Subject: Fix assertion on passing nullptr QLatin1Strings to qt_compare_strings qstrnicmp() has an assertion that the lhs string is not nullptr. Fix by moving the length check back to the front, regardless of cs's value. Amends cad7100fda1b27ba56c4d9efc6bceba62859dfbc. Change-Id: I31f808936c8dc6fbb10a70a59923746ef3e675e9 Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 4852d20082..ad2e8bbcd8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1199,10 +1199,10 @@ static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensit static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW { - if (cs == Qt::CaseInsensitive) - return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size()); if (lhs.isEmpty()) return lencmp(0, rhs.size()); + if (cs == Qt::CaseInsensitive) + return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size()); const auto l = std::min(lhs.size(), rhs.size()); int r = qstrncmp(lhs.data(), rhs.data(), l); return r ? r : lencmp(lhs.size(), rhs.size()); -- cgit v1.2.3 From f2f1a93c58b6cb88f3cd0655e95ccd5ad99286d0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 7 Aug 2019 21:36:41 +0200 Subject: QToolBarLayout: fix position calculation Fix a bug introduced in d493f676a38f000dd9c22dee6eea2b5ae4291e0a while calculating the size / position of the layout item. Fixes: QTBUG-77115 Change-Id: I20ad1685659da7225009734e25287e590367aa9e Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qtoolbarlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index d50e19a5ed..961a261e8f 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -533,7 +533,7 @@ bool QToolBarLayout::layoutActions(const QSize &size) if (expanded) rperp(o, size) = rowHeight; else - rperp(o, size) = perp(o, rect.size()) - perp(o, QSize(margins.top(), margins.left())); + rperp(o, size) = perp(o, rect.size()) - perp(o, margins); QRect r(pos, size); if (o == Qt::Horizontal) -- cgit v1.2.3 From 46f3b40a6d8c96a0531b461e2d13bbf28a6ec735 Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Mon, 15 Jul 2019 14:04:57 +0200 Subject: Docs: Some cleanup of class documentation Change-Id: I62f89157e57189a97151f9661bc354af9bd67468 Reviewed-by: Kai Koehne --- src/corelib/io/qloggingcategory.cpp | 267 +++++++++++++++++------------------- 1 file changed, 127 insertions(+), 140 deletions(-) diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 33253429a2..89607d5a98 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -70,14 +70,16 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) QLoggingCategory represents a certain logging category - identified by a string - at runtime. A category can be configured to enable or disable - logging of messages per message type. Whether a message type is enabled or - not can be checked with the \l isDebugEnabled(), \l isInfoEnabled(), - \l isWarningEnabled(), and \l isCriticalEnabled() methods. - - All objects are meant to be configured by a common registry (see also - \l{Configuring Categories}). Different objects can also represent the same - category. It is therefore not recommended to export objects across module - boundaries, nor to manipulate the objects directly, nor to inherit from + logging of messages per message type. + + To check whether a message type is enabled or not, use one of these methods: + \l isDebugEnabled(), \l isInfoEnabled(), \l isWarningEnabled(), and + \l isCriticalEnabled(). + + All objects are meant to be configured by a common registry, as described in + \l{Configuring Categories}. Different objects can also represent the same + category. Therefore, it's \b{not} recommended to export objects across + module boundaries, to manipulate the objects directly, or to inherit from QLoggingCategory. \section1 Creating Category Objects @@ -87,17 +89,17 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) \snippet qloggingcategory/main.cpp 1 - \note Category names are free text. However, to allow easy configuration - of the categories using \l{Logging Rules} the names should follow some rules: + Category names are free text; to configure categories using \l{Logging Rules}, their + names should follow this convention: \list \li Use letters and numbers only. - \li Further structure categories into common areas by using dots. - \li Avoid the category names \c{debug}, \c{info}, \c{warning}, and \c{critical}. - \li Category names starting with \c{qt} are reserved for Qt modules. + \li Use dots to further structure categories into common areas. + \li Avoid the category names: \c{debug}, \c{info}, \c{warning}, and \c{critical}. + \li Category names with the \c{qt} prefix are solely reserved for Qt modules. \endlist - QLoggingCategory objects implicitly defined by Q_LOGGING_CATEGORY() - are created on first use in a thread-safe manner. + QLoggingCategory objects that are implicitly defined by Q_LOGGING_CATEGORY() + are created on first use, in a thread-safe manner. \section1 Checking Category Configuration @@ -105,8 +107,8 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) \l isWarningEnabled(), \l isCriticalEnabled(), as well as \l isEnabled() to check whether messages for the given message type should be logged. - \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments - from being evaluated if the respective message types are not enabled for the + The qCDebug(), qCWarning(), and qCCritical() macros prevent arguments from + being evaluated if the respective message types are not enabled for the category, so explicit checking is not needed: \snippet qloggingcategory/main.cpp 4 @@ -119,28 +121,27 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) \snippet qloggingcategory/main.cpp 5 - will log messages of type \c QtWarningMsg, \c QtCriticalMsg, \c QtFatalMsg, but will - ignore messages of type \c QtDebugMsg and \c QtInfoMsg. + logs messages of type \c QtWarningMsg, \c QtCriticalMsg, \c QtFatalMsg, but + ignores messages of type \c QtDebugMsg and \c QtInfoMsg. - If no argument is passed, all messages will be logged. + If no argument is passed, all messages are logged. \section1 Configuring Categories - The default configuration of categories can be overridden either by setting logging - rules, or by installing a custom filter. + You can override the default configuration for categories either by setting + logging rules, or by installing a custom filter. \section2 Logging Rules - Logging rules allow logging for categories to be enabled or disabled in a - flexible way. Rules are specified in text, where every line must have the - format + Logging rules let you enable or disable logging for categories in a flexible + way. Rules are specified in text, where every line must have the format: \snippet code/src_corelib_io_qloggingcategory.cpp 0 \c is the name of the category, potentially with \c{*} as a - wildcard symbol as the first or last character (or at both positions). - The optional \c must be either \c debug, \c info, \c warning, or \c critical. - Lines that do not fit this scheme are ignored. + wildcard symbol for the first or last character; or at both positions. + The optional \c must be \c debug, \c info, \c warning, or \c critical. + Lines that don't fit this scheme are ignored. Rules are evaluated in text order, from first to last. That is, if two rules apply to a category/type, the rule that comes later is applied. @@ -149,47 +150,37 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) \snippet code/src_corelib_io_qloggingcategory.cpp 1 - Since Qt 5.3, logging rules are also - automatically loaded from the \c [Rules] section of a logging - configuration file. Such configuration files are looked up in the QtProject - configuration directory, or explicitly set in a \c QT_LOGGING_CONF - environment variable: + Logging rules are automatically loaded from the \c [Rules] section in a logging + configuration file. These configuration files are looked up in the QtProject + configuration directory, or explicitly set in a \c QT_LOGGING_CONF environment + variable: \snippet code/src_corelib_io_qloggingcategory.cpp 2 - Since Qt 5.3, logging rules can also be specified in a \c QT_LOGGING_RULES - environment variable. And since Qt 5.6, multiple rules can also be - separated by semicolons: + Logging rules can also be specified in a \c QT_LOGGING_RULES environment variable; + multiple rules can also be separated by semicolons: \snippet code/src_corelib_io_qloggingcategory.cpp 3 - Rules set by \l setFilterRules() take precedence over rules specified - in the QtProject configuration directory, and can, in turn, be - overwritten by rules from the configuration file specified by - \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. - - Order of evaluation: - \list - \li [QLibraryInfo::DataPath]/qtlogging.ini - \li QtProject/qtlogging.ini - \li \l setFilterRules() - \li \c QT_LOGGING_CONF - \li \c QT_LOGGING_RULES + Rules set by \l setFilterRules() take precedence over rules specified in the + QtProject configuration directory. In turn, these rules can be overwritten by those + from the configuration file specified by \c QT_LOGGING_CONF, and those set by + \c QT_LOGGING_RULES. + + The order of evaluation is as follows: + \list 1 + \li [QLibraryInfo::DataPath]/qtlogging.ini + \li QtProject/qtlogging.ini + \li \l setFilterRules() + \li \c QT_LOGGING_CONF + \li \c QT_LOGGING_RULES \endlist The \c QtProject/qtlogging.ini file is looked up in all directories returned - by QStandardPaths::GenericConfigLocation, e.g. + by QStandardPaths::GenericConfigLocation. - \list - \li on \macos and iOS: \c ~/Library/Preferences - \li on Unix: \c ~/.config, \c /etc/xdg - \li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%, - \l QCoreApplication::applicationDirPath(), - QCoreApplication::applicationDirPath() + \c "/data" - \endlist - - Set the \c QT_LOGGING_DEBUG environment variable to see from where - logging rules are loaded. + Set the \c QT_LOGGING_DEBUG environment variable to find out where you logging + rules are loaded from. \section2 Installing a Custom Filter @@ -211,7 +202,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) If \a category is \c{0}, the category name is changed to \c "default". - Note that \a category must be kept valid during the lifetime of this object. + \note \a category must be kept valid during the lifetime of this object. */ QLoggingCategory::QLoggingCategory(const char *category) : d(0), @@ -226,7 +217,7 @@ QLoggingCategory::QLoggingCategory(const char *category) If \a category is \c{0}, the category name is changed to \c "default". - Note that \a category must be kept valid during the lifetime of this object. + \note \a category must be kept valid during the lifetime of this object. \since 5.4 */ @@ -251,7 +242,7 @@ void QLoggingCategory::init(const char *category, QtMsgType severityLevel) } /*! - Destructs a QLoggingCategory object. + Destroys a QLoggingCategory object. */ QLoggingCategory::~QLoggingCategory() { @@ -268,24 +259,24 @@ QLoggingCategory::~QLoggingCategory() /*! \fn bool QLoggingCategory::isDebugEnabled() const - Returns \c true if debug messages should be shown for this category. - Returns \c false otherwise. + Returns \c true if debug messages should be shown for this category; + \c false otherwise. - \note The \l qCDebug() macro already does this check before executing any - code. However, calling this method may be useful to avoid - expensive generation of data that is only used for debug output. + \note The \l qCDebug() macro already does this check before running any + code. However, calling this method may be useful to avoid the + expensive generation of data for debug output only. */ /*! \fn bool QLoggingCategory::isInfoEnabled() const - Returns \c true if informational messages should be shown for this category. - Returns \c false otherwise. + Returns \c true if informational messages should be shown for this category; + \c false otherwise. \note The \l qCInfo() macro already does this check before executing any - code. However, calling this method may be useful to avoid - expensive generation of data that is only used for debug output. + code. However, calling this method may be useful to avoid the + expensive generation of data for debug output only. \since 5.5 */ @@ -294,28 +285,28 @@ QLoggingCategory::~QLoggingCategory() /*! \fn bool QLoggingCategory::isWarningEnabled() const - Returns \c true if warning messages should be shown for this category. - Returns \c false otherwise. + Returns \c true if warning messages should be shown for this category; + \c false otherwise. \note The \l qCWarning() macro already does this check before executing any - code. However, calling this method may be useful to avoid - expensive generation of data that is only used for debug output. + code. However, calling this method may be useful to avoid the + expensive generation of data for debug output only. */ /*! \fn bool QLoggingCategory::isCriticalEnabled() const - Returns \c true if critical messages should be shown for this category. - Returns \c false otherwise. + Returns \c true if critical messages should be shown for this category; + \c false otherwise. \note The \l qCCritical() macro already does this check before executing any - code. However, calling this method may be useful to avoid - expensive generation of data that is only used for debug output. + code. However, calling this method may be useful to avoid the + expensive generation of data for debug output only. */ /*! Returns \c true if a message of type \a msgtype for the category should be - shown. Returns \c false otherwise. + shown; \c false otherwise. */ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const { @@ -332,11 +323,11 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const /*! Changes the message type \a type for the category to \a enable. - This method is meant to be used only from inside a filter - installed by \l installFilter(). See \l {Configuring Categories} for - an overview on how to configure categories globally. + This method is meant for use only from inside a filter installed with + \l installFilter(). For an overview on how to configure categories globally, + see \l {Configuring Categories}. - \note \c QtFatalMsg cannot be changed. It will always remain \c true. + \note \c QtFatalMsg cannot be changed; it will always remain \c true. */ void QLoggingCategory::setEnabled(QtMsgType type, bool enable) { @@ -359,28 +350,25 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable) /*! \fn QLoggingCategory &QLoggingCategory::operator()() - Returns the object itself. This allows both a QLoggingCategory variable, and - a factory method returning a QLoggingCategory, to be used in \l qCDebug(), - \l qCWarning(), \l qCCritical() macros. + Returns the object itself. This allows for both: a QLoggingCategory variable, and + a factory method that returns a QLoggingCategory, to be used in \l qCDebug(), + \l qCWarning(), or \l qCCritical() macros. */ /*! \fn const QLoggingCategory &QLoggingCategory::operator()() const - Returns the object itself. This allows both a QLoggingCategory variable, and - a factory method returning a QLoggingCategory, to be used in \l qCDebug(), - \l qCWarning(), \l qCCritical() macros. + Returns the object itself. This allows for both: a QLoggingCategory variable, and + a factory method that returns a QLoggingCategory, to be used in \l qCDebug(), + \l qCWarning(), or \l qCCritical() macros. */ /*! - Returns a pointer to the global category \c "default" that - is used e.g. by qDebug(), qInfo(), qWarning(), qCritical(), qFatal(). + Returns a pointer to the global category \c "default" that is used, for + example, by qDebug(), qInfo(), qWarning(), qCritical(), or qFatal(). - \note The returned pointer may be null during destruction of - static objects. - - \note Ownership of the category is not transferred, do not - \c delete the returned pointer. + \note The pointer returned may be null during destruction of static objects. + Also, don't \c delete this pointer, as ownership of the category isn't transferred. */ QLoggingCategory *QLoggingCategory::defaultCategory() @@ -391,8 +379,7 @@ QLoggingCategory *QLoggingCategory::defaultCategory() /*! \typedef QLoggingCategory::CategoryFilter - This is a typedef for a pointer to a function with the following - signature: + This is a typedef for a pointer to a function with the following signature: \snippet qloggingcategory/main.cpp 20 @@ -408,14 +395,13 @@ QLoggingCategory *QLoggingCategory::defaultCategory() filter is free to change the respective category configuration with \l setEnabled(). - The filter might be called from different threads, but never concurrently. - The filter shall not call any static functions of QLoggingCategory. + When you define your filter, note that it can be called from different threads; but never + concurrently. This filter cannot call any static functions from QLoggingCategory. Example: \snippet qloggingcategory/main.cpp 21 - An alternative way of configuring the default filter is via - \l setFilterRules(). + Alternatively, you can configure the default filter via \l setFilterRules(). */ QLoggingCategory::CategoryFilter QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter) @@ -425,15 +411,15 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter) /*! Configures which categories and message types should be enabled through a - a set of \a rules. + set of \a rules. Example: \snippet qloggingcategory/main.cpp 2 \note The rules might be ignored if a custom category filter is installed - with \l installFilter(), or if the user defined \c QT_LOGGING_CONF or \c QT_LOGGING_RULES - environment variable. + with \l installFilter(), or if the user has defined the \c QT_LOGGING_CONF + or the \c QT_LOGGING_RULES environment variable. */ void QLoggingCategory::setFilterRules(const QString &rules) { @@ -446,7 +432,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.2 - Returns an output stream for debug messages in the logging category + Returns an output stream for debug messages in the logging category, \a category. The macro expands to code that checks whether @@ -457,8 +443,8 @@ void QLoggingCategory::setFilterRules(const QString &rules) \snippet qloggingcategory/main.cpp 10 - \note Arguments are not processed if debug output for the category is not - enabled, so do not rely on any side effects. + \note Arguments aren't processed if the debug output for that \a category is not + enabled, so don't rely on any side effects. \sa qDebug() */ @@ -469,16 +455,16 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.3 - Logs a debug message \a message in the logging category \a category. - \a message might contain place holders that are replaced by additional - arguments, similar to the C printf() function. + Logs a debug message, \a message, in the logging category, \a category. + \a message may contain place holders to be replaced by additional arguments, + similar to the C printf() function. Example: \snippet qloggingcategory/main.cpp 13 - \note Arguments might not be processed if debug output for the category is - not enabled, so do not rely on any side effects. + \note Arguments aren't processed if the debug output for that \a category is not + enabled, so don't rely on any side effects. \sa qDebug() */ @@ -489,7 +475,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.5 - Returns an output stream for informational messages in the logging category + Returns an output stream for informational messages in the logging category, \a category. The macro expands to code that checks whether @@ -500,8 +486,8 @@ void QLoggingCategory::setFilterRules(const QString &rules) \snippet qloggingcategory/main.cpp qcinfo_stream - \note Arguments are not processed if debug output for the category is not - enabled, so do not rely on any side effects. + \note If the debug output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qInfo() */ @@ -512,16 +498,16 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.5 - Logs an informational message \a message in the logging category \a category. - \a message might contain place holders that are replaced by additional - arguments, similar to the C printf() function. + Logs an informational message, \a message, in the logging category, \a category. + \a message may contain place holders to be replaced by additional arguments, + similar to the C printf() function. Example: \snippet qloggingcategory/main.cpp qcinfo_printf - \note Arguments might not be processed if debug output for the category is - not enabled, so do not rely on any side effects. + \note If the debug output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qInfo() */ @@ -532,7 +518,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.2 - Returns an output stream for warning messages in the logging category + Returns an output stream for warning messages in the logging category, \a category. The macro expands to code that checks whether @@ -543,8 +529,8 @@ void QLoggingCategory::setFilterRules(const QString &rules) \snippet qloggingcategory/main.cpp 11 - \note Arguments are not processed if warning output for the category is not - enabled, so do not rely on any side effects. + \note If the warning output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qWarning() */ @@ -555,16 +541,16 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.3 - Logs a warning message \a message in the logging category \a category. - \a message might contain place holders that are replaced by additional - arguments, similar to the C printf() function. + Logs a warning message, \a message, in the logging category, \a category. + \a message may contain place holders to be replaced by additional arguments, + similar to the C printf() function. Example: \snippet qloggingcategory/main.cpp 14 - \note Arguments might not be processed if warning output for the category is - not enabled, so do not rely on any side effects. + \note If the warning output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qWarning() */ @@ -575,7 +561,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.2 - Returns an output stream for critical messages in the logging category + Returns an output stream for critical messages in the logging category, \a category. The macro expands to code that checks whether @@ -586,8 +572,9 @@ void QLoggingCategory::setFilterRules(const QString &rules) \snippet qloggingcategory/main.cpp 12 - \note Arguments are not processed if critical output for the category is not - enabled, so do not rely on any side effects. + + \note If the critical output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qCritical() */ @@ -598,16 +585,16 @@ void QLoggingCategory::setFilterRules(const QString &rules) \threadsafe \since 5.3 - Logs a critical message \a message in the logging category \a category. - \a message might contain place holders that are replaced by additional - arguments, similar to the C printf() function. + Logs a critical message, \a message, in the logging category, \a category. + \a message may contain place holders to be replaced by additional arguments, + similar to the C printf() function. Example: \snippet qloggingcategory/main.cpp 15 - \note Arguments might not be processed if critical output for the category - is not enabled, so do not rely on any side effects. + \note If the critical output for a particular category isn't enabled, arguments + won't be processed, so don't rely on any side effects. \sa qCritical() */ @@ -633,7 +620,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) \a string identifier. By default, all message types are enabled. Only one translation unit in a library or executable can define a category - with a specific name. The implicitly defined QLoggingCategory object is + with a specific name. The implicitly-defined QLoggingCategory object is created on first use, in a thread-safe manner. This macro must be used outside of a class or method. @@ -650,7 +637,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) and more severe are enabled, types with a lower severity are disabled. Only one translation unit in a library or executable can define a category - with a specific name. The implicitly defined QLoggingCategory object is + with a specific name. The implicitly-defined QLoggingCategory object is created on first use, in a thread-safe manner. This macro must be used outside of a class or method. It is only defined -- cgit v1.2.3 From 375f56506089f98118aa1848ed9f05a35e212c90 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Thu, 22 Aug 2019 15:12:56 +0200 Subject: Fix reporting the network interface type on macOS 10.14.5 and later * initialize the structure used as argument to ioctl SIOCGIFMEDIA The ioctl in ifType(...) returned -1 and set errno to EFAULT, thus the code to determine the interface type was not executed. Task-number: QTBUG-76408 Change-Id: Ib69c2c0cd4dda3604d568adf9746e0c9a280e9a0 Reviewed-by: Thiago Macieira Reviewed-by: Karsten Heimrich Reviewed-by: Christian Ehrlicher --- src/network/kernel/qnetworkinterface_unix.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp index c28c5ea9e6..4c57bff3bc 100644 --- a/src/network/kernel/qnetworkinterface_unix.cpp +++ b/src/network/kernel/qnetworkinterface_unix.cpp @@ -485,6 +485,7 @@ static QList createInterfaces(ifaddrs *rawList) struct ifreq req; }; int socket = -1; + memset(&mediareq, 0, sizeof(mediareq)); // ensure both structs start with the name field, of size IFNAMESIZ Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name)); -- cgit v1.2.3 From 351f6eb52bd6b0e8e5d969afa4022dc741df8580 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 29 Jul 2019 14:12:04 +0200 Subject: Add Third-Party code in qregion.cpp to qt_attribution.json file This makes it visible also in the overview documentation of the module, and can be used to automatically generate attribution documents. The code actually mentions the names and file versions (CVS?) where things got copied from; however, X11 seems to have stopped using CVS a long time ago, and without a server it's hard to determine the exact X11 version that was copied from. It arguably doesn't matter, anyhow, because we won't update the code anymore. Fixes: QTBUG-70556 Change-Id: Ib17117a1a3c4112b81982afbd51273048a43221a Reviewed-by: Edward Welbourne --- src/gui/painting/XCONSORTIUM_LICENSE.txt | 43 +++++++++++++++++++++++++ src/gui/painting/qregion.cpp | 54 -------------------------------- src/gui/painting/qt_attribution.json | 15 +++++++++ 3 files changed, 58 insertions(+), 54 deletions(-) create mode 100644 src/gui/painting/XCONSORTIUM_LICENSE.txt diff --git a/src/gui/painting/XCONSORTIUM_LICENSE.txt b/src/gui/painting/XCONSORTIUM_LICENSE.txt new file mode 100644 index 0000000000..5d98625787 --- /dev/null +++ b/src/gui/painting/XCONSORTIUM_LICENSE.txt @@ -0,0 +1,43 @@ +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 77718ce747..69d48fcc58 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -88,60 +88,6 @@ QT_BEGIN_NAMESPACE Example of using complex regions: \snippet code/src_gui_painting_qregion.cpp 0 - \section1 Additional License Information - - On Embedded Linux and X11 platforms, parts of this class rely on - code obtained under the following licenses: - - \legalese - Copyright (c) 1987 X Consortium - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of the X Consortium shall not be - used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from the X Consortium. - \endlegalese - - \br - - \legalese - Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation, and that the name of Digital not be - used in advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - \endlegalese - \sa QPainter::setClipRegion(), QPainter::setClipRect(), QPainterPath */ diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json index 9d3debc1b9..7b16e8c211 100644 --- a/src/gui/painting/qt_attribution.json +++ b/src/gui/painting/qt_attribution.json @@ -41,5 +41,20 @@ "LicenseId": "MIT", "LicenseFile": "WEBGRADIENTS_LICENSE.txt", "Copyright": "Copyright (c) 2017 itmeo" + }, + { + "Id": "xserverhelper", + "Name": "X Server helper", + "QDocModule": "qtgui", + "QtUsage": "Used in Qt GUI (QRegion).", + "Files": "qregion.cpp", + + "Description": "Code from X11's region.h, Region.c, poly.h, and PolyReg.c", + "Homepage": "https://www.x.org/", + "License": "X11 License and Historical Permission Notice and Disclaimer", + "LicenseId": "X11 AND HPND", + "LicenseFile": "XCONSORTIUM_LICENSE.txt", + "Copyright": "Copyright (c) 1987, 1988 X Consortium +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts." } ] -- cgit v1.2.3 From 0844be34ba4b9dea5fb00e03becc2e086e58c0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 28 Aug 2019 13:37:39 +0200 Subject: iOS: Skip explicit dead code stripping when generating Xcode projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-73680 Change-Id: I5d17ef6321bb1f800c39c3f80dca9527ad343d12 Reviewed-by: Timur Pocheptsov Reviewed-by: Volker Hilsheimer Reviewed-by: Jörg Bornemann --- mkspecs/features/uikit/gc_binaries.prf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/uikit/gc_binaries.prf b/mkspecs/features/uikit/gc_binaries.prf index c4f7445951..aa27e69054 100644 --- a/mkspecs/features/uikit/gc_binaries.prf +++ b/mkspecs/features/uikit/gc_binaries.prf @@ -1,2 +1,6 @@ # bitcode (release mode) is incompatible with splitting sections. -!bitcode|!release: load(gc_binaries) +# We have to explicitly exclude Xcode, as that supports both debug +# and release builds in the same project. Xcode already has a settting +# for dead code stripping which is enabled by default, so we'll still +# strip any libraries build with split sections. +!bitcode|if(!macx-xcode:!release): load(gc_binaries) -- cgit v1.2.3 From 02a62094876c51b71f5922d168305ffc970f24c6 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Wed, 28 Aug 2019 09:57:51 +0200 Subject: Fix invalid end range appended to HTTP request When the end range of a byte range in a HTTP request is skipped the download manager adds 0 it its place when resuming that download. When there is no end range given the value is skipped. Task-number: QTBUG-77867 Change-Id: I52358c94cf56c88217fcc91abb102ed393ac7242 Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 2d7649fa61..9d338f9003 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -752,8 +752,9 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq quint64 requestStartOffset = requestRange.left(index).toULongLong(); quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); + // In case an end offset is not given it is skipped from the request range requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + - '-' + QByteArray::number(requestEndOffset); + '-' + (requestEndOffset ? QByteArray::number(requestEndOffset) : QByteArray()); httpRequest.setHeaderField("Range", requestRange); } else { -- cgit v1.2.3 From 7b2dfb37ee5a4252d83e7b08970107a15561fe61 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Wed, 28 Aug 2019 09:19:05 +0200 Subject: Remove hardcoded qt_instdate field from binary Move hardcoded date to the only client code in the repo. This field is currently modified by MaintenanceTool and possibly windeployqt, which contributes to breaking the DLL signature on Windows. Removing the field should avoid this problem. Task-number: QTBUG-76985 Change-Id: I01386136ac493ea50c99c05879a3e215f3f6344c Reviewed-by: Thiago Macieira --- configure.pri | 3 --- src/corelib/global/qlibraryinfo.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/configure.pri b/configure.pri index 09c34af4ee..b109192beb 100644 --- a/configure.pri +++ b/configure.pri @@ -835,9 +835,6 @@ defineTest(qtConfOutput_preparePaths) { addConfStr($$[QMAKE_SPEC]) $${currentConfig}.output.qconfigSource = \ - "/* Installation date */" \ - "static const char qt_configure_installation [12+11] = \"qt_instdate=2012-12-20\";" \ - "" \ "/* Installation Info */" \ "static const char qt_configure_prefix_path_str [12+256] = \"qt_prfxpath=$$config.input.prefix\";" \ "$${LITERAL_HASH}ifdef QT_BUILD_QMAKE" \ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index c0a5369cdd..5634d6e6c3 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -274,7 +274,7 @@ QLibraryInfo::licensedProducts() QDate QLibraryInfo::buildDate() { - return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate); + return QDate::fromString(QString::fromLatin1("2012-12-20"), Qt::ISODate); } #endif #endif // datestring -- cgit v1.2.3 From c53f84300111c90b8a63e117fe834a3d52df54c3 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 30 Aug 2019 10:15:27 +0200 Subject: Doc: Clarify QJsonDocument::toJson() Mention that this method returns an indented document. Change-Id: I0cadcc1c894c9a87910cfce389c6a5288238044d Reviewed-by: Christian Kandeler Reviewed-by: Leena Miettinen --- src/corelib/serialization/qjsondocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp index 0cd86d3ded..aaa4bda19f 100644 --- a/src/corelib/serialization/qjsondocument.cpp +++ b/src/corelib/serialization/qjsondocument.cpp @@ -331,7 +331,7 @@ QVariant QJsonDocument::toVariant() const } /*! - Converts the QJsonDocument to a UTF-8 encoded JSON document. + Converts the QJsonDocument to an indented, UTF-8 encoded JSON document. \sa fromJson() */ -- cgit v1.2.3 From 1c55a6caf1fc2b8a73a9a756bcf6894c5d4e4398 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Fri, 30 Aug 2019 20:02:58 +0200 Subject: Windows QPA: Fix crash in UI Automation with Youdao Dictionary Unlike other accessibility classes, QAccessibleTree is returning a different instance, with a different ID, every time child()/childAt() are called for the same child elements. This causes ElementProviderFromPoint to return different IRawElementProviderSimple instances every time, for the same coordinates, which causes the NetEase Youdao Dictionary to call it in an infinite loop, allocating new QAccessibleTableCell instances, until the application crashes. The crash happened, for instance, just by using the mouse over Qt Creator's project tree while Youdao Dictionary was running. While the root cause seems to be QAccessibleTree not caching and reusing objects, this change adds a layer of safety to the UI Automation classes in the Windows QPA, to avoid causing a crash until QAccessibleTree, and possibly other accessibility classes, are fixed. Fixes: QTBUG-77974 Change-Id: I9b0c8174bc0fd9ef7f5626ee0b72c8a9626520ee Reviewed-by: Oliver Wolff --- .../uiautomation/qwindowsuiamainprovider.cpp | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index a427e553f0..5a05adbf81 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -670,18 +670,26 @@ HRESULT QWindowsUiaMainProvider::ElementProviderFromPoint(double x, double y, IR QPoint point; nativeUiaPointToPoint(uiaPoint, window, &point); - QAccessibleInterface *targetacc = accessible->childAt(point.x(), point.y()); - - if (targetacc) { - QAccessibleInterface *acc = targetacc; - // Controls can be embedded within grouping elements. By default returns the innermost control. - while (acc) { - targetacc = acc; - // For accessibility tools it may be better to return the text element instead of its subcomponents. - if (targetacc->textInterface()) break; - acc = acc->childAt(point.x(), point.y()); + if (auto targetacc = accessible->childAt(point.x(), point.y())) { + auto acc = accessible->childAt(point.x(), point.y()); + // Reject the cases where childAt() returns a different instance in each call for the same + // element (e.g., QAccessibleTree), as it causes an endless loop with Youdao Dictionary installed. + if (targetacc == acc) { + // Controls can be embedded within grouping elements. By default returns the innermost control. + while (acc) { + targetacc = acc; + // For accessibility tools it may be better to return the text element instead of its subcomponents. + if (targetacc->textInterface()) break; + acc = targetacc->childAt(point.x(), point.y()); + if (acc != targetacc->childAt(point.x(), point.y())) { + qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << targetacc; + break; + } + } + *pRetVal = providerForAccessible(targetacc); + } else { + qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << accessible; } - *pRetVal = providerForAccessible(targetacc); } return S_OK; } -- cgit v1.2.3 From db57af5a0d7aa0687a19fef1cd385bee0f26f7b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 3 Sep 2019 08:50:13 +0200 Subject: QRegexp: Fix MSVC2019 warning about fallthrough not being followed by a case label Move fallthrough down, fixing: tools\qregexp.cpp(3014): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label tools\qregexp.cpp(3054): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label tools\qregexp.cpp(3100): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label Change-Id: If25ddec5dc1d4929a3383729aabad89f5879e316 Reviewed-by: Edward Welbourne Reviewed-by: Samuel Gaist --- src/corelib/tools/qregexp.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index ef24c952eb..adca8624f9 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -3009,12 +3009,10 @@ int QRegExpEngine::getEscape() yyCharClass->addSingleton(0x005f); // '_' return Tok_CharClass; case 'I': - if (xmlSchemaExtensions) { - yyCharClass->setNegative(!yyCharClass->negative()); - Q_FALLTHROUGH(); - } else { + if (!xmlSchemaExtensions) break; - } + yyCharClass->setNegative(!yyCharClass->negative()); + Q_FALLTHROUGH(); case 'i': if (xmlSchemaExtensions) { yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) | @@ -3049,12 +3047,10 @@ int QRegExpEngine::getEscape() break; } case 'C': - if (xmlSchemaExtensions) { - yyCharClass->setNegative(!yyCharClass->negative()); - Q_FALLTHROUGH(); - } else { + if (!xmlSchemaExtensions) break; - } + yyCharClass->setNegative(!yyCharClass->negative()); + Q_FALLTHROUGH(); case 'c': if (xmlSchemaExtensions) { yyCharClass->addCategories(FLAG(QChar::Mark_NonSpacing) | @@ -3095,12 +3091,10 @@ int QRegExpEngine::getEscape() break; } case 'P': - if (xmlSchemaExtensions) { - yyCharClass->setNegative(!yyCharClass->negative()); - Q_FALLTHROUGH(); - } else { + if (!xmlSchemaExtensions) break; - } + yyCharClass->setNegative(!yyCharClass->negative()); + Q_FALLTHROUGH(); case 'p': if (xmlSchemaExtensions) { if (yyCh != '{') { -- cgit v1.2.3