From 31374105940bb15a68683a0ae691e7fe1f9b049a Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 16 May 2017 08:11:08 +0200 Subject: Revert "Enable "combined-angle-lib" for ANGLE builds" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Combining libEGL and libGLESv2 into QtANGLE cannot be the default any longer, as the change was binary incompatible. We just had to return to previous behavior temporarily to be able to fix qtlocation. This reverts commit 97ab65076e30d8cd0cbe6bdbdb51d1dc2c0ff7e7. Task-number: QTBUG-60795 Change-Id: I3095cb5f9da30e2d873d9a186cfbc5aee3fb10b2 Reviewed-by: Jan Arve Sæther --- src/gui/configure.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 306ce13214..73e59a7ad9 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -430,7 +430,6 @@ "combined-angle-lib": { "label": "Combined ANGLE Library", "autoDetect": false, - "enable": "features.angle", "condition": "features.angle", "output": [ "publicFeature" ] }, -- cgit v1.2.3 From f6b36eaafec24b4c67efff621d380a4ca4257d0b Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 22 May 2017 20:01:04 +0200 Subject: QHeaderView: fix visual/logical index corruption when restoring state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a followup to 77a8e90cddcfa1c34518ef846a4838874a7bc0c7 which didn't handle the case where no columns had been moved. visualIndices and logicalIndices are empty until initializeIndexMapping() is called, in which case appending is wrong. As a result, visualIndex(i) would return -1 for the values over those added by read(), and an assert would happen at painting time. The fix is to leave visualIndices and logicalIndices empty if they are empty already, leaving it to initializeIndexMapping() to fill them later if necessary (e.g. when moving a column). Task-number: QTBUG-60837 Change-Id: Ia7e4b9d3122647984acd434dfaa0400df319d065 Reviewed-by: Marc Mutz Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 8 ++-- .../itemviews/qheaderview/tst_qheaderview.cpp | 50 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index e0e993ce77..76f80c680e 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3876,9 +3876,11 @@ bool QHeaderViewPrivate::read(QDataStream &in) const int currentCount = (orient == Qt::Horizontal ? model->columnCount(root) : model->rowCount(root)); if (newSectionItems.count() < currentCount) { // we have sections not in the saved state, give them default settings - for (int i = newSectionItems.count(); i < currentCount; ++i) { - visualIndicesIn.append(i); - logicalIndicesIn.append(i); + if (!visualIndicesIn.isEmpty() && !logicalIndicesIn.isEmpty()) { + for (int i = newSectionItems.count(); i < currentCount; ++i) { + visualIndicesIn.append(i); + logicalIndicesIn.append(i); + } } const int insertCount = currentCount - newSectionItems.count(); const int insertLength = defaultSectionSizeIn * insertCount; diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 7bfec2831d..b13e7b2f33 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -171,6 +171,7 @@ private slots: void saveRestore(); void restoreQt4State(); void restoreToMoreColumns(); + void restoreToMoreColumnsNoMovedColumns(); void restoreBeforeSetModel(); void defaultSectionSizeTest(); void defaultSectionSizeTestStyles(); @@ -1690,6 +1691,55 @@ void tst_QHeaderView::restoreToMoreColumns() QCOMPARE(h4.hiddenSectionCount(), 1); QCOMPARE(h4.sortIndicatorSection(), 2); QCOMPARE(h4.sortIndicatorOrder(), Qt::DescendingOrder); + QCOMPARE(h4.logicalIndex(0), 2); + QCOMPARE(h4.logicalIndex(1), 1); + QCOMPARE(h4.logicalIndex(2), 0); + QCOMPARE(h4.visualIndex(0), 2); + QCOMPARE(h4.visualIndex(1), 1); + QCOMPARE(h4.visualIndex(2), 0); + + // Repainting shouldn't crash + h4.show(); + QVERIFY(QTest::qWaitForWindowExposed(&h4)); +} + +void tst_QHeaderView::restoreToMoreColumnsNoMovedColumns() +{ + // Given a model with 2 columns, for saving state + QHeaderView h1(Qt::Horizontal); + QStandardItemModel model1(1, 2); + h1.setModel(&model1); + QCOMPARE(h1.visualIndex(0), 0); + QCOMPARE(h1.visualIndex(1), 1); + QCOMPARE(h1.logicalIndex(0), 0); + QCOMPARE(h1.logicalIndex(1), 1); + const QByteArray savedState = h1.saveState(); + + // And a model with 3 columns, to apply that state upon + QHeaderView h2(Qt::Horizontal); + QStandardItemModel model2(1, 3); + h2.setModel(&model2); + QCOMPARE(h2.visualIndex(0), 0); + QCOMPARE(h2.visualIndex(1), 1); + QCOMPARE(h2.visualIndex(2), 2); + QCOMPARE(h2.logicalIndex(0), 0); + QCOMPARE(h2.logicalIndex(1), 1); + QCOMPARE(h2.logicalIndex(2), 2); + + // When calling restoreState() + QVERIFY(h2.restoreState(savedState)); + + // Then the index mapping should still be as default + QCOMPARE(h2.visualIndex(0), 0); + QCOMPARE(h2.visualIndex(1), 1); + QCOMPARE(h2.visualIndex(2), 2); + QCOMPARE(h2.logicalIndex(0), 0); + QCOMPARE(h2.logicalIndex(1), 1); + QCOMPARE(h2.logicalIndex(2), 2); + + // And repainting shouldn't crash + h2.show(); + QVERIFY(QTest::qWaitForWindowExposed(&h2)); } void tst_QHeaderView::restoreBeforeSetModel() -- cgit v1.2.3 From 315f634180697a2c47286817d7c54aeb11b6bc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Wed, 17 May 2017 09:06:07 +0300 Subject: Fix autotest not to open too many files on a Unix tst_QSharedPointer can't create a pipe as the OS has too many files open. Systems like macOS have a lower limit to these simultaneous files open. Task-number: QTBUG-60410 Change-Id: I21e89f992ada2a7d09b706522a05b5952f00ec33 Reviewed-by: Simon Hausmann --- .../tools/qsharedpointer/tst_qsharedpointer.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 7850478602..442d4d089c 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -43,6 +43,10 @@ #include #include +#ifdef Q_OS_UNIX +#include +#endif + QT_BEGIN_NAMESPACE namespace QtSharedPointer { Q_CORE_EXPORT void internalSafetyCheckCleanCheck(); @@ -54,6 +58,7 @@ class tst_QSharedPointer: public QObject Q_OBJECT private slots: + void initTestCase(); void basics_data(); void basics(); void operators(); @@ -118,6 +123,20 @@ public: } }; +void tst_QSharedPointer::initTestCase() +{ +#if defined(Q_OS_UNIX) + // The tests create a lot of threads, which require file descriptors. On systems like + // OS X low defaults such as 256 as the limit for the number of simultaneously + // open files is not sufficient. + struct rlimit numFiles; + if (getrlimit(RLIMIT_NOFILE, &numFiles) == 0 && numFiles.rlim_cur < 1024) { + numFiles.rlim_cur = qMin(rlim_t(1024), numFiles.rlim_max); + setrlimit(RLIMIT_NOFILE, &numFiles); + } +#endif +} + template static inline QtSharedPointer::ExternalRefCountData *refCountData(const QSharedPointer &b) { -- cgit v1.2.3 From aea4e3823dc52618767ab7ebf0bce53696a4b80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Wed, 26 Apr 2017 10:36:53 +0300 Subject: Add INTEGRITY mkspec for ARMv8 Drive CX Change-Id: I038de7a0cc9e6046aec3fc930876d43263702e90 Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- mkspecs/common/ghs-integrity-armv8.conf | 27 +++++++++++++ .../devices/integrity-armv8-drive-cx/qmake.conf | 39 +++++++++++++++++++ .../integrity-armv8-drive-cx/qplatformdefs.h | 45 ++++++++++++++++++++++ src/platformsupport/eglconvenience/qt_egl_p.h | 6 ++- 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 mkspecs/common/ghs-integrity-armv8.conf create mode 100644 mkspecs/devices/integrity-armv8-drive-cx/qmake.conf create mode 100644 mkspecs/devices/integrity-armv8-drive-cx/qplatformdefs.h diff --git a/mkspecs/common/ghs-integrity-armv8.conf b/mkspecs/common/ghs-integrity-armv8.conf new file mode 100644 index 0000000000..e454cfd245 --- /dev/null +++ b/mkspecs/common/ghs-integrity-armv8.conf @@ -0,0 +1,27 @@ +# +# Base qmake configuration for INTEGRITY armv8 targets +# +MAKEFILE_GENERATOR = UNIX + +QMAKE_PLATFORM = integrity + +include(unix.conf) + +include(ghs-base.conf) + +bsp_name = $$(INTEGRITY_BSP) +isEmpty(bsp_name): \ + error("This qmakespec requires $INTEGRITY_BSP to be set") + +os_directory = $$(INTEGRITY_DIR) +isEmpty(os_directory): \ + error("This qmakespec requires $INTEGRITY_DIR to be set") + +QMAKE_CC = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared +QMAKE_CXX = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared +QMAKE_LINK = $$QMAKE_CXX +QMAKE_AR = $$QMAKE_CXX -archive -o + +QMAKE_CFLAGS += -bigswitch +QMAKE_CXXFLAGS += -bigswitch +QMAKE_LFLAGS += -bigswitch diff --git a/mkspecs/devices/integrity-armv8-drive-cx/qmake.conf b/mkspecs/devices/integrity-armv8-drive-cx/qmake.conf new file mode 100644 index 0000000000..37474e9dea --- /dev/null +++ b/mkspecs/devices/integrity-armv8-drive-cx/qmake.conf @@ -0,0 +1,39 @@ +# +# qmake configuration for 64-bit Tegra X1 boards, like the DRIVE CX, using Vibrante Integrity +# +# A typical configure line might look like: +# configure \ +# -device integrity-armv8-drive-cx \ +# -device-option VIBRANTE_INTEGRITY_PDK_TOPDIR=/opt/nvidia/vibrante-t186ref-integrity +# -static \ +# -opengl es2 + +load(device_config) + +include(../../common/ghs-integrity-armv8.conf) + +DEFINES += WIN_INTERFACE_CUSTOM + +QT_QPA_DEFAULT_PLATFORM = eglfs + +QMAKE_LIBS_EGL += -lEGL -lGLESv2 -lnvidia-glsi -lnvidia-eglcore -lnvidia-rmapi-tegra -lposix -livfs -ldrm-nvdc -lnvll -lnvdc -lnvrm -lnvrm_gpu -lnvrm_graphics -lnvos -lsocket -lnet -lnvtegrahv +QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL} + +EGLFS_DEVICE_INTEGRATION = eglfs_kms_egldevice + +# Vibrante Integrity PDK headers & libraries +QMAKE_INCDIR += $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/include +QMAKE_LIBDIR += $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/libs + +# OpenGL libraries have a dependency on libEGL +QMAKE_INCDIR_EGL = $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/include +QMAKE_LIBDIR_EGL = $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/libs +QMAKE_INCDIR_OPENGL_ES2 = $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/include +QMAKE_LIBDIR_OPENGL_ES2 = $${VIBRANTE_INTEGRITY_PDK_TOPDIR}/libs + +defineTest(qtConfSanitizeMkspec) { + isEmpty(VIBRANTE_INTEGRITY_PDK_TOPDIR): \ + error("You must pass -device-option VIBRANTE_INTEGRITY_PDK_TOPDIR=/path/to/pdk") +} + +load(qt_config) diff --git a/mkspecs/devices/integrity-armv8-drive-cx/qplatformdefs.h b/mkspecs/devices/integrity-armv8-drive-cx/qplatformdefs.h new file mode 100644 index 0000000000..c8361113a0 --- /dev/null +++ b/mkspecs/devices/integrity-armv8-drive-cx/qplatformdefs.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the qmake spec 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 QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +#include "../../common/integrity/qplatformdefs.h" + +#endif // QPLATFORMDEFS_H diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h index b1495c9f9d..e2c6b0ceb6 100644 --- a/src/platformsupport/eglconvenience/qt_egl_p.h +++ b/src/platformsupport/eglconvenience/qt_egl_p.h @@ -53,8 +53,10 @@ #ifdef QT_EGL_NO_X11 # define MESA_EGL_NO_X11_HEADERS // MESA -# define WIN_INTERFACE_CUSTOM // NV -#endif // QT_EGL_NO_X11 +# if !defined(Q_OS_INTEGRITY) +# define WIN_INTERFACE_CUSTOM // NV +# endif // Q_OS_INTEGRITY +#endif // QT_EGL_NO_X11 #ifdef QT_EGL_WAYLAND # define WAYLAND // NV -- cgit v1.2.3 From 5a01b586653d4d0346f5b918792c21ae29db0346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Wed, 26 Apr 2017 10:51:39 +0300 Subject: Add Integrity ARMv8 detection Change-Id: I352c9b16077011aad1175e31ffaadfa44d2403ea Reviewed-by: Nikola Velinov Reviewed-by: Laszlo Agocs Reviewed-by: Thiago Macieira --- src/corelib/global/qprocessordetection.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index ed11e013f2..0b260d01e3 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -94,8 +94,8 @@ ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to auto-detection implemented below. */ -#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) -# if defined(__aarch64__) +#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) || defined(__ARM64__) +# if defined(__aarch64__) || defined(__ARM64__) # define Q_PROCESSOR_ARM_64 # define Q_PROCESSOR_WORDSIZE 8 # else @@ -109,7 +109,8 @@ # define Q_PROCESSOR_ARM _M_ARM # elif defined(__ARM64_ARCH_8__) \ || defined(__aarch64__) \ - || defined(__CORE_CORTEXAV8__) // GHS-specific for INTEGRITY + || defined(__ARMv8__) \ + || defined(__ARMv8_A__) # define Q_PROCESSOR_ARM 8 # elif defined(__ARM_ARCH_7__) \ || defined(__ARM_ARCH_7A__) \ @@ -117,7 +118,7 @@ || defined(__ARM_ARCH_7M__) \ || defined(__ARM_ARCH_7S__) \ || defined(_ARM_ARCH_7) \ - || defined(__CORE_CORTEXA__) // GHS-specific for INTEGRITY + || defined(__CORE_CORTEXA__) # define Q_PROCESSOR_ARM 7 # elif defined(__ARM_ARCH_6__) \ || defined(__ARM_ARCH_6J__) \ -- cgit v1.2.3 From ccb3e25d8266e0c26afc8776dce7f9fbe63d2a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Wed, 26 Apr 2017 10:56:34 +0300 Subject: Configure eglfs_kms_egldevice for INTEGRITY ARMv8 Drive CX Change-Id: If41135cdf8287b90690321bef3ad839db6778782 Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- src/gui/configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 306ce13214..9db0eb0327 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -85,7 +85,8 @@ "test": "qpa/kms", "sources": [ { "type": "pkgConfig", "args": "libdrm" }, - "-ldrm" + { "libs": "-ldrm", "condition": "!config.integrity" }, + { "libs": "-ldrm-nvdc -lposix -livfs -lnvll -lnvdc -lnvrm -lnvrm_graphics -lnvos", "condition": "config.integrity" } ] }, "egl": { -- cgit v1.2.3 From c49c559abeab827f668ce5eb1e29d841cc64abb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Wed, 26 Apr 2017 10:59:36 +0300 Subject: Get alpha buffer size bigger than zero for INTEGRITY ARMv8 Drive CX Change-Id: I5bdfe9bb50aafe50542c665d91973e4c0c12e602 Reviewed-by: Nikola Velinov Reviewed-by: Laszlo Agocs --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 7 +++++++ .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 43bdb77a18..3af21d768e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -56,6 +56,13 @@ QEglFSKmsEglDeviceIntegration::QEglFSKmsEglDeviceIntegration() qCDebug(qLcEglfsKmsDebug, "New DRM/KMS on EGLDevice integration created"); } +QSurfaceFormat QEglFSKmsEglDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const +{ + QSurfaceFormat format = QEglFSKmsIntegration::surfaceFormatFor(inputFormat); + format.setAlphaBufferSize(8); + return format; +} + EGLint QEglFSKmsEglDeviceIntegration::surfaceType() const { return EGL_STREAM_BIT_KHR; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index 62404cfcd1..5819d82ebf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -55,6 +55,7 @@ class QEglFSKmsEglDeviceIntegration : public QEglFSKmsIntegration public: QEglFSKmsEglDeviceIntegration(); + QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override; EGLint surfaceType() const override; EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override; bool supportsSurfacelessContexts() const override; -- cgit v1.2.3 From b418c763960782ba3a26a6612365eb446a4717d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Mon, 15 May 2017 08:33:52 +0300 Subject: Add INTEGRITY framebuffer test to configure Change-Id: I606da783ef9959448a89a7a616ab197820194977 Reviewed-by: Oswald Buddenhagen --- config.tests/qpa/integrityfb/integrityfb.cpp | 46 ++++++++++++++++++++++++++++ config.tests/qpa/integrityfb/integrityfb.pro | 3 ++ src/gui/configure.json | 7 ++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 config.tests/qpa/integrityfb/integrityfb.cpp create mode 100644 config.tests/qpa/integrityfb/integrityfb.pro diff --git a/config.tests/qpa/integrityfb/integrityfb.cpp b/config.tests/qpa/integrityfb/integrityfb.cpp new file mode 100644 index 0000000000..7f2dd0705f --- /dev/null +++ b/config.tests/qpa/integrityfb/integrityfb.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests 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 + +int main(int, char **) +{ + FBDriver *driver = 0; + return 0; +} diff --git a/config.tests/qpa/integrityfb/integrityfb.pro b/config.tests/qpa/integrityfb/integrityfb.pro new file mode 100644 index 0000000000..5da4e77923 --- /dev/null +++ b/config.tests/qpa/integrityfb/integrityfb.pro @@ -0,0 +1,3 @@ +SOURCES = integrityfb.cpp + +CONFIG -= qt diff --git a/src/gui/configure.json b/src/gui/configure.json index 9db0eb0327..cbf2315af4 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -363,6 +363,11 @@ "type": "compile", "test": "unix/evdev" }, + "integrityfb": { + "label": "INTEGRITY framebuffer", + "type": "compile", + "test": "qpa/integrityfb" + }, "libinput_axis_api": { "label": "axis API in libinput", "type": "compile", @@ -510,7 +515,7 @@ "integrityfb": { "label": "INTEGRITY framebuffer", "section": "Platform plugins", - "condition": "config.integrity", + "condition": "config.integrity && tests.integrityfb", "output": [ "privateFeature" ] }, "kms": { -- cgit v1.2.3 From 8b1377fde16a2049a1c27f6d005bff84a8f85f28 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Apr 2017 13:29:07 +0200 Subject: QWidgetEffectSourcePrivate::draw(): Call render() when no shared painter exists Task-number: QTBUG-60231 Change-Id: If07274a01bb9a4b9323865a3e061b3674507fd5b Reviewed-by: Andy Shaw Reviewed-by: Frederik Gladhorn --- src/widgets/kernel/qwidget.cpp | 2 +- .../effects/qgraphicseffect/tst_qgraphicseffect.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7a83e0b517..a2f3fa4a5f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5858,7 +5858,7 @@ QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) con void QWidgetEffectSourcePrivate::draw(QPainter *painter) { - if (!context || context->painter != painter) { + if (!context || context->painter != painter || !context->sharedPainter) { m_widget->render(painter); return; } diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index a1cb729849..4d289dcb02 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -52,6 +52,7 @@ private slots: void boundingRect2(); void draw(); void opacity(); + void nestedOpaqueOpacity(); void grayscale(); void colorize(); void drawPixmapItem(); @@ -407,6 +408,26 @@ void tst_QGraphicsEffect::opacity() QCOMPARE(effect->m_opacity, qreal(0.5)); } +void tst_QGraphicsEffect::nestedOpaqueOpacity() +{ + // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with + // QGraphicsOpacityEffect caused crashes due to constructing several + // QPainter instances on a device in the fast path for + // QGraphicsOpacityEffect::opacity=1 + QWidget topLevel; + topLevel.setWindowTitle(QTest::currentTestFunction()); + topLevel.resize(QApplication::desktop()->screenGeometry(&topLevel).size() / 8); + QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; + opacityEffect->setOpacity(1); + topLevel.setGraphicsEffect(opacityEffect); + QWidget *child = new QWidget(&topLevel); + child->resize(topLevel.size() / 2); + QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect; + child->setGraphicsEffect(childEffect); + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); +} + void tst_QGraphicsEffect::grayscale() { if (qApp->desktop()->depth() < 24) -- cgit v1.2.3 From a089de0d992072bb06aa35323a53ca6cb5d76557 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 26 May 2017 13:28:55 +0200 Subject: Fix tst_QWidget::translucentWidget() on high DPI displays It was grabbing a QLabel without accounting for the size of the window in the case where the DPI is larger than 1: FAIL! : tst_QWidget::translucentWidget() Compared values are not the same Actual (actual.size()) : QSize(32x32) Expected (expected.size()): QSize(16x16) Change-Id: I4873f3c6364ee2696f5612d91e6c97c60b2cd915 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index e68f0f57ef..0933dc991d 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8526,8 +8526,8 @@ void tst_QWidget::translucentWidget() else #endif widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size())); - QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); - QImage expected = pm.toImage().convertToFormat(QImage::Format_RGB32); + const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32); + const QImage expected = pm.toImage().scaled(label.devicePixelRatioF() * pm.size()); QCOMPARE(actual.size(),expected.size()); QCOMPARE(actual,expected); } -- cgit v1.2.3 From 9ec028071409410dba192ec1c1e228cf3aea224b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Fri, 13 Jan 2017 01:33:42 +0100 Subject: Make sure QWindow screen is set before calling QPlatformWindow::create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWindow uses device independent geometry while QXcb and QPlatform classes do not. When QXcbWindow::create is called we have no guarantee that the correct screen has been set in QWindow so the code attempts to check if "currentScreen" matches "actualscreen". To perform that operation though we need to convert the units from "Device independent" to "native pixels" that we do by calling QPlatformWindow::windowGeometry which calls QHighDpiScaling::toNativePixels which requires the correct screen to be already set. So basically we have a cyclic dependency, to get the correct screen we require the correct screen to be already set. To fix this we can: 1-Remove the dependency (Look for the actual screen using device independent pixels) This will imply adding code in QXcb to use QPlatformScreen::deviceIndependentGeometry to lookup the screen up 2-Make sure the Screen is set before calling QXcbWindow::create This patch implements the first approach that allows us to keep the changes within the QXcb backend which seems to be the only one affected. Task-number: QTBUG-53813 Change-Id: I6dc955d63e17c3b3421f3a1a9e0d841e508b2e5c Reviewed-by: David Edmundson Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 ++++++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6365a6e9cb..289d0720e7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -156,6 +156,14 @@ QXcbScreen *QXcbWindow::parentScreen() return parent() ? static_cast(parent())->parentScreen() : xcbScreen(); } +//QPlatformWindow::screenForGeometry version that uses deviceIndependentGeometry +QXcbScreen *QXcbWindow::initialScreen() const +{ + QWindowPrivate *windowPrivate = qt_window_private(window()); + QScreen *screen = windowPrivate->screenForGeometry(window()->geometry()); + return static_cast(screen->handle()); +} + // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) { @@ -350,8 +358,8 @@ void QXcbWindow::create() Qt::WindowType type = window()->type(); QXcbScreen *currentScreen = xcbScreen(); - QRect rect = windowGeometry(); - QXcbScreen *platformScreen = parent() ? parentScreen() : static_cast(screenForGeometry(rect)); + QXcbScreen *platformScreen = parent() ? parentScreen() : initialScreen(); + QRect rect = QHighDpi::toNativePixels(window()->geometry(), platformScreen); if (type == Qt::Desktop) { m_window = platformScreen->root(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index b4d947e700..56628094ee 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -191,6 +191,7 @@ protected: QXcbScreen *parentScreen(); + QXcbScreen *initialScreen() const; void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); NetWmStates netWmStates(); void setNetWmStates(NetWmStates); -- cgit v1.2.3 From 3945cf1f9aa3c4f43b995cc695cc3cfb5ec75c8c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 20 May 2017 20:07:58 +0200 Subject: Convert features.movie to QT_[REQUIRE_]CONFIG Change-Id: I838c7305d4649f953c5bb972f1aa51dbb078afe2 Reviewed-by: Oswald Buddenhagen --- src/gui/image/image.pri | 6 ++++-- src/gui/image/qmovie.cpp | 4 ---- src/gui/image/qmovie.h | 7 ++----- src/widgets/accessible/simplewidgets.cpp | 2 +- src/widgets/widgets/qlabel.cpp | 16 ++++++++-------- src/widgets/widgets/qlabel.h | 6 +++--- src/widgets/widgets/qlabel_p.h | 6 ++++-- 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index bac00f7e95..76aba944b2 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -10,7 +10,6 @@ HEADERS += \ image/qimageiohandler.h \ image/qimagereader.h \ image/qimagewriter.h \ - image/qmovie.h \ image/qpaintengine_pic_p.h \ image/qpicture.h \ image/qpicture_p.h \ @@ -41,7 +40,6 @@ SOURCES += \ image/qpixmap.cpp \ image/qpixmapcache.cpp \ image/qplatformpixmap.cpp \ - image/qmovie.cpp \ image/qpixmap_raster.cpp \ image/qpixmap_blitter.cpp \ image/qimagepixmapcleanuphooks.cpp \ @@ -50,6 +48,10 @@ SOURCES += \ image/qiconengine.cpp \ image/qiconengineplugin.cpp \ +qtConfig(movie) { + HEADERS += image/qmovie.h + SOURCES += image/qmovie.cpp +} win32:!winrt: SOURCES += image/qpixmap_win.cpp diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 55ddd839b7..a1ca857daa 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -172,8 +172,6 @@ #include "qmovie.h" -#ifndef QT_NO_MOVIE - #include "qglobal.h" #include "qimage.h" #include "qimagereader.h" @@ -1020,5 +1018,3 @@ void QMovie::setCacheMode(CacheMode cacheMode) QT_END_NAMESPACE #include "moc_qmovie.cpp" - -#endif // QT_NO_MOVIE diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index 2b41e07dba..930d502892 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -42,15 +42,14 @@ #include -#ifndef QT_NO_MOVIE - #include #include #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(movie); +QT_BEGIN_NAMESPACE class QByteArray; class QColor; @@ -144,6 +143,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_MOVIE - #endif // QMOVIE_H diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index aa075cad1b..e557dc9615 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -422,7 +422,7 @@ QAccessible::Role QAccessibleDisplay::role() const if (l->picture()) return QAccessible::Graphic; #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) if (l->movie()) return QAccessible::Animation; #endif diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 39e072234e..4946e3e354 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -72,7 +72,7 @@ QLabelPrivate::QLabelPrivate() #ifndef QT_NO_PICTURE picture(Q_NULLPTR), #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) movie(), #endif control(Q_NULLPTR), @@ -582,7 +582,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const } else if (picture && !picture->isNull()) { br = picture->boundingRect(); #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) } else if (movie && !movie->currentPixmap().isNull()) { br = movie->currentPixmap().rect(); br.setSize(br.size() / movie->currentPixmap().devicePixelRatio()); @@ -1015,7 +1015,7 @@ void QLabel::paintEvent(QPaintEvent *) int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection() : layoutDirection(), QFlag(d->align)); -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) if (d->movie) { if (d->scaledcontents) style->drawItemPixmap(&painter, cr, align, d->movie->currentPixmap().scaled(cr.size())); @@ -1216,7 +1216,7 @@ void QLabelPrivate::updateShortcut() #endif // QT_NO_SHORTCUT -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) void QLabelPrivate::_q_movieUpdated(const QRect& rect) { Q_Q(QLabel); @@ -1276,7 +1276,7 @@ void QLabel::setMovie(QMovie *movie) d->updateLabel(); } -#endif // QT_NO_MOVIE +#endif // QT_CONFIG(movie) /*! \internal @@ -1309,7 +1309,7 @@ void QLabelPrivate::clearContents() q->releaseShortcut(shortcutId); shortcutId = 0; #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) if (movie) { QObject::disconnect(movie, SIGNAL(resized(QSize)), q, SLOT(_q_movieResized(QSize))); QObject::disconnect(movie, SIGNAL(updated(QRect)), q, SLOT(_q_movieUpdated(QRect))); @@ -1329,7 +1329,7 @@ void QLabelPrivate::clearContents() } -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) /*! Returns a pointer to the label's movie, or 0 if no movie has been @@ -1344,7 +1344,7 @@ QMovie *QLabel::movie() const return d->movie; } -#endif // QT_NO_MOVIE +#endif // QT_CONFIG(movie) /*! \property QLabel::textFormat diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h index 3978e34d14..469254a145 100644 --- a/src/widgets/widgets/qlabel.h +++ b/src/widgets/widgets/qlabel.h @@ -76,7 +76,7 @@ public: #ifndef QT_NO_PICTURE const QPicture *picture() const; #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) QMovie *movie() const; #endif @@ -122,7 +122,7 @@ public Q_SLOTS: #ifndef QT_NO_PICTURE void setPicture(const QPicture &); #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) void setMovie(QMovie *movie); #endif void setNum(int); @@ -152,7 +152,7 @@ protected: private: Q_DISABLE_COPY(QLabel) Q_DECLARE_PRIVATE(QLabel) -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) Q_PRIVATE_SLOT(d_func(), void _q_movieUpdated(const QRect&)) Q_PRIVATE_SLOT(d_func(), void _q_movieResized(const QSize&)) #endif diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h index d13c05fc99..f3236ac527 100644 --- a/src/widgets/widgets/qlabel_p.h +++ b/src/widgets/widgets/qlabel_p.h @@ -59,7 +59,9 @@ #include "qtextdocumentfragment.h" #include "qframe_p.h" #include "qtextdocument.h" +#if QT_CONFIG(movie) #include "qmovie.h" +#endif #include "qimage.h" #include "qbitmap.h" #include "qpicture.h" @@ -79,7 +81,7 @@ public: void updateLabel(); QSize sizeForWidth(int w) const; -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) void _q_movieUpdated(const QRect&); void _q_movieResized(const QSize&); #endif @@ -116,7 +118,7 @@ public: #ifndef QT_NO_PICTURE QPicture *picture; #endif -#ifndef QT_NO_MOVIE +#if QT_CONFIG(movie) QPointer movie; #endif mutable QWidgetTextControl *control; -- cgit v1.2.3 From 61384e910d0dcf68495ac247388ab965e31dcae7 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 21 May 2017 12:50:24 +0200 Subject: Convert features.lcdnumber to QT_[REQUIRE_]CONFIG Change-Id: Ie99d2ce0a836c27fb882c04ff465e6cdd483d360 Reviewed-by: Oswald Buddenhagen --- src/widgets/accessible/simplewidgets.cpp | 4 +++- src/widgets/widgets/qlcdnumber.cpp | 4 +--- src/widgets/widgets/qlcdnumber.h | 5 +---- src/widgets/widgets/widgets.pri | 9 +++++++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index e557dc9615..b8ce9a9060 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -59,7 +59,9 @@ #include #endif #include +#if QT_CONFIG(lcdnumber) #include +#endif #include #include #include @@ -464,7 +466,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const str = qt_accStripAmp(str); #endif #endif // QT_CONFIG(label) -#ifndef QT_NO_LCDNUMBER +#if QT_CONFIG(lcdnumber) } else if (qobject_cast(object())) { QLCDNumber *l = qobject_cast(object()); if (l->digitCount()) diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index aa052ef5cb..a0aeee2237 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qlcdnumber.h" -#ifndef QT_NO_LCDNUMBER + #include "qbitarray.h" #include "qpainter.h" #include "private/qframe_p.h" @@ -1220,5 +1220,3 @@ bool QLCDNumber::event(QEvent *e) QT_END_NAMESPACE #include "moc_qlcdnumber.cpp" - -#endif // QT_NO_LCDNUMBER diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h index 33669fa900..28fd530e6e 100644 --- a/src/widgets/widgets/qlcdnumber.h +++ b/src/widgets/widgets/qlcdnumber.h @@ -45,8 +45,7 @@ QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LCDNUMBER +QT_REQUIRE_CONFIG(lcdnumber); class QLCDNumberPrivate; class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget @@ -115,8 +114,6 @@ private: Q_DECLARE_PRIVATE(QLCDNumber) }; -#endif // QT_NO_LCDNUMBER - QT_END_NAMESPACE #endif // QLCDNUMBER_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 086585f0e6..4d627e6f07 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -20,7 +20,6 @@ HEADERS += \ widgets/qgroupbox.h \ widgets/qkeysequenceedit.h \ widgets/qkeysequenceedit_p.h \ - widgets/qlcdnumber.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ widgets/qmainwindow.h \ @@ -84,7 +83,6 @@ SOURCES += \ widgets/qframe.cpp \ widgets/qgroupbox.cpp \ widgets/qkeysequenceedit.cpp \ - widgets/qlcdnumber.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ widgets/qmainwindow.cpp \ @@ -165,6 +163,13 @@ qtConfig(label) { widgets/qlabel.cpp } +qtConfig(lcdnumber) { + HEADERS += \ + widgets/qlcdnumber.h + + SOURCES += \ + widgets/qlcdnumber.cpp +} qtConfig(pushbutton) { HEADERS += \ -- cgit v1.2.3 From ad8b4ba0145696ad0da3ab9fad0dee9bad6d567a Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 21 May 2017 12:53:07 +0200 Subject: Convert features.splashscreen to QT_REQUIRE_CONFIG Change-Id: Ie46b7c6fb52773dea25c552a77c96d800f471738 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qsplashscreen.cpp | 4 ---- src/widgets/widgets/qsplashscreen.h | 6 ++---- src/widgets/widgets/widgets.pri | 10 ++++++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index 2758af53ef..fb92d5de0d 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -39,8 +39,6 @@ #include "qsplashscreen.h" -#ifndef QT_NO_SPLASHSCREEN - #include "qapplication.h" #include "qdesktopwidget.h" #include "qpainter.h" @@ -354,5 +352,3 @@ bool QSplashScreen::event(QEvent *e) QT_END_NAMESPACE #include "moc_qsplashscreen.cpp" - -#endif //QT_NO_SPLASHSCREEN diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h index de58d86592..1971b8bacf 100644 --- a/src/widgets/widgets/qsplashscreen.h +++ b/src/widgets/widgets/qsplashscreen.h @@ -44,10 +44,10 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(splashscreen); +QT_BEGIN_NAMESPACE -#ifndef QT_NO_SPLASHSCREEN class QSplashScreenPrivate; class Q_WIDGETS_EXPORT QSplashScreen : public QWidget @@ -82,8 +82,6 @@ private: Q_DECLARE_PRIVATE(QSplashScreen) }; -#endif // QT_NO_SPLASHSCREEN - QT_END_NAMESPACE #endif // QSPLASHSCREEN_H diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 4d627e6f07..1779c8d183 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -40,7 +40,6 @@ HEADERS += \ widgets/qsizegrip.h \ widgets/qslider.h \ widgets/qspinbox.h \ - widgets/qsplashscreen.h \ widgets/qsplitter.h \ widgets/qsplitter_p.h \ widgets/qstackedwidget.h \ @@ -97,7 +96,6 @@ SOURCES += \ widgets/qsizegrip.cpp \ widgets/qslider.cpp \ widgets/qspinbox.cpp \ - widgets/qsplashscreen.cpp \ widgets/qsplitter.cpp \ widgets/qstackedwidget.cpp \ widgets/qstatusbar.cpp \ @@ -196,6 +194,14 @@ qtConfig(dialogbuttonbox) { widgets/qdialogbuttonbox.cpp } +qtConfig(splashscreen) { + HEADERS += \ + widgets/qsplashscreen.h + + SOURCES += \ + widgets/qsplashscreen.cpp +} + qtConfig(widgettextcontrol) { HEADERS += \ widgets/qwidgettextcontrol_p.h \ -- cgit v1.2.3 From 2a0d96daa8a3aea72172340be1df1029ac38700d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 16 May 2017 14:59:28 +0200 Subject: Do not use FT_LOAD_TARGET_LCD when full hinting is requested In FreeType 2.8.0 FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT instead of of FT_LOAD_TARGET_NORMAL. This means requesting it will get us light hinting. See https://sourceforge.net/projects/freetype/files/freetype2/2.8 We should just avoid using it all together since we request the LCD mode separately anyway with FT_RENDER_MODE later. Change-Id: I9ea2e39a6e9ba25ba11604a194e552fe4240a127 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 39b6814a57..64a0ef6fe8 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -967,15 +967,10 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, if (format == Format_Mono) { load_target = FT_LOAD_TARGET_MONO; } else if (format == Format_A32) { - if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) { - if (default_hint_style == HintFull) - load_target = FT_LOAD_TARGET_LCD; + if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) hsubpixel = true; - } else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) { - if (default_hint_style == HintFull) - load_target = FT_LOAD_TARGET_LCD_V; + else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) vfactor = 3; - } } else if (format == Format_ARGB) { #ifdef FT_LOAD_COLOR load_flags |= FT_LOAD_COLOR; -- cgit v1.2.3 From e579c822c5bedf5e626e4eb72db3b49a4a4015dc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 May 2017 13:33:29 -0700 Subject: tst_qudpsocket: Blacklist "utun" interfaces on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Packets sent to to link-local addresses on it are never received. We don't know why this happens, as the tooling provided by Apple for development is close to useless. So we just ignore this interface. Task-number: QTBUG-61041 Change-Id: Ia608df1fff6bdee5238e107d8a50292a1f9e5c03 Reviewed-by: Tony Sarajärvi --- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 9a604e5d04..b476fdd334 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1553,9 +1553,17 @@ void tst_QUdpSocket::linkLocalIPv6() //Windows preallocates link local addresses to interfaces that are down. //These may or may not work depending on network driver if (iface.flags() & QNetworkInterface::IsUp) { +#if defined(Q_OS_WIN) // Do not add the Teredo Tunneling Pseudo Interface on Windows. if (iface.humanReadableName().contains("Teredo")) continue; +#elif defined(Q_OS_DARWIN) + // Do not add "utun" interfaces on macOS: nothing ever gets received + // (we don't know why) + if (iface.name().startsWith("utun")) + continue; +#endif + foreach (QNetworkAddressEntry addressEntry, iface.addressEntries()) { QHostAddress addr(addressEntry.ip()); if (!addr.scopeId().isEmpty() && addr.isInSubnet(localMask, 64)) { -- cgit v1.2.3 From 64a4216254a49ae0ba946717599c4f52dac978c5 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 24 May 2017 16:06:28 +0200 Subject: tst_QFiledialog: use escape to close dialogs instead of timer This makes the test a lot faster and perhaps more reliable. Change-Id: I055cfde627c75f71735eabbf01af2a196bd8b00a Reviewed-by: Friedemann Kleint --- tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 44cb5a5bf8..8d209fc241 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1463,10 +1463,7 @@ class DialogRejecter : public QObject public: DialogRejecter() { - QTimer *timer = new QTimer(this); - timer->setInterval(1000); - connect(timer, &QTimer::timeout, this, &DialogRejecter::rejectFileDialog); - timer->start(); + connect(qApp, &QApplication::focusChanged, this, &DialogRejecter::rejectFileDialog); } public slots: @@ -1474,7 +1471,7 @@ public slots: { if (QWidget *w = QApplication::activeModalWidget()) if (QDialog *d = qobject_cast(w)) - d->reject(); + QTest::keyClick(d, Qt::Key_Escape); } }; -- cgit v1.2.3 From 88f30250eb15b520415658c6c32f48fda111b6bf Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Mon, 29 May 2017 12:23:08 +0300 Subject: Add USB HID device feature to INTEGRITY This change adds USB mouse handling support for INTEGRITY Change-Id: I8a2a51c8c3578898e90dd5bbb01f6aed6c64e2a4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Timo Aarnipuro Reviewed-by: Nikola Velinov Reviewed-by: Rolland Dudemaine Reviewed-by: Lars Knoll Reviewed-by: Tero Alamaki --- config.tests/qpa/integrityhid/integrityhid.cpp | 52 ++++ config.tests/qpa/integrityhid/integrityhid.pro | 2 + src/gui/configure.json | 13 + src/platformsupport/input/input.pro | 4 + .../input/integrityhid/integrityhid.pri | 7 + .../input/integrityhid/qintegrityhidmanager.cpp | 263 +++++++++++++++++++++ .../input/integrityhid/qintegrityhidmanager.h | 69 ++++++ src/platformsupport/platformsupport.pro | 2 +- .../platforms/eglfs/api/qeglfsintegration.cpp | 8 + 9 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 config.tests/qpa/integrityhid/integrityhid.cpp create mode 100644 config.tests/qpa/integrityhid/integrityhid.pro create mode 100644 src/platformsupport/input/integrityhid/integrityhid.pri create mode 100644 src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp create mode 100644 src/platformsupport/input/integrityhid/qintegrityhidmanager.h diff --git a/config.tests/qpa/integrityhid/integrityhid.cpp b/config.tests/qpa/integrityhid/integrityhid.cpp new file mode 100644 index 0000000000..1493e7c7e4 --- /dev/null +++ b/config.tests/qpa/integrityhid/integrityhid.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests 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 +#include +#include + +int main(int, char **) +{ + HIDDriver *driver; + uintptr_t devicecontext; + uint32_t device_id; + gh_hid_enum_devices(driver, &device_id, &devicecontext); + + return 0; +} diff --git a/config.tests/qpa/integrityhid/integrityhid.pro b/config.tests/qpa/integrityhid/integrityhid.pro new file mode 100644 index 0000000000..87fafde897 --- /dev/null +++ b/config.tests/qpa/integrityhid/integrityhid.pro @@ -0,0 +1,2 @@ +SOURCES = integrityhid.cpp +CONFIG -= qt diff --git a/src/gui/configure.json b/src/gui/configure.json index cbf2315af4..af5dcf8961 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -149,6 +149,13 @@ { "type": "pkgConfig", "args": "libinput" } ] }, + "integrityhid": { + "label": "integrityhid", + "test": "qpa/integrityhid", + "sources": [ + { "libs": "-lhiddev -lusbhid -lusb" } + ] + }, "libjpeg": { "label": "libjpeg", "test": "unix/libjpeg", @@ -528,6 +535,11 @@ "condition": "features.libudev && libs.libinput", "output": [ "privateFeature" ] }, + "integrityhid": { + "label": "INTEGRITY HID", + "condition": "config.integrity && libs.integrityhid", + "output": [ "privateFeature" ] + }, "libinput-axis-api": { "label": "axis API in libinput", "condition": "features.libinput && tests.libinput_axis_api", @@ -1115,6 +1127,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "entries": [ "evdev", "libinput", + "integrityhid", "mtdev", "tslib", "xkbcommon-evdev" diff --git a/src/platformsupport/input/input.pro b/src/platformsupport/input/input.pro index f8ff4344cf..3d39210b9e 100644 --- a/src/platformsupport/input/input.pro +++ b/src/platformsupport/input/input.pro @@ -28,4 +28,8 @@ qtConfig(evdev)|qtConfig(libinput) { include($$PWD/shared/shared.pri) } +qtConfig(integrityhid) { + include($$PWD/integrityhid/integrityhid.pri) +} + load(qt_module) diff --git a/src/platformsupport/input/integrityhid/integrityhid.pri b/src/platformsupport/input/integrityhid/integrityhid.pri new file mode 100644 index 0000000000..0a6240c422 --- /dev/null +++ b/src/platformsupport/input/integrityhid/integrityhid.pri @@ -0,0 +1,7 @@ +HEADERS += \ + $$PWD/qintegrityhidmanager.h + +SOURCES += \ + $$PWD/qintegrityhidmanager.cpp + +QMAKE_USE_PRIVATE += integrityhid diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp new file mode 100644 index 0000000000..8089a6e38b --- /dev/null +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp @@ -0,0 +1,263 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Green Hills Software +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 "qintegrityhidmanager.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class IntNotifier +{ + static const Value ActivityPriority = 2; +protected: + Activity act; +public: + IntNotifier() + { + CheckSuccess(CreateActivity(CurrentTask(), ActivityPriority, false, (Value)this, &act)); + }; + ~IntNotifier() + { + CheckSuccess(CloseActivity(act)); + }; + virtual void process_event() = 0; + virtual void async_wait() = 0; +}; + +class HIDDeviceHandler : IntNotifier +{ +public: + HIDDeviceHandler(HIDDriver *hidd, HIDHandle hidh) + : driver(hidd), handle(hidh), currentPos(0, 0) { } + ~HIDDeviceHandler() + { + CheckSuccess(gh_hid_close(handle)); + }; + void process_event(void) Q_DECL_OVERRIDE; + void async_wait(void) Q_DECL_OVERRIDE; + HIDDriver *get_driver(void) { return driver; }; + HIDHandle get_handle(void) { return handle; }; +private: + HIDDriver *driver; + HIDHandle handle; + QPoint currentPos; + Qt::MouseButtons buttons; +}; + +class HIDDriverHandler : IntNotifier +{ +public: + HIDDriverHandler(HIDDriver *hidd) : IntNotifier(), driver(hidd) { } + ~HIDDriverHandler() + { + qDeleteAll(devices); + }; + void process_event(void) Q_DECL_OVERRIDE; + void async_wait(void) Q_DECL_OVERRIDE; + void find_devices(void); +private: + QHash devices; + HIDDriver *driver; +}; + +void HIDDriverHandler::process_event() +{ + find_devices(); +} + +void HIDDriverHandler::async_wait() +{ + gh_hid_wait_for_new_device(driver, act); +} + +void HIDDriverHandler::find_devices() +{ + Error err; + uintptr_t devicecontext; + uint32_t device_id; + HIDHandle handle; + HIDDeviceHandler *hidnot; + int deviceCount = 0; + + devicecontext = 0; + forever { + err = gh_hid_enum_devices(driver, &device_id, &devicecontext); + if (err == OperationNotImplemented) + break; + else if (err == Failure) + break; + if (!devices.contains(device_id)) { + err = gh_hid_init_device(driver, device_id, &handle); + if (err == Success) { + hidnot = new HIDDeviceHandler(driver, handle); + devices.insert(device_id, hidnot); + QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( + QInputDeviceManager::DeviceTypePointer,++deviceCount); + hidnot->async_wait(); + } + } + } + if (err == OperationNotImplemented) { + /* fallback on legacy enumeration where we assume 0-based + * contiguous indexes */ + device_id = 0; + err = Success; + do { + if (!devices.contains(device_id)) { + err = gh_hid_init_device(driver, device_id, &handle); + if (err != Success) + break; + hidnot = new HIDDeviceHandler(driver, handle); + devices.insert(device_id, hidnot); + hidnot->async_wait(); + } + device_id++; + } while (err == Success); + } + + async_wait(); +} + + +void HIDDeviceHandler::process_event() +{ + HIDEvent event; + uint32_t num_events = 1; + + while (gh_hid_get_event(handle, &event, &num_events) == Success) { + if (event.type == HID_TYPE_AXIS) { + switch (event.index) { + case HID_AXIS_ABSX: + currentPos.setX(event.value); + break; + case HID_AXIS_ABSY: + currentPos.setY(event.value); + break; + case HID_AXIS_RELX: + currentPos.setX(currentPos.x() + event.value); + break; + case HID_AXIS_RELY: + currentPos.setY(currentPos.y() + event.value); + break; + default: + /* ignore the rest for now */ + break; + } + } else if (event.type == HID_TYPE_KEY) { + switch (event.index) { + case HID_BUTTON_LEFT: + if (event.value) + buttons |= Qt::LeftButton; + else + buttons &= ~Qt::LeftButton; + break; + case HID_BUTTON_MIDDLE: + if (event.value) + buttons |= Qt::MiddleButton; + else + buttons &= ~Qt::MiddleButton; + break; + case HID_BUTTON_RIGHT: + if (event.value) + buttons |= Qt::RightButton; + else + buttons &= ~Qt::RightButton; + break; + default: + /* ignore the rest for now */ + break; + } + } else if (event.type == HID_TYPE_SYNC) { + QWindowSystemInterface::handleMouseEvent(0, currentPos, currentPos, buttons, + QGuiApplication::keyboardModifiers()); + } else if (event.type == HID_TYPE_DISCONNECT) { + /* FIXME */ + } + } + async_wait(); +} + +void HIDDeviceHandler::async_wait() +{ + CheckSuccess(gh_hid_async_wait_for_event(handle, act)); +} + +void QIntegrityHIDManager::open_devices() +{ + HIDDriver *hidd; + uintptr_t context = 0; + HIDDriverHandler *hidnot; + + while (gh_hid_enum_drivers(&hidd, &context) == Success) { + hidnot = new HIDDriverHandler(hidd); + m_drivers.append(hidnot); + hidnot->find_devices(); + } +} + +void QIntegrityHIDManager::run() +{ + IntNotifier *notifier; + open_devices(); + /* main loop */ + forever { + WaitForActivity((Value *)¬ifier); + notifier->process_event(); + } +} + +QIntegrityHIDManager::QIntegrityHIDManager(const QString &key, const QString &spec, QObject *parent) + : QThread(parent) +{ + start(); +} + +QIntegrityHIDManager::~QIntegrityHIDManager() +{ + terminate(); + qDeleteAll(m_drivers); +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h new file mode 100644 index 0000000000..c8780b2dc2 --- /dev/null +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Green Hills Software +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 QINTEGRITYHIDMANAGER_P_H +#define QINTEGRITYHIDMANAGER_P_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class HIDDriverHandler; + +class QIntegrityHIDManager : public QThread +{ + Q_OBJECT +public: + QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = 0); + ~QIntegrityHIDManager(); + + void run(void); +private: + void open_devices(void); + + QString m_spec; + QList m_drivers; + +}; + +QT_END_NAMESPACE + +#endif // QINTEGRITYHIDMANAGER_P_H diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 7a97a12bae..7db6de78b4 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -10,7 +10,7 @@ SUBDIRS = \ qtConfig(freetype)|darwin|win32: \ SUBDIRS += fontdatabases -qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput) { +qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput)|qtConfig(integrityhid) { SUBDIRS += input input.depends += devicediscovery } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 8b751a72bf..9a0be489a8 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -92,6 +92,10 @@ #include #endif +#if QT_CONFIG(integrityhid) +#include +#endif + #include static void initResources() @@ -466,6 +470,10 @@ void QEglFSIntegration::createInputHandlers() #endif new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif + +#if QT_CONFIG(integrityhid) + new QIntegrityHIDManager("HID", "", this); +#endif } EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const -- cgit v1.2.3 From c25ad981a334a4a720ae48cfe800868c4aef51a9 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 24 May 2017 17:15:17 +0200 Subject: QWidgetWindow: don't give focus to windows that are being destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the referenced bug report, dismissing a QFileDialog while the Qt Virtual Keyboard was in use would result in a crash. Dismissing a file dialog created with e.g. QFileDialog::getOpenFileName() causes it to eventually be destroyed. When this happens, it starts deleting its children. Each child widget's destructor calls clearFocus(). In clearFocus(), there is a block of code that emits QWindow::focusChanged(), passing the result of focusObject() called on that widget's window. QWidgetWindow::focusObject() could end up using itself as a fallback focus object if it had no other focus objects (e.g. children) to use instead, even though it was in the process of being destroyed; as were all of its children. The Qt Virtual Keyboard plugin would then try to use the focus object, even though it was in an invalid state. To fix this problem, we return early from QWidgetWindow::focusObject() if the window is in the process of being destroyed. Task-number: QTBUG-57193 Change-Id: I137cf9415812ce2e0419c0afe8076ce150f248cb Reviewed-by: Friedemann Kleint Reviewed-by: Jarkko Koivikko Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qwidgetwindow.cpp | 4 +++ .../dialogs/qfiledialog/tst_qfiledialog.cpp | 34 +++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 31f2d672bb..6741555c0c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -152,6 +152,10 @@ QObject *QWidgetWindow::focusObject() const if (!windowWidget) return Q_NULLPTR; + // A window can't have a focus object if it's being destroyed. + if (QWidgetPrivate::get(windowWidget)->data.in_destructor) + return nullptr; + QWidget *widget = windowWidget->focusWidget(); if (!widget) diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 8d209fc241..05410f4a0f 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -144,6 +144,7 @@ private slots: #endif void rejectModalDialogs(); void QTBUG49600_nativeIconProviderCrash(); + void focusObjectDuringDestruction(); // NOTE: Please keep widgetlessNativeDialog() as the LAST test! // @@ -1467,7 +1468,7 @@ public: } public slots: - void rejectFileDialog() + virtual void rejectFileDialog() { if (QWidget *w = QApplication::activeModalWidget()) if (QDialog *d = qobject_cast(w)) @@ -1511,5 +1512,36 @@ void tst_QFiledialog::QTBUG49600_nativeIconProviderCrash() fd.iconProvider(); } +class qtbug57193DialogRejecter : public DialogRejecter +{ +public: + void rejectFileDialog() override + { + QCOMPARE(QGuiApplication::topLevelWindows().size(), 1); + const QWindow *window = QGuiApplication::topLevelWindows().constFirst(); + + const QFileDialog *fileDialog = qobject_cast(QApplication::activeModalWidget()); + QVERIFY(fileDialog); + + // The problem in QTBUG-57193 was from a platform input context plugin that was + // connected to QWindow::focusObjectChanged(), and consequently accessed the focus + // object (the QFileDialog) that was in the process of being destroyed. This test + // checks that the QFileDialog is never set as the focus object after its destruction process begins. + connect(window, &QWindow::focusObjectChanged, [=](QObject *focusObject) { + QVERIFY(focusObject != fileDialog); + }); + DialogRejecter::rejectFileDialog(); + } +}; + +void tst_QFiledialog::focusObjectDuringDestruction() +{ + QTRY_VERIFY(QGuiApplication::topLevelWindows().isEmpty()); + + qtbug57193DialogRejecter dialogRejecter; + + QFileDialog::getOpenFileName(nullptr, QString(), QString(), QString(), nullptr); +} + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" -- cgit v1.2.3 From c3030d7163245b55abfd09eefe696c035c55011c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 23 May 2017 11:07:11 +0200 Subject: moc: remove _MSC_EXTENSIONS #define Because we obviously don't support Microsoft's extensions in C++. This is required because some MS headers have code that isn't proper C++, like iso646.h: #if !defined(__cplusplus) || defined(_MSC_EXTENSIONS) #define and && Do not pass /Za to MSVC to generate moc_predefs.h, because this option is incompatible with compiler options like /fp:fast that may be user-specified. This reverts commit e1a70ce4 and re-fixes the issue similarly to commit d72ac3f3. Task-number: QTBUG-58391 Change-Id: I5c0143283afed09f98200806c87259c039c00ae1 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- mkspecs/features/moc.prf | 4 ++-- src/tools/moc/main.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 15eb38af31..955933d874 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -31,10 +31,10 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APP moc_predefs.name = "Generate moc_predefs.h" moc_predefs.CONFIG = no_link gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} - else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Za -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} + else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:msvc { moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \ - -E -Za ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} + -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} } else: error("Oops, I messed up") moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.input = MOC_PREDEF_FILE diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index b30de66258..25f2fd45bf 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -380,6 +380,9 @@ int runMoc(int argc, char **argv) error("Missing macro name"); parser.showHelp(1); } + // Prevent parse errors on MSVC extensions. + if (name == "_MSC_EXTENSIONS") + continue; Macro macro; macro.symbols = Preprocessor::tokenize(value, 1, Preprocessor::TokenizeDefine); macro.symbols.removeLast(); // remove the EOF symbol -- cgit v1.2.3 From c70c1d54f437e77f1e75b3f438b4c3dd6f1ce5a0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 29 May 2017 13:45:25 +0200 Subject: QStackedLayout: Fix UB (invalid cast) in qt_wasDeleted() Fixup of commit b4995eb7491c1b4784a1bf48db834c11c42b8d9d. We can't call QWidgetPrivate::get(w) on a deleted QWidget, because of the call to the member function QWidget::d_func. We can however call QObjectPrivate::get since we still are in the QObject destructor. tst_qstackedlayout now pass without ubsan Warnings. Change-Id: I4e839a97ddbd1cf21435a8fca76523b98a1f7d9b Reviewed-by: Marc Mutz --- src/corelib/kernel/qobject_p.h | 1 + src/widgets/kernel/qstackedlayout.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index a7d7ef0889..7b9253ac64 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -198,6 +198,7 @@ public: static QObjectPrivate *get(QObject *o) { return o->d_func(); } + static const QObjectPrivate *get(const QObject *o) { return o->d_func(); } int signalIndex(const char *signalName, const QMetaObject **meta = 0) const; inline bool isSignalConnected(uint signalIdx, bool checkDeclarative = true) const; diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index d9c1c524d7..b8b6f4302d 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -253,7 +253,7 @@ QLayoutItem *QStackedLayout::itemAt(int index) const // on the object then) static bool qt_wasDeleted(const QWidget *w) { - return QWidgetPrivate::get(w)->wasDeleted; + return QObjectPrivate::get(w)->wasDeleted; } -- cgit v1.2.3 From 86326149474763a9b7adf109b59c7c4acc74b031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Fri, 5 May 2017 15:18:46 +0200 Subject: QSslCertificate: don't init() if SSL is not supported QSslCertificate used SSL without checking if SSL is available. This patch adds such checks to the constructors. Change-Id: Iea298aded5966641327e22e41ad4665a3d0ec5d3 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcertificate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index ce78399e01..6433b84e80 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -143,7 +143,7 @@ QSslCertificate::QSslCertificate(QIODevice *device, QSsl::EncodingFormat format) : d(new QSslCertificatePrivate) { QSslSocketPrivate::ensureInitialized(); - if (device) + if (device && QSslSocket::supportsSsl()) d->init(device->readAll(), format); } @@ -157,7 +157,8 @@ QSslCertificate::QSslCertificate(const QByteArray &data, QSsl::EncodingFormat fo : d(new QSslCertificatePrivate) { QSslSocketPrivate::ensureInitialized(); - d->init(data, format); + if (QSslSocket::supportsSsl()) + d->init(data, format); } /*! -- cgit v1.2.3 From 18e5d10426e7b116f02b20c258542c4de4f18560 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 29 May 2017 16:56:28 +0200 Subject: Convert features.cups to QT_[REQUIRE_]CONFIG Change-Id: I189134b41c4f6e4ac42b5e47ae79338c744b581d Reviewed-by: Oswald Buddenhagen --- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 8 +++++--- src/printsupport/dialogs/qprintdialog_unix.cpp | 10 +++++----- src/printsupport/kernel/qcups.cpp | 4 ---- src/printsupport/kernel/qcups_p.h | 4 +--- src/printsupport/kernel/qprint_p.h | 4 ++-- src/printsupport/widgets/qcupsjobwidget.cpp | 4 ---- src/printsupport/widgets/widgets.pri | 2 +- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 98d657bed4..fdaeb7ae8c 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -44,7 +44,9 @@ #include #include +#if QT_CONFIG(cups) #include +#endif #include "qpainter.h" #include "qprintdialog.h" @@ -294,7 +296,7 @@ void QPageSetupWidget::initUnits() // Init the Pages Per Sheet (n-up) combo boxes if using CUPS void QPageSetupWidget::initPagesPerSheet() { -#if !defined(QT_NO_CUPS) +#if QT_CONFIG(cups) m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Left to Right, Top to Bottom"), QVariant::fromValue(QCUPSSupport::LeftToRightTopToBottom)); m_ui.pagesPerSheetLayoutCombo->addItem(QPrintDialog::tr("Left to Right, Bottom to Top"), @@ -498,7 +500,7 @@ void QPageSetupWidget::updateWidget() void QPageSetupWidget::setupPrinter() const { m_printer->setPageLayout(m_pageLayout); -#if !defined(QT_NO_CUPS) +#if QT_CONFIG(cups) QCUPSSupport::PagesPerSheet pagesPerSheet = m_ui.pagesPerSheetCombo->currentData() .value(); QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = m_ui.pagesPerSheetLayoutCombo->currentData() @@ -545,7 +547,7 @@ void QPageSetupWidget::pageOrientationChanged() void QPageSetupWidget::pagesPerSheetChanged() { -#if !defined(QT_NO_CUPS) +#if QT_CONFIG(cups) switch (m_ui.pagesPerSheetCombo->currentData().toInt()) { case QCUPSSupport::OnePagePerSheet: m_pagePreview->setPagePreviewLayout(1, 1); diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 5527cd94f9..7c0e064ddd 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -64,7 +64,7 @@ #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" -#ifndef QT_NO_CUPS +#if QT_CONFIG(cups) #include #if QT_CONFIG(cupsjobwidget) #include "qcupsjobwidget_p.h" @@ -313,7 +313,7 @@ void QPrintDialogPrivate::init() options.grayscale->setIconSize(QSize(32, 32)); options.grayscale->setIcon(QIcon(QLatin1String(":/qt-project.org/dialogs/qprintdialog/images/status-gray-scale.png"))); -#ifndef QT_NO_CUPS +#if QT_CONFIG(cups) // Add Page Set widget if CUPS is available options.pageSetCombo->addItem(tr("All Pages"), QVariant::fromValue(QCUPSSupport::AllPages)); options.pageSetCombo->addItem(tr("Odd Pages"), QVariant::fromValue(QCUPSSupport::OddPages)); @@ -435,7 +435,7 @@ void QPrintDialogPrivate::setupPrinter() } } -#ifndef QT_NO_CUPS +#if QT_CONFIG(cups) // page set if (p->printRange() == QPrinter::AllPages || p->printRange() == QPrinter::PageRange) { //If the application is selecting pages and the first page number is even then need to adjust the odd-even accordingly @@ -518,7 +518,7 @@ void QPrintDialogPrivate::updateWidgets() options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies)); -#ifndef QT_NO_CUPS +#if QT_CONFIG(cups) // Don't display Page Set if only Selection or Current Page are enabled if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) && (q->isOptionEnabled(QPrintDialog::PrintSelection) || q->isOptionEnabled(QPrintDialog::PrintCurrentPage))) { @@ -867,7 +867,7 @@ bool QUnixPrintWidgetPrivate::checkFields() } } -#ifndef QT_NO_CUPS +#if QT_CONFIG(cups) if (propertiesDialogShown) { QCUPSSupport::PagesPerSheet pagesPerSheet = propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo ->currentData().value(); diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index d655dd09ba..48ab71eea4 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -41,8 +41,6 @@ #include "qprintengine.h" -#ifndef QT_NO_CUPS - QT_BEGIN_NAMESPACE QStringList QCUPSSupport::cupsOptionsList(QPrinter *printer) @@ -205,5 +203,3 @@ void QCUPSSupport::setPageRange(QPrinter *printer, int pageFrom, int pageTo) } QT_END_NAMESPACE - -#endif // QT_NO_CUPS diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h index 139b18c509..780115e350 100644 --- a/src/printsupport/kernel/qcups_p.h +++ b/src/printsupport/kernel/qcups_p.h @@ -57,7 +57,7 @@ #include "QtPrintSupport/qprinter.h" #include "QtCore/qdatetime.h" -#ifndef QT_NO_CUPS +QT_REQUIRE_CONFIG(cups); QT_BEGIN_NAMESPACE @@ -150,6 +150,4 @@ Q_DECLARE_METATYPE(QCUPSSupport::PageSet) Q_DECLARE_METATYPE(QCUPSSupport::PagesPerSheetLayout) Q_DECLARE_METATYPE(QCUPSSupport::PagesPerSheet) -#endif // QT_NO_CUPS - #endif diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h index 47dfce3787..280c2d7608 100644 --- a/src/printsupport/kernel/qprint_p.h +++ b/src/printsupport/kernel/qprint_p.h @@ -57,7 +57,7 @@ #include #include -#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_MACOS) || (defined Q_OS_UNIX && QT_CONFIG(cups)) #include // Use for type defs only, don't want to actually link in main module #endif @@ -245,7 +245,7 @@ public: return QByteArray(); } -#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_MACOS) || (defined Q_OS_UNIX && QT_CONFIG(cups)) // PPD utilities shared by CUPS and Mac plugins requiring CUPS headers // May turn into a proper internal QPpd class if enough shared between Mac and CUPS, diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp index 204a125d13..00f2d64df2 100644 --- a/src/printsupport/widgets/qcupsjobwidget.cpp +++ b/src/printsupport/widgets/qcupsjobwidget.cpp @@ -54,8 +54,6 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS) - /*! \internal \class QCupsJobWidget @@ -212,6 +210,4 @@ QCUPSSupport::BannerPage QCupsJobWidget::endBannerPage() const return m_ui.endBannerPageCombo->itemData(m_ui.endBannerPageCombo->currentIndex()).value(); } -#endif // QT_NO_PRINTER / QT_NO_CUPS - QT_END_NAMESPACE diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri index 505983778e..1fa32764e8 100644 --- a/src/printsupport/widgets/widgets.pri +++ b/src/printsupport/widgets/widgets.pri @@ -1,7 +1,7 @@ HEADERS += widgets/qprintpreviewwidget.h SOURCES += widgets/qprintpreviewwidget.cpp -unix:!darwin:qtConfig(cups):qtConfig(cupsjobwidget) { +unix:!darwin:qtConfig(cupsjobwidget) { HEADERS += widgets/qcupsjobwidget_p.h SOURCES += widgets/qcupsjobwidget.cpp FORMS += widgets/qcupsjobwidget.ui -- cgit v1.2.3 From e0b39313b068b41b0689b37bed6750dd0459ab89 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 29 May 2017 17:05:56 +0200 Subject: Convert features.printpreviewdialog to QT_[REQUIRE_]CONFIG Change-Id: If38d70b1e098c0cc680b913b2c4087681ad2a41e Reviewed-by: Oswald Buddenhagen --- src/printsupport/dialogs/dialogs.pri | 11 +++++++---- src/printsupport/dialogs/qprintpreviewdialog.cpp | 6 ------ src/printsupport/dialogs/qprintpreviewdialog.h | 7 ++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri index 7b520a05de..6c75e562ab 100644 --- a/src/printsupport/dialogs/dialogs.pri +++ b/src/printsupport/dialogs/dialogs.pri @@ -5,8 +5,7 @@ HEADERS += \ dialogs/qabstractprintdialog_p.h \ dialogs/qpagesetupdialog_p.h \ dialogs/qpagesetupdialog.h \ - dialogs/qprintdialog.h \ - dialogs/qprintpreviewdialog.h + dialogs/qprintdialog.h osx { OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ @@ -33,8 +32,12 @@ INCLUDEPATH += $$PWD SOURCES += \ dialogs/qabstractprintdialog.cpp \ - dialogs/qpagesetupdialog.cpp \ - dialogs/qprintpreviewdialog.cpp + dialogs/qpagesetupdialog.cpp + +qtConfig(printpreviewdialog) { + HEADERS += dialogs/qprintpreviewdialog.h + SOURCES += dialogs/qprintpreviewdialog.cpp +} FORMS += dialogs/qpagesetupwidget.ui RESOURCES += dialogs/qprintdialog.qrc diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp index 33ba842a1f..fd23aea460 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -56,8 +56,6 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWDIALOG - #include "private/qdialog_p.h" #include @@ -787,7 +785,3 @@ QT_END_NAMESPACE #include "moc_qprintpreviewdialog.cpp" #include "qprintpreviewdialog.moc" - -#endif // QT_NO_PRINTPREVIEWDIALOG - - diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h index 640369fdf3..3b8f8a1171 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.h +++ b/src/printsupport/dialogs/qprintpreviewdialog.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_PRINTPREVIEWDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(printpreviewdialog); +QT_BEGIN_NAMESPACE class QGraphicsView; class QPrintPreviewDialogPrivate; @@ -91,6 +90,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PRINTPREVIEWDIALOG - #endif // QPRINTPREVIEWDIALOG_H -- cgit v1.2.3 From f209215c0d96c8badcc14a3fc1cd8a6b0e56625c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 29 May 2017 17:11:20 +0200 Subject: Convert features.printpreviewwidget to QT_[REQUIRE_]CONFIG Change-Id: I7e38179acd93bf8c7c48c79ff5e304d893460758 Reviewed-by: Oswald Buddenhagen --- src/printsupport/kernel/kernel.pri | 7 +++++-- src/printsupport/kernel/qpaintengine_preview.cpp | 3 --- src/printsupport/kernel/qpaintengine_preview_p.h | 4 +--- src/printsupport/kernel/qprinter.cpp | 8 +++++--- src/printsupport/kernel/qprinter_p.h | 6 +++--- src/printsupport/widgets/qprintpreviewwidget.cpp | 4 ---- src/printsupport/widgets/qprintpreviewwidget.h | 3 +-- src/printsupport/widgets/widgets.pri | 6 ++++-- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 90eab4a634..ea7b4b9780 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -1,6 +1,5 @@ HEADERS += \ $$PWD/qpaintengine_alpha_p.h \ - $$PWD/qpaintengine_preview_p.h \ $$PWD/qprint_p.h \ $$PWD/qprintdevice_p.h \ $$PWD/qprintengine.h \ @@ -16,7 +15,6 @@ HEADERS += \ SOURCES += \ $$PWD/qpaintengine_alpha.cpp \ - $$PWD/qpaintengine_preview.cpp \ $$PWD/qprintdevice.cpp \ $$PWD/qprintengine_pdf.cpp \ $$PWD/qprinter.cpp \ @@ -25,6 +23,11 @@ SOURCES += \ $$PWD/qplatformprintplugin.cpp \ $$PWD/qplatformprintersupport.cpp +qtConfig(printpreviewwidget) { + HEADERS += $$PWD/qpaintengine_preview_p.h + SOURCES += $$PWD/qpaintengine_preview.cpp +} + win32 { HEADERS += \ $$PWD/qprintengine_win_p.h diff --git a/src/printsupport/kernel/qpaintengine_preview.cpp b/src/printsupport/kernel/qpaintengine_preview.cpp index b5d40fd430..4c00333097 100644 --- a/src/printsupport/kernel/qpaintengine_preview.cpp +++ b/src/printsupport/kernel/qpaintengine_preview.cpp @@ -46,7 +46,6 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET QT_BEGIN_NAMESPACE class QPreviewPaintEnginePrivate : public QPaintEnginePrivate @@ -218,5 +217,3 @@ QPrinter::PrinterState QPreviewPaintEngine::printerState() const } QT_END_NAMESPACE - -#endif diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h index 31b3142cb6..9203e40235 100644 --- a/src/printsupport/kernel/qpaintengine_preview_p.h +++ b/src/printsupport/kernel/qpaintengine_preview_p.h @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET +QT_REQUIRE_CONFIG(printpreviewwidget); QT_BEGIN_NAMESPACE @@ -100,6 +100,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PRINTPREVIEWWIDGET - #endif diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 53bed87dfc..83ebb15a12 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -55,7 +55,9 @@ #include "qprintengine_pdf_p.h" #include +#if QT_CONFIG(printpreviewwidget) #include +#endif QT_BEGIN_NAMESPACE @@ -185,7 +187,7 @@ void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinte delete oldPrintEngine; } -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QList QPrinterPrivate::previewPages() const { if (previewEngine) @@ -210,7 +212,7 @@ void QPrinterPrivate::setPreviewMode(bool enable) use_default_engine = had_default_engines; } } -#endif // QT_NO_PRINTPREVIEWWIDGET +#endif // QT_CONFIG(printpreviewwidget) void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) { @@ -623,7 +625,7 @@ QPrinter::~QPrinter() Q_D(QPrinter); if (d->use_default_engine) delete d->printEngine; -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) delete d->previewEngine; #endif } diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 18dfad926c..603eaf7409 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -79,7 +79,7 @@ public: paintEngine(0), realPrintEngine(0), realPaintEngine(0), -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) previewEngine(0), #endif q_ptr(printer), @@ -98,7 +98,7 @@ public: QPrinterInfo findValidPrinter(const QPrinterInfo &printer = QPrinterInfo()); void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QList previewPages() const; void setPreviewMode(bool); #endif @@ -112,7 +112,7 @@ public: QPrintEngine *realPrintEngine; QPaintEngine *realPaintEngine; -#ifndef QT_NO_PRINTPREVIEWWIDGET +#if QT_CONFIG(printpreviewwidget) QPreviewPaintEngine *previewEngine; #endif diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp index fd1cf68587..b28e693612 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.cpp +++ b/src/printsupport/widgets/qprintpreviewwidget.cpp @@ -48,8 +48,6 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET - QT_BEGIN_NAMESPACE namespace { @@ -831,5 +829,3 @@ QT_END_NAMESPACE #include "moc_qprintpreviewwidget.cpp" #include "qprintpreviewwidget.moc" - -#endif // QT_NO_PRINTPREVIEWWIDGET diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h index dec7092eb1..8735d06072 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.h +++ b/src/printsupport/widgets/qprintpreviewwidget.h @@ -44,7 +44,7 @@ #include #include -#ifndef QT_NO_PRINTPREVIEWWIDGET +QT_REQUIRE_CONFIG(printpreviewwidget); QT_BEGIN_NAMESPACE @@ -114,5 +114,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PRINTPREVIEWWIDGET #endif // QPRINTPREVIEWWIDGET_H diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri index 1fa32764e8..1b5f0aca34 100644 --- a/src/printsupport/widgets/widgets.pri +++ b/src/printsupport/widgets/widgets.pri @@ -1,5 +1,7 @@ -HEADERS += widgets/qprintpreviewwidget.h -SOURCES += widgets/qprintpreviewwidget.cpp +qtConfig(printpreviewwidget) { + HEADERS += widgets/qprintpreviewwidget.h + SOURCES += widgets/qprintpreviewwidget.cpp +} unix:!darwin:qtConfig(cupsjobwidget) { HEADERS += widgets/qcupsjobwidget_p.h -- cgit v1.2.3 From dbeb748de30bcc0e0615d21c593b761408404950 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 29 May 2017 17:35:58 +0200 Subject: Convert features.printdialog to QT_[REQUIRE_]CONFIG Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a Reviewed-by: Oswald Buddenhagen --- examples/touch/fingerpaint/scribblearea.cpp | 9 ++-- .../dialogs/licensewizard/licensewizard.cpp | 7 ++- examples/widgets/graphicsview/chip/view.cpp | 7 ++- .../widgets/itemviews/pixelator/mainwindow.cpp | 7 ++- .../widgets/itemviews/spreadsheet/spreadsheet.cpp | 9 +++- .../widgets/mainwindows/dockwidgets/mainwindow.cpp | 7 ++- .../widgets/painting/fontsampler/mainwindow.cpp | 9 +++- examples/widgets/painting/fontsampler/mainwindow.h | 2 - examples/widgets/richtext/orderform/mainwindow.cpp | 7 ++- examples/widgets/richtext/textedit/textedit.cpp | 13 +++-- .../widgets/widgets/imageviewer/imageviewer.cpp | 7 ++- examples/widgets/widgets/scribble/scribblearea.cpp | 9 ++-- src/printsupport/dialogs/dialogs.pri | 57 ++++++++++++---------- src/printsupport/dialogs/qabstractprintdialog.cpp | 4 -- src/printsupport/dialogs/qabstractprintdialog.h | 7 +-- src/printsupport/dialogs/qabstractprintdialog_p.h | 10 +--- src/printsupport/dialogs/qpagesetupdialog.cpp | 4 -- src/printsupport/dialogs/qpagesetupdialog.h | 7 +-- src/printsupport/dialogs/qpagesetupdialog_mac.mm | 3 -- src/printsupport/dialogs/qpagesetupdialog_p.h | 6 +-- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 3 -- src/printsupport/dialogs/qpagesetupdialog_unix_p.h | 5 +- src/printsupport/dialogs/qpagesetupdialog_win.cpp | 2 - src/printsupport/dialogs/qprintdialog.h | 7 +-- src/printsupport/dialogs/qprintdialog_mac.mm | 4 -- src/printsupport/dialogs/qprintdialog_unix.cpp | 5 -- src/printsupport/dialogs/qprintdialog_win.cpp | 4 -- src/printsupport/doc/snippets/widgetprinting.cpp | 5 +- src/printsupport/kernel/qplatformprintdevice.cpp | 2 + .../tst_qabstractprintdialog.cpp | 7 ++- 30 files changed, 121 insertions(+), 114 deletions(-) diff --git a/examples/touch/fingerpaint/scribblearea.cpp b/examples/touch/fingerpaint/scribblearea.cpp index f8dadb4829..aa4e60c934 100644 --- a/examples/touch/fingerpaint/scribblearea.cpp +++ b/examples/touch/fingerpaint/scribblearea.cpp @@ -49,10 +49,13 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include #endif +#endif #include "scribblearea.h" @@ -167,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize) //! [21] void ScribbleArea::print() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QPrinter printer(QPrinter::HighResolution); QPrintDialog printDialog(&printer, this); @@ -181,7 +184,7 @@ void ScribbleArea::print() painter.setWindow(image.rect()); painter.drawImage(0, 0, image); } -#endif // QT_NO_PRINTER +#endif // QT_CONFIG(printdialog) } //! [22] diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.cpp b/examples/widgets/dialogs/licensewizard/licensewizard.cpp index 6dbb894ad8..c082afa876 100644 --- a/examples/widgets/dialogs/licensewizard/licensewizard.cpp +++ b/examples/widgets/dialogs/licensewizard/licensewizard.cpp @@ -49,8 +49,13 @@ ****************************************************************************/ #include +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include +#endif +#endif #include "licensewizard.h" @@ -364,7 +369,7 @@ void ConclusionPage::setVisible(bool visible) void ConclusionPage::printButtonClicked() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QPrinter printer; QPrintDialog dialog(&printer, this); if (dialog.exec()) diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 62aa25b575..79b173bec7 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -50,8 +50,13 @@ #include "view.h" +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include +#endif +#endif #ifndef QT_NO_OPENGL #include #else @@ -259,7 +264,7 @@ void View::toggleAntialiasing() void View::print() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QPrinter printer; QPrintDialog dialog(&printer, this); if (dialog.exec() == QDialog::Accepted) { diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp index 2a5b572344..63617f0169 100644 --- a/examples/widgets/itemviews/pixelator/mainwindow.cpp +++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp @@ -53,10 +53,13 @@ #include "pixeldelegate.h" #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include #endif +#endif //! [0] MainWindow::MainWindow() @@ -164,7 +167,7 @@ void MainWindow::openImage(const QString &fileName) void MainWindow::printImage() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) { QMessageBox::StandardButton answer; answer = QMessageBox::question(this, tr("Large Image Size"), diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp b/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp index e894d7fbd4..621f655b02 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp +++ b/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp @@ -49,11 +49,16 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include +#endif +#if QT_CONFIG(printpreviewdialog) #include #endif +#endif #include "spreadsheet.h" #include "spreadsheetdelegate.h" @@ -637,7 +642,7 @@ QString encode_pos(int row, int col) void SpreadSheet::print() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printpreviewdialog) QPrinter printer(QPrinter::ScreenResolution); QPrintPreviewDialog dlg(&printer); PrintView view; diff --git a/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp b/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp index eb5864c818..47a6e78265 100644 --- a/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp +++ b/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp @@ -50,9 +50,12 @@ //! [0] #include -#ifndef QT_NO_PRINTDIALOG +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #endif +#endif #include "mainwindow.h" //! [0] @@ -125,7 +128,7 @@ void MainWindow::newLetter() //! [3] void MainWindow::print() { -#ifndef QT_NO_PRINTDIALOG +#if QT_CONFIG(printdialog) QTextDocument *document = textEdit->document(); QPrinter printer; diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 192ffbd369..bd15438df9 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -50,8 +50,15 @@ #include #if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) +#include +#include +#if QT_CONFIG(printpreviewdialog) #include #endif +#endif +#endif #include "mainwindow.h" @@ -270,7 +277,7 @@ void MainWindow::printDocument(QPrinter *printer) void MainWindow::on_printPreviewAction_triggered() { -#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printpreviewdialog) pageMap = currentPageMap(); if (pageMap.count() == 0) diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h index 8f59e1021b..ffb2839ffa 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.h +++ b/examples/widgets/painting/fontsampler/mainwindow.h @@ -52,8 +52,6 @@ #define MAINWINDOW_H #include "ui_mainwindowbase.h" -#include -#include #if defined(QT_PRINTSUPPORT_LIB) #include diff --git a/examples/widgets/richtext/orderform/mainwindow.cpp b/examples/widgets/richtext/orderform/mainwindow.cpp index 35934bee72..030072978e 100644 --- a/examples/widgets/richtext/orderform/mainwindow.cpp +++ b/examples/widgets/richtext/orderform/mainwindow.cpp @@ -49,10 +49,13 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include #endif +#endif #include "detailsdialog.h" #include "mainwindow.h" @@ -245,7 +248,7 @@ void MainWindow::openDialog() //! [17] void MainWindow::printFile() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QTextEdit *editor = static_cast(letters->currentWidget()); //! [18] QPrinter printer; diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index 140ae478ff..fe4ee4f499 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -71,11 +71,18 @@ #include #include #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printer) +#if QT_CONFIG(printdialog) #include +#endif #include +#if QT_CONFIG(printpreviewdialog) #include #endif +#endif +#endif #include "textedit.h" @@ -474,7 +481,7 @@ bool TextEdit::fileSaveAs() void TextEdit::filePrint() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QPrinter printer(QPrinter::HighResolution); QPrintDialog *dlg = new QPrintDialog(&printer, this); if (textEdit->textCursor().hasSelection()) @@ -488,7 +495,7 @@ void TextEdit::filePrint() void TextEdit::filePrintPreview() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printpreviewdialog) QPrinter printer(QPrinter::HighResolution); QPrintPreviewDialog preview(&printer, this); connect(&preview, &QPrintPreviewDialog::paintRequested, this, &TextEdit::printPreview); diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp index f2570c18c1..327abf7e43 100644 --- a/examples/widgets/widgets/imageviewer/imageviewer.cpp +++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp @@ -49,9 +49,12 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #endif +#endif #include "imageviewer.h" @@ -180,7 +183,7 @@ void ImageViewer::print() //! [5] //! [6] { Q_ASSERT(imageLabel->pixmap()); -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) //! [6] //! [7] QPrintDialog dialog(&printer, this); //! [7] //! [8] diff --git a/examples/widgets/widgets/scribble/scribblearea.cpp b/examples/widgets/widgets/scribble/scribblearea.cpp index 2ae7ee027b..d32a29697b 100644 --- a/examples/widgets/widgets/scribble/scribblearea.cpp +++ b/examples/widgets/widgets/scribble/scribblearea.cpp @@ -49,10 +49,13 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER +#if defined(QT_PRINTSUPPORT_LIB) +#include +#if QT_CONFIG(printdialog) #include #include #endif +#endif #include "scribblearea.h" @@ -210,7 +213,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize) //! [21] void ScribbleArea::print() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if QT_CONFIG(printdialog) QPrinter printer(QPrinter::HighResolution); QPrintDialog printDialog(&printer, this); @@ -224,6 +227,6 @@ void ScribbleArea::print() painter.setWindow(image.rect()); painter.drawImage(0, 0, image); } -#endif // QT_NO_PRINTER +#endif // QT_CONFIG(printdialog) } //! [22] diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri index 6c75e562ab..0a7b947c79 100644 --- a/src/printsupport/dialogs/dialogs.pri +++ b/src/printsupport/dialogs/dialogs.pri @@ -1,43 +1,46 @@ # Qt dialogs module -HEADERS += \ +INCLUDEPATH += $$PWD + +qtConfig(printdialog) { + HEADERS += \ dialogs/qabstractprintdialog.h \ dialogs/qabstractprintdialog_p.h \ dialogs/qpagesetupdialog_p.h \ dialogs/qpagesetupdialog.h \ dialogs/qprintdialog.h -osx { - OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ - dialogs/qprintdialog_mac.mm - LIBS_PRIVATE += -framework AppKit -} - -win32 { - SOURCES += dialogs/qpagesetupdialog_win.cpp \ - dialogs/qprintdialog_win.cpp -} - -unix:!mac { - INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/printsupport/cups - HEADERS += dialogs/qpagesetupdialog_unix_p.h - SOURCES += dialogs/qprintdialog_unix.cpp \ - dialogs/qpagesetupdialog_unix.cpp - FORMS += dialogs/qprintsettingsoutput.ui \ - dialogs/qprintwidget.ui \ - dialogs/qprintpropertieswidget.ui -} - -INCLUDEPATH += $$PWD - -SOURCES += \ + macos { + OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ + dialogs/qprintdialog_mac.mm + LIBS_PRIVATE += -framework AppKit + } + + win32 { + SOURCES += dialogs/qpagesetupdialog_win.cpp \ + dialogs/qprintdialog_win.cpp + } + + unix:!darwin { + INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/printsupport/cups + HEADERS += dialogs/qpagesetupdialog_unix_p.h + SOURCES += dialogs/qprintdialog_unix.cpp \ + dialogs/qpagesetupdialog_unix.cpp + FORMS += dialogs/qprintsettingsoutput.ui \ + dialogs/qprintwidget.ui \ + dialogs/qprintpropertieswidget.ui + } + + SOURCES += \ dialogs/qabstractprintdialog.cpp \ dialogs/qpagesetupdialog.cpp + FORMS += dialogs/qpagesetupwidget.ui + RESOURCES += dialogs/qprintdialog.qrc +} + qtConfig(printpreviewdialog) { HEADERS += dialogs/qprintpreviewdialog.h SOURCES += dialogs/qprintpreviewdialog.cpp } -FORMS += dialogs/qpagesetupwidget.ui -RESOURCES += dialogs/qprintdialog.qrc diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp index 3c5f882f2e..f982da46d9 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.cpp +++ b/src/printsupport/dialogs/qabstractprintdialog.cpp @@ -43,8 +43,6 @@ #include "qprinter.h" #include "private/qprinter_p.h" -#ifndef QT_NO_PRINTDIALOG - QT_BEGIN_NAMESPACE // hack @@ -497,5 +495,3 @@ void QPrintDialog::open(QObject *receiver, const char *member) } QT_END_NAMESPACE - -#endif // QT_NO_PRINTDIALOG diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h index e6d34cdb5b..eb4dc3eb99 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.h +++ b/src/printsupport/dialogs/qabstractprintdialog.h @@ -42,12 +42,11 @@ #include -#if QT_CONFIG(printdialog) - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(printdialog); +QT_BEGIN_NAMESPACE class QAbstractPrintDialogPrivate; class QPrinter; @@ -120,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions) QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG - #endif // QABSTRACTPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qabstractprintdialog_p.h b/src/printsupport/dialogs/qabstractprintdialog_p.h index 12de4ee882..2537fcbf80 100644 --- a/src/printsupport/dialogs/qabstractprintdialog_p.h +++ b/src/printsupport/dialogs/qabstractprintdialog_p.h @@ -53,14 +53,12 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include "private/qdialog_p.h" #include "QtPrintSupport/qabstractprintdialog.h" -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(printdialog); -#ifndef QT_NO_PRINTER +QT_BEGIN_NAMESPACE class QPrinter; class QPrinterPrivate; @@ -92,10 +90,6 @@ public: int maxPage; }; -#endif //QT_NO_PRINTER - QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG - #endif // QABSTRACTPRINTDIALOG_P_H diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index 911c0ecdf7..4acac2c5f1 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -42,8 +42,6 @@ #include -#ifndef QT_NO_PRINTDIALOG - QT_BEGIN_NAMESPACE /*! @@ -183,5 +181,3 @@ void QPageSetupDialog::done(int result) } QT_END_NAMESPACE - -#endif diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h index bc7462ebaa..3bd752a413 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.h +++ b/src/printsupport/dialogs/qpagesetupdialog.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(printdialog); +QT_BEGIN_NAMESPACE class QPrinter; class QPageSetupDialogPrivate; @@ -77,6 +76,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG - #endif // QPAGESETUPDIALOG_H diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index 581c0271f1..1e398452f7 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -42,7 +42,6 @@ #include "qpagesetupdialog.h" -#ifndef QT_NO_PRINTDIALOG #include "qpagesetupdialog_p.h" #include @@ -222,5 +221,3 @@ int QPageSetupDialog::exec() } QT_END_NAMESPACE - -#endif /* QT_NO_PRINTDIALOG */ diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h index 98b466ccdc..6a389b039a 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_p.h @@ -54,14 +54,14 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include "private/qdialog_p.h" #include "qbytearray.h" #include "qpagesetupdialog.h" #include "qpointer.h" +QT_REQUIRE_CONFIG(printdialog); + QT_BEGIN_NAMESPACE class QPrinter; @@ -83,6 +83,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG - #endif // QPAGESETUPDIALOG_P_H diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index fdaeb7ae8c..b4ad718646 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -39,7 +39,6 @@ #include "qpagesetupdialog.h" -#ifndef QT_NO_PRINTDIALOG #include "qpagesetupdialog_unix_p.h" #include @@ -644,5 +643,3 @@ int QPageSetupDialog::exec() QT_END_NAMESPACE #include "moc_qpagesetupdialog.cpp" - -#endif // QT_NO_PRINTDIALOG diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h index 3c9733dd83..658f103bea 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h @@ -53,14 +53,14 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include "qprinter.h" #include #include +QT_REQUIRE_CONFIG(printdialog); + QT_BEGIN_NAMESPACE class QPrinter; @@ -106,5 +106,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG #endif diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp index 88e57d27e5..23fff82f25 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp @@ -39,7 +39,6 @@ #include "qpagesetupdialog.h" -#ifndef QT_NO_PRINTDIALOG #include #include "../kernel/qprintengine_win_p.h" @@ -168,4 +167,3 @@ void QPageSetupDialog::setVisible(bool visible) } QT_END_NAMESPACE -#endif diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index 35d650a7fc..53a6224f49 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(printdialog); +QT_BEGIN_NAMESPACE class QPrintDialogPrivate; class QPushButton; @@ -104,6 +103,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PRINTDIALOG - #endif // QPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index 4595ed71ff..854779977c 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -48,8 +48,6 @@ #include #include -#ifndef QT_NO_PRINTDIALOG - QT_BEGIN_NAMESPACE extern qreal qt_pointMultiplier(QPageLayout::Unit unit); @@ -358,5 +356,3 @@ void QPrintDialog::setVisible(bool visible) QT_END_NAMESPACE #include "moc_qprintdialog.cpp" - -#endif // QT_NO_PRINTDIALOG diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 7c0e064ddd..32a06a4f7e 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -40,8 +40,6 @@ #include "qplatformdefs.h" #include -#ifndef QT_NO_PRINTDIALOG - #include "private/qabstractprintdialog_p.h" #include #include "qprintdialog.h" @@ -983,6 +981,3 @@ QT_END_NAMESPACE #include "moc_qprintdialog.cpp" #include "qprintdialog_unix.moc" - -#endif // QT_NO_PRINTDIALOG - diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp index 2e954a508d..11f2fa3259 100644 --- a/src/printsupport/dialogs/qprintdialog_win.cpp +++ b/src/printsupport/dialogs/qprintdialog_win.cpp @@ -39,8 +39,6 @@ #include -#ifndef QT_NO_PRINTDIALOG - #include "qprintdialog.h" #include @@ -308,5 +306,3 @@ void QPrintDialog::setVisible(bool visible) QT_END_NAMESPACE #include "moc_qprintdialog.cpp" - -#endif // QT_NO_PRINTDIALOG diff --git a/src/printsupport/doc/snippets/widgetprinting.cpp b/src/printsupport/doc/snippets/widgetprinting.cpp index 561e22d5b3..6e0256cb92 100644 --- a/src/printsupport/doc/snippets/widgetprinting.cpp +++ b/src/printsupport/doc/snippets/widgetprinting.cpp @@ -50,7 +50,8 @@ #include #include -#ifndef QT_NO_PRINTER +#include +#if QT_CONFIG(printdialog) #include #include #endif @@ -98,7 +99,7 @@ private slots: } void printFile() { - #if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) + #if QT_CONFIG(printdialog) //! [1] QPrinter printer; diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index cbb67aefdc..e2d4a08de3 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -40,7 +40,9 @@ #include "qplatformprintdevice.h" #include "qprintdevice_p.h" +#if QT_CONFIG(printdialog) #include "qprintdialog.h" +#endif #include diff --git a/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp index 79c910cb5b..bb3624a51d 100644 --- a/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp +++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp @@ -31,14 +31,17 @@ #include #include +#include +#if QT_CONFIG(printdialog) #include #include +#endif class tst_QAbstractPrintDialog : public QObject { Q_OBJECT -#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG) +#if !QT_CONFIG(printdialog) public slots: void initTestCase(); #else @@ -49,7 +52,7 @@ private slots: #endif }; -#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG) +#if !QT_CONFIG(printdialog) void tst_QAbstractPrintDialog::initTestCase() { QSKIP("This test requires printing and print dialog support"); -- cgit v1.2.3 From fa3940cc4b5580070f465d1f64a23a69bc925367 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 May 2017 14:00:53 -0700 Subject: QStorageInfo: Pass MNT_NOWAIT to getmntinfo This forces the API not to wait for synchronous I/O from the filesystems and get the information, but instead just use the cached information directly. It's a good idea if we have an unresponsive FS, like NFS with an unreachable server. Task-number: QTBUG-61096 Change-Id: Iddeeffb6f4ad4a2894a2fffd14c32f6e90664a63 Reviewed-by: Tobias C. Berner Reviewed-by: Shawn Rutledge Reviewed-by: Edward Welbourne --- src/corelib/io/qstorageinfo_unix.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index b9c9883609..9072b34f54 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -195,8 +195,12 @@ static bool shouldIncludeFs(const QStorageIterator &it) #if defined(Q_OS_BSD4) +#ifndef MNT_NOWAIT +# define MNT_NOWAIT 0 +#endif + inline QStorageIterator::QStorageIterator() - : entryCount(::getmntinfo(&stat_buf, 0)), + : entryCount(::getmntinfo(&stat_buf, MNT_NOWAIT)), currentIndex(-1) { } -- cgit v1.2.3 From 27f0d8db9112cebd6ca54f8709e80d03f3e23aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Tue, 30 May 2017 10:08:56 +0300 Subject: Fix qpa/kms test with Vibrante 4.1.6.0 on INTEGRITY for Drive CX Change-Id: I44ae001dc9f96ea8819a56a87be9322326dbbb4b Reviewed-by: Lars Knoll --- src/gui/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index af5dcf8961..93098a4b58 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -86,7 +86,7 @@ "sources": [ { "type": "pkgConfig", "args": "libdrm" }, { "libs": "-ldrm", "condition": "!config.integrity" }, - { "libs": "-ldrm-nvdc -lposix -livfs -lnvll -lnvdc -lnvrm -lnvrm_graphics -lnvos", "condition": "config.integrity" } + { "libs": "-ldrm-nvdc -lposix -livfs -lnvll -lnvdc -lnvrm -lnvrm_graphics -lnvos -lnvtegrahv", "condition": "config.integrity" } ] }, "egl": { -- cgit v1.2.3 From 6dcd944deeed28bdd001eea5289d04116c9d23f4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 May 2017 17:28:22 +0200 Subject: make mkspecs not mess up library and include search paths adding shared install paths to QMAKE_{INCDIR,LIBDIR} in the spec has the tiny side effect that they are searched _first_, which is generally a really bad idea - they should be _last_. for that purpose, make QMAKE_{INCDIR,LIBDIR}_POST live up to their names (i.e., search them actually last) and migrate all affected specs to use them. Task-number: QTBUG-40825 Change-Id: Ie0de81c3cc49e193186d2fedd7d6c77590c8ef79 Reviewed-by: Joerg Bornemann --- mkspecs/common/android-base-tail.conf | 4 ++-- mkspecs/common/qcc-base-qnx.conf | 4 ++-- mkspecs/devices/common/freebsd_device_pre.conf | 2 +- mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf | 6 +++--- mkspecs/devices/linux-drive-cx-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-jetson-tk1-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-jetson-tx1-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf | 4 ++-- mkspecs/devices/linux-tegra2-g++/qmake.conf | 4 ++-- mkspecs/features/default_post.prf | 3 --- mkspecs/freebsd-clang/qmake.conf | 4 ++-- mkspecs/freebsd-g++/qmake.conf | 4 ++-- mkspecs/netbsd-g++/qmake.conf | 4 ++-- mkspecs/openbsd-g++/qmake.conf | 4 ++-- qmake/generators/unix/unixmake.cpp | 2 ++ qmake/generators/win32/winmakefile.cpp | 3 +++ 18 files changed, 35 insertions(+), 33 deletions(-) diff --git a/mkspecs/common/android-base-tail.conf b/mkspecs/common/android-base-tail.conf index 23bd6696de..2610918c4e 100644 --- a/mkspecs/common/android-base-tail.conf +++ b/mkspecs/common/android-base-tail.conf @@ -74,8 +74,8 @@ else: \ LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL) -QMAKE_INCDIR = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR -QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH +QMAKE_INCDIR_POST = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR +QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH QMAKE_INCDIR_X11 = QMAKE_LIBDIR_X11 = QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf index 624bdd3656..e300dfe8d9 100644 --- a/mkspecs/common/qcc-base-qnx.conf +++ b/mkspecs/common/qcc-base-qnx.conf @@ -38,8 +38,8 @@ isEmpty(QNX_DIR) { error("QNX_TARGET environment variable not set") } -QMAKE_INCDIR = $${QNX_DIR}/usr/include $${QNX_DIR}/usr/include/freetype2 -QMAKE_LIBDIR = $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib +QMAKE_INCDIR_POST = $${QNX_DIR}/usr/include $${QNX_DIR}/usr/include/freetype2 +QMAKE_LIBDIR_POST = $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib QMAKE_LFLAGS += -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/lib -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/usr/lib QMAKE_CXXFLAGS_CXX11 = -Wc,-std=gnu++11 diff --git a/mkspecs/devices/common/freebsd_device_pre.conf b/mkspecs/devices/common/freebsd_device_pre.conf index 97d70b5265..8eb76f60f1 100644 --- a/mkspecs/devices/common/freebsd_device_pre.conf +++ b/mkspecs/devices/common/freebsd_device_pre.conf @@ -24,4 +24,4 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip # it messes up system include order. --sysroot is # sufficient. See link for details: # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213217 -QMAKE_LIBDIR = $$[QT_SYSROOT]/usr/lib +QMAKE_LIBDIR_POST = $$[QT_SYSROOT]/usr/lib diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf index 99b8f22f97..f65e9730d0 100644 --- a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf @@ -19,8 +19,8 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += /usr/arm-linux-gnueabihf/include -QMAKE_LIBDIR += /usr/arm-linux-gnueabihf/lib +QMAKE_INCDIR_POST += /usr/arm-linux-gnueabihf/include +QMAKE_LIBDIR_POST += /usr/arm-linux-gnueabihf/lib QMAKE_LIBS += -lrt diff --git a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf index b131f65a79..5619c205fb 100644 --- a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf @@ -50,9 +50,9 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -QMAKE_INCDIR += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generic_apps/usr/include -QMAKE_LIBDIR += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generic_apps/usr/lib -QMAKE_LIBDIR += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generated/lib/armgnu_linux_el_cortex-a9 +QMAKE_INCDIR_POST += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generic_apps/usr/include +QMAKE_LIBDIR_POST += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generic_apps/usr/lib +QMAKE_LIBDIR_POST += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generated/lib/armgnu_linux_el_cortex-a9 QMAKE_INCDIR_EGL = $${TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2} QMAKE_LIBDIR_EGL = $${TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2} diff --git a/mkspecs/devices/linux-drive-cx-g++/qmake.conf b/mkspecs/devices/linux-drive-cx-g++/qmake.conf index a658f29deb..3cff38ff8b 100644 --- a/mkspecs/devices/linux-drive-cx-g++/qmake.conf +++ b/mkspecs/devices/linux-drive-cx-g++/qmake.conf @@ -16,11 +16,11 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += \ +QMAKE_INCDIR_POST += \ $${VIBRANTE_SDK_TOPDIR}/include \ $$[QT_SYSROOT]/usr/include -QMAKE_LIBDIR += \ +QMAKE_LIBDIR_POST += \ $${VIBRANTE_SDK_TOPDIR}/lib-target \ $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/aarch64-linux-gnu \ diff --git a/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf b/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf index 493b55384f..32996f59e6 100644 --- a/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf @@ -11,11 +11,11 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += \ +QMAKE_INCDIR_POST += \ $$[QT_SYSROOT]/usr/include \ $$[QT_SYSROOT]/usr/include/arm-linux-gnueabihf -QMAKE_LIBDIR += \ +QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf diff --git a/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf index 1f44c47151..64b25e0182 100644 --- a/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf @@ -14,11 +14,11 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += \ +QMAKE_INCDIR_POST += \ $${VIBRANTE_SDK_TOPDIR}/include \ $$[QT_SYSROOT]/usr/include -QMAKE_LIBDIR += \ +QMAKE_LIBDIR_POST += \ $${VIBRANTE_SDK_TOPDIR}/lib-target \ $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \ diff --git a/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf b/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf index 06cf329f3a..f45be457fd 100644 --- a/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf @@ -25,11 +25,11 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += \ +QMAKE_INCDIR_POST += \ $$[QT_SYSROOT]/usr/include \ $$[QT_SYSROOT]/usr/include/aarch64-linux-gnu -QMAKE_LIBDIR += \ +QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/aarch64-linux-gnu \ $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf index 9211551daf..2a4e558186 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf @@ -52,8 +52,8 @@ QMAKE_LIBDIR_OPENGL_ES2 = $${BRCM_ROCKFORD_PATH}/middleware/v3d/lib_$${BRCM_PLAT QMAKE_LIBS_OPENGL_ES2 = -lv3ddriver -lrt QMAKE_LIBS_EGL = -INCLUDEPATH += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 -QMAKE_LIBDIR += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 +QMAKE_INCDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 +QMAKE_LIBDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 QMAKE_LFLAGS += -Wl,-rpath-link,$$QMAKE_LIBDIR_OPENGL_ES2 -Wl,-rpath-link,$${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 diff --git a/mkspecs/devices/linux-tegra2-g++/qmake.conf b/mkspecs/devices/linux-tegra2-g++/qmake.conf index adadc4d5b0..4db576d791 100644 --- a/mkspecs/devices/linux-tegra2-g++/qmake.conf +++ b/mkspecs/devices/linux-tegra2-g++/qmake.conf @@ -10,9 +10,9 @@ include(../common/linux_device_pre.conf) -QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include +QMAKE_INCDIR_POST += $$[QT_SYSROOT]/usr/include -QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib \ +QMAKE_LIBDIR_POST += $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/arm-linux-gnueabi \ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index d6caf870f7..0e67223449 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -139,6 +139,3 @@ utf8_source { } !precompile_header: SOURCES += $$NO_PCH_SOURCES - -QMAKE_INCDIR += $$QMAKE_INCDIR_POST -QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST diff --git a/mkspecs/freebsd-clang/qmake.conf b/mkspecs/freebsd-clang/qmake.conf index 10bb4a3723..f59fbd3c7d 100644 --- a/mkspecs/freebsd-clang/qmake.conf +++ b/mkspecs/freebsd-clang/qmake.conf @@ -8,8 +8,8 @@ QMAKE_PLATFORM = freebsd include(../common/bsd/bsd.conf) # Addon software goes into /usr/local on FreeBSD, by default we will look there -QMAKE_INCDIR = /usr/local/include -QMAKE_LIBDIR = /usr/local/lib +QMAKE_INCDIR_POST = /usr/local/include +QMAKE_LIBDIR_POST = /usr/local/lib QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index 1f4448889e..4df444480d 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -8,8 +8,8 @@ QMAKE_PLATFORM = freebsd include(../common/bsd/bsd.conf) # Addon software goes into /usr/local on FreeBSD, by default we will look there -QMAKE_INCDIR = /usr/local/include -QMAKE_LIBDIR = /usr/local/lib +QMAKE_INCDIR_POST = /usr/local/include +QMAKE_LIBDIR_POST = /usr/local/lib include(../common/gcc-base-unix.conf) include(../common/g++-unix.conf) diff --git a/mkspecs/netbsd-g++/qmake.conf b/mkspecs/netbsd-g++/qmake.conf index a4b26837ce..c7e067a5c7 100644 --- a/mkspecs/netbsd-g++/qmake.conf +++ b/mkspecs/netbsd-g++/qmake.conf @@ -8,8 +8,8 @@ QMAKE_PLATFORM = netbsd include(../common/bsd/bsd.conf) # Addon software goes into /usr/pkg on NetBSD, by default we will look there -QMAKE_INCDIR = /usr/pkg/include -QMAKE_LIBDIR = /usr/pkg/lib +QMAKE_INCDIR_POST = /usr/pkg/include +QMAKE_LIBDIR_POST = /usr/pkg/lib # System provided X11 defaults to X11R7 path on NetBSD since 5.0 QMAKE_INCDIR_X11 = /usr/X11R7/include diff --git a/mkspecs/openbsd-g++/qmake.conf b/mkspecs/openbsd-g++/qmake.conf index 6124d31439..4a142e476e 100644 --- a/mkspecs/openbsd-g++/qmake.conf +++ b/mkspecs/openbsd-g++/qmake.conf @@ -8,8 +8,8 @@ QMAKE_PLATFORM = openbsd include(../common/bsd/bsd.conf) # Addon software goes into /usr/local on OpenBSD, by default we will look there -QMAKE_INCDIR = /usr/local/include -QMAKE_LIBDIR = /usr/local/lib +QMAKE_INCDIR_POST = /usr/local/include +QMAKE_LIBDIR_POST = /usr/local/lib # System provided X11 defaults to X11R6 path on OpenBSD QMAKE_INCDIR_X11 = /usr/X11R6/include diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index b86594d191..2f1bbeea25 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -94,6 +94,8 @@ UnixMakefileGenerator::init() !project->values("QMAKE_LIB_FLAG").isEmpty() && project->isActiveConfig("dll")) project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PREBIND"); + project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST"); + project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST"); if(!project->isEmpty("QMAKE_INCDIR")) project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR"); ProStringList ldadd; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 6f2f43c03c..75bb5d236d 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -174,6 +174,9 @@ void Win32MakefileGenerator::processVars() else if (project->first("TEMPLATE").startsWith("vc")) project->values("MAKEFILE") = project->values("QMAKE_PROJECT_NAME"); + project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST"); + project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST"); + if (!project->values("QMAKE_INCDIR").isEmpty()) project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR"); -- cgit v1.2.3 From 5afde92bd76421a49b9eb76e6071b32fd3ca41df Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 May 2017 18:06:24 +0200 Subject: make mkspecs not mess up -rpath-link adding shared install paths via QMAKE_LFLAGS in the spec has the tiny side effect that they are searched _first_, which is generally a really bad idea - they should be _last_. for that purpose, introduce QMAKE_RPATHLINKDIR_POST, and migrate all specs to use it. QMAKE_RPATHDIR_POST is added for consistency, but not actually used. Task-number: QTBUG-59457 Change-Id: Iac6cda5e9111ef8cca454a69861fe8408bb40589 Reviewed-by: Joerg Bornemann --- mkspecs/common/qcc-base-qnx.conf | 2 +- mkspecs/devices/common/linux_device_post.conf | 5 +++-- mkspecs/devices/linux-drive-cx-g++/qmake.conf | 10 +++++----- mkspecs/devices/linux-jetson-tk1-g++/qmake.conf | 8 ++++---- mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf | 10 +++++----- mkspecs/devices/linux-jetson-tx1-g++/qmake.conf | 10 +++++----- mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf | 3 +-- mkspecs/devices/linux-rasp-pi-g++/qmake.conf | 2 +- mkspecs/devices/linux-rasp-pi2-g++/qmake.conf | 2 +- mkspecs/devices/linux-rasp-pi3-g++/qmake.conf | 5 ++--- mkspecs/devices/linux-snowball-g++/qmake.conf | 5 +++-- mkspecs/devices/linux-tegra2-g++/qmake.conf | 7 ++++--- qmake/generators/unix/unixmake.cpp | 2 ++ 13 files changed, 37 insertions(+), 34 deletions(-) diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf index e300dfe8d9..148645b4e9 100644 --- a/mkspecs/common/qcc-base-qnx.conf +++ b/mkspecs/common/qcc-base-qnx.conf @@ -40,7 +40,7 @@ isEmpty(QNX_DIR) { QMAKE_INCDIR_POST = $${QNX_DIR}/usr/include $${QNX_DIR}/usr/include/freetype2 QMAKE_LIBDIR_POST = $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib -QMAKE_LFLAGS += -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/lib -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/usr/lib +QMAKE_RPATHLINKDIR_POST += $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib QMAKE_CXXFLAGS_CXX11 = -Wc,-std=gnu++11 QMAKE_CXXFLAGS_CXX14 = -Wc,-std=gnu++1y diff --git a/mkspecs/devices/common/linux_device_post.conf b/mkspecs/devices/common/linux_device_post.conf index cf1608f32b..9a434dba77 100644 --- a/mkspecs/devices/common/linux_device_post.conf +++ b/mkspecs/devices/common/linux_device_post.conf @@ -3,8 +3,9 @@ defineTest(qtConfSanitizeMkspec) { } contains(DISTRO_OPTS, deb-multi-arch) { - QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP} + QMAKE_RPATHLINKDIR_POST += \ + $$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \ + $$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP} } contains(DISTRO_OPTS, boot2qt) { diff --git a/mkspecs/devices/linux-drive-cx-g++/qmake.conf b/mkspecs/devices/linux-drive-cx-g++/qmake.conf index 3cff38ff8b..a0dcaddec9 100644 --- a/mkspecs/devices/linux-drive-cx-g++/qmake.conf +++ b/mkspecs/devices/linux-drive-cx-g++/qmake.conf @@ -26,11 +26,11 @@ QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/lib/aarch64-linux-gnu \ $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu -QMAKE_LFLAGS += \ - -Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu +QMAKE_RPATHLINKDIR_POST += \ + $${VIBRANTE_SDK_TOPDIR}/lib-target \ + $$[QT_SYSROOT]/usr/lib \ + $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \ + $$[QT_SYSROOT]/lib/aarch64-linux-gnu DISTRO_OPTS += aarch64 diff --git a/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf b/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf index 32996f59e6..4c733e8b77 100644 --- a/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tk1-g++/qmake.conf @@ -20,10 +20,10 @@ QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf -QMAKE_LFLAGS += \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf +QMAKE_RPATHLINKDIR_POST += \ + $$[QT_SYSROOT]/usr/lib \ + $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ + $$[QT_SYSROOT]/lib/arm-linux-gnueabihf DISTRO_OPTS += hard-float COMPILER_FLAGS += -mtune=cortex-a15 -march=armv7-a -mfpu=neon-vfpv4 diff --git a/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf index 64b25e0182..fb89721798 100644 --- a/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf @@ -24,11 +24,11 @@ QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf -QMAKE_LFLAGS += \ - -Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf +QMAKE_RPATHLINKDIR_POST += \ + $${VIBRANTE_SDK_TOPDIR}/lib-target \ + $$[QT_SYSROOT]/usr/lib \ + $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ + $$[QT_SYSROOT]/lib/arm-linux-gnueabihf DISTRO_OPTS += hard-float COMPILER_FLAGS += -mtune=cortex-a15 -march=armv7-a -mfpu=neon-vfpv4 -DWIN_INTERFACE_CUSTOM diff --git a/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf b/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf index f45be457fd..f9dec441f6 100644 --- a/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf +++ b/mkspecs/devices/linux-jetson-tx1-g++/qmake.conf @@ -34,11 +34,11 @@ QMAKE_LIBDIR_POST += \ $$[QT_SYSROOT]/lib/aarch64-linux-gnu \ $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu -QMAKE_LFLAGS += \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu/tegra \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu +QMAKE_RPATHLINKDIR_POST += \ + $$[QT_SYSROOT]/usr/lib \ + $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \ + $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu/tegra \ + $$[QT_SYSROOT]/lib/aarch64-linux-gnu DISTRO_OPTS += aarch64 COMPILER_FLAGS += -mtune=cortex-a57.cortex-a53 -march=armv8-a diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf index 2a4e558186..c7b6970fea 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf @@ -54,8 +54,7 @@ QMAKE_LIBS_EGL = QMAKE_INCDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 QMAKE_LIBDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 - -QMAKE_LFLAGS += -Wl,-rpath-link,$$QMAKE_LIBDIR_OPENGL_ES2 -Wl,-rpath-link,$${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 +QMAKE_RPATHLINKDIR_POST += $$QMAKE_LIBDIR_OPENGL_ES2 $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3 # DirectFB platform hooks for this hardware QT_CONFIG += directfb_egl egl diff --git a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf index 89177b7fa2..5497b0ce1b 100644 --- a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf +++ b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf @@ -4,7 +4,7 @@ include(../common/linux_device_pre.conf) -QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib +QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 diff --git a/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf index 2911f08873..ffe8f5739a 100644 --- a/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf +++ b/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf @@ -2,7 +2,7 @@ include(../common/linux_device_pre.conf) -QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib +QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 diff --git a/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf index 10862ccd70..2bb70ffb5a 100644 --- a/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf +++ b/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf @@ -8,13 +8,12 @@ include(../common/linux_device_pre.conf) # and possibly no pkg-config, have some static values as well: # I consider it a bug that this is required, but our EGL config.test _requires_ it -QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib +QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib VC_LIBRARY_PATH = /opt/vc/lib VC_INCLUDE_PATH = =/opt/vc/include -# terrible, they do not appear to resolve "=" in rpath! -VC_LINK_LINE = -L=$${VC_LIBRARY_PATH} -Wl,-rpath-link,$$[QT_SYSROOT]$${VC_LIBRARY_PATH} +VC_LINK_LINE = -L=$${VC_LIBRARY_PATH} QMAKE_LIBDIR_OPENGL_ES2 = =$${VC_LIBRARY_PATH} QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 diff --git a/mkspecs/devices/linux-snowball-g++/qmake.conf b/mkspecs/devices/linux-snowball-g++/qmake.conf index 9791119363..ff0f3ab1ae 100644 --- a/mkspecs/devices/linux-snowball-g++/qmake.conf +++ b/mkspecs/devices/linux-snowball-g++/qmake.conf @@ -27,7 +27,8 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf +QMAKE_RPATHLINKDIR_POST += \ + $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ + $$[QT_SYSROOT]/lib/arm-linux-gnueabihf load(qt_config) diff --git a/mkspecs/devices/linux-tegra2-g++/qmake.conf b/mkspecs/devices/linux-tegra2-g++/qmake.conf index 4db576d791..3f6da7668d 100644 --- a/mkspecs/devices/linux-tegra2-g++/qmake.conf +++ b/mkspecs/devices/linux-tegra2-g++/qmake.conf @@ -16,9 +16,10 @@ QMAKE_LIBDIR_POST += $$[QT_SYSROOT]/usr/lib \ $$[QT_SYSROOT]/lib/arm-linux-gnueabi \ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi -QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \ - -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi \ - -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabi +QMAKE_RPATHLINKDIR_POST += \ + $$[QT_SYSROOT]/usr/lib \ + $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi \ + $$[QT_SYSROOT]/lib/arm-linux-gnueabi TEGRA2_CFLAGS = -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=softfp -mfpu=vfpv3-d16 QMAKE_CFLAGS += $$TEGRA2_CFLAGS diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 2f1bbeea25..30f99174f8 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -96,6 +96,8 @@ UnixMakefileGenerator::init() project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PREBIND"); project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST"); project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST"); + project->values("QMAKE_RPATHDIR") += project->values("QMAKE_RPATHDIR_POST"); + project->values("QMAKE_RPATHLINKDIR") += project->values("QMAKE_RPATHLINKDIR_POST"); if(!project->isEmpty("QMAKE_INCDIR")) project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR"); ProStringList ldadd; -- cgit v1.2.3 From 09e2fc43ab10e6cdf8a9d9121bf93262f9e6a73e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 May 2017 19:40:21 +0200 Subject: fix configure PSQL_*= being ignored make qtConfLibrary_psqlEnv() fall back to qtConfLibrary_inline() if $PSQL_LIBS is not set. Task-number: QTBUG-59521 Change-Id: Ie293e8bfaa3e113ede166243b345833973cc66f8 Reviewed-by: Joerg Bornemann --- src/sql/configure.pri | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sql/configure.pri b/src/sql/configure.pri index 05794582e9..9fb957291f 100644 --- a/src/sql/configure.pri +++ b/src/sql/configure.pri @@ -36,6 +36,9 @@ defineTest(qtConfLibrary_psqlEnv) { !isEmpty(PSQL_LIBS) { $${1}.libs = $$PSQL_LIBS export($${1}.libs) + } else { + !qtConfLibrary_inline($$1): \ + return(false) } return(true) } -- cgit v1.2.3 From 9e04102180e9cd2d57c8b11ac3ef4bc9da15bcde Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 19 May 2017 13:53:44 +0200 Subject: fix library retrieval in pkg-config source, take 2 the entry's libs field is supposed to be a single pre-quoted string. that implies that the libs and libpaths need to be joined first. amends 7e298e2f. Task-number: QTBUG-60925 Change-Id: Id85b2784e3c081b3ff8eb9ee2216976691f8580d Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 5cbc0d4bfd..964c2393c2 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -581,7 +581,8 @@ defineTest(qtConfLibrary_pkgConfig) { version ~= s/[^0-9.].*$// $${1}.version = $$first(version) export($${1}.version) - $${1}.libs = $$libpaths $$libs + libpaths += $$libs + $${1}.libs = "$$libpaths" export($${1}.libs) return(true) } -- cgit v1.2.3 From cb4bc34cb150d02889f5be2e54074e4e864b18ae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 22 May 2017 11:17:28 +0200 Subject: fix module version number in qt modules' cmake config files this actually just makes the code more straight-forward. amends f8607045c. Task-number: QTBUG-60936 Change-Id: Iaa05b474206cf29352f9bba516936ff30b90a778 Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 4f342d67d7..17da8b979e 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -35,7 +35,7 @@ set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\") !!IF !equals(TEMPLATE, aux) # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead. -set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)") +set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.VERSION)") set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME}) !!ENDIF // TEMPLATE != aux -- cgit v1.2.3 From 1a004bf550c93aa2ddeeaaf22c8bedbb1bad6a92 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 26 May 2017 12:12:47 +0200 Subject: quote the confirm-license argument of licheck it can be (and usually is) empty (if the option was not used), which would make it disappear from the command line. Change-Id: Ic682e92a0d20cf849fade8449ebd79a5aa424d21 Reviewed-by: Andy Shaw --- configure.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.pri b/configure.pri index be1b166080..115277e057 100644 --- a/configure.pri +++ b/configure.pri @@ -150,7 +150,7 @@ defineReplace(qtConfFunc_licenseCheck) { } !qtRunLoggedCommand("$$system_quote($$QT_SOURCE_TREE/bin/$$Licheck) \ - $$eval(config.input.confirm-license) \ + $$system_quote($$eval(config.input.confirm-license)) \ $$system_quote($$QT_SOURCE_TREE) $$system_quote($$QT_BUILD_TREE) \ $$[QMAKE_SPEC] $$[QMAKE_XSPEC]", \ LicheckOutput): \ -- cgit v1.2.3 From d56d2e0cb25e8190d58594eb1c397715c94416a1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 26 May 2017 12:17:37 +0200 Subject: don't redirect licheck's stderr it uses it for interaction. Task-number: QTBUG-61017 Change-Id: I9edc0f9aa91793bc451fa78a8f6ad11d61e04b57 Reviewed-by: Andy Shaw --- configure.pri | 2 +- mkspecs/features/configure_base.prf | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.pri b/configure.pri index 115277e057..45692d6b5c 100644 --- a/configure.pri +++ b/configure.pri @@ -153,7 +153,7 @@ defineReplace(qtConfFunc_licenseCheck) { $$system_quote($$eval(config.input.confirm-license)) \ $$system_quote($$QT_SOURCE_TREE) $$system_quote($$QT_BUILD_TREE) \ $$[QMAKE_SPEC] $$[QMAKE_XSPEC]", \ - LicheckOutput): \ + LicheckOutput, false): \ return(false) logn() for (o, LicheckOutput) { diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index a4464528b4..e870e2ee10 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -31,7 +31,9 @@ defineTest(qtLog) { defineTest(qtRunLoggedCommand) { qtLog("+ $$1") - output = $$system("( $$1 ) 2>&1", lines, result) + !equals(3, false): \ + 1 = "( $$1 ) 2>&1" + output = $$system("$$1", lines, result) lg = for (l, output): \ lg += "> $$l" -- cgit v1.2.3 From e9c2a363cb2baf16763112c9fb13e8eda323bb45 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 26 May 2017 14:34:48 +0200 Subject: fix licheck calls on 32 bit systems $$QMAKE_HOST.arch isn't very well defined for ia32 - on windows it's x86, on linux it may be anything from i386 to i686. test for != x86_64 instead. Task-number: QTBUG-61044 Change-Id: I8f3267b404fffbf479d87bee2e8ee8c6cd404b50 Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- configure.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.pri b/configure.pri index 45692d6b5c..673252dc51 100644 --- a/configure.pri +++ b/configure.pri @@ -137,7 +137,7 @@ defineReplace(qtConfFunc_licenseCheck) { export(config.input.qt_edition) } else { equals(QMAKE_HOST.os, Linux) { - equals(QMAKE_HOST.arch, x86): \ + !equals(QMAKE_HOST.arch, x86_64): \ Licheck = licheck32 else: \ Licheck = licheck64 -- cgit v1.2.3 From a0d3b5bb2b19cec782a395700ef3a087c27c71f6 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 16 May 2017 10:53:49 +0200 Subject: Fix tst_qmessagehandler for configurations without process support Change-Id: If61a7b1e389e7fffb9cfa85d6b5d77a7b777215f Reviewed-by: Friedemann Kleint --- tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index bb8bb6cc21..3465385ba7 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -100,11 +100,11 @@ tst_qmessagehandler::tst_qmessagehandler() void tst_qmessagehandler::initTestCase() { +#if QT_CONFIG(process) m_appDir = QFINDTESTDATA("app"); QVERIFY2(!m_appDir.isEmpty(), qPrintable( QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath()))); -#if QT_CONFIG(process) m_baseEnvironment = QProcess::systemEnvironment(); for (int i = 0; i < m_baseEnvironment.count(); ++i) { if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) { -- cgit v1.2.3 From 00d9033fa03fd1f9160f1d1320cc05f1f15fb160 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 16 May 2017 10:55:04 +0200 Subject: Fix tst_QFile for configurations without process support Change-Id: Icca2d55f0b9402bf4bcb009d972f21075d144f87 Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 81c11ef085..9751bb4c9e 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -412,8 +412,10 @@ static QByteArray msgFileDoesNotExist(const QString &name) void tst_QFile::initTestCase() { QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString())); +#if QT_CONFIG(process) m_stdinProcessDir = QFINDTESTDATA("stdinprocess"); QVERIFY(!m_stdinProcessDir.isEmpty()); +#endif m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp"); QVERIFY(!m_testSourceFile.isEmpty()); m_testLogFile = QFINDTESTDATA("testlog.txt"); -- cgit v1.2.3 From 72e9aee500cbd1363edf8a517b007ebb8ac6e88a Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 24 May 2017 12:53:17 +0200 Subject: winrt: Fix tst_QPainterPath We have to use a temporary data path for winrt, as the applications are sandboxed and cannot just put data anywhere. Change-Id: I8f95de132e5b5ac77441cbbf26af873b8018c7cb Reviewed-by: Friedemann Kleint --- tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 757e4d16e4..16215714f3 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -699,9 +699,11 @@ void tst_QPainterPath::testOperatorDatastream() path.addRect(0, 0, 100, 100); path.setFillRule(Qt::WindingFill); + QTemporaryDir tempDir(QDir::tempPath() + "/tst_qpainterpath.XXXXXX"); + QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); // Write out { - QFile data("data"); + QFile data(tempDir.path() + "/data"); bool ok = data.open(QFile::WriteOnly); QVERIFY(ok); QDataStream stream(&data); @@ -711,7 +713,7 @@ void tst_QPainterPath::testOperatorDatastream() QPainterPath other; // Read in { - QFile data("data"); + QFile data(tempDir.path() + "/data"); bool ok = data.open(QFile::ReadOnly); QVERIFY(ok); QDataStream stream(&data); -- cgit v1.2.3 From 600454578d9e378c2918f0191240ac2f6e2aeabe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Fri, 26 May 2017 09:19:55 +0300 Subject: Extend blacklisting of tst_QSemaphore tryAcquireWithTimeout(0.2s) was already blacklisted and now the same failed with "(2s)". Task-number: QTBUG-58745 Change-Id: I82363238c08056d2969a7616e3a6e5af080d537d Reviewed-by: Liang Qi --- tests/auto/corelib/thread/qsemaphore/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST index c198b90253..eb83b03556 100644 --- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST +++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST @@ -3,3 +3,4 @@ windows osx-10.12 [tryAcquireWithTimeout:2s] windows +osx-10.12 -- cgit v1.2.3 From c76b0c87b0cd9ba55dcb50eee0792592226672b3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 30 May 2017 09:22:20 +0200 Subject: Revert "Win: If the combined key is unknown then fall back to the original key pressed" The change has been found to break Ctrl+C/V shortcuts when using a Russian keyboard layout. This reverts commit c6ecbd4762dd753d34a8ed36bbb4ef3885a2f0fe. Task-number: QTBUG-61086 Change-Id: I0dce708b1a65b08ea10317d723c38b0414cbac7f Reviewed-by: Oliver Wolff Reviewed-by: Andy Shaw --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 24c2df86d4..ab806fd3ea 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -971,8 +971,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms state = state ^ Qt::ShiftModifier; else if (code == Qt::Key_Alt) state = state ^ Qt::AltModifier; - else if (code == 0 && modifiersIndex != 0) - code = keyLayout[vk_key].qtKey[0]; + // If the bit 24 of lParm is set you received a enter, // otherwise a Return. (This is the extended key bit) if ((code == Qt::Key_Return) && (msg.lParam & 0x1000000)) -- cgit v1.2.3 From 32a94e54b58f311f37689f4bc8e0c8a54f0f9216 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 23 May 2017 13:57:20 +0200 Subject: Do not always use argb32pm for subsurfaces A number of drawing paths were never tested by lancelot because we always used argb32pm for subsurfaces. This patch switches the subsurfaces to use the painter format or its alpha version. This means changes to composition tests as it changes precision, especially of alpha in the a2rgb30 formats. Change-Id: I24d53bf6e1db8cca36bda69e2ddf07f20256b3c8 Reviewed-by: Eirik Aavitsland --- tests/auto/other/lancelot/lancelot.pro | 2 +- tests/auto/other/lancelot/paintcommands.cpp | 9 ++++++++- tests/auto/other/lancelot/paintcommands.h | 5 +++-- tests/auto/other/lancelot/scripts/porter_duff.qps | 12 ++++++------ tests/auto/other/lancelot/scripts/porter_duff2.qps | 12 ++++++------ tests/auto/other/lancelot/tst_lancelot.cpp | 10 +++++----- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index 73c12e67a2..6ece7315ed 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_lancelot -QT += testlib +QT += testlib gui-private SOURCES += tst_lancelot.cpp \ paintcommands.cpp diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index c28812e120..8419f93e3b 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #ifndef QT_NO_OPENGL #include @@ -2402,7 +2403,13 @@ void PaintCommands::command_surface_begin(QRegExp re) m_painter = new QPainter(&m_surface_pixmap); #endif } else { - m_surface_image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32_Premultiplied); + QImage::Format surface_format; + if (QImage::toPixelFormat(m_format).alphaUsage() != QPixelFormat::UsesAlpha) + surface_format = qt_alphaVersion(m_format); + else + surface_format = m_format; + + m_surface_image = QImage(qRound(w), qRound(h), surface_format); m_surface_image.fill(0); m_painter = new QPainter(&m_surface_image); } diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h index 4113fd6881..fc7496ce11 100644 --- a/tests/auto/other/lancelot/paintcommands.h +++ b/tests/auto/other/lancelot/paintcommands.h @@ -68,9 +68,10 @@ class PaintCommands { public: // construction / initialization - PaintCommands(const QStringList &cmds, int w, int h) + PaintCommands(const QStringList &cmds, int w, int h, QImage::Format format) : m_painter(0) , m_surface_painter(0) + , m_format(format) , m_commands(cmds) , m_gradientSpread(QGradient::PadSpread) , m_gradientCoordinate(QGradient::LogicalMode) @@ -246,8 +247,8 @@ private: // attributes QPainter *m_painter; QPainter *m_surface_painter; + QImage::Format m_format; QImage m_surface_image; - QPixmap m_surface_pixmap; QRectF m_surface_rect; QStringList m_commands; QString m_currentCommand; diff --git a/tests/auto/other/lancelot/scripts/porter_duff.qps b/tests/auto/other/lancelot/scripts/porter_duff.qps index 166e48a57f..94e9c68522 100644 --- a/tests/auto/other/lancelot/scripts/porter_duff.qps +++ b/tests/auto/other/lancelot/scripts/porter_duff.qps @@ -184,7 +184,7 @@ repeat_block postdraw surface_end -# Multiply +# ColorBurn surface_begin 100 300 100 100 repeat_block predraw setCompositionMode ColorBurn @@ -192,7 +192,7 @@ repeat_block postdraw surface_end -# Screen +# HardLight surface_begin 200 300 100 100 repeat_block predraw setCompositionMode HardLight @@ -200,7 +200,7 @@ repeat_block postdraw surface_end -# Overlay +# SoftLight surface_begin 300 300 100 100 repeat_block predraw setCompositionMode SoftLight @@ -208,7 +208,7 @@ repeat_block postdraw surface_end -# Darken +# Difference surface_begin 400 300 100 100 repeat_block predraw setCompositionMode Difference @@ -216,7 +216,7 @@ repeat_block postdraw surface_end -# Lighten +# Exclusion surface_begin 500 300 100 100 repeat_block predraw setCompositionMode Exclusion @@ -248,4 +248,4 @@ drawText 100 500 "ColorBurn" drawText 200 500 "HardLight" drawText 300 500 "SoftLight" drawText 400 500 "Difference" -drawText 500 500 "Exclusion" \ No newline at end of file +drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/scripts/porter_duff2.qps b/tests/auto/other/lancelot/scripts/porter_duff2.qps index a792d9b278..f538371ca1 100644 --- a/tests/auto/other/lancelot/scripts/porter_duff2.qps +++ b/tests/auto/other/lancelot/scripts/porter_duff2.qps @@ -194,7 +194,7 @@ repeat_block postdraw surface_end -# Multiply +# ColorBurn surface_begin 100 300 100 100 repeat_block predraw setCompositionMode ColorBurn @@ -202,7 +202,7 @@ repeat_block postdraw surface_end -# Screen +# HardLight surface_begin 200 300 100 100 repeat_block predraw setCompositionMode HardLight @@ -210,7 +210,7 @@ repeat_block postdraw surface_end -# Overlay +# SoftLight surface_begin 300 300 100 100 repeat_block predraw setCompositionMode SoftLight @@ -218,7 +218,7 @@ repeat_block postdraw surface_end -# Darken +# Difference surface_begin 400 300 100 100 repeat_block predraw setCompositionMode Difference @@ -226,7 +226,7 @@ repeat_block postdraw surface_end -# Lighten +# Exclusion surface_begin 500 300 100 100 repeat_block predraw setCompositionMode Exclusion @@ -258,4 +258,4 @@ drawText 100 500 "ColorBurn" drawText 200 500 "HardLight" drawText 300 500 "SoftLight" drawText 400 500 "Difference" -drawText 500 500 "Exclusion" \ No newline at end of file +drawText 500 500 "Exclusion" diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp index 63c62bab86..79d0f7c6cf 100644 --- a/tests/auto/other/lancelot/tst_lancelot.cpp +++ b/tests/auto/other/lancelot/tst_lancelot.cpp @@ -54,7 +54,7 @@ private: void setupTestSuite(const QStringList& blacklist = QStringList()); void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat()); - void paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath); + void paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath); QStringList qpsFiles; QHash scripts; @@ -318,7 +318,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co if (engine == Raster) { QImage img(800, 800, format); - paint(&img, engine, script, QFileInfo(filePath).absoluteFilePath()); + paint(&img, engine, format, script, QFileInfo(filePath).absoluteFilePath()); rendered = img; #ifndef QT_NO_OPENGL } else if (engine == OpenGL) { @@ -336,7 +336,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co QOpenGLFramebufferObject fbo(800, 800, fmt); fbo.bind(); QOpenGLPaintDevice pdv(800, 800); - paint(&pdv, engine, script, QFileInfo(filePath).absoluteFilePath()); + paint(&pdv, engine, format, script, QFileInfo(filePath).absoluteFilePath()); rendered = fbo.toImage().convertToFormat(format); #endif } @@ -344,10 +344,10 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co QBASELINE_TEST(rendered); } -void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath) +void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath) { QPainter p(device); - PaintCommands pcmd(script, 800, 800); + PaintCommands pcmd(script, 800, 800, format); //pcmd.setShouldDrawText(false); switch (engine) { case OpenGL: -- cgit v1.2.3 From f33cf18d882ada727da0f378525e55d9421e3b16 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 28 May 2017 10:49:21 +0200 Subject: QAbstractItemModel::supportedDragActions: fix regression This method now returns -1 by default, due to commit 6255cb893d which mistakenly replaced -1 with Qt::IgnoreAction (0x0). As a result, dropping is forbidden in a number of applications (I detected this in zanshin). Change-Id: I4922451216e08d5d3fe36f8ba87364a361b691bf Reviewed-by: Giuseppe D'Angelo --- src/corelib/itemmodels/qabstractitemmodel.cpp | 2 +- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 22 ++++++++++++++++++++++ .../qstringlistmodel/tst_qstringlistmodel.cpp | 9 +++++++++ .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 8 ++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index c0737ffb36..f893cf06e3 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -2044,7 +2044,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const Qt::DropActions QAbstractItemModel::supportedDragActions() const { Q_D(const QAbstractItemModel); - if (d->supportedDragActions != Qt::IgnoreAction) + if (int(d->supportedDragActions) != -1) return d->supportedDragActions; return supportedDropActions(); } diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index dcd9eda4bb..9f67ccd9c9 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -101,6 +101,7 @@ private slots: void testRoleNames(); void testDragActions(); + void dragActionsFallsBackToDropActions(); void testFunctionPointerSignalConnection(); @@ -2157,6 +2158,27 @@ void tst_QAbstractItemModel::testDragActions() QVERIFY(actions & Qt::MoveAction); } +class OverrideDropActions : public QStringListModel +{ + Q_OBJECT +public: + OverrideDropActions(QObject *parent = 0) + : QStringListModel(parent) + { + } + Qt::DropActions supportedDropActions() const override + { + return Qt::MoveAction; + } +}; + +void tst_QAbstractItemModel::dragActionsFallsBackToDropActions() +{ + QAbstractItemModel *model = new OverrideDropActions(this); + QCOMPARE(model->supportedDragActions(), Qt::MoveAction); + QCOMPARE(model->supportedDropActions(), Qt::MoveAction); +} + class SignalConnectionTester : public QObject { Q_OBJECT diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index f99241da3b..adc8c59bf7 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -80,6 +80,8 @@ private slots: void setData_emits_both_roles_data(); void setData_emits_both_roles(); + + void supportedDragDropActions(); }; void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved_data() @@ -250,5 +252,12 @@ void tst_QStringListModel::setData_emits_both_roles() expected); } +void tst_QStringListModel::supportedDragDropActions() +{ + QStringListModel model; + QCOMPARE(model.supportedDragActions(), Qt::CopyAction | Qt::MoveAction); + QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction); +} + QTEST_MAIN(tst_QStringListModel) #include "tst_qstringlistmodel.moc" diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index dca718a6d8..cff26be7bb 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -125,6 +125,7 @@ private slots: void itemRoleNames(); void getMimeDataWithInvalidModelIndex(); + void supportedDragDropActions(); private: QAbstractItemModel *m_model; @@ -1666,5 +1667,12 @@ void tst_QStandardItemModel::getMimeDataWithInvalidModelIndex() QVERIFY(!data); } +void tst_QStandardItemModel::supportedDragDropActions() +{ + QStandardItemModel model; + QCOMPARE(model.supportedDragActions(), Qt::CopyAction | Qt::MoveAction); + QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction); +} + QTEST_MAIN(tst_QStandardItemModel) #include "tst_qstandarditemmodel.moc" -- cgit v1.2.3 From c214c000ccebda30ed867934a9d56af29cb34264 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 3 Aug 2016 16:04:22 -0700 Subject: qEnvironmentVariableIntValue: fix the case of a non-numeric value The documentation says that it's equivalent to qgetenv(varName).toInt() But the implementation wasn't. QByteArray::toInt() verifies that the entire string was consumed, so QByteArray("1a").toInt() == 0, but qstrtoll alone doesn't. That is, qstrtoll("1a", ...) == 1. The implementation also detected the base, a behavior I kept. Instead, I updated the documentation. Change-Id: I0031aa609e714ae983c3fffd14676ea6061a9268 Reviewed-by: Marc Mutz --- src/corelib/global/qglobal.cpp | 21 +++++++++++------ .../corelib/global/qgetputenv/tst_qgetputenv.cpp | 26 +++++++++++++++++++++- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 22fc20d47e..14853b3687 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3259,20 +3259,26 @@ bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT Equivalent to \code - qgetenv(varName).toInt() + qgetenv(varName).toInt(ok, 0) \endcode except that it's much faster, and can't throw exceptions. + \note there's a limit on the length of the value, which is sufficient for + all valid values of int, not counting leading zeroes or spaces. Values that + are too long will either be truncated or this function will set \a ok to \c + false. + \sa qgetenv(), qEnvironmentVariableIsSet() */ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT { - QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 - // we provide a buffer that can hold any int value: static const int NumBinaryDigitsPerOctalDigit = 3; static const int MaxDigitsForOctalInt = (std::numeric_limits::digits + NumBinaryDigitsPerOctalDigit - 1) / NumBinaryDigitsPerOctalDigit; + + QMutexLocker locker(&environmentMutex); +#if defined(_MSC_VER) && _MSC_VER >= 1400 + // we provide a buffer that can hold any int value: char buffer[MaxDigitsForOctalInt + 2]; // +1 for NUL +1 for optional '-' size_t dummy; if (getenv_s(&dummy, buffer, sizeof buffer, varName) != 0) { @@ -3282,15 +3288,16 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT } #else const char * const buffer = ::getenv(varName); - if (!buffer || !*buffer) { + if (!buffer || strlen(buffer) > MaxDigitsForOctalInt + 2) { if (ok) *ok = false; return 0; } #endif bool ok_ = true; - const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, &ok_); - if (int(value) != value) { // this is the check in QByteArray::toInt(), keep it in sync + const char *endptr; + const qlonglong value = qstrtoll(buffer, &endptr, 0, &ok_); + if (int(value) != value || *endptr != '\0') { // this is the check in QByteArray::toInt(), keep it in sync if (ok) *ok = false; return 0; diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 66fc578d5f..09abb953ba 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -97,17 +97,33 @@ void tst_QGetPutEnv::intValue_data() QTest::addColumn("expected"); QTest::addColumn("ok"); - // most non-success cases already tested in getSetCheck() + // some repetition from what is tested in getSetCheck() + QTest::newRow("empty") << QByteArray() << 0 << false; + QTest::newRow("spaces-heading") << QByteArray(" 1") << 1 << true; + QTest::newRow("spaces-trailing") << QByteArray("1 ") << 0 << false; #define ROW(x, i, b) \ QTest::newRow(#x) << QByteArray(#x) << (i) << (b) ROW(auto, 0, false); + ROW(1auto, 0, false); ROW(0, 0, true); + ROW(+0, 0, true); ROW(1, 1, true); + ROW(+1, 1, true); + ROW(09, 0, false); ROW(010, 8, true); ROW(0x10, 16, true); + ROW(0x, 0, false); + ROW(0xg, 0, false); + ROW(0x1g, 0, false); + ROW(000000000000000000000000000000000000000000000000001, 0, false); + ROW(+000000000000000000000000000000000000000000000000001, 0, false); + ROW(000000000000000000000000000000000000000000000000001g, 0, false); + ROW(-0, 0, true); ROW(-1, -1, true); ROW(-010, -8, true); + ROW(-000000000000000000000000000000000000000000000000001, 0, false); + ROW(2147483648, 0, false); // ROW(0xffffffff, -1, true); // could be expected, but not how QByteArray::toInt() works ROW(0xffffffff, 0, false); const int bases[] = {10, 8, 16}; @@ -125,6 +141,7 @@ void tst_QGetPutEnv::intValue_data() void tst_QGetPutEnv::intValue() { + const int maxlen = (sizeof(int) * CHAR_BIT + 2) / 3; const char varName[] = "should_not_exist"; QFETCH(QByteArray, value); @@ -133,6 +150,13 @@ void tst_QGetPutEnv::intValue() bool actualOk = !ok; + // Self-test: confirm that it was like the docs said it should be + if (value.length() < maxlen) { + QCOMPARE(value.toInt(&actualOk, 0), expected); + QCOMPARE(actualOk, ok); + } + + actualOk = !ok; QVERIFY(qputenv(varName, value)); QCOMPARE(qEnvironmentVariableIntValue(varName), expected); QCOMPARE(qEnvironmentVariableIntValue(varName, &actualOk), expected); -- cgit v1.2.3 From 40a7c57ba990dfd58814a4a9dc69948991458cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Wed, 24 May 2017 14:05:29 +0300 Subject: Blacklist tst_QTimer::basic_chrono on macOS Task-number: QTBUG-61013 Change-Id: I1c877aeb3e141e0e19b71bf9e595ff478e313b10 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- tests/auto/corelib/kernel/qtimer/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/corelib/kernel/qtimer/BLACKLIST b/tests/auto/corelib/kernel/qtimer/BLACKLIST index e5136624d8..b355bc22c2 100644 --- a/tests/auto/corelib/kernel/qtimer/BLACKLIST +++ b/tests/auto/corelib/kernel/qtimer/BLACKLIST @@ -1,3 +1,5 @@ [remainingTime] windows osx +[basic_chrono] +osx ci -- cgit v1.2.3 From 61f67c12fa1e46894c50cd72983354f8c6834717 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 31 May 2017 09:02:39 +0200 Subject: winrt: Use styleHint as clue for fallbacks for font families Similar on how it is done for Windows desktop we also use the given style hint when building the list of fallbacks a font family. Change-Id: I71378581d07f20ebe5bf0bc757bba919cc70e118 Reviewed-by: Maurice Kalinowski --- .../fontdatabases/winrt/qwinrtfontdatabase.cpp | 28 +++++++++++++++++++--- .../fontdatabases/winrt/qwinrtfontdatabase_p.h | 2 ++ tests/auto/gui/text/qfont/tst_qfont.cpp | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp index 2a95ca26a9..db58e49bb2 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp @@ -448,19 +448,41 @@ QFontEngine *QWinRTFontDatabase::fontEngine(const QFontDef &fontDef, void *handl return QFontEngineFT::create(fontDef, faceId, fontData); } +QString QWinRTFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) +{ + switch (styleHint) { + case QFont::Times: + return QStringLiteral("Times New Roman"); + case QFont::Courier: + return QStringLiteral("Courier New"); + case QFont::Monospace: + return QStringLiteral("Courier New"); + case QFont::Cursive: + return QStringLiteral("Comic Sans MS"); + case QFont::Fantasy: + return QStringLiteral("Impact"); + case QFont::Decorative: + return QStringLiteral("Old English"); + case QFont::Helvetica: + return QStringLiteral("Segoe UI"); + case QFont::System: + default: + break; + } + return QStringLiteral("Segoe UI"); +} + QStringList QWinRTFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { Q_UNUSED(style) - Q_UNUSED(styleHint) Q_UNUSED(script) qCDebug(lcQpaFonts) << __FUNCTION__ << family; QStringList result; - if (family == QLatin1String("Helvetica")) - result.append(QStringLiteral("Arial")); + result.append(QWinRTFontDatabase::familyForStyleHint(styleHint)); result.append(QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script)); return result; } diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h index 9a2bf00fab..c21f411fff 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h @@ -80,6 +80,8 @@ public: QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; void releaseHandle(void *handle) override; + + static QString familyForStyleHint(QFont::StyleHint styleHint); private: QHash m_fonts; QHash m_fontFamilies; diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 1f826c01cf..7d230d3bb3 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -515,7 +515,7 @@ void tst_QFont::defaultFamily_data() QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(",")); QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(",")); QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(",")); - QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif").split(",")); + QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << "Segoe UI" << getPlatformGenericFont("sans-serif").split(",")); } void tst_QFont::defaultFamily() -- cgit v1.2.3 From 96d6e031635f6d838ae0109d2a91b852a65bbc60 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 1 Jun 2017 11:30:46 +0200 Subject: Doc: Fix a typo in QVariant::toPoint docs Task-number: QTBUG-61050 Change-Id: I517f95df9d1019d37b6484e00220e8e325ee2ecf Reviewed-by: Martin Smith --- src/corelib/kernel/qvariant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index e636c6fe52..17c94e4e9d 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2363,7 +2363,7 @@ QByteArray QVariant::toByteArray() const \fn QPoint QVariant::toPoint() const Returns the variant as a QPoint if the variant has userType() - \l QMetaType::QPointF or \l QMetaType::QPointF; otherwise returns a null + \l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QPoint. \sa canConvert(), convert() -- cgit v1.2.3 From 22a52d1d640f4ee6c68e8ef5da4573770efdb90a Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 31 May 2017 10:32:39 +0200 Subject: Doc: Remove references to screenshots illustrating different styles ... from widget class descriptions. Use one screenshot from Windows instead. The styles change and the screenshots become outdated very fast, so it is easier to update just one screenshot now and then. The styles can still be seen in the style gallery topics. The image files will be removed in a follow-up commit after all references to them have been removed. Change-Id: Id326c141f4884a2e4f67a4fe8681d8c65f8b24ba Reviewed-by: Martin Smith --- src/widgets/itemviews/qlistview.cpp | 11 ++--------- src/widgets/itemviews/qlistwidget.cpp | 11 ++--------- src/widgets/itemviews/qtableview.cpp | 17 ++--------------- src/widgets/itemviews/qtablewidget.cpp | 11 ++--------- src/widgets/itemviews/qtreeview.cpp | 11 ++--------- src/widgets/itemviews/qtreewidget.cpp | 11 ++--------- src/widgets/widgets/qcheckbox.cpp | 14 ++------------ src/widgets/widgets/qcombobox.cpp | 4 ++-- src/widgets/widgets/qdatetimeedit.cpp | 33 ++++++--------------------------- src/widgets/widgets/qdial.cpp | 12 ++---------- src/widgets/widgets/qgroupbox.cpp | 11 ++--------- src/widgets/widgets/qlabel.cpp | 14 ++------------ src/widgets/widgets/qlcdnumber.cpp | 13 ++----------- src/widgets/widgets/qlineedit.cpp | 12 ++---------- src/widgets/widgets/qmenu.cpp | 12 ++---------- src/widgets/widgets/qprogressbar.cpp | 11 ++--------- src/widgets/widgets/qpushbutton.cpp | 21 +++++++-------------- src/widgets/widgets/qradiobutton.cpp | 11 ++--------- src/widgets/widgets/qscrollbar.cpp | 9 --------- src/widgets/widgets/qslider.cpp | 11 ++--------- src/widgets/widgets/qspinbox.cpp | 11 ++--------- src/widgets/widgets/qtabwidget.cpp | 11 ++--------- 22 files changed, 51 insertions(+), 231 deletions(-) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 3ef5b788c6..e7a3c11b44 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -73,6 +73,8 @@ extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); \ingroup advanced \inmodule QtWidgets + \image windows-listview.png + A QListView presents items stored in a model, either as a simple non-hierarchical list, or as a collection of icons. This class is used to provide lists and icon views that were previously provided by the @@ -111,15 +113,6 @@ extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); within a notional grid of size specified by gridSize(). The items can be rendered as large or small icons depending on their iconSize(). - \table 100% - \row \li \inlineimage windowsvista-listview.png Screenshot of a Windows Vista style list view - \li \inlineimage macintosh-listview.png Screenshot of a Macintosh style table view - \li \inlineimage fusion-listview.png Screenshot of a Fusion style table view - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} list view. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} list view. - \li A \l{Fusion Style Widget Gallery}{Fusion style} list view. - \endtable - \section1 Improving Performance It is possible to give the view hints about the data it is handling in order diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 9b34e89ef0..0a1f85facb 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1149,6 +1149,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \ingroup model-view \inmodule QtWidgets + \image windows-listview.png + QListWidget is a convenience class that provides a list view similar to the one supplied by QListView, but with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage @@ -1191,15 +1193,6 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, current item changes, the currentItemChanged() signal is emitted with the new current item and the item that was previously current. - \table 100% - \row \li \inlineimage windowsvista-listview.png Screenshot of a Windows Vista style list widget - \li \inlineimage macintosh-listview.png Screenshot of a Macintosh style table widget - \li \inlineimage fusion-listview.png Screenshot of a Fusion style table widget - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} list widget. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} list widget. - \li A \l{Fusion Style Widget Gallery}{Fusion style} list widget. - \endtable - \sa QListWidgetItem, QListView, QTreeView, {Model/View Programming}, {Config Dialog Example} */ diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index ed6482a8bc..b79932327b 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -988,6 +988,8 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS \ingroup advanced \inmodule QtWidgets + \image windows-tableview.png + A QTableView implements a table view that displays items from a model. This class is used to provide standard tables that were previously provided by the QTable class, but using the more @@ -1052,21 +1054,6 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS columnViewportPosition() functions provide the equivalent conversion operations between x-coordinates and column indexes. - \section1 Styles - - QTableView is styled appropriately for each platform. The following images show - how it looks on three different platforms. Go to the \l{Qt Widget Gallery} to see - its appearance in other styles. - - \table 100% - \row \li \inlineimage windowsvista-tableview.png Screenshot of a Windows Vista style table view - \li \inlineimage macintosh-tableview.png Screenshot of a Macintosh style table view - \li \inlineimage fusion-tableview.png Screenshot of a Fusion style table view - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} table view. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} table view. - \li A \l{Fusion Style Widget Gallery}{Fusion style} table view. - \endtable - \sa QTableWidget, {View Classes}, QAbstractItemModel, QAbstractItemView, {Chart Example}, {Pixelator Example}, {Table Model Example} */ diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index ed83ef7b85..663cd4adc6 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -1504,6 +1504,8 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other) \ingroup model-view \inmodule QtWidgets + \image windows-tableview.png + Table widgets provide standard table display facilities for applications. The items in a QTableWidget are provided by QTableWidgetItem. @@ -1545,15 +1547,6 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other) number of columns with columnCount(). The table can be cleared with the clear() function. - \table 100% - \row \li \inlineimage windowsvista-tableview.png Screenshot of a Windows Vista style table widget - \li \inlineimage macintosh-tableview.png Screenshot of a Macintosh style table widget - \li \inlineimage fusion-tableview.png Screenshot of a Fusion style table widget - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} table widget. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} table widget. - \li A \l{Fusion Style Widget Gallery}{Fusion style} table widget. - \endtable - \sa QTableWidgetItem, QTableView, {Model/View Programming} */ diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index f139fb2d5b..c1647cc2f1 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -71,6 +71,8 @@ QT_BEGIN_NAMESPACE \ingroup advanced \inmodule QtWidgets + \image windows-treeview.png + A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that were previously provided by the \c QListView class, but using the more @@ -150,15 +152,6 @@ QT_BEGIN_NAMESPACE Describe the expanding/collapsing concept if not covered elsewhere. \endomit - \table 100% - \row \li \inlineimage windowsvista-treeview.png Screenshot of a Windows Vista style tree view - \li \inlineimage macintosh-treeview.png Screenshot of a Macintosh style tree view - \li \inlineimage fusion-treeview.png Screenshot of a Fusion style tree view - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} tree view. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} tree view. - \li A \l{Fusion Style Widget Gallery}{Fusion style} tree view. - \endtable - \section1 Improving Performance It is possible to give the view hints about the data it is handling in order diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 1338ce4585..8ce36ab47e 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2354,6 +2354,8 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \ingroup model-view \inmodule QtWidgets + \image windows-treeview.png + The QTreeWidget class is a convenience class that provides a standard tree widget with a classic item-based interface similar to that used by the QListView class in Qt 3. @@ -2387,15 +2389,6 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \l{QTreeView::isSortingEnabled()}{isSortingEnabled()} function indicates whether sorting is enabled. - \table 100% - \row \li \inlineimage windowsvista-treeview.png Screenshot of a Windows Vista style tree widget - \li \inlineimage macintosh-treeview.png Screenshot of a Macintosh style tree widget - \li \inlineimage fusion-treeview.png Screenshot of a Fusion style tree widget - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} tree widget. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} tree widget. - \li A \l{Fusion Style Widget Gallery}{Fusion style} tree widget. - \endtable - \sa QTreeWidgetItem, QTreeWidgetItemIterator, QTreeView, {Model/View Programming}, {Settings Editor Example} */ diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index d4ba17b08e..9b49916774 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -73,6 +73,8 @@ public: \ingroup basicwidgets \inmodule QtWidgets + \image windows-checkbox.png + A QCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an application that can be enabled or disabled without affecting others. @@ -117,18 +119,6 @@ public: setAutoRepeat(), toggle(), pressed(), released(), clicked(), toggled(), checkState(), and stateChanged(). - \table 100% - \row - \li \inlineimage macintosh-checkbox.png Screenshot of a Macintosh style checkbox - \li A checkbox shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row - \li \inlineimage windowsvista-checkbox.png Screenshot of a Windows Vista style checkbox - \li A checkbox shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row - \li \inlineimage fusion-checkbox.png Screenshot of a Fusion style checkbox - \li A checkbox shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QAbstractButton, QRadioButton, {fowler}{GUI Design Handbook: Check Box} */ diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 2376a18e43..45dfffe8bd 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -900,6 +900,8 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent) \ingroup basicwidgets \inmodule QtWidgets + \image windows-combobox.png + A QComboBox provides a means of presenting a list of options to the user in a way that takes up the minimum amount of screen space. @@ -960,8 +962,6 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent) of the view(), e.g., by using \l{QAbstractItemView::}{setSelectionMode()}. - \image qstyle-comboboxes.png Comboboxes in the different built-in styles. - \sa QLineEdit, QSpinBox, QRadioButton, QButtonGroup, {fowler}{GUI Design Handbook: Combo Box, Drop-Down List Box} */ diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 0eaa110bee..2e0a8a3cd7 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -76,6 +76,8 @@ QT_BEGIN_NAMESPACE \ingroup basicwidgets \inmodule QtWidgets + \image windows-datetimeedit.png + QDateTimeEdit allows the user to edit dates by using the keyboard or the arrow keys to increase and decrease date and time values. The arrow keys can be used to move from section to section within the @@ -103,15 +105,6 @@ QT_BEGIN_NAMESPACE calendar pop-up by calling the setCalendarWidget() function. The existing calendar widget can be retrieved with calendarWidget(). - \table 100% - \row \li \inlineimage windowsvista-datetimeedit.png Screenshot of a Windows Vista style date time editing widget - \li A date time editing widget shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage macintosh-datetimeedit.png Screenshot of a Macintosh style date time editing widget - \li A date time editing widget shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage fusion-datetimeedit.png Screenshot of a Fusion style date time editing widget - \li A date time editing widget shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QDateEdit, QTimeEdit, QDate, QTime */ @@ -1505,6 +1498,8 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event) \ingroup basicwidgets \inmodule QtWidgets + \image windows-timeedit.png + Many of the properties and functions provided by QTimeEdit are implemented in QDateTimeEdit. These are the relevant properties of this class: @@ -1518,15 +1513,6 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event) to format the time displayed in the widget. \endlist - \table 100% - \row \li \inlineimage windowsvista-timeedit.png Screenshot of a Windows Vista style time editing widget - \li A time editing widget shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage macintosh-timeedit.png Screenshot of a Macintosh style time editing widget - \li A time editing widget shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage fusion-timeedit.png Screenshot of a Fusion style time editing widget - \li A time editing widget shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QDateEdit, QDateTimeEdit */ @@ -1582,6 +1568,8 @@ QTimeEdit::~QTimeEdit() \ingroup basicwidgets \inmodule QtWidgets + \image windows-dateedit.png + Many of the properties and functions provided by QDateEdit are implemented in QDateTimeEdit. These are the relevant properties of this class: @@ -1595,15 +1583,6 @@ QTimeEdit::~QTimeEdit() to format the date displayed in the widget. \endlist - \table 100% - \row \li \inlineimage windowsvista-dateedit.png Screenshot of a Windows Vista style date editing widget - \li A date editing widget shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage macintosh-dateedit.png Screenshot of a Macintosh style date editing widget - \li A date editing widget shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage fusion-dateedit.png Screenshot of a Fusion style date editing widget - \li A date editing widget shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QTimeEdit, QDateTimeEdit */ diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp index cee39e2ae3..a219e4ccb6 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -179,6 +179,8 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const \ingroup basicwidgets \inmodule QtWidgets + \image windows-dial.png + QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the @@ -226,16 +228,6 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const by \l {QAbstractSlider::singleStep} {singleStep}, and \l {QAbstractSlider::pageStep} {pageStep}. - \table - \row \li \inlineimage fusion-dial.png Screenshot of a dial in the Fusion widget style - \li \inlineimage windowsvista-dial.png Screenshot of a dial in the Windows Vista widget style - \li \inlineimage macintosh-dial.png Screenshot of a dial in the Macintosh widget style - \row \li {3,1} Dials shown in various widget styles (from left to right): - \l{Fusion Style Widget Gallery}{Fusion}, - \l{Windows Vista Style Widget Gallery}{Windows Vista}, - \l{Macintosh Style Widget Gallery}{Macintosh}. - \endtable - \sa QScrollBar, QSpinBox, QSlider, {fowler}{GUI Design Handbook: Slider}, {Sliders Example} */ diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index fda68879d1..9e323df9a6 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -145,6 +145,8 @@ void QGroupBoxPrivate::click() \ingroup geomanagement \inmodule QtWidgets + \image windows-groupbox.png + A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box's child widgets. @@ -166,15 +168,6 @@ void QGroupBoxPrivate::click() \snippet widgets/groupbox/window.cpp 2 - \table 100% - \row \li \inlineimage windowsvista-groupbox.png Screenshot of a Windows Vista style group box - \li \inlineimage macintosh-groupbox.png Screenshot of a Macintosh style group box - \li \inlineimage fusion-groupbox.png Screenshot of a Fusion style group box - \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} group box. - \li A \l{Macintosh Style Widget Gallery}{Macintosh style} group box. - \li A \l{Fusion Style Widget Gallery}{Fusion style} group box. - \endtable - \sa QButtonGroup, {Group Box Example} */ diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 4946e3e354..e3225800cc 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -116,6 +116,8 @@ QLabelPrivate::~QLabelPrivate() \ingroup basicwidgets \inmodule QtWidgets + \image windows-label.png + QLabel is used for displaying text or an image. No user interaction functionality is provided. The visual appearance of the label can be configured in various ways, and it can be used @@ -181,18 +183,6 @@ QLabelPrivate::~QLabelPrivate() was a button (inheriting from QAbstractButton), triggering the mnemonic would emulate a button click. - \table 100% - \row - \li \inlineimage macintosh-label.png Screenshot of a Macintosh style label - \li A label shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row - \li \inlineimage fusion-label.png Screenshot of a Fusion style label - \li A label shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \row - \li \inlineimage windowsvista-label.png Screenshot of a Windows Vista style label - \li A label shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \endtable - \sa QLineEdit, QTextEdit, QPixmap, QMovie, {fowler}{GUI Design Handbook: Label} */ diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index a0aeee2237..282714843c 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -74,6 +74,8 @@ public: \ingroup basicwidgets \inmodule QtWidgets + \image windows-lcdnumber.png + It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to connect to data sources using the display() slot, which is @@ -103,17 +105,6 @@ public: Incidentally, QLCDNumber is the very oldest part of Qt, tracing its roots back to a BASIC program on the \l{Sinclair Spectrum}{Sinclair Spectrum}. - \table - \row \li - \inlineimage windows-lcdnumber.png Screenshot of a Windows style LCD number widget - \inlineimage windowsvista-lcdnumber.png Screenshot of a Windows Vista style LCD number widget - \inlineimage macintosh-lcdnumber.png Screenshot of a Macintosh style LCD number widget - \inlineimage fusion-lcdnumber.png Screenshot of a Fusion style LCD number widget - \row \li LCD number widgets shown in various widget styles (from left to right): - \l{Windows Style Widget Gallery}{Windows}, \l{Windows Vista Style Widget Gallery}{Windows Vista}, - \l{Macintosh Style Widget Gallery}{Macintosh}, \l{Fusion Style Widget Gallery}{Fusion}. - \endtable - \sa QLabel, QFrame, {Digital Clock Example}, {Tetrix Example} */ diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 27dd186f04..7e24704de3 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -128,6 +128,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const \ingroup basicwidgets \inmodule QtWidgets + \image windows-lineedit.png + A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop (see @@ -142,7 +144,6 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const on the same line edit, it is best to clear the validator or input mask to prevent undefined behavior. - A related class is QTextEdit which allows multi-line, rich text editing. @@ -202,15 +203,6 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const Any other key sequence that represents a valid character, will cause the character to be inserted into the line edit. - \table 100% - \row \li \inlineimage macintosh-lineedit.png Screenshot of a Macintosh style line edit - \li A line edit shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage windowsvista-lineedit.png Screenshot of a Windows Vista style line edit - \li A line edit shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage fusion-lineedit.png Screenshot of a Fusion style line edit - \li A line edit shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QTextEdit, QLabel, QComboBox, {fowler}{GUI Design Handbook: Field, Entry}, {Line Edits Example} */ diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 2cafe462b1..5732131578 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1534,6 +1534,8 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) \ingroup basicwidgets \inmodule QtWidgets + \image fusion-menu.png + A menu widget is a selection menu. It can be either a pull-down menu in a menu bar or a standalone context menu. Pull-down menus are shown by the menu bar when the user clicks on the respective @@ -1545,16 +1547,6 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) response to button presses; these are just like context menus except for how they are invoked. - \table 100% - \row - \li \inlineimage fusion-menu.png - \li \inlineimage windowsxp-menu.png - \li \inlineimage macintosh-menu.png - \endtable - \caption Fig. A menu shown in \l{Fusion Style Widget Gallery}{Fusion widget style}, - \l{Windows XP Style Widget Gallery}{Windows XP widget style}, - and \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \section1 Actions A menu consists of a list of action items. Actions are added with diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 2b228cdb2c..b4819278c7 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -177,6 +177,8 @@ bool QProgressBarPrivate::repaintRequired() const \ingroup basicwidgets \inmodule QtWidgets + \image windows-progressbar.png + A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application is still running. @@ -198,15 +200,6 @@ bool QProgressBarPrivate::repaintRequired() const example, when using QNetworkAccessManager to download items when they are unable to determine the size of the item being downloaded. - \table - \row \li \inlineimage macintosh-progressbar.png Screenshot of a Macintosh style progress bar - \li A progress bar shown in the Macintosh widget style. - \row \li \inlineimage windowsvista-progressbar.png Screenshot of a Windows Vista style progress bar - \li A progress bar shown in the Windows Vista widget style. - \row \li \inlineimage fusion-progressbar.png Screenshot of a Fusion style progress bar - \li A progress bar shown in the Fusion widget style. - \endtable - \sa QProgressDialog, {fowler}{GUI Design Handbook: Progress Indicator} */ diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 5b1e10eb32..6aa1d68c32 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -81,6 +81,8 @@ QT_BEGIN_NAMESPACE \ingroup basicwidgets \inmodule QtWidgets + \image windows-pushbutton.jpg + The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button to command the computer to perform some action, or to answer a @@ -152,6 +154,11 @@ QT_BEGIN_NAMESPACE button is probably not what you want. When in doubt, use a tool button. + \note On \macos when a push button's width becomes smaller than 50 or + its height becomes smaller than 30, the button's corners are + changed from round to square. Use the setMinimumSize() + function to prevent this behavior. + A variation of a command button is a menu button. These provide not just one command, but several, since when they are clicked they pop up a menu of options. Use the method setMenu() to @@ -160,20 +167,6 @@ QT_BEGIN_NAMESPACE Other classes of buttons are option buttons (see QRadioButton) and check boxes (see QCheckBox). - \table 100% - \row \li \inlineimage macintosh-pushbutton.png Screenshot of a Macintosh style push button - \li A push button shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - - Note that when a button's width becomes smaller than 50 or - its height becomes smaller than 30, the button's corners are - changed from round to square. Use the setMinimumSize() - function to prevent this behavior. - - \row \li \inlineimage windowsvista-pushbutton.png Screenshot of a Windows Vista style push button - \li A push button shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage fusion-pushbutton.png Screenshot of a Fusion style push button - \li A push button shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable In Qt, the QAbstractButton base class provides most of the modes and other API, and QPushButton provides GUI logic. diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index 284c5f56cf..ac711d34c7 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -80,6 +80,8 @@ void QRadioButtonPrivate::init() \ingroup basicwidgets \inmodule QtWidgets + \image windows-radiobutton.png + A QRadioButton is an option button that can be switched on (checked) or off (unchecked). Radio buttons typically present the user with a "one of many" choice. In a group of radio buttons, only one radio button at @@ -113,15 +115,6 @@ void QRadioButtonPrivate::init() setDown(), isDown(), autoRepeat(), group(), setAutoRepeat(), toggle(), pressed(), released(), clicked(), and toggled(). - \table 100% - \row \li \inlineimage fusion-radiobutton.png Screenshot of a Fusion radio button - \li A radio button shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \row \li \inlineimage windowsvista-radiobutton.png Screenshot of a Windows Vista radio button - \li A radio button shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage macintosh-radiobutton.png Screenshot of a Macintosh radio button - \li A radio button shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \endtable - \sa QPushButton, QToolButton, QCheckBox, {fowler}{GUI Design Handbook: Radio Button}, {Group Box Example} */ diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 79bfedb8c4..66f1a4c689 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -187,15 +187,6 @@ QT_BEGIN_NAMESPACE Most GUI styles use the pageStep() value to calculate the size of the slider. - \table 100% - \row \li \inlineimage macintosh-horizontalscrollbar.png Screenshot of a Macintosh style scroll bar - \li A scroll bar shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage windowsvista-horizontalscrollbar.png Screenshot of a Windows Vista style scroll bar - \li A scroll bar shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage fusion-horizontalscrollbar.png Screenshot of a Fusion style scroll bar - \li A scroll bar shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QScrollArea, QSlider, QDial, QSpinBox, {fowler}{GUI Design Handbook: Scroll Bar}, {Sliders Example} */ diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index 744a43253a..356cbcfce7 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -203,6 +203,8 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) \ingroup basicwidgets \inmodule QtWidgets + \image windows-slider.png + The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical groove and translates the handle's position into an integer value @@ -252,15 +254,6 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) \li End moves to the end (maximum). \endlist - \table 100% - \row \li \inlineimage macintosh-slider.png Screenshot of a Macintosh slider - \li A slider shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \row \li \inlineimage windowsvista-slider.png Screenshot of a Windows Vista slider - \li A slider shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage fusion-slider.png Screenshot of a Fusion slider - \li A slider shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \endtable - \sa QScrollBar, QSpinBox, QDial, {fowler}{GUI Design Handbook: Slider}, {Sliders Example} */ diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index 0daa624ae8..508cb05cfc 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -112,6 +112,8 @@ public: \ingroup basicwidgets \inmodule QtWidgets + \image windows-spinbox.png + QSpinBox is designed to handle integers and discrete sets of values (e.g., month names); use QDoubleSpinBox for floating point values. @@ -151,15 +153,6 @@ public: choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with QSpinBox. - \table 100% - \row \li \inlineimage windowsvista-spinbox.png Screenshot of a Windows Vista spin box - \li A spin box shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}. - \row \li \inlineimage fusion-spinbox.png Screenshot of a Fusion spin box - \li A spin box shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}. - \row \li \inlineimage macintosh-spinbox.png Screenshot of a Macintosh spin box - \li A spin box shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \endtable - \section1 Subclassing QSpinBox If using prefix(), suffix(), and specialValueText() don't provide diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index be870133ee..7c75f859ed 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE \ingroup basicwidgets \inmodule QtWidgets + \image windows-tabwidget.png + A tab widget provides a tab bar (see QTabBar) and a "page area" that is used to display pages related to each tab. By default, the tab bar is shown above the page area, but different configurations @@ -117,15 +119,6 @@ QT_BEGIN_NAMESPACE (at the top, providing the tabs) and a QStackedWidget (most of the area, organizing the individual pages). - \table 100% - \row \li \inlineimage windowsvista-tabwidget.png Screenshot of a Windows Vista style tab widget - \li \inlineimage macintosh-tabwidget.png Screenshot of a Macintosh style tab widget - \li \inlineimage fusion-tabwidget.png Screenshot of a Fusion style tab widget - \row \li A Windows Vista style tab widget. - \li A Macintosh style tab widget. - \li A Fusion style tab widget. - \endtable - \sa QTabBar, QStackedWidget, QToolBox, {Tab Dialog Example} */ -- cgit v1.2.3 From 49fc750ee4b17f602c054c6f812352264d973403 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 24 May 2017 15:33:20 +0100 Subject: QStringLiteral/QByteArrayLiteral: fix/add documentation Various editorial fixes. Also, in 5.9 QStringLiteral does not fall back to fromUtf8 any longer, but guarantees a compile-time construction. Change-Id: Ida4698cf8e32a6e3de97b2c16b997fc9630c9db9 Reviewed-by: Edward Welbourne --- src/corelib/tools/qbytearray.cpp | 22 ++++++++++++++++ src/corelib/tools/qstring.cpp | 55 ++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 329cc358d4..8df439f7cd 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -4712,4 +4712,26 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA \internal */ +/*! + \macro QByteArrayLiteral(ba) + \relates QByteArray + + The macro generates the data for a QByteArray out of the string literal + \a ba at compile time. Creating a QByteArray from it is free in this case, and + the generated byte array data is stored in the read-only segment of the + compiled object file. + + For instance: + + \code + QByteArray ba = QByteArrayLiteral("byte array contents"); + \endcode + + Using QByteArrayLiteral instead of a double quoted plain C++ string literal + can significantly speed up creation of QByteArray instances from data known + at compile time. + + \sa QStringLiteral +*/ + QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 48f3d64c4a..941532658b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -10774,52 +10774,47 @@ QString QString::toHtmlEscaped() const \macro QStringLiteral(str) \relates QString - The macro generates the data for a QString out of \a str at compile time if the compiler supports it. - Creating a QString from it is free in this case, and the generated string data is stored in - the read-only segment of the compiled object file. + The macro generates the data for a QString out of the string literal \a str + at compile time. Creating a QString from it is free in this case, and the + generated string data is stored in the read-only segment of the compiled + object file. - For compilers not supporting the creation of compile time strings, QStringLiteral will fall back to - QString::fromUtf8(). + If you have code that looks like this: - If you have code looking like: \code + // hasAttribute takes a QString argument if (node.hasAttribute("http-contents-length")) //... \endcode - One temporary QString will be created to be passed as the hasAttribute function parameter. - This can be quite expensive, as it involves a memory allocation and the copy and the conversion - of the data into QString's internal encoding. - This can be avoided by doing + then a temporary QString will be created to be passed as the \c{hasAttribute} + function parameter. This can be quite expensive, as it involves a memory + allocation and the copy/conversion of the data into QString's internal + encoding. + + This cost can be avoided by using QStringLiteral instead: + \code if (node.hasAttribute(QStringLiteral("http-contents-length"))) //... \endcode - Then the QString's internal data will be generated at compile time and no conversion or allocation - will occur at runtime - Using QStringLiteral instead of a double quoted ascii literal can significantly speed up creation - of QString's from data known at compile time. + In this case, QString's internal data will be generated at compile time; no + conversion or allocation will occur at runtime. + + Using QStringLiteral instead of a double quoted plain C++ string literal can + significantly speed up creation of QString instances from data known at + compile time. - If the compiler is C++11 enabled the string \a str can actually contain unicode data. + \note QLatin1String can still be more efficient than QStringLiteral + when the string is passed to a function that has an overload taking + QLatin1String and this overload avoids conversion to QString. For + instance, QString::operator==() can compare to a QLatin1String + directly: - \note There are still a few cases in which QLatin1String is more efficient than QStringLiteral: - If it is passed to a function that has an overload that takes the QLatin1String directly, without - conversion to QString. For instance, this is the case of QString::operator== \code if (attribute.name() == QLatin1String("http-contents-length")) //... \endcode - \note There are some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets - provided here fail to compile with them. - \list - \li Concatenated string literals cannot be used with QStringLiteral. - \code - QString s = QStringLiteral("a" "b"); - \endcode - \li QStringLiteral cannot be used to initialize lists or arrays of QString. - \code - QString a[] = { QStringLiteral("a"), QStringLiteral("b") }; - \endcode - \endlist + \sa QByteArrayLiteral */ /*! -- cgit v1.2.3 From 8c620d24bb220fd3db32a75023b892b26fad32f3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 31 May 2017 12:33:11 +0200 Subject: Fix semi-opaque linear gradient on ARGB32 The qt_gradient_argb32 routine optimizes linear gradients with the solid blend routines that is ARGB32PM only. If the gradient is not solid, it will not get unpremultipled on write like it should for ARGB32. Covered by lancelot, but the change is less than 5%. Change-Id: Id99f2fa125cc091f3b5b29ec2d06618785d628fa Reviewed-by: Eirik Aavitsland --- src/gui/painting/qdrawhelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index cb3e7523a8..9d5710a5e9 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6077,7 +6077,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = // Format_ARGB32, { blend_color_generic, - qt_gradient_argb32, + blend_src_generic, qt_bitmapblit_argb32, qt_alphamapblit_argb32, qt_alphargbblit_argb32, -- cgit v1.2.3 From 91ef71b7bf3526a0bb7f6f83e6b3e03e286c2030 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 30 May 2017 14:39:50 +0200 Subject: winrt: Get rid of one deferral when handling socket data Instead of defering one more time by emitting the signal, we can add the data to the list of available data/pending datagrams. For TCP readNotification can be invoked directly so that emission of the readyRead signal is tightly coupled to the availability of new data. For UDP sockets calling readNotification directly stops handling of more data and thus cannot be done. With the old approach it was possible, that the last bit of TCP data was lost, because the socket was closed while the data was still being processed/transferred from the worker to the engine. Task-number: QTBUG-61078 Change-Id: I9330b87876be853d310dc9e8e817ab344939d5dd Reviewed-by: Maurice Kalinowski --- src/network/socket/qnativesocketengine_winrt.cpp | 37 +++++++----------------- src/network/socket/qnativesocketengine_winrt_p.h | 3 -- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 0625ea65da..38c2b6e8c0 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -1250,20 +1250,22 @@ void QNativeSocketEngine::handleConnectOpFinished(bool success, QAbstractSocket: void QNativeSocketEngine::handleNewDatagrams(const QList &datagrams) { Q_D(QNativeSocketEngine); - // Defer putting the datagrams into the list until the next event loop iteration - // (where the readyRead signal is emitted as well) - QMetaObject::invokeMethod(this, "putIntoPendingDatagramsList", Qt::QueuedConnection, - Q_ARG(QList, datagrams)); + QMutexLocker locker(&d->readMutex); + d->pendingDatagrams.append(datagrams); if (d->notifyOnRead) emit readReady(); } void QNativeSocketEngine::handleNewData(const QVector &data) { - // Defer putting the data into the list until the next event loop iteration - // (where the readyRead signal is emitted as well) - QMetaObject::invokeMethod(this, "putIntoPendingData", Qt::QueuedConnection, - Q_ARG(QVector, data)); + Q_D(QNativeSocketEngine); + QMutexLocker locker(&d->readMutex); + d->pendingData.append(data); + for (const QByteArray &newData : data) + d->bytesAvailable += newData.length(); + locker.unlock(); + if (d->notifyOnRead) + readNotification(); } void QNativeSocketEngine::handleTcpError(QAbstractSocket::SocketError error) @@ -1284,25 +1286,6 @@ void QNativeSocketEngine::handleTcpError(QAbstractSocket::SocketError error) emit readReady(); } -void QNativeSocketEngine::putIntoPendingDatagramsList(const QList &datagrams) -{ - Q_D(QNativeSocketEngine); - QMutexLocker locker(&d->readMutex); - d->pendingDatagrams.append(datagrams); -} - -void QNativeSocketEngine::putIntoPendingData(const QVector &data) -{ - Q_D(QNativeSocketEngine); - QMutexLocker locker(&d->readMutex); - d->pendingData.append(data); - for (const QByteArray &newData : data) - d->bytesAvailable += newData.length(); - locker.unlock(); - if (d->notifyOnRead) - readNotification(); -} - bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol) { Q_UNUSED(socketProtocol); diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h index 6528c6d627..13922cb397 100644 --- a/src/network/socket/qnativesocketengine_winrt_p.h +++ b/src/network/socket/qnativesocketengine_winrt_p.h @@ -183,9 +183,6 @@ private slots: void handleTcpError(QAbstractSocket::SocketError error); private: - Q_INVOKABLE void putIntoPendingDatagramsList(const QList &datagrams); - Q_INVOKABLE void putIntoPendingData(const QVector &data); - Q_DECLARE_PRIVATE(QNativeSocketEngine) Q_DISABLE_COPY(QNativeSocketEngine) }; -- cgit v1.2.3 From 4fb174563945438d34da38ebadf0f6b03cad266d Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Jun 2017 12:04:06 +0200 Subject: Ssl socket - fix broken certificate verification On iOS QSslConfiguration always has an empty list of system CA certificates. Calling SecTrustSetAnchorCertificatesOnly(.., TRUE) on iOS results in SecTrustEvaluate failing to verify a valid certificate, since there are no 'anchors' at all. We can use SecTrustSetAnchorCerificatesOnly(.. TRUE) on macOS only, where we do extract/copy system certificates using SecTrustSettingsCopyCertificates and save them in a QSslConfiguration's list. Task-number: QTBUG-61053 Change-Id: I70d4e46273d78414baaac8531273def707c3eebc Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_mac.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index fec5fbefc0..78aceadb81 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -1222,9 +1222,32 @@ bool QSslSocketBackendPrivate::verifyPeerTrust() QCFType certRef = SecCertificateCreateWithData(NULL, certData); CFArrayAppendValue(certArray, certRef); } + SecTrustSetAnchorCertificates(trust, certArray); - // Secure Transport should use anchors only from our QSslConfiguration: - SecTrustSetAnchorCertificatesOnly(trust, true); + + // By default SecTrustEvaluate uses both CA certificates provided in + // QSslConfiguration and the ones from the system database. This behavior can + // be unexpected if a user's code tries to limit the trusted CAs to those + // explicitly set in QSslConfiguration. + // Since on macOS we initialize the default QSslConfiguration copying the + // system CA certificates (using SecTrustSettingsCopyCertificates) we can + // call SecTrustSetAnchorCertificatesOnly(trust, true) to force SecTrustEvaluate + // to use anchors only from our QSslConfiguration. + // Unfortunately, SecTrustSettingsCopyCertificates is not available on iOS + // and the default QSslConfiguration always has an empty list of system CA + // certificates. This leaves no way to provide client code with access to the + // actual system CA certificate list (which most use-cases need) other than + // by letting SecTrustEvaluate fall through to the system list; so, in this case + // (even though the client code may have provided its own certs), we retain + // the default behavior. + +#ifdef Q_OS_MACOS + const bool anchorsFromConfigurationOnly = true; +#else + const bool anchorsFromConfigurationOnly = false; +#endif + + SecTrustSetAnchorCertificatesOnly(trust, anchorsFromConfigurationOnly); SecTrustResultType trustResult = kSecTrustResultInvalid; SecTrustEvaluate(trust, &trustResult); -- cgit v1.2.3 From e4eaa629439fe1ba1e157c2d81adee51d1995161 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 26 Apr 2017 13:59:50 -0300 Subject: Disable bogus GCC 7 warning about string op overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Analysis proves this is a false positive: qarraydataops.h:69:17: error: ‘void* memset(void*, int, size_t)’: specified size between 18446744056529682436 and 18446744065119617024 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] Change-Id: I7814054a102a407d876ffffd14b6ab0be9e222fc Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydataops.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index ae83e6986e..b7c3bc1287 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -49,6 +49,11 @@ QT_BEGIN_NAMESPACE namespace QtPrivate { +QT_WARNING_PUSH +#if defined(Q_CC_GNU) && Q_CC_GNU >= 700 +QT_WARNING_DISABLE_GCC("-Wstringop-overflow") +#endif + template struct QPodArrayOps : QTypedArrayData @@ -131,6 +136,7 @@ struct QPodArrayOps this->size -= (e - b); } }; +QT_WARNING_POP template struct QGenericArrayOps -- cgit v1.2.3 From b7d76e533c76f7d9e9373d68f33ff9595fe8ce52 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 3 May 2017 13:07:18 -0700 Subject: MSVC: Enable standard-conformance mode by default That's not the same as -Za. Change-Id: Ica9894dc9b5e48278fd4fffd14bb316b687abffe Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- mkspecs/common/msvc-version.conf | 1 + mkspecs/features/default_post.prf | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf index 29f96b7abf..fdf7efc0a5 100644 --- a/mkspecs/common/msvc-version.conf +++ b/mkspecs/common/msvc-version.conf @@ -81,6 +81,7 @@ greaterThan(QMAKE_MSC_VER, 1909) { MSVC_VER = 15.0 COMPAT_MKSPEC = win32-msvc2017 QMAKE_CXXFLAGS += -Zc:referenceBinding + QMAKE_CXXFLAGS_STRICTCXX = -permissive- } greaterThan(QMAKE_MSC_VER, 1910) { diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 0e67223449..d18604e0b8 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -124,8 +124,12 @@ c++11|c++14|c++1z { cxxstd = CXX11 } - # Check if we should disable the GNU extensions or not - !strict_c++:!isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd): cxxstd = GNU$$cxxstd + # Check if we should disable compiler extensions or not + isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd) { + strict_c++: QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STRICTCXX + } else { + !strict_c++: cxxstd = GNU$$cxxstd + } QMAKE_CXXFLAGS += $$eval(QMAKE_CXXFLAGS_$$cxxstd) QMAKE_LFLAGS += $$eval(QMAKE_LFLAGS_$$cxxstd) -- cgit v1.2.3 From 6e97d091e4d30566c14cf726f44d9e17f819c2c2 Mon Sep 17 00:00:00 2001 From: "R.J.V. Bertin" Date: Thu, 1 Jun 2017 23:59:55 +0200 Subject: define QT_NO_EXCEPTIONS reliably when using Clang Clang's definition of the __EXCEPTIONS macro is inconsistent across platforms. When compiling for Darwin, Clang 3.6 and newer will set the token when exceptions are enabled in either C++ or ObjC. This change adds the reliable check described in the Clang 3.6 release notes to ensure that QT_NO_EXCEPTIONS is defined when required. The check requires the use of the Clang-specific __has_feature() syntax for which a new proxy macro QT_HAS_FEATURE(x) is added in qcompilerdetection.h Task-number: QTBUG-61034 Change-Id: Ie7b482dfa1a4a5b700a6b97562c26b626be1fc04 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 5 +++++ src/corelib/global/qglobal.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 173ada89de..c221115e8f 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1246,6 +1246,11 @@ #else # define QT_HAS_INCLUDE_NEXT(x) 0 #endif +#ifdef __has_feature +# define QT_HAS_FEATURE(x) __has_feature(x) +#else +# define QT_HAS_FEATURE(x) 0 +#endif /* * Warning/diagnostic handling diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 79053329a1..f2f28343c6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -631,7 +631,12 @@ inline void qt_noop(void) {} */ #if !defined(QT_NO_EXCEPTIONS) -# if defined(QT_BOOTSTRAPPED) || (defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN)) +# if !defined(Q_MOC_RUN) +# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \ + (defined(Q_CC_GNU) && !defined(__EXCEPTIONS)) +# define QT_NO_EXCEPTIONS +# endif +# elif defined(QT_BOOTSTRAPPED) # define QT_NO_EXCEPTIONS # endif #endif -- cgit v1.2.3 From acaaa84d7e6cafda80fdaa2b914dc09ba21ce42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 2 Jun 2017 21:18:27 +0100 Subject: Fix build with clang 4.0 and libstdc++ 7.1.1 With this setup clang cannot use c++1z yet. Fixed with clang 5.0. In file included from /data/sources/qt/qt5/qtbase/src/corelib/codecs/qtextcodec.cpp:53: In file included from ../../../include/QtCore/5.9.1/QtCore/private/qcoreglobaldata_p.h:1: In file included from ../../../include/QtCore/5.9.1/QtCore/private/../../../../../../../../../sources/qt/qt5/qtbase/src/corelib/kernel/qcoreglobaldata_p.h:55: In file included from ../../../include/QtCore/qmap.h:1: In file included from ../../../include/QtCore/../../../../../../sources/qt/qt5/qtbase/src/corelib/tools/qmap.h:52: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/map:60: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/stl_tree.h:72: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/node_handle.h:39: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:27: error: use of class template 'optional' requires template arguments Change-Id: Ib4cd8a9f5791a6e6cae4e6d61dfec3ad50dd63ab Reviewed-by: Thiago Macieira --- config.tests/common/c++1z/c++1z.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.tests/common/c++1z/c++1z.cpp b/config.tests/common/c++1z/c++1z.cpp index a30196f57d..63c6fb5b8a 100644 --- a/config.tests/common/c++1z/c++1z.cpp +++ b/config.tests/common/c++1z/c++1z.cpp @@ -43,4 +43,6 @@ # error "__cplusplus must be > 201402L (the value for C++14)" #endif +#include // https://bugs.llvm.org//show_bug.cgi?id=33117 + int main(int, char **) { return 0; } -- cgit v1.2.3 From d56c6cf7a4fe2b7e5543d58a786efc768b7370c2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 15:51:27 -0700 Subject: Work around uname(2) on Apple mobile OSes not returning the proper arch Task-number: QTBUG-61205 Change-Id: Ia3e896da908f42939148fffd14c46fc991650f6f Reviewed-by: Jake Petroules --- src/corelib/global/qglobal.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 14853b3687..2176bd8d4a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -86,6 +86,12 @@ # include #endif +#if defined(Q_OS_DARWIN) +# include +# include +# include +#endif + #ifdef Q_OS_UNIX #include #include @@ -2437,6 +2443,20 @@ QString QSysInfo::currentCpuArchitecture() case PROCESSOR_ARCHITECTURE_IA64: return QStringLiteral("ia64"); } +#elif defined(Q_OS_DARWIN) + cpu_type_t type; + size_t size = sizeof(type); + sysctlbyname("hw.cputype", &type, &size, NULL, 0); + switch (type) { + case CPU_TYPE_X86: + return QStringLiteral("i386"); + case CPU_TYPE_X86_64: + return QStringLiteral("x86_64"); + case CPU_TYPE_ARM: + return QStringLiteral("arm"); + case CPU_TYPE_ARM64: + return QStringLiteral("arm64"); + } #elif defined(Q_OS_UNIX) long ret = -1; struct utsname u; -- cgit v1.2.3 From 934235e967b4e3c96fa3ebf0338497cc0604e270 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Mon, 5 Jun 2017 04:23:53 +0000 Subject: Revert "moc: remove _MSC_EXTENSIONS #define" It seems this change is preventing us to integrate qt5.git in '5.9' This reverts commit c3030d7163245b55abfd09eefe696c035c55011c. Task-number: QTBUG-61204 Change-Id: Id98afaa23be0a8dd6f2c54a899f46542c65436aa Reviewed-by: Olivier Goffart (Woboq GmbH) --- mkspecs/features/moc.prf | 4 ++-- src/tools/moc/main.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 955933d874..15eb38af31 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -31,10 +31,10 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APP moc_predefs.name = "Generate moc_predefs.h" moc_predefs.CONFIG = no_link gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} - else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} + else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Za -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:msvc { moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \ - -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} + -E -Za ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} } else: error("Oops, I messed up") moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.input = MOC_PREDEF_FILE diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 25f2fd45bf..b30de66258 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -380,9 +380,6 @@ int runMoc(int argc, char **argv) error("Missing macro name"); parser.showHelp(1); } - // Prevent parse errors on MSVC extensions. - if (name == "_MSC_EXTENSIONS") - continue; Macro macro; macro.symbols = Preprocessor::tokenize(value, 1, Preprocessor::TokenizeDefine); macro.symbols.removeLast(); // remove the EOF symbol -- cgit v1.2.3 From 5f0ce2333f7e11a3ffb5d16a27cd9303efa712d5 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 6 Jun 2017 09:43:13 +0200 Subject: Remove -permissive- flag from MSVC 2017 build The flag makes the build fail for UWP as well as desktop Windows . It will trigger a compile error as soon as UWP API is used, which happens in qtbase for desktop in the direct2d backend, but it is also used for other Qt modules, so we decided to disable the flag for now. This patch partly reverts b7d76e533c76f7d9e9373d68f33ff9595fe8ce52 Task-number: QTBUG-61239 Change-Id: I0cc630f4c09c52f0c116f4a7b95a44c3a55e0be3 Reviewed-by: Maurice Kalinowski --- mkspecs/common/msvc-version.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf index fdf7efc0a5..d8ec089f55 100644 --- a/mkspecs/common/msvc-version.conf +++ b/mkspecs/common/msvc-version.conf @@ -81,7 +81,10 @@ greaterThan(QMAKE_MSC_VER, 1909) { MSVC_VER = 15.0 COMPAT_MKSPEC = win32-msvc2017 QMAKE_CXXFLAGS += -Zc:referenceBinding - QMAKE_CXXFLAGS_STRICTCXX = -permissive- + # For now permissive fails as soon as UWP API comes into play. In qtbase this + # API is used in direct2d, but also in multimedia, positioning and sensors. + # We can try again with a later version of Visual Studio. + # QMAKE_CXXFLAGS_STRICTCXX = -permissive- } greaterThan(QMAKE_MSC_VER, 1910) { -- cgit v1.2.3