From 88932d4339ea604a1bea8c09aef3945ac348df9c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Jan 2017 13:31:06 +0100 Subject: [PATCH 01/70] Android: transform input rectangle correctly QRect::setX/setY will change both position and size. In this case, the width and/or height of the input rectangle could end up negative. The correct functions to use are moveLeft/moveTop which will preserve the size when changing the position. Task-number: QTBUG-58179 Change-Id: I71a2e38958754dc53e062ad1c780e2337f72ec32 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 12e85046f84..436e41bad53 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -354,8 +354,8 @@ static QRect inputItemRectangle() ? QHighDpiScaling::factor(window) : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); if (pixelDensity != 1.0) { - rect.setX(rect.x() * pixelDensity); - rect.setY(rect.y() * pixelDensity); + rect.moveLeft(rect.x() * pixelDensity); + rect.moveTop(rect.y() * pixelDensity); rect.setWidth(rect.width() * pixelDensity); rect.setHeight(rect.height() * pixelDensity); } From 1e7ce7aab07bf8605503bf1e5a3da3e9f86d42cb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 17 Jan 2017 13:24:57 +0100 Subject: [PATCH 02/70] Fix registration of system default font QPlatformFontDatabase::resolveFontFamilyAlias returns the input unchanged if the font-name is not found. This means we never register the system default font when it is only a virtual font name. Task-number: QTBUG-58225 Change-Id: Ib4f80bb758aa66a163d223573bfe624bb3c134ab Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/windows/qwindowsfontdatabase.cpp | 2 +- .../fontdatabases/windows/qwindowsfontdatabase_ft.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index 887123083ae..c457246354d 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1191,7 +1191,7 @@ void QWindowsFontDatabase::populateFontDatabase() ReleaseDC(0, dummy); // Work around EnumFontFamiliesEx() not listing the system font. QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().family(); - if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily).isEmpty()) + if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily) QPlatformFontDatabase::registerFontFamily(systemDefaultFamily); } diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp index ebb82baf6f5..7cfebf0436d 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp @@ -386,7 +386,7 @@ void QWindowsFontDatabaseFT::populateFontDatabase() ReleaseDC(0, dummy); // Work around EnumFontFamiliesEx() not listing the system font QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().family(); - if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily).isEmpty()) + if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily) QPlatformFontDatabase::registerFontFamily(systemDefaultFamily); } From 49dc9aa409d727824f26b246054a22b5a7dd5980 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 17 Jan 2017 10:40:18 +0100 Subject: [PATCH 03/70] Windows QPA: Do not return QPlatformIntegration::ShowIsMaximized in tablet mode The hint is not appropriate for Windows 10 tablet mode as it affects only main windows. Dialogs should still show up in normal size. Partially reverts change d377f14fd5b4fe3ed64392c6b743bac395f9f891. Task-number: QTBUG-58227 Change-Id: If9cf4990eb40913904cd97e17a7622bc6cbe84ca Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/windows/qwindowsintegration.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index f49ad0e7674..3f74fd52963 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -512,11 +512,6 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co return QVariant(keyBoardAutoRepeatRateMS()); #endif case QPlatformIntegration::ShowIsMaximized: -#ifndef QT_NO_CLIPBOARD - return qt_windowsIsTabletMode(d->m_clipboard.clipboardViewer()); -#else - break; -#endif case QPlatformIntegration::StartDragTime: case QPlatformIntegration::StartDragDistance: case QPlatformIntegration::KeyboardInputInterval: From df7a65afdaef4a402bbc2c7af27688678856887d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 4 Jan 2017 10:27:02 +0100 Subject: [PATCH 04/70] Fix license header of QInputControl The license headers here were accidentally copied from Qt 5.6, since the files were targeted for that branch originally. This updates them to the proper LGPLv3 + GPLv2 + commercial. Change-Id: I0623bdbf8fd4475405500b2687ef8dce2f1dbb6b Reviewed-by: Simon Hausmann --- src/gui/text/qinputcontrol.cpp | 30 ++++++++++++++++++------------ src/gui/text/qinputcontrol_p.h | 30 ++++++++++++++++++------------ 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp index c2c198866a2..af21ee86ee2 100644 --- a/src/gui/text/qinputcontrol.cpp +++ b/src/gui/text/qinputcontrol.cpp @@ -5,27 +5,33 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h index 3b46067ba9f..e5709b5e54c 100644 --- a/src/gui/text/qinputcontrol_p.h +++ b/src/gui/text/qinputcontrol_p.h @@ -5,27 +5,33 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** From 40827457a7883bf2465b5365c9e95f38a59404d5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Jan 2017 10:22:32 -0800 Subject: [PATCH 05/70] QMacCocoaViewContainer: Fix typos, wording in documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also removes reference to Carbon and the old dual backend. Change-Id: I01292caa7efcbe85526cd7602ec8ac678fd78eab Reviewed-by: Tor Arne Vestbø Reviewed-by: Timur Pocheptsov --- .../widgets/qmaccocoaviewcontainer_mac.mm | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index b4f2b8959ee..8e565ecfe08 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -56,27 +56,21 @@ \inmodule QtWidgets While Qt offers a lot of classes for writing your application, Apple's - Cocoa framework offers lots of functionality that is not currently in Qt or - may never end up in Qt. Using QMacCocoaViewContainer, it is possible to put an - arbitrary NSView-derived class from Cocoa and put it in a Qt hierarchy. - Depending on how comfortable you are with using objective-C, you can use - QMacCocoaViewContainer directly, or subclass it to wrap further functionality - of the underlying NSView. + Cocoa frameworks offer functionality that is not currently available (or + may never end up) in Qt. Using QMacCocoaViewContainer, it is possible to take an + arbitrary NSView-derived class from Cocoa and put it in a Qt widgets hierarchy. + Depending on the level of integration you need, you can use QMacCocoaViewContainer + directly or subclass it to wrap more functionality of the underlying NSView. - QMacCocoaViewContainer works regardless if Qt is built against Carbon or - Cocoa. However, QCocoaContainerView requires \macos 10.5 or better to be - used with Carbon. + It should be also noted that, at the Cocoa level, there is a difference + between top-level windows and views (widgets that are inside a window). + For this reason, make sure that the NSView that you are wrapping doesn't + end up as a top-level window. The best way to ensure this is to make sure + QMacCocoaViewContainer's parent widget is not null. - It should be also noted that at the low level on \macos, there is a - difference between windows (top-levels) and view (widgets that are inside a - window). For this reason, make sure that the NSView that you are wrapping - doesn't end up as a top-level. The best way to ensure this is to make sure - you always have a parent and not set the parent to 0. - - If you are using QMacCocoaViewContainer as a sub-class and are mixing and - matching objective-C with C++ (a.k.a. objective-C++). It is probably - simpler to have your file end with \tt{.mm} than \tt{.cpp}. Most Apple tools will - correctly identify the source as objective-C++. + If you are using QMacCocoaViewContainer as a subclass and are accessing Cocoa API, + it is probably simpler to have your file end with \tt{.mm} instead of \tt{.cpp}. + Most Apple tools will correctly identify the source as Objective-C++. QMacCocoaViewContainer requires knowledge of how Cocoa works, especially in regard to its reference counting (retain/release) nature. It is noted in @@ -85,7 +79,8 @@ pool. If this is done outside of a running event loop, it is up to the developer to provide the autorelease pool. - The following is a snippet of subclassing QMacCocoaViewContainer to wrap a NSSearchField. + The following is a snippet showing how to subclass QMacCocoaViewContainer + to wrap an NSSearchField. \snippet macmainwindow.mm 0 */ From aa8fb3608952ab9f344e2b6beb7e083908c8d905 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Jan 2017 11:39:35 -0800 Subject: [PATCH 06/70] QMacNativeWidget: Remove Carbon reference from documentation Change-Id: Ie1f1064a98f202194cad98aa3fa106e87eba7f39 Reviewed-by: Timur Pocheptsov --- src/widgets/widgets/qmacnativewidget_mac.mm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 936bd35187e..9ad8aa13050 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -65,15 +65,11 @@ but it cannot be shown on its own. It needs to be put into a window when it is created or later through a native call. - QMacNativeWidget works for either Carbon or Cocoa depending on how Qt was configured. If Qt is - using Carbon, QMacNativeWidget will embed into Carbon hierarchies. If Qt is - using Cocoa, QMacNativeWidget embeds into Cocoa hierarchies. - - Here is an example of putting a QPushButton into a NSWindow: + Here is an example showing how to put a QPushButton into a NSWindow: \snippet qmacnativewidget/main.mm 0 - Note that QMacNativeWidget requires knowledge of Carbon or Cocoa. All it + Note that QMacNativeWidget requires knowledge of Cocoa. All it does is get the Qt hierarchy into a window not owned by Qt. It is then up to the programmer to ensure it is placed correctly in the window and responds correctly to events. From dd52fd0024600d3beffc82d6da02b4239a62d725 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 17 Jan 2017 17:05:00 +0100 Subject: [PATCH 07/70] Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling Very large 1080p TVs or any display which is running at an abnormally low resolution can have a DPI lower than 48, which means that qRound(dpi/96) will result in a 0 pixel density, causing critical issues for applications using Qt::AA_EnableHighDpiScaling. Make sure that we always have a pixel density of at least 1 to allow applications not having to worry about such displays. Task-number: QTBUG-56140 Change-Id: I1dafbf7794a99ae6f872984c0337d8ff0d1fc1c0 Reviewed-by: Shawn Rutledge Reviewed-by: Friedemann Kleint --- src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp | 2 +- src/plugins/platforms/windows/qwindowsscreen.cpp | 2 +- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 3e1e93f1e4f..863a115b741 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -226,7 +226,7 @@ QDpi QEglFSDeviceIntegration::logicalDpi() const qreal QEglFSDeviceIntegration::pixelDensity() const { - return qRound(logicalDpi().first / qreal(100)); + return qMax(1, qRound(logicalDpi().first / qreal(100))); } Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 7a885b462ea..c70323c06f5 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -265,7 +265,7 @@ qreal QWindowsScreen::pixelDensity() const // the pixel density since it is reflects the Windows UI scaling. // High DPI auto scaling should be disabled when the user chooses // small fonts on a High DPI monitor, resulting in lower logical DPI. - return qRound(logicalDpi().first / 96); + return qMax(1, qRound(logicalDpi().first / 96)); } /*! diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index f87ae9fd243..2a4b6c8907b 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -647,7 +647,7 @@ QDpi QWinRTScreen::logicalDpi() const qreal QWinRTScreen::pixelDensity() const { Q_D(const QWinRTScreen); - return qRound(d->logicalDpi / 96); + return qMax(1, qRound(d->logicalDpi / 96)); } qreal QWinRTScreen::scaleFactor() const diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index a9675935f49..d8facdbb842 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -631,7 +631,7 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); - m_pixelDensity = qRound(dpi/96); + m_pixelDensity = qMax(1, qRound(dpi/96)); m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); From acacca859c3416e525599c4162292dd2a5e78fb7 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 22 Jan 2017 00:18:58 +0100 Subject: [PATCH 08/70] Doc: update QStringList doc with missing QRegularExpression reference The documentation of QStringList is missing some mention of QRegularExpression as well as still using QRegExp in some sample code. This patch fixes that. Change-Id: I4a7c9fe8e5ae7c73497192bb71d1fa66ee864bd2 Reviewed-by: Sze Howe Koh --- src/corelib/doc/snippets/qstringlist/main.cpp | 2 +- src/corelib/tools/qstringlist.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index 7e7d55ca301..4d9c0157471 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -97,7 +97,7 @@ Widget::Widget(QWidget *parent) //! [6] //! [7] - QStringList monospacedFonts = fonts.filter(QRegExp("Courier|Fixed")); + QStringList monospacedFonts = fonts.filter(QRegularExpression("Courier|Fixed")); //! [7] //! [8] diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index a0b65ea5549..88ceae20b94 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -143,8 +143,8 @@ QT_BEGIN_NAMESPACE \snippet qstringlist/main.cpp 6 - The argument to split can be a single character, a string, or a - QRegExp. + The argument to split can be a single character, a string, a + QRegularExpression or a (deprecated) QRegExp. In addition, the \l {QStringList::operator+()}{operator+()} function allows you to concatenate two string lists into one. To From 00bbb4d27301a566f004880d68d3be8659620506 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 00:51:19 +0100 Subject: [PATCH 09/70] Example: migrate network-chat to use QRegularExpression Update the network-chat example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: Idcd3dc5b3e9b520b2eeef9565d50195cc8dffd06 Reviewed-by: Sze Howe Koh --- examples/network/network-chat/peermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index b056d5ed1f9..4e2ea3e6f39 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -68,7 +68,7 @@ PeerManager::PeerManager(Client *client) QStringList environment = QProcess::systemEnvironment(); foreach (QString string, envVariables) { - int index = environment.indexOf(QRegExp(string)); + int index = environment.indexOf(QRegularExpression(string)); if (index != -1) { QStringList stringList = environment.at(index).split('='); if (stringList.size() == 2) { From cbd7dea83ed5d1f8876759e44d589b0e4c90c5f3 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 22 Jan 2017 00:08:16 +0100 Subject: [PATCH 10/70] Doc: updated QString::fromRawData documentation to QRegularExpression QString::fromRawData code sample still shows the use of QRegExp. This patch updates it for QRegularExpression and cleans the code. Change-Id: Iff0f736cdbdd7d35c65fde1496ce9f838a8f5c6d Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/qstring/main.cpp | 4 ++-- src/corelib/tools/qstring.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 5871026f95a..41ee5a9cef1 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -380,14 +380,14 @@ void Widget::fillFunction() void Widget::fromRawDataFunction() { //! [22] - QRegExp pattern; + QRegularExpression pattern("\u00A4"); static const QChar unicode[] = { 0x005A, 0x007F, 0x00A4, 0x0060, 0x1009, 0x0020, 0x0020}; int size = sizeof(unicode) / sizeof(QChar); QString str = QString::fromRawData(unicode, size); - if (str.contains(QRegExp(pattern))) { + if (str.contains(pattern) { // ... //! [22] //! [23] } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 8888eced875..9a3c05ac85e 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -8144,7 +8144,7 @@ bool QString::isRightToLeft() const to create a deep copy of the data, ensuring that the raw data isn't modified. - Here's an example of how we can use a QRegExp on raw data in + Here's an example of how we can use a QRegularExpression on raw data in memory without requiring to copy the data into a QString: \snippet qstring/main.cpp 22 From 59780d132aa114f8b7edfb17a24b91d09e38236d Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Mon, 23 Jan 2017 15:25:38 -0800 Subject: [PATCH 11/70] Cocoa: fix crash regression in qt_mac_create_nsimage() The regression was introduced in d8857f21ac264. The original change was meant to fix support for SVG icons, but failed to take into account a valid QIcon with no sizes, but which is also unable to create a pixmap for the requested size. Task-number: QTBUG-58344 Change-Id: I7ac1dbfaf6e3dab8581fe4b33c814e2517fcdba8 Reviewed-by: Andy Shaw --- src/gui/painting/qcoregraphics.mm | 2 ++ tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index 803328c10ff..3753fa4e885 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -157,6 +157,8 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize) availableSizes << QSize(defaultSize, defaultSize); foreach (QSize size, availableSizes) { QPixmap pm = icon.pixmap(size); + if (pm.isNull()) + continue; QImage image = pm.toImage(); CGImageRef cgImage = qt_mac_toCGImage(image); NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f19d7619cc3..e3af0135e76 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -136,6 +136,7 @@ private slots: void QTBUG_57404_existingMenuItemException(); #endif void taskQTBUG55966_subMenuRemoved(); + void QTBUG_58344_invalidIcon(); void platformMenu(); @@ -1594,5 +1595,14 @@ void tst_QMenuBar::taskQTBUG55966_subMenuRemoved() QTest::qWait(500); } +void tst_QMenuBar::QTBUG_58344_invalidIcon() +{ + QMenuBar menuBar; + QMenu menu("menu"); + menu.addAction(QIcon("crash.png"), "crash"); + menuBar.addMenu(&menu); + // No crash, all fine. +} + QTEST_MAIN(tst_QMenuBar) #include "tst_qmenubar.moc" From 74819c4ed95af98d3caf5144f44123dee0149e45 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 23:27:17 +0100 Subject: [PATCH 12/70] Tutorial: migrate addressbook tutorial to use QRegularExpression Update the addressbook tutorial to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: Ibea9252ab8fe1d12e6fc862fa70229ca6efe0804 Reviewed-by: Sze Howe Koh --- examples/widgets/tutorials/addressbook/part7/addressbook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp index 8fabcf87582..e946c873e30 100644 --- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp @@ -402,7 +402,7 @@ void AddressBook::exportAsVCard() int index = name.indexOf(" "); if (index != -1) { - nameList = name.split(QRegExp("\\s+"), QString::SkipEmptyParts); + nameList = name.split(QRegularExpression("\\s+"), QString::SkipEmptyParts); firstName = nameList.first(); lastName = nameList.last(); } else { From b0649df7d69a3db1538c62c624eda42a6326110b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 23 Jan 2017 09:57:46 +0100 Subject: [PATCH 13/70] Fix MIPS32 processor detection Gcc defines neither _MIPS_ARCH_MIPS32 nor __mips32 on MIPS32 architectures, instead __mips is defined to 32. This fix exposed bit-rot in qdrawhelper where qt_memfill32 was set as a function pointer despite not being one since Qt4. Change-Id: I87461823e54fa3166223ebf97175fd05d2f2fd16 Reviewed-by: Thiago Macieira --- src/corelib/global/qprocessordetection.h | 6 +++--- src/gui/painting/qdrawhelper.cpp | 14 +------------- src/gui/painting/qdrawhelper_mips_dsp.cpp | 5 +++++ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 566d76d3d22..55fcb370936 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -231,9 +231,6 @@ # if defined(_MIPS_ARCH_MIPS2) || (defined(__mips) && __mips - 0 >= 2) # define Q_PROCESSOR_MIPS_II # endif -# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32) -# define Q_PROCESSOR_MIPS_32 -# endif # if defined(_MIPS_ARCH_MIPS3) || (defined(__mips) && __mips - 0 >= 3) # define Q_PROCESSOR_MIPS_III # endif @@ -243,6 +240,9 @@ # if defined(_MIPS_ARCH_MIPS5) || (defined(__mips) && __mips - 0 >= 5) # define Q_PROCESSOR_MIPS_V # endif +# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32) || (defined(__mips) && __mips - 0 >= 32) +# define Q_PROCESSOR_MIPS_32 +# endif # if defined(_MIPS_ARCH_MIPS64) || defined(__mips64) # define Q_PROCESSOR_MIPS_64 # define Q_PROCESSOR_WORDSIZE 8 diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index adc28f07d3f..298304c4ef3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6030,18 +6030,10 @@ void qt_memfill16(quint16 *dest, quint16 color, int count) qt_memfill_template(dest, color, count); } #endif -#if !defined(__SSE2__) && !defined(__ARM_NEON__) -# ifdef QT_COMPILER_SUPPORTS_MIPS_DSP -extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int); -# endif - +#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__mips_dsp) void qt_memfill32(quint32 *dest, quint32 color, int count) { -# ifdef QT_COMPILER_SUPPORTS_MIPS_DSP - qt_memfill32_asm_mips_dsp(dest, color, count); -# else qt_memfill_template(dest, color, count); -# endif } #endif @@ -6233,10 +6225,6 @@ static void qInitDrawhelperFunctions() #endif -#if defined(Q_PROCESSOR_MIPS_32) && defined(QT_COMPILER_SUPPORTS_MIPS_DSP) - qt_memfill32 = qt_memfill32_asm_mips_dsp; -#endif // Q_PROCESSOR_MIPS_32 - #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) { // Composition functions are all DSP r1 diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index b72ca3da3d0..783e4812966 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -43,6 +43,11 @@ QT_BEGIN_NAMESPACE +void qt_memfill32(quint32 *dest, quint32 color, int count) +{ + qt_memfill32_asm_mips_dsp(dest, color, count); +} + void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, From fc893d949c2d8924ea42b10b6b1dce118c3c985c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 24 Jan 2017 13:02:21 +0100 Subject: [PATCH 14/70] model-view-programming.qdoc: Add missing list/endlist Fixes qdoc-warnings: qtbase/src/widgets/doc/src/model-view-programming.qdoc:2076: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2077: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2078: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2079: warning: Command '\li' outside of '\list' and '\table' Amends change 7adfe7494bb4a2c1d3a036fe9dfd946bc00c5d49. Change-Id: Ifa1121ba743c17d7223058e780ad03211565e3ff Reviewed-by: David Faure --- src/widgets/doc/src/model-view-programming.qdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc index 84819e8c1ab..f6b7c80656f 100644 --- a/src/widgets/doc/src/model-view-programming.qdoc +++ b/src/widgets/doc/src/model-view-programming.qdoc @@ -2073,10 +2073,12 @@ model's structure, perhaps involving internal reorganization, sorting of data or any other structural change, it is necessary to perform the following sequence: + \list \li Emit the \l{QAbstractItemModel::layoutAboutToBeChanged()}{layoutAboutToBeChanged()} signal \li Update internal data which represents the structure of the model. \li Update persistent indexes using \l{QAbstractItemModel::changePersistentIndexList()}{changePersistentIndexList()} \li Emit the \l{QAbstractItemModel::layoutChanged()}{layoutChanged()} signal. + \endlist This sequence can be used for any structural update in lieu of the more high-level and convenient protected methods. For example, if a model of From 1b1686d194731d940a40112635647536ac8ee676 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 22 Nov 2016 15:35:24 +0100 Subject: [PATCH 15/70] Fix mouse extra button mapping on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously extra mouse buttons apart from left, right and middle buttons, were mapped incorrectly with an offset of -1. This resulted in the first extra button being recognized as the middle button, the second extra button as the first extra button, etc. Fix consists in using a binary shift with proper offset to create the corresponding Qt::MouseButton value. [ChangeLog][macOS] Fixed extra mouse buttons to be mapped to correct Qt::MouseButton values. Change-Id: I9e6084586cd4737a172b7706a805211f0edff749 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 01fbb7bad20..3ab6b641fa9 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -281,16 +281,8 @@ NSRect qt_mac_flipRect(const QRect &rect) Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) { - if (buttonNum == 0) - return Qt::LeftButton; - if (buttonNum == 1) - return Qt::RightButton; - if (buttonNum == 2) - return Qt::MiddleButton; - if (buttonNum >= 3 && buttonNum <= 31) { // handle XButton1 and higher via logical shift - return Qt::MouseButton(uint(Qt::MiddleButton) << (buttonNum - 3)); - } - // else error: buttonNum too high, or negative + if (buttonNum >= 0 && buttonNum <= 31) + return Qt::MouseButton(1 << buttonNum); return Qt::NoButton; } From 91e5c7e1da6d2a939b7a34cd9c166e76192bf53b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 21 Nov 2016 15:32:04 +0100 Subject: [PATCH 16/70] Inform user that a non-prefix build can't be used on other machines This implies that using tools like windeployqt and macdeployqt will not generate a working standalone application. Change-Id: I002cf6e527e479ccbee2f18df8766648196d6232 Reviewed-by: Andy Shaw Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_configure.prf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 4056b4d05ab..1f7fb1b2923 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1874,6 +1874,7 @@ pfx = $$[QT_INSTALL_PREFIX] equals(pfx, $$[QT_INSTALL_PREFIX/get]) { logn("Once everything is built, Qt is installed.") logn("You should NOT run '$$QMAKE_MAKE_NAME install'.") + logn("Note that this build cannot be deployed to other machines or devices.") } else { logn("Once everything is built, you must run '$$QMAKE_MAKE_NAME install'.") logn("Qt will be installed into '$$system_path($$pfx)'.") From 6a3e728e9b60f0201b0319b4b8de52ac5e282091 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 23 Jan 2017 22:12:59 +0100 Subject: [PATCH 17/70] Fix possible loss of data warning warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data while compiling class template member function 'QVarLengthArray::QVarLengthArray(std::initializer_list)' Change-Id: I36f5ef65ec1f511eac7f3ad1a4717d18f7dc9ce4 Reviewed-by: Timur Pocheptsov --- src/corelib/tools/qvarlengtharray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 1530299303f..bb5ae78d2b3 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -77,7 +77,7 @@ public: : a(Prealloc), s(0), ptr(reinterpret_cast(array)) { if (args.size()) - append(args.begin(), args.size()); + append(args.begin(), int(args.size())); } #endif From e0f0850cd48b92ae3beb33b65a3ac936d8f38b08 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 23 Jan 2017 16:07:36 +0100 Subject: [PATCH 18/70] Use context as glyph cache key in GL paint engine Switch from ctx->shareGroup() to ctx. The original intention to use the same cache instance for sharing GL contexts is reasonable, but can only work when there are only shareable resources involved. The FBO used by QOpenGLTextureGlyphCache is not one of these. Text rendering in Qt Quick already uses the same approach and uses per-context glyph caches. Change-Id: Ie7e521769f28b4902ca714eb029acfbf52814309 Task-number: QTBUG-58276 Reviewed-by: Joni Poikelin Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/opengl/qopenglpaintengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 5c05a05d809..90652a5ab85 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1664,7 +1664,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly QOpenGL2PaintEngineState *s = q->state(); - void *cacheKey = ctx->shareGroup(); + void *cacheKey = ctx; // use context, not the shareGroup() -> the GL glyph cache uses FBOs which may not be shareable bool recreateVertexArrays = false; QTransform glyphCacheTransform; From 9170cf9f1d57b6c31d58511b04759942d640b57c Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 22 Jan 2017 17:33:45 +0100 Subject: [PATCH 19/70] Remove use of deprecated QRegExp from QLibraryInfo This patch replaces QRegExp by QString search and replace. Change-Id: I11165afa45f8f9a856e6fb9b64929e4bdacb913d Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 0de8b509002..03ee0730db0 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -530,14 +530,24 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) } #endif - // expand environment variables in the form $(ENVVAR) - int rep; - QRegExp reg_var(QLatin1String("\\$\\(.*\\)")); - reg_var.setMinimal(true); - while((rep = reg_var.indexIn(ret)) != -1) { - ret.replace(rep, reg_var.matchedLength(), - QString::fromLocal8Bit(qgetenv(ret.midRef(rep + 2, - reg_var.matchedLength() - 3).toLatin1().constData()).constData())); + int startIndex = 0; + forever { + startIndex = ret.indexOf(QLatin1Char('$'), startIndex); + if (startIndex < 0) + break; + if (ret.length() < startIndex + 3) + break; + if (ret.at(startIndex + 1) != QLatin1Char('(')) { + startIndex++; + continue; + } + int endIndex = ret.indexOf(QLatin1Char(')'), startIndex + 2); + if (endIndex < 0) + break; + QStringRef envVarName = ret.midRef(startIndex + 2, endIndex - startIndex - 2); + QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData())); + ret.replace(startIndex, endIndex - startIndex + 1, value); + startIndex += value.length(); } config->endGroup(); From 992bffdba587a1885e844570a0d04b15cda9fa3f Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 23:39:52 +0100 Subject: [PATCH 20/70] Doc: Fixed old text still mentioning QRegExp The example has already been ported to QRegularExpression however part of the documentation still referred to the QRegExp class. This patch updates the documentation to match the new version of the code. Change-Id: Id433d0b28deae0c4f702c0c54d2704174f8c7689 Reviewed-by: Sze Howe Koh --- examples/widgets/doc/src/icons.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/widgets/doc/src/icons.qdoc b/examples/widgets/doc/src/icons.qdoc index d3bf508f2c8..42d823975b3 100644 --- a/examples/widgets/doc/src/icons.qdoc +++ b/examples/widgets/doc/src/icons.qdoc @@ -741,8 +741,8 @@ whitespace and one or several digits again. The first digits of the regular expression are captured using - parentheses. This enables us to use the QRegExp::cap() or - QRegExp::capturedTexts() functions to extract the matched + parentheses. This enables us to use the QRegularExpressionMatch::captured() + or QRegularExpressionMatch::capturedTexts() functions to extract the matched characters. If the first and second numbers of the spin box value differ (e.g., "16 x 24"), we use the first number. From bb42a6741f7af19c8c8a1fa67c827b06000ec28c Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 01:14:34 +0100 Subject: [PATCH 21/70] Example: migrate licensewizard example to use QRegularExpression Update the licensewizard example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: Ib6e0ee9ec802e83540b1c37846b99378395fe0ec Reviewed-by: Sze Howe Koh --- examples/widgets/dialogs/licensewizard/licensewizard.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.cpp b/examples/widgets/dialogs/licensewizard/licensewizard.cpp index e145a18e2c4..6dbb894ad8d 100644 --- a/examples/widgets/dialogs/licensewizard/licensewizard.cpp +++ b/examples/widgets/dialogs/licensewizard/licensewizard.cpp @@ -54,6 +54,8 @@ #include "licensewizard.h" +QString emailRegExp = QStringLiteral(".+@.+"); + //! [0] //! [1] //! [2] LicenseWizard::LicenseWizard(QWidget *parent) : QWizard(parent) @@ -189,7 +191,7 @@ EvaluatePage::EvaluatePage(QWidget *parent) emailLabel = new QLabel(tr("&Email address:")); emailLineEdit = new QLineEdit; - emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this)); + emailLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(emailRegExp), this)); emailLabel->setBuddy(emailLineEdit); //! [21] @@ -264,7 +266,7 @@ DetailsPage::DetailsPage(QWidget *parent) emailLabel = new QLabel(tr("&Email address:")); emailLineEdit = new QLineEdit; - emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this)); + emailLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(emailRegExp), this)); emailLabel->setBuddy(emailLineEdit); postalLabel = new QLabel(tr("&Postal address:")); From 0a96d8fb38b85134a8879404fcd05b899dbf59e5 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 01:06:43 +0100 Subject: [PATCH 22/70] Example: migrate the classwizard example to use QRegularExpression Update the classwizard example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: I125664549e249c4156f8c664fac7648f1c41f9d5 Reviewed-by: Sze Howe Koh --- examples/widgets/dialogs/classwizard/classwizard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/widgets/dialogs/classwizard/classwizard.cpp b/examples/widgets/dialogs/classwizard/classwizard.cpp index d6c7c7a546b..3eab2f5fb2d 100644 --- a/examples/widgets/dialogs/classwizard/classwizard.cpp +++ b/examples/widgets/dialogs/classwizard/classwizard.cpp @@ -363,9 +363,10 @@ void CodeStylePage::initializePage() baseIncludeLabel->setEnabled(!baseClass.isEmpty()); baseIncludeLineEdit->setEnabled(!baseClass.isEmpty()); + QRegularExpression rx("Q[A-Z].*"); if (baseClass.isEmpty()) { baseIncludeLineEdit->clear(); - } else if (QRegExp("Q[A-Z].*").exactMatch(baseClass)) { + } else if (rx.match(baseClass).hasMatch()) { baseIncludeLineEdit->setText('<' + baseClass + '>'); } else { baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\""); From 64e977cfac2fbe93fc234d3e134d126591d4c821 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 21 Jan 2017 00:29:28 +0900 Subject: [PATCH 23/70] Fix build without features.temporaryfile Change-Id: I3f26f122a20aa8e59baaf3f33b89cc776865ff8b Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings.cpp | 4 ++-- .../compose/generator/qtablegenerator.cpp | 9 ++++++++- src/testlib/qtestcase.cpp | 2 ++ src/testlib/qtestcase.h | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8c67d97afa4..e12da68671d 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1460,7 +1460,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo) ensureAllSectionsParsed(confFile); ParsedSettingsMap mergedKeys = confFile->mergedKeyMap(); -#ifndef QT_BOOTSTRAPPED +#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile) QSaveFile sf(confFile->name); #else QFile sf(confFile->name); @@ -1488,7 +1488,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo) ok = writeFunc(sf, tempOriginalKeys); } -#ifndef QT_BOOTSTRAPPED +#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile) if (ok) ok = sf.commit(); #endif diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index bd259924579..ca9f7af127e 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -194,8 +194,11 @@ static QVector loadCache(const QComposeCacheFileHeader &co static bool saveCache(const QComposeCacheFileHeader &info, const QVector &vec) { const QString filePath = getCacheFilePath(); +#if QT_CONFIG(temporaryfile) QSaveFile outputFile(filePath); - +#else + QFile outputFile(filePath); +#endif if (!outputFile.open(QIODevice::WriteOnly)) return false; const char *data = reinterpret_cast(&info); @@ -207,7 +210,11 @@ static bool saveCache(const QComposeCacheFileHeader &info, const QVector QTest::qExtractTestData(const QString &dirName) return result; } +#endif // QT_CONFIG(temporaryfile) /*! \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 4c226830e94..57e04866864 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -283,7 +283,9 @@ namespace QTest Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); #endif +#if QT_CONFIG(temporaryfile) Q_TESTLIB_EXPORT QSharedPointer qExtractTestData(const QString &dirName); +#endif Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = Q_NULLPTR, int line = 0, const char* builddir = Q_NULLPTR); Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = Q_NULLPTR, int line = 0, const char* builddir = Q_NULLPTR); From 447ca99191a8659c3b4aa57847f674a49a18f41c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 20 Jan 2017 14:41:46 +0100 Subject: [PATCH 24/70] Fix printsupport compilation with -no-feature... Change-Id: I881e736aefd4068965edb2a57f4436ee43d2bb93 Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 8 +++++++- src/printsupport/kernel/qplatformprintdevice.cpp | 8 ++++++++ src/printsupport/widgets/qcupsjobwidget_p.h | 2 +- src/printsupport/widgets/widgets.pri | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 439f2dbdd83..a4855212fd6 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -31,6 +31,12 @@ "condition": "libs.cups", "output": [ "privateFeature", "feature" ] }, + "cupsjobwidget": { + "label": "CUPS job control widget", + "section": "Widgets", + "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox", + "output": [ "privateFeature", "feature" ] + }, "printer": { "label": "QPrinter", "purpose": "Provides a printer backend of QPainter.", @@ -49,7 +55,7 @@ "label": "QPrintDialog", "purpose": "Provides a dialog widget for specifying printer configuration.", "section": "Dialogs", - "condition": "features.printer && features.combobox && features.buttongroup && features.spinbox && features.treeview && features.tabwidget", + "condition": "features.printer && features.combobox && features.buttongroup && features.spinbox && features.treeview && features.tabwidget && features.datetimeedit", "output": [ "publicFeature", "feature" ] }, "printpreviewdialog": { diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index eabd7e72957..cbb67aefdc2 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -302,7 +302,11 @@ QPrint::InputSlot QPlatformPrintDevice::defaultInputSlot() const { QPrint::InputSlot input; input.key = QByteArrayLiteral("Auto"); +#if QT_CONFIG(printdialog) input.name = QPrintDialog::tr("Automatic"); +#else + input.name = QString::fromLatin1("Automatic"); +#endif input.id = QPrint::Auto; return input; } @@ -322,7 +326,11 @@ QPrint::OutputBin QPlatformPrintDevice::defaultOutputBin() const { QPrint::OutputBin output; output.key = QByteArrayLiteral("Auto"); +#if QT_CONFIG(printdialog) output.name = QPrintDialog::tr("Automatic"); +#else + output.name = QString::fromLatin1("Automatic"); +#endif output.id = QPrint::AutoOutputBin; return output; } diff --git a/src/printsupport/widgets/qcupsjobwidget_p.h b/src/printsupport/widgets/qcupsjobwidget_p.h index 5320818f303..288aeac1aa5 100644 --- a/src/printsupport/widgets/qcupsjobwidget_p.h +++ b/src/printsupport/widgets/qcupsjobwidget_p.h @@ -56,7 +56,7 @@ #include #include -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS) +#if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS) && !defined(QT_NO_DATETIMEEDIT) #include QT_BEGIN_NAMESPACE diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri index 8a98da17180..505983778e1 100644 --- a/src/printsupport/widgets/widgets.pri +++ b/src/printsupport/widgets/widgets.pri @@ -1,11 +1,11 @@ HEADERS += widgets/qprintpreviewwidget.h SOURCES += widgets/qprintpreviewwidget.cpp -unix:!darwin:qtConfig(cups) { +unix:!darwin:qtConfig(cups):qtConfig(cupsjobwidget) { HEADERS += widgets/qcupsjobwidget_p.h SOURCES += widgets/qcupsjobwidget.cpp FORMS += widgets/qcupsjobwidget.ui - INCLUDEPATH += $$PWD } +INCLUDEPATH += $$PWD From d82e23e775c74f9993f9b8599c928e56abde6808 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 20 Jan 2017 14:41:46 +0100 Subject: [PATCH 25/70] Make sure features are defined before testing them Include the file defining the feature before testing whether the feature exists. Also use the new feature macro to make sure this bug doesn't happen again. Change-Id: I204836fee59b143a7ce7d256a7aed223c4d0ceb1 Reviewed-by: Lars Knoll --- src/widgets/dialogs/qfontdialog.cpp | 8 ++++---- src/widgets/itemviews/qcolumnview.cpp | 8 ++++---- src/widgets/styles/qstylesheetstyle.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 3a833e85c0f..955e93a26fa 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -38,10 +38,10 @@ ****************************************************************************/ #include "qwindowdefs.h" - -#ifndef QT_NO_FONTDIALOG - #include "qfontdialog.h" + +#if QT_CONFIG(fontdialog) + #include "qfontdialog_p.h" #include @@ -1051,4 +1051,4 @@ QT_END_NAMESPACE #include "qfontdialog.moc" #include "moc_qfontdialog.cpp" -#endif // QT_NO_FONTDIALOG +#endif // QT_CONFIG(fontdialog) diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 6c7c914bc02..ea9bbb0fb91 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -38,10 +38,10 @@ ****************************************************************************/ #include - -#ifndef QT_NO_COLUMNVIEW - #include "qcolumnview.h" + +#if QT_CONFIG(columnview) + #include "qcolumnview_p.h" #include "qcolumnviewgrip_p.h" @@ -1170,4 +1170,4 @@ QT_END_NAMESPACE #include "moc_qcolumnview.cpp" -#endif // QT_NO_COLUMNVIEW +#endif // QT_CONFIG(columnview) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 68ee8c22d33..d4f15b13152 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -38,10 +38,10 @@ ****************************************************************************/ #include - -#ifndef QT_NO_STYLE_STYLESHEET - #include "qstylesheetstyle_p.h" + +#if QT_CONFIG(style_stylesheet) + #include "private/qcssutil_p.h" #include #include @@ -6024,4 +6024,4 @@ QT_END_NAMESPACE #include "moc_qstylesheetstyle_p.cpp" -#endif // QT_NO_STYLE_STYLESHEET +#endif // QT_CONFIG(style_stylesheet) From 7cafa85a49d1b2fcafb21d647c94f01a9351a9b9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 15:51:05 +0100 Subject: [PATCH 26/70] Remove reimplementations of removed features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid the "marked ‘override’, but does not override" compile error. Change-Id: I4b125f1951614045781f3059fbc5cb65dd26775c Reviewed-by: Lars Knoll --- src/widgets/widgets/qabstractspinbox.cpp | 6 ++---- src/widgets/widgets/qabstractspinbox.h | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 494e30c7c73..8ccad5c35df 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1246,11 +1246,9 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event) \reimp */ +#if QT_CONFIG(contextmenu) void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) { -#ifdef QT_NO_CONTEXTMENU - Q_UNUSED(event); -#else Q_D(QAbstractSpinBox); QPointer menu = d->edit->createStandardContextMenu(); @@ -1286,8 +1284,8 @@ void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) } } event->accept(); -#endif // QT_NO_CONTEXTMENU } +#endif // QT_CONFIG(contextmenu) /*! \reimp diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index ac46894a272..b60178b94c1 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -142,7 +142,9 @@ protected: #endif void focusInEvent(QFocusEvent *event) override; void focusOutEvent(QFocusEvent *event) override; +#if QT_CONFIG(contextmenu) void contextMenuEvent(QContextMenuEvent *event) override; +#endif void changeEvent(QEvent *event) override; void closeEvent(QCloseEvent *event) override; void hideEvent(QHideEvent *event) override; From 27792ea09897e41d52a9842af89b8d48cbac08ac Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 16:11:56 +0100 Subject: [PATCH 27/70] Fix style compilation with -no-feature-... Change-Id: Ic7fadf0622f98d339322a4a1d4d5c36908f4f7f6 Reviewed-by: Lars Knoll --- src/widgets/styles/qcommonstyle.cpp | 2 ++ src/widgets/styles/qfusionstyle.cpp | 17 ++++++++++++++++- src/widgets/styles/qpixmapstyle.cpp | 19 +++++++++++++++---- src/widgets/styles/qstylesheetstyle.cpp | 7 ++++++- src/widgets/styles/qwindowsstyle.cpp | 2 ++ 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 690c8111401..7971bd0b8bf 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5224,9 +5224,11 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_Splitter_OpaqueResize: ret = true; break; +#if QT_CONFIG(itemviews) case SH_ItemView_ScrollMode: ret = QAbstractItemView::ScrollPerItem; break; +#endif default: ret = 0; break; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index c2b4ef382b6..898a14d7fb9 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1097,6 +1097,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio } painter->restore(); break; +#if QT_CONFIG(toolbar) case CE_ToolBar: if (const QStyleOptionToolBar *toolBar = qstyleoption_cast(option)) { // Reserve the beveled appearance only for mainwindow toolbars @@ -1217,6 +1218,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->setPen(oldPen); } break; +#endif // QT_CONFIG(toolbar) case CE_DockWidgetTitle: painter->save(); if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast(option)) { @@ -1550,7 +1552,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio bool ignoreCheckMark = false; int checkcol = qMax(menuItem->maxIconWidth, 20); - if (qobject_cast(widget) || + if ( +#if QT_CONFIG(combobox) + qobject_cast(widget) || +#endif (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool())) ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate @@ -1607,8 +1612,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); QSize iconSize(smallIconSize, smallIconSize); +#if QT_CONFIG(combobox) if (const QComboBox *combo = qobject_cast(widget)) iconSize = combo->iconSize(); +#endif if (checked) pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); else @@ -3018,10 +3025,12 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption painter->setPen(oldPen); } break; +#if QT_CONFIG(dial) case CC_Dial: if (const QStyleOptionSlider *dial = qstyleoption_cast(option)) QStyleHelper::drawDial(dial, painter); break; +#endif default: QCommonStyle::drawComplexControl(control, option, painter, widget); break; @@ -3217,9 +3226,11 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti } } else if (!menuItem->icon.isNull()) { +#if QT_CONFIG(combobox) if (const QComboBox *combo = qobject_cast(widget)) { newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height())); } +#endif } newSize.setWidth(newSize.width() + 12); newSize.setWidth(qMax(newSize.width(), 120)); @@ -3252,7 +3263,9 @@ void QFusionStyle::polish(QWidget *widget) { QCommonStyle::polish(widget); if (qobject_cast(widget) +#if QT_CONFIG(combobox) || qobject_cast(widget) +#endif || qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget) @@ -3281,7 +3294,9 @@ void QFusionStyle::unpolish(QWidget *widget) { QCommonStyle::unpolish(widget); if (qobject_cast(widget) +#if QT_CONFIG(combobox) || qobject_cast(widget) +#endif || qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget) diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index ce37065fb6e..ac57adf862e 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -147,6 +147,7 @@ void QPixmapStyle::polish(QWidget *widget) if (qobject_cast(widget)) widget->installEventFilter(this); +#if QT_CONFIG(combobox) if (QComboBox *cb = qobject_cast(widget)) { widget->installEventFilter(this); // NOTE: This will break if the private API of QComboBox changes drastically @@ -177,16 +178,18 @@ void QPixmapStyle::polish(QWidget *widget) #endif } } - +#endif // QT_CONFIG(combobox) if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) widget->installEventFilter(this); if (QAbstractScrollArea *scrollArea = qobject_cast(widget)) { scrollArea->viewport()->setAutoFillBackground(false); +#if QT_CONFIG(itemviews) if (QAbstractItemView *view = qobject_cast(scrollArea)) { view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); } +#endif #if QT_CONFIG(gestures) QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture); #endif @@ -211,8 +214,11 @@ void QPixmapStyle::unpolish(QApplication *application) */ void QPixmapStyle::unpolish(QWidget *widget) { - if (qobject_cast(widget) || - qobject_cast(widget)) { + if (qobject_cast(widget) +#if QT_CONFIG(combobox) + || qobject_cast(widget) +#endif + ) { widget->removeEventFilter(this); } @@ -256,9 +262,11 @@ void QPixmapStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *o drawRadioButton(option, painter, widget); break; case PE_PanelItemViewItem: +#if QT_CONFIG(listview) if (qobject_cast(widget)) drawPanelItemViewItem(option, painter, widget); else +#endif QCommonStyle::drawPrimitive(element, option, painter, widget); break; default: @@ -532,6 +540,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event) } } +#if QT_CONFIG(combobox) if (QComboBox *comboBox = qobject_cast(watched)) { switch (event->type()) { case QEvent::MouseButtonPress: @@ -552,6 +561,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event) default: ; } } +#endif // QT_CONFIG(combobox) if (qstrcmp(watched->metaObject()->className(),"QComboBoxPrivateContainer") == 0) { if (event->type() == QEvent::Show) { @@ -701,9 +711,10 @@ void QPixmapStyle::drawLineEdit(const QStyleOption *option, QPainter *painter, const QWidget *widget) const { // Don't draw for the line edit inside a combobox +#if QT_CONFIG(combobox) if (widget && qobject_cast(widget->parentWidget())) return; - +#endif const bool enabled = option->state & State_Enabled; const bool focused = option->state & State_HasFocus; ControlDescriptor control = enabled ? (focused ? LE_Focused : LE_Enabled) : LE_Disabled; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index d4f15b13152..5a0b93474f1 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4415,14 +4415,18 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op break; case PE_IndicatorColumnViewArrow: +#if QT_CONFIG(itemviews) if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast(opt)) { bool reverse = (viewOpt->direction == Qt::RightToLeft); pseudoElement = reverse ? PseudoElement_LeftArrow : PseudoElement_RightArrow; - } else { + } else +#endif + { pseudoElement = PseudoElement_RightArrow; } break; +#if QT_CONFIG(itemviews) case PE_IndicatorBranch: if (const QStyleOptionViewItem *vopt = qstyleoption_cast(opt)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch); @@ -4437,6 +4441,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op } } return; +#endif // QT_CONFIG(itemviews) case PE_PanelTipLabel: if (!rule.hasDrawable()) diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index a8ee881a307..f9370a2cc76 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -815,6 +815,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->save(); doRestore = true; } +#if QT_CONFIG(itemviews) if (pe == PE_IndicatorViewItemCheck) { const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast(opt); p->setPen(itemViewOpt @@ -826,6 +827,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->setBrush(opt->palette.brush(QPalette::Button)); p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11); } +#endif // QT_CONFIG(itemviews) if (!(opt->state & State_Off)) { QLineF lines[7]; int i, xx, yy; From fcab7186668de71a7c0f9055fb75c98b906f5dc7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 16:37:25 +0100 Subject: [PATCH 28/70] Fix build with -no-feature-dockwidget Change-Id: Id484b54fd7191715e61ba6708247357b83159f28 Reviewed-by: Lars Knoll --- src/widgets/widgets/qmainwindowlayout.cpp | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 14d7f3d835c..9e1af16625b 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2172,7 +2172,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget) savedState.clear(); currentGapPos.clear(); pluggingWidget = 0; - currentHoveredFloat = Q_NULLPTR; +#if QT_CONFIG(dockwidget) + currentHoveredFloat = nullptr; +#endif //applying the state will make sure that the currentGap is updated correctly //and all the geometries (especially the one from the central widget) is correct layoutState.apply(false); @@ -2408,8 +2410,16 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) void QMainWindowLayout::updateGapIndicator() { #ifndef QT_NO_RUBBERBAND - if ((!widgetAnimator.animating() && !currentGapPos.isEmpty()) || currentHoveredFloat) { - QWidget *expectedParent = currentHoveredFloat ? currentHoveredFloat.data() : parentWidget(); + if ((!widgetAnimator.animating() && !currentGapPos.isEmpty()) +#if QT_CONFIG(dockwidget) + || currentHoveredFloat +#endif + ) { + QWidget *expectedParent = +#if QT_CONFIG(dockwidget) + currentHoveredFloat ? currentHoveredFloat.data() : +#endif + parentWidget(); if (!gapIndicator) { gapIndicator = new QRubberBand(QRubberBand::Rectangle, expectedParent); // For accessibility to identify this special widget. @@ -2417,7 +2427,11 @@ void QMainWindowLayout::updateGapIndicator() } else if (gapIndicator->parent() != expectedParent) { gapIndicator->setParent(expectedParent); } - gapIndicator->setGeometry(currentHoveredFloat ? currentHoveredFloat->rect() : currentGapRect); + gapIndicator->setGeometry( +#if QT_CONFIG(dockwidget) + currentHoveredFloat ? currentHoveredFloat->rect() : +#endif + currentGapRect); gapIndicator->show(); gapIndicator->raise(); } else if (gapIndicator) { @@ -2540,12 +2554,14 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) updateGapIndicator(); } +#if QT_CONFIG(dockwidget) QDockWidgetGroupWindow *QMainWindowLayout::createTabbedDockWindow() { QDockWidgetGroupWindow* f = new QDockWidgetGroupWindow(parentWidget(), Qt::Tool); new QDockWidgetGroupLayout(f); return f; } +#endif void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate) { From 6d06d4b07c5fb1b51d6d1e216a0bcd6da2dedaf2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 16:48:42 +0100 Subject: [PATCH 29/70] Fix build with -no-feature-graphicsview Change-Id: I9ae724ddf90efc9e951d475e3332083e6f8207d6 Reviewed-by: Lars Knoll --- src/widgets/graphicsview/graphicsview.pri | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/graphicsview/graphicsview.pri b/src/widgets/graphicsview/graphicsview.pri index b81f736ef42..7d102446340 100644 --- a/src/widgets/graphicsview/graphicsview.pri +++ b/src/widgets/graphicsview/graphicsview.pri @@ -1,4 +1,6 @@ # Qt graphicsview module + +qtConfig(graphicsview) { HEADERS += graphicsview/qgraphicsgridlayout.h \ graphicsview/qgraphicsitem.h \ graphicsview/qgraphicsitem_p.h \ @@ -53,3 +55,4 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \ graphicsview/qsimplex_p.cpp \ graphicsview/qgraphicsanchorlayout_p.cpp \ graphicsview/qgraphicsanchorlayout.cpp +} From eae92384b0f59a7c27edd422e5b3f26c2d8b323c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 17:38:11 +0100 Subject: [PATCH 30/70] Compile with -no-feature-itemviews Change-Id: I23506f06df35f124f5eb9fcc8426c63b407a0872 Reviewed-by: Lars Knoll --- src/widgets/configure.json | 2 +- src/widgets/itemviews/itemviews.pri | 11 ++++++++--- src/widgets/widgets/qabstractscrollarea.cpp | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 8acbffef6ad..92a57534e63 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -504,7 +504,7 @@ "label": "QCompleter", "purpose": "Provides completions based on an item model.", "section": "Utilities", - "condition": "features.proxymodel", + "condition": "features.proxymodel && features.itemviews", "output": [ "publicFeature", "feature" ] }, "fscompleter": { diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri index 245962d35fa..d78bc4b40ee 100644 --- a/src/widgets/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -1,5 +1,6 @@ # Qt gui library, itemviews +qtConfig(itemviews) { HEADERS += \ itemviews/qabstractitemview.h \ itemviews/qabstractitemview_p.h \ @@ -27,8 +28,6 @@ HEADERS += \ itemviews/qitemeditorfactory_p.h \ itemviews/qtreewidgetitemiterator.h \ itemviews/qdatawidgetmapper.h \ - itemviews/qfileiconprovider.h \ - itemviews/qfileiconprovider_p.h \ itemviews/qcolumnviewgrip_p.h \ itemviews/qcolumnview.h \ itemviews/qcolumnview_p.h \ @@ -50,8 +49,14 @@ SOURCES += \ itemviews/qitemeditorfactory.cpp \ itemviews/qtreewidgetitemiterator.cpp \ itemviews/qdatawidgetmapper.cpp \ - itemviews/qfileiconprovider.cpp \ itemviews/qcolumnview.cpp \ itemviews/qcolumnviewgrip.cpp \ itemviews/qstyleditemdelegate.cpp +} +HEADERS += \ + itemviews/qfileiconprovider.h \ + itemviews/qfileiconprovider_p.h \ + +SOURCES += \ + itemviews/qfileiconprovider.cpp diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 5b31e4467fc..35b9851cad4 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -473,6 +473,7 @@ void QAbstractScrollAreaPrivate::layoutChildren() // move the scrollbars away from top/left headers int vHeaderRight = 0; int hHeaderBottom = 0; +#if QT_CONFIG(itemviews) if ((vscrollOverlap > 0 && needv) || (hscrollOverlap > 0 && needh)) { const QList headers = q->findChildren(); if (headers.count() <= 2) { @@ -485,7 +486,7 @@ void QAbstractScrollAreaPrivate::layoutChildren() } } } - +#endif // QT_CONFIG(itemviews) if (needh) { QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); #if 0 // Used to be included in Qt4 for Q_WS_MAC From 056a35d02f683dba8deba5345477987c451c189c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Jan 2017 18:00:16 +0100 Subject: [PATCH 31/70] Fix build with -no-feature-menu Change-Id: I8f9d5ef6b7f7102e56816677f1d3a5b5144b7083 Reviewed-by: Lars Knoll --- src/widgets/accessible/qaccessiblewidgets.cpp | 2 ++ src/widgets/accessible/simplewidgets.cpp | 6 ++++-- src/widgets/util/qsystemtrayicon.cpp | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index b8147621684..4c48ecb4659 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -85,7 +85,9 @@ QList childWidgets(const QWidget *widget) QString objectName = w->objectName(); if (!w->isWindow() && !qobject_cast(w) +#if QT_CONFIG(menu) && !qobject_cast(w) +#endif && objectName != QLatin1String("qt_rubberband") && objectName != QLatin1String("qt_qmainwindow_extended_splitter")) { widgets.append(w); diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index e6fda103fb0..0cfa9bfbb22 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -339,10 +339,12 @@ QStringList QAccessibleToolButton::actionNames() const { QStringList names; if (widget()->isEnabled()) { +#if QT_CONFIG(menu) if (toolButton()->menu()) names << showMenuAction(); if (toolButton()->popupMode() != QToolButton::InstantPopup) names << QAccessibleButton::actionNames(); +#endif } return names; } @@ -355,12 +357,12 @@ void QAccessibleToolButton::doAction(const QString &actionName) if (actionName == pressAction()) { button()->click(); } else if (actionName == showMenuAction()) { +#if QT_CONFIG(menu) if (toolButton()->popupMode() != QToolButton::InstantPopup) { toolButton()->setDown(true); -#ifndef QT_NO_MENU toolButton()->showMenu(); -#endif } +#endif } else { QAccessibleButton::doAction(actionName); } diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 630524aadba..f7464d50ecb 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -693,10 +693,12 @@ void QSystemTrayIconPrivate::updateIcon_sys_qpa() void QSystemTrayIconPrivate::updateMenu_sys_qpa() { +#if QT_CONFIG(menu) if (menu) { addPlatformMenu(menu); qpa_sys->updateMenu(menu->platformMenu()); } +#endif } void QSystemTrayIconPrivate::updateToolTip_sys_qpa() @@ -729,6 +731,7 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &title, void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const { +#if QT_CONFIG(menu) if (menu->platformMenu()) return; // The platform menu already exists. @@ -745,6 +748,7 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const QPlatformMenu *platformMenu = qpa_sys->createMenu(); if (platformMenu) menu->setPlatformMenu(platformMenu); +#endif // QT_CONFIG(menu) } QT_END_NAMESPACE From a8a74fe81acab07bfe068bff398555804629a88c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Jan 2017 11:21:32 +0100 Subject: [PATCH 32/70] Stabilize tst_QPropertyAnimation::noStartValue() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the qWait() and introduce a QTRY_COMPARE() checking for the end value first. Task-number: QTBUG-58402 Change-Id: I2d3758178de5f67881008f28c406076ad27c4a90 Reviewed-by: Jędrzej Nowacki --- .../animation/qpropertyanimation/tst_qpropertyanimation.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index c1a8fde504a..b0b0a307e91 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -441,10 +441,8 @@ void tst_QPropertyAnimation::noStartValue() a.setDuration(250); a.start(); - QTest::qWait(300); - - QTRY_COMPARE(o.values.first(), 42); - QCOMPARE(o.values.last(), 420); + QTRY_COMPARE(o.values.value(o.values.size() - 1, -1), 420); + QCOMPARE(o.values.first(), 42); } void tst_QPropertyAnimation::noStartValueWithLoop() From 6bf9f49072233b4eef9afac2720ef282c65b6948 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 09:38:12 +0100 Subject: [PATCH 33/70] Fix build with -no-feature-menubar Change-Id: I23b23fcaf6fcc655d38a06495127b108975f4a58 Reviewed-by: Lars Knoll --- src/widgets/accessible/qaccessiblemenu.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index 4a684e01f96..ae50bbaef04 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -117,7 +117,11 @@ QAccessibleInterface *QAccessibleMenu::parent() const parentCandidates << menu()->parentWidget(); parentCandidates << menuAction->associatedWidgets(); foreach (QWidget *w, parentCandidates) { - if (qobject_cast(w) || qobject_cast(w)) { + if (qobject_cast(w) +#if QT_CONFIG(menubar) + || qobject_cast(w) +#endif + ) { if (w->actions().indexOf(menuAction) != -1) return getOrCreateMenu(w, menuAction); } @@ -348,13 +352,16 @@ void QAccessibleMenuItem::doAction(const QString &actionName) if (actionName == pressAction()) { m_action->trigger(); } else if (actionName == showMenuAction()) { +#if QT_CONFIG(menubar) if (QMenuBar *bar = qobject_cast(owner())) { if (m_action->menu() && m_action->menu()->isVisible()) { m_action->menu()->hide(); } else { bar->setActiveAction(m_action); } - } else if (QMenu *menu = qobject_cast(owner())){ + } else +#endif + if (QMenu *menu = qobject_cast(owner())){ if (m_action->menu() && m_action->menu()->isVisible()) { m_action->menu()->hide(); } else { From cabf2950f7bb25cee06a92202f47692df1c37847 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 09:58:13 +0100 Subject: [PATCH 34/70] Fix build with -no-feature-rubberband Change-Id: Ida6698c4868507ccbf5b4c5e3eb1d2f5a7109f53 Reviewed-by: Lars Knoll --- src/widgets/widgets/qmdiarea.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 9b397432813..6b23e22bc1c 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -1533,6 +1533,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor) Q_ASSERT(indexToHighlighted >= 0); } +#if QT_CONFIG(rubberband) void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow) { if (!subWindow || !rubberBand) @@ -1546,7 +1547,7 @@ void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow) rubberBand->raise(); rubberBand->show(); } - +#endif // QT_CONFIG(rubberBand) /*! \internal \since 4.4 From 2ac7fb78b9928a7bac133e474d483b14e65d0a65 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 09:59:41 +0100 Subject: [PATCH 35/70] Fix styles compilation with features removed, round 2 Change-Id: I8f09a8844e5edc1ad3e3dfd39eca9f3b42c5c828 Reviewed-by: Lars Knoll --- src/widgets/styles/qfusionstyle.cpp | 35 +++++++++++++++++++- src/widgets/styles/qpixmapstyle.cpp | 44 ++++++++++++++++++++----- src/widgets/styles/qstylehelper.cpp | 2 +- src/widgets/styles/qstylesheetstyle.cpp | 2 ++ 4 files changed, 72 insertions(+), 11 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 898a14d7fb9..e08cd3ac70c 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -453,6 +453,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); break; } +#if QT_CONFIG(tabbar) case PE_FrameTabBarBase: if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast(option)) { @@ -489,6 +490,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, painter->restore(); } return; +#endif // QT_CONFIG(tabbar) case PE_PanelScrollAreaCorner: { painter->save(); QColor alphaOutline = outline; @@ -938,6 +940,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, case PE_FrameTabWidget: painter->save(); painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor); +#if QT_CONFIG(tabwidget) if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(option)) { QColor borderColor = outline.lighter(110); QRect rect = option->rect.adjusted(0, 0, -1, -1); @@ -960,6 +963,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, painter->drawRect(rect.adjusted(1, 1, -1, -1)); } +#endif // QT_CONFIG(tabwidget) painter->restore(); break ; @@ -1057,6 +1061,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio } break; } +#if QT_CONFIG(rubberband) case CE_RubberBand: if (qstyleoption_cast(option)) { QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); @@ -1082,6 +1087,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->restore(); } break; +#endif //QT_CONFIG(rubberband) case CE_SizeGrip: painter->save(); { @@ -1800,6 +1806,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio } painter->restore(); break; +#if QT_CONFIG(tabbar) case CE_TabBarTabShape: painter->save(); if (const QStyleOptionTab *tab = qstyleoption_cast(option)) { @@ -1915,6 +1922,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio } painter->restore(); break; +#endif //QT_CONFIG(tabbar) default: QCommonStyle::drawControl(element,option,painter,widget); break; @@ -2000,6 +2008,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } painter->restore(); break; +#if QT_CONFIG(spinbox) case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { QPixmap cache; @@ -2150,6 +2159,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption painter->drawPixmap(spinBox->rect.topLeft(), cache); } break; +#endif // QT_CONFIG(spinbox) case CC_TitleBar: painter->save(); if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast(option)) { @@ -2410,6 +2420,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } painter->restore(); break; +#if QT_CONFIG(slider) case CC_ScrollBar: painter->save(); if (const QStyleOptionSlider *scrollBar = qstyleoption_cast(option)) { @@ -2718,6 +2729,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } painter->restore(); break;; +#endif // QT_CONFIG(slider) case CC_ComboBox: painter->save(); if (const QStyleOptionComboBox *comboBox = qstyleoption_cast(option)) { @@ -2815,6 +2827,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } painter->restore(); break; +#if QT_CONFIG(slider) case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); @@ -3025,6 +3038,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption painter->setPen(oldPen); } break; +#endif // QT_CONFIG(slider) #if QT_CONFIG(dial) case CC_Dial: if (const QStyleOptionSlider *dial = qstyleoption_cast(option)) @@ -3266,11 +3280,19 @@ void QFusionStyle::polish(QWidget *widget) #if QT_CONFIG(combobox) || qobject_cast(widget) #endif +#if QT_CONFIG(progressbar) || qobject_cast(widget) +#endif +#if QT_CONFIG(scrollbar) || qobject_cast(widget) +#endif +#if QT_CONFIG(splitter) || qobject_cast(widget) +#endif || qobject_cast(widget) +#if QT_CONFIG(spinbox) || qobject_cast(widget) +#endif || (widget->inherits("QDockSeparator")) || (widget->inherits("QDockWidgetSeparator")) ) { @@ -3297,11 +3319,19 @@ void QFusionStyle::unpolish(QWidget *widget) #if QT_CONFIG(combobox) || qobject_cast(widget) #endif +#if QT_CONFIG(progressbar) || qobject_cast(widget) +#endif +#if QT_CONFIG(scrollbar) || qobject_cast(widget) +#endif +#if QT_CONFIG(splitter) || qobject_cast(widget) +#endif || qobject_cast(widget) +#if QT_CONFIG(spinbox) || qobject_cast(widget) +#endif || (widget->inherits("QDockSeparator")) || (widget->inherits("QDockWidgetSeparator")) ) { @@ -3326,6 +3356,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); switch (control) { +#if QT_CONFIG(slider) case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); @@ -3376,6 +3407,8 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom } } break; +#endif // QT_CONFIG(slider) +#if QT_CONFIG(spinbox) case CC_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(option)) { int center = spinbox->rect.height() / 2; @@ -3413,7 +3446,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom rect = visualRect(spinbox->direction, spinbox->rect, rect); } break; - +#endif // QT_CONFIG(spinbox) case CC_GroupBox: if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast(option)) { rect = option->rect; diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index ac57adf862e..a947f5d079d 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -129,12 +129,14 @@ void QPixmapStyle::polish(QWidget *widget) Q_D(QPixmapStyle); // Don't fill the interior of the QTextEdit +#if QT_CONFIG(textedit) if (qobject_cast(widget)) { QPalette p = widget->palette(); p.setBrush(QPalette::Base, Qt::NoBrush); widget->setPalette(p); } - +#endif +#if QT_CONFIG(progressbar) if (QProgressBar *pb = qobject_cast(widget)) { // Center the text in the progress bar pb->setAlignment(Qt::AlignCenter); @@ -143,10 +145,11 @@ void QPixmapStyle::polish(QWidget *widget) font.setPixelSize(d->descriptors.value(PB_HBackground).size.height()/2); pb->setFont(font); } - +#endif +#if QT_CONFIG(slider) if (qobject_cast(widget)) widget->installEventFilter(this); - +#endif #if QT_CONFIG(combobox) if (QComboBox *cb = qobject_cast(widget)) { widget->installEventFilter(this); @@ -182,6 +185,7 @@ void QPixmapStyle::polish(QWidget *widget) if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) widget->installEventFilter(this); +#if QT_CONFIG(scrollarea) if (QAbstractScrollArea *scrollArea = qobject_cast(widget)) { scrollArea->viewport()->setAutoFillBackground(false); #if QT_CONFIG(itemviews) @@ -194,10 +198,11 @@ void QPixmapStyle::polish(QWidget *widget) QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture); #endif } - +#endif // QT_CONFIG(scrollarea) +#if QT_CONFIG(scrollbar) if (qobject_cast(widget)) widget->setAttribute(Qt::WA_OpaquePaintEvent, false); - +#endif QCommonStyle::polish(widget); } @@ -214,7 +219,12 @@ void QPixmapStyle::unpolish(QApplication *application) */ void QPixmapStyle::unpolish(QWidget *widget) { - if (qobject_cast(widget) + if ( +#if QT_CONFIG(slider) + qobject_cast(widget) +#else + false +#endif #if QT_CONFIG(combobox) || qobject_cast(widget) #endif @@ -225,7 +235,7 @@ void QPixmapStyle::unpolish(QWidget *widget) if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) widget->removeEventFilter(this); -#if QT_CONFIG(gestures) +#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) if (QAbstractScrollArea *scrollArea = qobject_cast(widget)) QScroller::ungrabGesture(scrollArea->viewport()); #endif @@ -251,10 +261,12 @@ void QPixmapStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *o drawLineEdit(option, painter, widget); break; case PE_Frame: +#if QT_CONFIG(textedit) case PE_FrameDefaultButton: if (qobject_cast(widget)) drawTextEdit(option, painter, widget); break; +#endif case PE_IndicatorCheckBox: drawCheckBox(option, painter, widget); break; @@ -412,11 +424,13 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, case PM_ButtonShiftVertical: return 0; case PM_DefaultFrameWidth: +#if QT_CONFIG(textedit) if (qobject_cast(widget)) { const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled); return qMax(qMax(desc.margins.left(), desc.margins.right()), qMax(desc.margins.top(), desc.margins.bottom())); } +#endif return 0; case PM_IndicatorWidth: return d->pixmaps.value(CB_Enabled).pixmap.width(); @@ -438,6 +452,7 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom())); } +#if QT_CONFIG(slider) case PM_SliderThickness: if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { @@ -478,6 +493,7 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, ? desc.size.height() : desc.size.width(); } break; +#endif // QT_CONFIG(slider) case PM_ScrollBarSliderMin: return 0; default: ; @@ -528,7 +544,7 @@ QStyle::SubControl QPixmapStyle::hitTestComplexControl(QStyle::ComplexControl co bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event) { Q_D(QPixmapStyle); - +#if QT_CONFIG(slider) if (QSlider *slider = qobject_cast(watched)) { switch (event->type()) { case QEvent::MouseButtonPress: @@ -539,7 +555,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event) default: ; } } - +#endif // QT_CONFIG(slider) #if QT_CONFIG(combobox) if (QComboBox *comboBox = qobject_cast(watched)) { switch (event->type()) { @@ -859,6 +875,7 @@ void QPixmapStyle::drawProgressBarFill(const QStyleOption *option, void QPixmapStyle::drawSlider(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { +#if QT_CONFIG(slider) Q_D(const QPixmapStyle); const QStyleOptionSlider *slider = qstyleoption_cast(option); @@ -908,6 +925,7 @@ void QPixmapStyle::drawSlider(const QStyleOptionComplex *option, painter->drawPixmap(handle, d->pixmaps.value(pix).pixmap); } } +#endif // QT_CONFIG(slider) } void QPixmapStyle::drawComboBox(const QStyleOptionComplex *option, @@ -934,6 +952,7 @@ void QPixmapStyle::drawComboBox(const QStyleOptionComplex *option, void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { +#if QT_CONFIG(slider) if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { // Do not draw the scrollbar @@ -945,6 +964,7 @@ void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option, ? SB_Horizontal : SB_Vertical; drawCachedPixmap(control, rect, painter); } +#endif // QT_CONFIG(slider) } QSize QPixmapStyle::pushButtonSizeFromContents(const QStyleOption *option, @@ -1003,6 +1023,7 @@ QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { +#if QT_CONFIG(slider) Q_D(const QPixmapStyle); const QStyleOptionSlider *slider = qstyleoption_cast(option); @@ -1018,6 +1039,9 @@ QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option, return QSize(result.width(), desc.size.height()); else return QSize(desc.size.width(), result.height()); +#else // QT_CONFIG(slider) + return QSize(); +#endif // QT_CONFIG(slider) } QSize QPixmapStyle::comboBoxSizeFromContents(const QStyleOption *option, @@ -1085,6 +1109,7 @@ QRect QPixmapStyle::comboBoxSubControlRect(const QStyleOptionComplex *option, QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option, QStyle::SubControl sc, const QWidget *) const { +#if QT_CONFIG(slider) if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { int length = (slider->orientation == Qt::Horizontal) @@ -1131,6 +1156,7 @@ QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option, } } } +#endif // QT_CONFIG(slider) return QRect(); } diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 602421725f9..9b381c383b3 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -411,7 +411,7 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec QColor backgroundColor(const QPalette &pal, const QWidget* widget) { -#ifndef QT_NO_SCROLLBAR +#if QT_CONFIG(scrollarea) if (qobject_cast(widget) && widget->parent() && qobject_cast(widget->parent()->parent())) return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 5a0b93474f1..d9d270643c1 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4903,6 +4903,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op QSize sz = rule.adjustSize(csz); switch (ct) { +#if QT_CONFIG(spinbox) case CT_SpinBox: // ### hopelessly broken QAbstractSpinBox (part 1) if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(opt)) { // Add some space for the up/down buttons @@ -4920,6 +4921,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op return sz; } break; +#endif // QT_CONFIG(spinbox) case CT_ToolButton: if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw()) sz += QSize(3, 3); // ### broken QToolButton From 2bbeebf80c127979d1859c8486774df22be4c3f2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 10:10:07 +0100 Subject: [PATCH 36/70] Fix build with -no-feature-textedit Change-Id: I4a75c134803043180c57287ca352e26e3422204c Reviewed-by: Lars Knoll --- src/widgets/configure.json | 2 +- src/widgets/dialogs/qmessagebox.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 92a57534e63..84500bff21e 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -435,7 +435,7 @@ "label": "QInputDialog", "purpose": "Provides a simple convenience dialog to get a single value from the user.", "section": "Dialogs", - "condition": "features.combobox && features.spinbox && features.stackedwidget", + "condition": "features.combobox && features.spinbox && features.stackedwidget && features.textedit", "output": [ "publicFeature", "feature" ] }, "errormessage": { diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 57b3f47863d..98d070e4939 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -336,8 +336,10 @@ void QMessageBoxPrivate::setupLayout() #else grid->addWidget(buttonBox, grid->rowCount(), 0, 1, grid->columnCount()); #endif +#if QT_CONFIG(textedit) if (detailsText) grid->addWidget(detailsText, grid->rowCount(), 0, 1, grid->columnCount()); +#endif grid->setSizeConstraint(QLayout::SetNoConstraint); q->setLayout(grid); @@ -2654,7 +2656,9 @@ void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *) options->setWindowTitle(q->windowTitle()); options->setText(q->text()); options->setInformativeText(q->informativeText()); +#if QT_CONFIG(textedit) options->setDetailedText(q->detailedText()); +#endif options->setIcon(helperIcon(q->icon())); options->setStandardButtons(helperStandardButtons(q)); } From 0f6cfd2217163e5851d16d3c0846d6dc37624762 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 11:16:50 +0100 Subject: [PATCH 37/70] Fix build with -no-feature-slider Change-Id: I36e5c850068c2f9ac2ae078a3734ddb88d88c532 Reviewed-by: Lars Knoll --- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/accessible/rangecontrols_p.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index dfc8c84836e..da184fd90dc 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -94,9 +94,9 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QScrollBar")) { iface = new QAccessibleScrollBar(widget); #endif +#ifndef QT_NO_SLIDER } else if (classname == QLatin1String("QAbstractSlider")) { iface = new QAccessibleAbstractSlider(widget); -#ifndef QT_NO_SLIDER } else if (classname == QLatin1String("QSlider")) { iface = new QAccessibleSlider(widget); #endif diff --git a/src/widgets/accessible/rangecontrols_p.h b/src/widgets/accessible/rangecontrols_p.h index 28f613462d3..c0b010c292d 100644 --- a/src/widgets/accessible/rangecontrols_p.h +++ b/src/widgets/accessible/rangecontrols_p.h @@ -143,6 +143,7 @@ protected: }; #endif // QT_NO_SPINBOX +#if QT_CONFIG(slider) class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface { public: @@ -159,6 +160,7 @@ public: protected: QAbstractSlider *abstractSlider() const; }; +#endif // QT_CONFIG(slider) #ifndef QT_NO_SCROLLBAR class QAccessibleScrollBar : public QAccessibleAbstractSlider From 624b67c6fb3c833ffe94cc2a52a2d1164eef839e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 12:01:01 +0100 Subject: [PATCH 38/70] Fix build with -no-feature-tabwidget Change-Id: I0fbabdfec763f1647bf85582afe088a3e5b42e1f Reviewed-by: Lars Knoll --- src/widgets/widgets/qmainwindowlayout.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 9e1af16625b..8eb1eaec188 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1021,7 +1021,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream, } } break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabwidget) case QDockAreaLayout::FloatingDockWidgetTabMarker: { auto dockWidgets = allMyDockWidgets(mainWindow); @@ -1045,7 +1045,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream, floatingTab->show(); } break; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabwidget) #endif // QT_NO_DOCKWIDGET #ifndef QT_NO_TOOLBAR @@ -2012,7 +2012,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) dwgw->layoutInfo()->remove(path); } currentGapRect = QRect(); - +#if QT_CONFIG(tabwidget) if (QDockWidget *dropTo = qobject_cast(currentHoveredFloat)) { //dropping to a normal widget, we mutate it in a QDockWidgetGroupWindow with two tabs QDockWidgetGroupWindow *floatingTabs = createTabbedDockWindow(); @@ -2030,7 +2030,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) dropTo->d_func()->plug(QRect()); currentHoveredFloat = floatingTabs; } - +#endif // QT_CONFIG(tabwidget) QDockWidgetGroupWindow *dwgw = qobject_cast(currentHoveredFloat); Q_ASSERT(dwgw); Q_ASSERT(dwgw->layoutInfo()->tabbed); // because floating group should always be tabbed @@ -2362,7 +2362,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) if (QDockWidget *dw = qobject_cast(widget)) { Q_ASSERT(path.constFirst() == 1); bool actualGroup = false; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabwidget) if (group && (dockOptions & QMainWindow::GroupedDragging) && path.size() > 3) { QDockAreaLayoutItem &parentItem = layoutState.dockAreaLayout.item(path.mid(1, path.size() - 2)); if (parentItem.subinfo && parentItem.subinfo->tabbed) { @@ -2383,7 +2383,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) savedState = layoutState; } } -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabwidget) if (!actualGroup) { dw->d_func()->unplug(r); } @@ -2554,7 +2554,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) updateGapIndicator(); } -#if QT_CONFIG(dockwidget) +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget) QDockWidgetGroupWindow *QMainWindowLayout::createTabbedDockWindow() { QDockWidgetGroupWindow* f = new QDockWidgetGroupWindow(parentWidget(), Qt::Tool); @@ -2565,8 +2565,7 @@ QDockWidgetGroupWindow *QMainWindowLayout::createTabbedDockWindow() void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate) { -#ifndef QT_NO_DOCKWIDGET -#ifndef QT_NO_TABBAR +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget) QSet used = newState.dockAreaLayout.usedTabBars(); foreach (QDockWidgetGroupWindow *dwgw, parent()->findChildren(QString(), Qt::FindDirectChildrenOnly)) { @@ -2594,8 +2593,7 @@ void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animat for (int i = 0; i < QInternal::DockCount; ++i) newState.dockAreaLayout.docks[i].reparentWidgets(parentWidget()); -#endif // QT_NO_TABBAR -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget) newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate); } From b0b726f8c7d8b17853962262fefd6e0b56de2b92 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 12:09:51 +0100 Subject: [PATCH 39/70] Fix build with -no-feature-tabbar Change-Id: I97c5345f2627743876aa05a94ffc03f2a6012b6c Reviewed-by: Lars Knoll --- src/widgets/widgets/qdockarealayout.cpp | 2 ++ src/widgets/widgets/qmainwindowlayout.cpp | 25 +++++++++++++++++++---- src/widgets/widgets/qmainwindowlayout_p.h | 2 +- src/widgets/widgets/qmdiarea.cpp | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index ad19e5d5f96..30eaa73b9ef 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -3175,6 +3175,7 @@ void QDockAreaLayout::resizeDocks(const QList &docks, while (path.size() > 1) { QDockAreaLayoutInfo *info = this->info(path); +#if QT_CONFIG(tabbar) if (!info->tabbed && info->o == o) { info->item_list[path.constLast()].size = size; int totalSize = 0; @@ -3187,6 +3188,7 @@ void QDockAreaLayout::resizeDocks(const QList &docks, } size = totalSize; } +#endif // QT_CONFIG(tabbar) path.removeLast(); } diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 8eb1eaec188..72e06e4efa5 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -125,8 +125,11 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayoutInfo &layout, QSt << layout.rect.height() << " min size: " << minSize.width() << ',' << minSize.height() << " orient:" << layout.o +#if QT_CONFIG(tabbar) << " tabbed:" << layout.tabbed - << " tbshape:" << layout.tabBarShape << '\n'; + << " tbshape:" << layout.tabBarShape +#endif + << '\n'; indent += QLatin1String(" "); @@ -226,7 +229,9 @@ public: if (li->isEmpty()) return; int fw = frameWidth(); +#if QT_CONFIG(tabbar) li->reparentWidgets(parentWidget()); +#endif li->rect = r.adjusted(fw, fw, -fw, -fw); li->fitItems(); li->apply(false); @@ -317,6 +322,7 @@ QDockWidget *QDockWidgetGroupWindow::topDockWidget() const { QDockAreaLayoutInfo *info = layoutInfo(); QDockWidget *dw = 0; +#if QT_CONFIG(tabbar) if (info->tabBar && info->tabBar->currentIndex() >= 0) { int i = info->tabIndexToListIndex(info->tabBar->currentIndex()); if (i >= 0) { @@ -325,6 +331,7 @@ QDockWidget *QDockWidgetGroupWindow::topDockWidget() const dw = qobject_cast(item.widgetItem->widget()); } } +#endif if (!dw) { for (int i = 0; !dw && i < info->item_list.count(); ++i) { const QDockAreaLayoutItem &item = info->item_list.at(i); @@ -373,8 +380,10 @@ void QDockWidgetGroupWindow::destroyOrHideIfEmpty() if (!wasHidden) dw->show(); } +#if QT_CONFIG(tabbar) foreach (QTabBar *tb, findChildren(QString(), Qt::FindDirectChildrenOnly)) tb->setParent(parentWidget()); +#endif deleteLater(); } @@ -1802,10 +1811,10 @@ bool QMainWindowLayout::endSeparatorMove(const QPoint&) void QMainWindowLayout::raise(QDockWidget *widget) { +#ifndef QT_NO_TABBAR QDockAreaLayoutInfo *info = dockInfo(widget); if (info == 0) return; -#ifndef QT_NO_TABBAR if (!info->tabbed) return; info->setCurrentTab(widget); @@ -2031,6 +2040,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) currentHoveredFloat = floatingTabs; } #endif // QT_CONFIG(tabwidget) +#if QT_CONFIG(tabbar) QDockWidgetGroupWindow *dwgw = qobject_cast(currentHoveredFloat); Q_ASSERT(dwgw); Q_ASSERT(dwgw->layoutInfo()->tabbed); // because floating group should always be tabbed @@ -2042,6 +2052,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) globalRect.moveTopLeft(dwgw->mapToGlobal(globalRect.topLeft())); pluggingWidget = widget; widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks); +#endif // QT_CONFIG(tabbar) return true; } #endif @@ -2120,7 +2131,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget) if (QDockWidgetGroupWindow *dropTo = qobject_cast(currentHoveredFloat)) { parentInfo = dropTo->layoutInfo(); +#if QT_CONFIG(tabbar) Q_ASSERT(parentInfo->tabbed); +#endif path = parentInfo->indexOf(widget); Q_ASSERT(path.size() == 1); } else { @@ -2129,7 +2142,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget) parentInfo = layoutState.dockAreaLayout.info(path); Q_ASSERT(parentInfo); } - +#if QT_CONFIG(tabbar) if (parentInfo->tabbed) { // merge the two tab widgets int idx = path.constLast(); @@ -2143,15 +2156,19 @@ void QMainWindowLayout::animationFinished(QWidget *widget) parentInfo->reparentWidgets(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget()); parentInfo->updateTabBar(); parentInfo->setCurrentTabId(currentId); - } else { + } else +#endif // QT_CONFIG(tabbar) + { QDockAreaLayoutItem &item = layoutState.dockAreaLayout.item(path); Q_ASSERT(item.widgetItem->widget() == dwgw); delete item.widgetItem; item.widgetItem = 0; item.subinfo = new QDockAreaLayoutInfo(qMove(*info)); *info = QDockAreaLayoutInfo(); +#if QT_CONFIG(tabbar) item.subinfo->reparentWidgets(parentWidget()); item.subinfo->setTabBarShape(parentInfo->tabBarShape); +#endif } dwgw->destroyOrHideIfEmpty(); } diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index 40336caeba5..857a05eb8ed 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -231,9 +231,9 @@ public: void raise(QDockWidget *widget); void setVerticalTabsEnabled(bool enabled); bool restoreDockWidget(QDockWidget *dockwidget); - QDockAreaLayoutInfo *dockInfo(QWidget *w); #ifndef QT_NO_TABBAR + QDockAreaLayoutInfo *dockInfo(QWidget *w); bool _documentMode; bool documentMode() const; void setDocumentMode(bool enabled); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 6b23e22bc1c..18cb8237029 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -1539,9 +1539,11 @@ void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow) if (!subWindow || !rubberBand) return; +#if QT_CONFIG(tabbar) if (viewMode == QMdiArea::TabbedView) rubberBand->setGeometry(tabBar->tabRect(childWindows.indexOf(subWindow))); else +#endif rubberBand->setGeometry(subWindow->geometry()); rubberBand->raise(); From 033fa96b6c89cc1be5cb2365e68bd1b01f91aad7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 13:23:08 +0100 Subject: [PATCH 40/70] Fix build with -no-feature-toolbutton Change-Id: I16495548fa3ed24409883fadab08ddb8545efd0d Reviewed-by: Lars Knoll --- src/widgets/widgets/qlineedit.cpp | 2 ++ src/widgets/widgets/qlineedit_p.cpp | 9 ++++++++- src/widgets/widgets/qlineedit_p.h | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index ffe1ca1c662..e5e832ab984 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -2195,10 +2195,12 @@ void QLineEdit::changeEvent(QEvent *ev) update(); break; case QEvent::LayoutDirectionChange: +#if QT_CONFIG(toolbutton) for (const auto &e : d->trailingSideWidgets) { // Refresh icon to show arrow in right direction. if (e.flags & QLineEditPrivate::SideWidgetClearButton) static_cast(e.widget)->setIcon(d->clearButtonIcon()); } +#endif d->positionSideWidgets(); break; default: diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 7da1d911ee9..9947d632799 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -313,6 +313,8 @@ void QLineEditPrivate::drag() #endif // QT_NO_DRAGANDDROP + +#if QT_CONFIG(toolbutton) QLineEditIconButton::QLineEditIconButton(QWidget *parent) : QToolButton(parent) , m_opacity(0) @@ -390,6 +392,7 @@ void QLineEditIconButton::updateCursor() setCursor(qFuzzyCompare(m_opacity, qreal(1.0)) || !parentWidget() ? QCursor(Qt::ArrowCursor) : parentWidget()->cursor()); #endif } +#endif // QT_CONFIG(toolbutton) void QLineEditPrivate::_q_textChanged(const QString &text) { @@ -397,7 +400,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) const int newTextSize = text.size(); if (!newTextSize || !lastTextSize) { lastTextSize = newTextSize; -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) && QT_CONFIG(toolbutton) const bool fadeIn = newTextSize > 0; for (const SideWidgetEntry &e : leadingSideWidgets) { if (e.flags & SideWidgetFadeInWithText) @@ -507,6 +510,7 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE flags |= SideWidgetCreatedByWidgetAction; } if (!w) { +#if QT_CONFIG(toolbutton) QLineEditIconButton *toolButton = new QLineEditIconButton(q); toolButton->setIcon(newAction->icon()); toolButton->setOpacity(lastTextSize > 0 || !(flags & SideWidgetFadeInWithText) ? 1 : 0); @@ -514,6 +518,9 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE QObject::connect(toolButton, SIGNAL(clicked()), q, SLOT(_q_clearButtonClicked())); toolButton->setDefaultAction(newAction); w = toolButton; +#else + return nullptr; +#endif } // If there is a 'before' action, it takes preference PositionIndexPair positionIndex = before ? findSideWidget(before) : PositionIndexPair(position, -1); diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 0a08aefab38..a903c003e6b 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE class QLineEditPrivate; // QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text - +#if QT_CONFIG(toolbutton) class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton { Q_OBJECT @@ -103,6 +103,7 @@ private: qreal m_opacity; }; +#endif // QT_CONFIG(toolbutton) class Q_AUTOTEST_EXPORT QLineEditPrivate : public QWidgetPrivate { From 08e8a02e518938261100f493eac8023597a2cc2b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 13:29:15 +0100 Subject: [PATCH 41/70] Compile with -no-feature-tooltip Change-Id: I6093559dd7b8df578ebd050655fb9bd07e5f6809 Reviewed-by: Lars Knoll --- src/widgets/accessible/complexwidgets.cpp | 2 ++ src/widgets/accessible/simplewidgets.cpp | 2 ++ src/widgets/util/qsystemtrayicon_x11.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 463019dbd04..32ac732eb2b 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -130,9 +130,11 @@ public: case QAccessible::Accelerator: str = qt_accHotKey(m_parent->tabText(m_index)); break; +#if QT_CONFIG(tooltip) case QAccessible::Description: str = m_parent->tabToolTip(m_index); break; +#endif case QAccessible::Help: str = m_parent->tabWhatsThis(m_index); break; diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 0cfa9bfbb22..a806cb7af6d 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -550,9 +550,11 @@ QString QAccessibleGroupBox::text(QAccessible::Text t) const case QAccessible::Name: txt = qt_accStripAmp(groupBox()->title()); break; +#if QT_CONFIG(tooltip) case QAccessible::Description: txt = groupBox()->toolTip(); break; +#endif case QAccessible::Accelerator: txt = qt_accHotKey(groupBox()->title()); break; diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index ea0604b6ed4..0bde31fd617 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -104,7 +104,9 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) , q(qIn) { setObjectName(QStringLiteral("QSystemTrayIconSys")); +#if QT_CONFIG(tooltip) setToolTip(q->toolTip()); +#endif setAttribute(Qt::WA_AlwaysShowToolTips, true); setAttribute(Qt::WA_QuitOnClose, false); const QSize size(22, 22); // Gnome, standard size From da21d20b85e4ab4e27ff620626fae52adced4af2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 13:36:14 +0100 Subject: [PATCH 42/70] Fix build with -no-feature-treewidget Make sure the feature is defined before testing it. Change-Id: I4d4b555c9f2629c8a3ca58cf52efff279f6a78f5 Reviewed-by: Lars Knoll --- src/widgets/itemviews/qtreewidgetitemiterator_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/itemviews/qtreewidgetitemiterator_p.h b/src/widgets/itemviews/qtreewidgetitemiterator_p.h index 4b6c7b0a573..e68f6103d39 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator_p.h +++ b/src/widgets/itemviews/qtreewidgetitemiterator_p.h @@ -53,8 +53,8 @@ #include -#ifndef QT_NO_TREEWIDGET #include "qtreewidgetitemiterator.h" +#if QT_CONFIG(treewidget) QT_BEGIN_NAMESPACE @@ -103,6 +103,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_TREEWIDGET +#endif // QT_CONFIG(treewidget) #endif //QTREEWIDGETITEMITERATOR_P_H From 195298326f0d8aa75e7034a11c13060b81435855 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 25 Jan 2017 13:52:44 +0100 Subject: [PATCH 43/70] Fix build with -no-feature-whatsthis Change-Id: I2f31357e91b01f826ef44710f477b80fde1f3fbf Reviewed-by: Lars Knoll --- src/widgets/accessible/complexwidgets.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 32ac732eb2b..ea3b88468b6 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -135,9 +135,11 @@ public: str = m_parent->tabToolTip(m_index); break; #endif +#if QT_CONFIG(whatsthis) case QAccessible::Help: str = m_parent->tabWhatsThis(m_index); break; +#endif default: break; } From d3671555cc013df266a33a256100610d30681dfd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 24 Jan 2017 13:36:09 -0800 Subject: [PATCH 44/70] Rename "interface" to "iface:" there's a #define in windows.h Change-Id: Ibe5b1b60c6ea47e19612fffd149cd2d07116584b Reviewed-by: Jake Petroules --- src/plugins/bearer/qnetworksession_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 7756709e55c..847479047fc 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -210,10 +210,10 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const if (!engine || state != QNetworkSession::Connected || !publicConfig.isValid()) return QNetworkInterface(); - QString interface = engine->getInterfaceFromId(activeConfig.identifier()); - if (interface.isEmpty()) + QString iface = engine->getInterfaceFromId(activeConfig.identifier()); + if (iface.isEmpty()) return QNetworkInterface(); - return QNetworkInterface::interfaceFromName(interface); + return QNetworkInterface::interfaceFromName(iface); } #endif From 374a173d1417a9f8c313088420cb1b792fe45977 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Jan 2017 15:14:45 +0100 Subject: [PATCH 45/70] Improve QTest::qWait() precision and switch to QDeadlineTimer Do not wait up to the timeout ms after already having waited several times. At the same time upgrade to using the QDeadlineTimer which is designed for this purpose. Change-Id: Iaf5e4f4655605d5143ce91040c6eb6706752e504 Reviewed-by: Thiago Macieira --- src/testlib/qtestsystem.h | 36 +++++++++---------- .../corelib/tools/qtimeline/tst_qtimeline.cpp | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 4973412f9b8..b38cd2bdb44 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -42,7 +42,7 @@ #include #include -#include +#include #ifdef QT_GUI_LIB # include #endif @@ -58,27 +58,29 @@ namespace QTest { Q_ASSERT(QCoreApplication::instance()); - QElapsedTimer timer; - timer.start(); + QDeadlineTimer timer(ms); + int remaining = ms; do { - QCoreApplication::processEvents(QEventLoop::AllEvents, ms); + QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete); - QTest::qSleep(10); - } while (timer.elapsed() < ms); + remaining = timer.remainingTime(); + if (remaining <= 0) + break; + QTest::qSleep(qMin(10, remaining)); + remaining = timer.remainingTime(); + } while (remaining > 0); } #ifdef QT_GUI_LIB inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000) { - QElapsedTimer timer; - timer.start(); - while (!window->isActive()) { - int remaining = timeout - int(timer.elapsed()); - if (remaining <= 0) - break; + QDeadlineTimer timer(timeout); + int remaining = timeout; + while (!window->isActive() && remaining > 0) { QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete); QTest::qSleep(10); + remaining = timer.remainingTime(); } // Try ensuring the platform window receives the real position. // (i.e. that window->pos() reflects reality) @@ -99,15 +101,13 @@ namespace QTest inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000) { - QElapsedTimer timer; - timer.start(); - while (!window->isExposed()) { - int remaining = timeout - int(timer.elapsed()); - if (remaining <= 0) - break; + QDeadlineTimer timer(timeout); + int remaining = timeout; + while (!window->isExposed() && remaining > 0) { QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete); QTest::qSleep(10); + remaining = timer.remainingTime(); } return window->isExposed(); } diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 383f357206d..b68c5827320 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -189,7 +189,7 @@ void tst_QTimeLine::frameRate() void tst_QTimeLine::value() { - QTimeLine timeLine(5000); + QTimeLine timeLine(4500); // Should be at least 5% under 5000ms QCOMPARE(timeLine.currentValue(), 0.0); // Default speed From f823af43f243b1848fd4a838847317d0ff6d4fdf Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 10 Nov 2016 14:57:04 +0100 Subject: [PATCH 46/70] QVariant of nullptr should always be null Implements isNull for QVariants of a nullptr so they always return true to isNull(), instead of depending on how they were constructed. Task-number: QTBUG-58296 Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qvariant_p.h | 22 ++++++++++++++++++- .../corelib/kernel/qvariant/tst_qvariant.cpp | 11 ++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index bf88def4382..487949431c2 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -177,6 +177,26 @@ inline void v_clear(QVariant::Private *d, T* = 0) } +template +struct PrimitiveIsNull +{ +public: + static bool isNull(const QVariant::Private *d) + { + return d->is_null; + } +}; + +template <> +struct PrimitiveIsNull +{ +public: + static bool isNull(const QVariant::Private *) + { + return true; + } +}; + template class QVariantComparator { template::IsAccepted> @@ -268,7 +288,7 @@ class QVariantIsNull { static bool isNull(const QVariant::Private *d) { - return d->is_null; + return PrimitiveIsNull::isNull(d); } }; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 75fa424ab13..3a51e677687 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -400,6 +400,17 @@ void tst_QVariant::isNull() QVERIFY( !varLL.isNull() ); QVariant var7(QString::null); QVERIFY(var7.isNull()); + var7 = QVariant::fromValue(QString::null); + QVERIFY(var7.isNull()); + + QVariant var8(QMetaType::Nullptr, nullptr); + QVERIFY(var8.isNull()); + var8 = QVariant::fromValue(nullptr); + QVERIFY(var8.isNull()); + QVariant var9 = QVariant(QJsonValue(QJsonValue::Null)); + QVERIFY(var9.isNull()); + var9 = QVariant::fromValue(QJsonValue(QJsonValue::Null)); + QVERIFY(var9.isNull()); } void tst_QVariant::swap() From 51dafeda8c833134acf7da40f7ad58cec349ee30 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 25 Jan 2017 07:22:04 -0800 Subject: [PATCH 47/70] linux-icc: always compile applications as position-independent execs The problem isn't the compiler, but the linker, so we ought to turn this flag on for all ELF-based systems where we compile Qt with -Bsymbolic, but so far only the Intel compiler has been affected. We can turn it on as needed for other systems. The cause of the problem is the way that ICC materializes the pointer- to-member-function: it stores the full 2*sizeof(void*) data in an anonymous variable, so that it can load it in one go, such as one 16- byte SSE aligned load on 64-bit systems. That relocation in a data variable gets turned into a fixed-position copy relocation by the linker, which breaks the signal-identification mechanism. GCC and Clang are likely to be affected if anyone did: static const auto destroyed = &QObject::destroyed; QObject::connect(obj, destroyed, [](){}); Task-number: QTBUG-52439 Change-Id: I0d69eaf61af149db9574fffd149d0cfb08459c33 Reviewed-by: Olivier Goffart (Woboq GmbH) --- mkspecs/linux-icc/qmake.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 2c66e80db4b..8ca27670614 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -79,6 +79,7 @@ QMAKE_LINK = icpc QMAKE_LINK_SHLIB = icpc QMAKE_LFLAGS = QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_APP = -pie QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_SHLIB = -shared -shared-intel QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB From deef2d4e70c54ffe71304575e56095dd25cd55eb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Jan 2017 14:04:14 -0800 Subject: [PATCH 48/70] Fix warning about not calling the base class copy constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit error: base class ‘class QBasicAtomicPointer’ should be explicitly initialized in the copy constructor [-Werror=extra] Change-Id: I2bc52f3c7a574209b213fffd149b4b71f3006be5 Reviewed-by: Marc Mutz --- src/corelib/thread/qatomic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index bbfc11f6c05..f9eacbf6f02 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -176,6 +176,9 @@ public: } #endif inline QAtomicPointer(const QAtomicPointer &other) Q_DECL_NOTHROW +#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS + : QBasicAtomicPointer() +#endif { this->storeRelease(other.loadAcquire()); } From dcfeeef91ef17f15adb3f961f1abce3ef169b263 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 17 Jan 2017 14:01:00 -0800 Subject: [PATCH 49/70] Remove the -no-rtti option from configure It only applied to Windows (not MSVC, like the help said) and the build was broken with this option. So remove it, as we clearly never test this. [ChangeLog][Windows] The -no-rtti configure option was removed, as Qt 5.8 fails to build under that condition. To disable RTTI on user code, add to your .pro file: CONFIG += rtti_off. Change-Id: I2bc52f3c7a574209b213fffd149aae1b8d0cf9df Reviewed-by: Oswald Buddenhagen --- config_help.txt | 1 - configure.json | 7 ------- mkspecs/features/win32/default_pre.prf | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/config_help.txt b/config_help.txt index f711a01cb87..5ebeaf5af30 100644 --- a/config_help.txt +++ b/config_help.txt @@ -99,7 +99,6 @@ Build options: -c++std .... Select C++ standard [c++1z/c++14/c++11] (Not supported with MSVC) - -rtti ................ Build with Runtime Type Information [yes] (MSVC only) -sse2 ................ Use SSE2 instructions [auto] -sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512 diff --git a/configure.json b/configure.json index f9abdae8cad..7d04f0a5160 100644 --- a/configure.json +++ b/configure.json @@ -107,7 +107,6 @@ "reduce-relocations": { "type": "boolean", "name": "reduce_relocations" }, "release": { "type": "enum", "name": "debug", "values": { "yes": "no", "no": "yes" } }, "rpath": "boolean", - "rtti": "boolean", "sanitize": "sanitize", "sdk": "string", "separate-debug-info": { "type": "boolean", "name": "separate_debug_info" }, @@ -554,12 +553,6 @@ "autoDetect": false, "output": [ { "type": "varAppend", "name": "EXTRA_RPATHS", "value": "input.rpaths" } ] }, - "rtti": { - "label": "Build with RTTI", - "comment": "mkspecs/features/win32/default_pre.prf sets no-rtti. Follow default behavior of configure.exe by overriding with rtti.", - "condition": "config.win32", - "output": [ "publicConfig" ] - }, "force_asserts": { "label": "Force assertions", "autoDetect": false, diff --git a/mkspecs/features/win32/default_pre.prf b/mkspecs/features/win32/default_pre.prf index bdb72c0d897..a9b247e113a 100644 --- a/mkspecs/features/win32/default_pre.prf +++ b/mkspecs/features/win32/default_pre.prf @@ -1,2 +1,2 @@ -CONFIG = rtti_off incremental_off windows $$CONFIG +CONFIG = incremental_off windows $$CONFIG load(default_pre) From dfd7a0e41153315625883619a4abe84db1d29769 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 19 Dec 2016 11:28:40 -0800 Subject: [PATCH 50/70] Doc: add a note that UniqueConnection does not work for lambdas Task-number: QTBUG-52438 Change-Id: I3e4e5051937c40319d6efffd1491bef6feb6776e Reviewed-by: Martin Smith Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 63b02d2c0c1..c44e4b16b16 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2614,6 +2614,9 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM (exact same signal to the exact same slot on the same objects), the connection will fail and connect will return an invalid QMetaObject::Connection. + \note Qt::UniqueConnections do not work for lambdas, non-member functions + and functors; they only apply to connecting to member functions. + The optional \a type parameter describes the type of connection to establish. In particular, it determines whether a particular signal is delivered to a slot immediately or queued for delivery @@ -4665,7 +4668,10 @@ void qDeleteInEventHandler(QObject *o) Creates a connection of a given \a type from \a signal in \a sender object to \a functor to be placed in a specific event - loop of \a context, and returns a handle to the connection + loop of \a context, and returns a handle to the connection. + + \note Qt::UniqueConnections do not work for lambdas, non-member functions + and functors; they only apply to connecting to member functions. The signal must be a function declared as a signal in the header. The slot function can be any function or functor that can be connected From 3b8f3fb327fd80217e1caf7fbb8d2d41576edc3b Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Wed, 25 Jan 2017 20:19:43 +0200 Subject: [PATCH 51/70] QEventDispatcherWin32: remove tailings of Windows CE code It was automatically merged from 5.6 branch. Qt 5.8 does not support Windows CE. Change-Id: I6968f50ef568035c224851d595d6c057128491a7 Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qeventdispatcher_win.cpp | 22 --------------------- src/corelib/kernel/qeventdispatcher_win_p.h | 2 -- 2 files changed, 24 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 1a0efae2dc7..88dbe8e4f7f 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -96,9 +96,7 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) -#ifndef Q_OS_WINCE , activateNotifiersPosted(false) -#endif { } @@ -179,11 +177,9 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSockNot *sn = dict ? dict->value(wp) : 0; if (sn) { -#ifndef Q_OS_WINCE d->doWsaAsyncSelect(sn->fd, 0); d->active_fd[sn->fd].selected = false; d->postActivateSocketNotifiers(); -#endif if (type < 3) { QEvent event(QEvent::SockAct); QCoreApplication::sendEvent(sn->obj, &event); @@ -194,7 +190,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } } return 0; -#ifndef Q_OS_WINCE } else if (message == WM_QT_ACTIVATENOTIFIERS) { Q_ASSERT(d != 0); @@ -209,7 +204,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } d->activateNotifiersPosted = false; return 0; -#endif // !Q_OS_WINCE } else if (message == WM_QT_SENDPOSTEDEVENTS // we also use a Windows timer to send posted events when the message queue is full || (message == WM_TIMER @@ -444,13 +438,11 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event) WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event); } -#ifndef Q_OS_WINCE void QEventDispatcherWin32Private::postActivateSocketNotifiers() { if (!activateNotifiersPosted) activateNotifiersPosted = PostMessage(internalHwnd, WM_QT_ACTIVATENOTIFIERS, 0, 0); } -#endif // !Q_OS_WINCE void QEventDispatcherWin32::createInternalHwnd() { @@ -704,22 +696,16 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); -#ifndef Q_OS_WINCE if (sd.selected) { d->doWsaAsyncSelect(sockfd, 0); sd.selected = false; } -#endif // !Q_OS_WINCE sd.event |= event; } else { d->active_fd.insert(sockfd, QSockFd(event)); } -#ifndef Q_OS_WINCE d->postActivateSocketNotifiers(); -#else - d->doWsaAsyncSelect(sockfd, event); -#endif } void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) @@ -748,7 +734,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); -#ifndef Q_OS_WINCE if (sd.selected) d->doWsaAsyncSelect(sockfd, 0); const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; @@ -759,13 +744,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier sd.selected = false; d->postActivateSocketNotifiers(); } -#else - const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; - sd.event ^= event[type]; - d->doWsaAsyncSelect(sockfd, sd.event); - if (sd.event == 0) - d->active_fd.erase(it); -#endif // !Q_OS_WINCE } QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except }; diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 773315c04fe..df1513a43ab 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -185,10 +185,8 @@ public: QSNDict sn_write; QSNDict sn_except; QSFDict active_fd; -#ifndef Q_OS_WINCE bool activateNotifiersPosted; void postActivateSocketNotifiers(); -#endif void doWsaAsyncSelect(int socket, long event); QList winEventNotifierList; From 1f814caca3836c43a415c219ef57b1d046321635 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 10:39:50 +0100 Subject: [PATCH 52/70] Plug memleaks in tst_QAbstractItemView Styles need to be deleted manually... Change-Id: Ic4193d22a57801127e994062cade7cb9ef6f34d8 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../itemviews/qabstractitemview/tst_qabstractitemview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index bd6733e2d0e..426db265ae2 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1567,7 +1567,7 @@ void tst_QAbstractItemView::testChangeEditorState() QTableView view; view.setEditTriggers(QAbstractItemView::CurrentChanged); - view.setItemDelegate(new StateChangeDelegate); + view.setItemDelegate(new StateChangeDelegate(&view)); view.setModel(&model); centerOnScreen(&view); moveCursorAway(&view); @@ -1941,7 +1941,8 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode() QCOMPARE(view.horizontalScrollMode(), styleScrollMode); // Change style, get new value - view.setStyle(new ScrollModeProxyStyle(styleScrollMode)); + ScrollModeProxyStyle proxyStyle1(styleScrollMode); + view.setStyle(&proxyStyle1); auto proxyScrollMode = static_cast(view.style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, &view, 0)); QVERIFY(styleScrollMode != proxyScrollMode); QCOMPARE(view.verticalScrollMode(), proxyScrollMode); @@ -1953,7 +1954,8 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode() QCOMPARE(view.horizontalScrollMode(), proxyScrollMode); // Change style, won't change value for vertical, will change for horizontal - view.setStyle(new ScrollModeProxyStyle(proxyScrollMode)); + ScrollModeProxyStyle proxyStyle2(proxyScrollMode); + view.setStyle(&proxyStyle2); QCOMPARE(view.verticalScrollMode(), proxyScrollMode); QCOMPARE(view.horizontalScrollMode(), styleScrollMode); } From 9064d0b8a8da8ddb2223c405e5a1359288d49714 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 11:34:57 +0100 Subject: [PATCH 53/70] tst_QTreeWidget: plug memleaks Taken QTreeWidgetItems need to be deleted, as do items created without a parent, and widgets without parent. Change-Id: I7ffa69903af9a1b92ba308f9f9416aec1d6d975f Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index fcffaa0eb9d..f20805f97e8 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -554,16 +554,16 @@ void tst_QTreeWidget::removeChild() QFETCH(int, childCount); QFETCH(int, removeAt); - QTreeWidgetItem *root = new QTreeWidgetItem; + const QScopedPointer root(new QTreeWidgetItem); for (int i = 0; i < childCount; ++i) - new QTreeWidgetItem(root, QStringList(QString::number(i))); + new QTreeWidgetItem(root.data(), QStringList(QString::number(i))); QCOMPARE(root->childCount(), childCount); for (int j = 0; j < childCount; ++j) QCOMPARE(root->child(j)->text(0), QString::number(j)); - QTreeWidgetItem *remove = root->child(removeAt); - root->removeChild(remove); + const QScopedPointer remove(root->child(removeAt)); + root->removeChild(remove.data()); QCOMPARE(root->childCount(), childCount - 1); for (int k = 0; k < childCount; ++k) { @@ -574,7 +574,6 @@ void tst_QTreeWidget::removeChild() else if (k > removeAt) QCOMPARE(root->child(k - 1)->text(0), QString::number(k)); } - delete root; } void tst_QTreeWidget::setItemHidden() @@ -1954,9 +1953,9 @@ void tst_QTreeWidget::itemData() void tst_QTreeWidget::enableDisable() { - QTreeWidgetItem *itm = new QTreeWidgetItem(); + const QScopedPointer itm(new QTreeWidgetItem); for (int i = 0; i < 10; ++i) - new QTreeWidgetItem(itm); + new QTreeWidgetItem(itm.data()); // make sure all items are enabled QVERIFY(itm->flags() & Qt::ItemIsEnabled); @@ -2720,7 +2719,10 @@ void tst_QTreeWidget::setDisabled() children.append(new QTreeWidgetItem()); children.append(new QTreeWidgetItem()); children.append(new QTreeWidgetItem()); - i1 = top->takeChild(0); + { + const QScopedPointer taken(top->takeChild(0)); + QCOMPARE(taken.data(), i1); + } top->addChildren(children); QCOMPARE(top->child(0)->isDisabled(), false); @@ -2732,16 +2734,21 @@ void tst_QTreeWidget::setDisabled() QCOMPARE(top->child(1)->isDisabled(), true); QCOMPARE(top->child(1)->isDisabled(), true); - children = top->takeChildren(); - QCOMPARE(children.at(0)->isDisabled(), false); - QCOMPARE(children.at(1)->isDisabled(), false); - QCOMPARE(children.at(1)->isDisabled(), false); + struct Deleter { + QList items; + explicit Deleter(QList items) : items(std::move(items)) {} + ~Deleter() { qDeleteAll(items); } + }; + const Deleter takenChildren(top->takeChildren()); + QCOMPARE(takenChildren.items[0]->isDisabled(), false); + QCOMPARE(takenChildren.items[1]->isDisabled(), false); + QCOMPARE(takenChildren.items[1]->isDisabled(), false); } void tst_QTreeWidget::removeSelectedItem() { - QTreeWidget *w = new QTreeWidget(); + const QScopedPointer w(new QTreeWidget); w->setSortingEnabled(true); QTreeWidgetItem *first = new QTreeWidgetItem(); @@ -2767,15 +2774,13 @@ void tst_QTreeWidget::removeSelectedItem() QCOMPARE(selModel->hasSelection(), true); QCOMPARE(selModel->selectedRows().count(), 1); - QTreeWidgetItem *taken = w->takeTopLevelItem(2); + const QScopedPointer taken(w->takeTopLevelItem(2)); QCOMPARE(taken->text(0), QLatin1String("C")); QCOMPARE(selModel->hasSelection(), false); QCOMPARE(selModel->selectedRows().count(), 0); QItemSelection sel = selModel->selection(); QCOMPARE(selModel->isSelected(w->model()->index(0,0)), false); - - delete w; } class AnotherTreeWidget : public QTreeWidget @@ -2934,11 +2939,11 @@ void tst_QTreeWidget::sortAndSelect() void tst_QTreeWidget::defaultRowSizes() { - QTreeWidget *tw = new QTreeWidget(); + const QScopedPointer tw(new QTreeWidget); tw->setIconSize(QSize(50, 50)); tw->setColumnCount(6); for (int i=0; i<10; ++i) { - QTreeWidgetItem *it = new QTreeWidgetItem(tw); + auto it = new QTreeWidgetItem(tw.data()); for (int j=0; jcolumnCount() - 1; ++j) { it->setText(j, "This is a test"); } From 7e6e92063324e589aa01928efae72b16f2823481 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 11:45:25 +0100 Subject: [PATCH 54/70] Plug memleaks in tst_QTreeView Forgot to delete QAIMs without parent. Change-Id: I9c914e841123ee250fb977c45a84870463288d9b Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 80ef0879cc7..e2886cfcfe0 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -3796,25 +3796,24 @@ void tst_QTreeView::task248022_changeSelection() void tst_QTreeView::task245654_changeModelAndExpandAll() { QTreeView view; - QStandardItemModel *model = new QStandardItemModel; + QScopedPointer model(new QStandardItemModel); QStandardItem *top = new QStandardItem("top"); QStandardItem *sub = new QStandardItem("sub"); top->appendRow(sub); model->appendRow(top); - view.setModel(model); + view.setModel(model.data()); view.expandAll(); QApplication::processEvents(); QVERIFY(view.isExpanded(top->index())); //now let's try to delete the model //then repopulate and expand again - delete model; - model = new QStandardItemModel; + model.reset(new QStandardItemModel); top = new QStandardItem("top"); sub = new QStandardItem("sub"); top->appendRow(sub); model->appendRow(top); - view.setModel(model); + view.setModel(model.data()); view.expandAll(); QApplication::processEvents(); QVERIFY(view.isExpanded(top->index())); From e4b19bfb94630c7da37d150955ccc246498966cf Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 15:04:34 +0100 Subject: [PATCH 55/70] Plug memleaks in tst_QHeaderView The char* returned from QTest::toString() calls must be manually delete[]ed. Change-Id: Iad078e8741e3e97693b1a417693f414b3fb3ec09 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 1078dcc2e9c..7bfec2831de 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2523,7 +2523,8 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare const bool sanity_checks = true; if (sanity_checks) { QString msg = QString("sanity problem at ") + sline; - char *verifytext = QTest::toString(msg); + const QScopedArrayPointer holder(QTest::toString(msg)); + const auto verifytext = holder.data(); QVERIFY2(m_tableview->model()->rowCount() == view->count() , verifytext); QVERIFY2(view->visualIndex(lastindex + 1) <= 0, verifytext); // there is no such index in model @@ -2555,7 +2556,8 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; - char *verifytext = QTest::toString(msg); + const QScopedArrayPointer holder(QTest::toString(msg)); + const auto verifytext = holder.data(); QVERIFY2(chk_visual == x[0], verifytext); QVERIFY2(chk_logical == x[1], verifytext); From e15cb86b3bc2cb1ed777a741f4b9e23fdb829249 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 15:07:46 +0100 Subject: [PATCH 56/70] Plug remaining memleaks in tests/auto/widgets/itemviews ... on Linux AMD64 builds. Pass QObject parents to QObjects otherwise leaked. Change-Id: Ia4f0ad2fdc4ef62a3d35a2cfca74965f79692da3 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | 2 +- tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp | 2 +- tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 0720a4f7667..5b353bb2ae4 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1350,7 +1350,7 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck() } QTableView view; view.setModel(&model); - view.setItemDelegate(new TestItemDelegate); + view.setItemDelegate(new TestItemDelegate(&view)); view.show(); view.selectAll(); QVERIFY(QTest::qWaitForWindowExposed(&view)); diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 6eed21abb25..a89f8f3c8ae 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -1488,7 +1488,7 @@ void tst_QListView::task203585_selectAll() //we make sure that "select all" doesn't select the hidden items QListView view; view.setSelectionMode(QAbstractItemView::ExtendedSelection); - view.setModel(new QStringListModel( QStringList() << "foo")); + view.setModel(new QStringListModel(QStringList() << "foo", &view)); view.setRowHidden(0, true); view.selectAll(); QVERIFY(view.selectionModel()->selectedIndexes().isEmpty()); diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index eb93e4c167a..6547bb89859 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1629,7 +1629,7 @@ void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers() { QListWidget listWidget; listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed); - listWidget.setItemDelegate(new ItemDelegate); + listWidget.setItemDelegate(new ItemDelegate(&listWidget)); QListWidgetItem *item = new QListWidgetItem(QLatin1String("select an item (don't start editing)"), &listWidget); item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable); new QListWidgetItem(QLatin1String("try to type the letter 'c'"), &listWidget); From 940d667eb41958de120ee759323c67bd7385af0d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 4 Oct 2016 19:49:58 +0200 Subject: [PATCH 57/70] Plug leaks in tests/auto/dbus In tst_QDBusMetaObject::types(), hold a QMetaObject obtained from QDBusMetaObject::createMetaObject() in a QScopedPointer instead of leaking it. Use correct return value type. This fixes the remaining errors in GCC 6.1 Linux ASan runs of tests/auto/dbus. Change-Id: I1df7f8e42d45f40ecf381fe7b684a8ab5ebee675 Reviewed-by: Alex Blasche Reviewed-by: Thiago Macieira --- tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp b/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp index cb1c9401ba6..a4afae4b46b 100644 --- a/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp +++ b/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp @@ -370,8 +370,7 @@ void tst_QDBusMetaObject::types() QDBusError error; - QMetaObject *result = QDBusMetaObject::createMetaObject("local.Interface", xml, - map, error); + const QScopedPointer result(QDBusMetaObject::createMetaObject("local.Interface", xml, map, error)); QVERIFY2(result, qPrintable(error.message())); QCOMPARE(result->enumeratorCount(), 0); From 9ba16336c51c5843db7c39df30853449972f8ead Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 6 Oct 2016 20:57:16 +0200 Subject: [PATCH 58/70] QGuiApplication: fix misleading code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comment says "don't send event if nothing changed", but the condition it is attached to reads if (velocityOnly), which is totally opaque. Change the variable name to stationaryTouchPointChangedVelocity and drop the then-branch of the if, because it is duplicated in the following default case of the switch. The comment makes sense again, and GCC 7 is happy, too, because this whole issue was pointed out by its -Wimplicit-fallthrough, which is why I added the fall-through attribute, too. Change-Id: I0631a381095f8897c55d9440304f6aefbc021a9a Reviewed-by: Shawn Rutledge Reviewed-by: Sérgio Martins --- src/gui/kernel/qguiapplication.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 71f27db6b7d..3ba0d591021 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2472,7 +2472,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QWindow *window = e->window.data(); typedef QPair > StatesAndTouchPoints; QHash windowsNeedingEvents; - bool velocityOnly = false; + bool stationaryTouchPointChangedVelocity = false; for (int i = 0; i < e->points.count(); ++i) { QTouchEvent::TouchPoint touchPoint = e->points.at(i); @@ -2552,7 +2552,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (touchPoint.state() == Qt::TouchPointStationary) { if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { touchInfo.touchPoint.setVelocity(touchPoint.velocity()); - velocityOnly = true; + stationaryTouchPointChangedVelocity = true; } } else { touchInfo.touchPoint = touchPoint; @@ -2590,10 +2590,9 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; case Qt::TouchPointStationary: // don't send the event if nothing changed - if (velocityOnly) - eventType = QEvent::TouchUpdate; - else + if (!stationaryTouchPointChangedVelocity) continue; + Q_FALLTHROUGH(); default: eventType = QEvent::TouchUpdate; break; From b6967d0c11a6f559350c105973780445e253d6b3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 13 Jan 2017 09:56:59 +0100 Subject: [PATCH 59/70] XCB QPA: Fix QScreen::grabWindow(0) to return the current screen Previously, the code queried the window to be grabbed for the geometry and thus returned the entire virtual desktop for multi screen setups. Use the QPlatformScreen's geometry in case of WID = 0. Task-number: QTBUG-58110 Change-Id: I3a9c0b0b3ea057f5e58f272f5c3fd40fafc073ba Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 121 ++++++++++++----------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index d8facdbb842..0ad9c97521e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -678,85 +678,88 @@ void QXcbScreen::updateRefreshRate(xcb_randr_mode_t mode) } } -QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) const +static xcb_get_geometry_reply_t *getGeometryUnchecked(xcb_connection_t *connection, xcb_window_t window) +{ + const xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry_unchecked(connection, window); + return xcb_get_geometry_reply(connection, geometry_cookie, NULL); +} + +static inline bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, + int *x, int *y) +{ + const xcb_translate_coordinates_cookie_t translate_cookie = + xcb_translate_coordinates_unchecked(connection, child, parent, *x, *y); + xcb_translate_coordinates_reply_t *translate_reply = + xcb_translate_coordinates_reply(connection, translate_cookie, NULL); + if (!translate_reply) + return false; + *x = translate_reply->dst_x; + *y = translate_reply->dst_y; + free(translate_reply); + return true; +} + +QPixmap QXcbScreen::grabWindow(WId window, int xIn, int yIn, int width, int height) const { if (width == 0 || height == 0) return QPixmap(); - // TODO: handle multiple screens + int x = xIn; + int y = yIn; QXcbScreen *screen = const_cast(this); xcb_window_t root = screen->root(); - if (window == 0) - window = root; - - xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), window); - - xcb_get_geometry_reply_t *reply = - xcb_get_geometry_reply(xcb_connection(), geometry_cookie, NULL); - - if (!reply) { + xcb_get_geometry_reply_t *rootReply = getGeometryUnchecked(xcb_connection(), root); + if (!rootReply) return QPixmap(); + + const quint8 rootDepth = rootReply->depth; + free(rootReply); + + QSize windowSize; + quint8 effectiveDepth = 0; + if (window) { + xcb_get_geometry_reply_t *windowReply = getGeometryUnchecked(xcb_connection(), window); + if (!windowReply) + return QPixmap(); + windowSize = QSize(windowReply->width, windowReply->height); + effectiveDepth = windowReply->depth; + free(windowReply); + if (effectiveDepth == rootDepth) { + // if the depth of the specified window and the root window are the + // same, grab pixels from the root window (so that we get the any + // overlapping windows and window manager frames) + + // map x and y to the root window + if (!translate(xcb_connection(), window, root, &x, &y)) + return QPixmap(); + + window = root; + } + } else { + window = root; + effectiveDepth = rootDepth; + windowSize = m_geometry.size(); + x += m_geometry.x(); + y += m_geometry.y(); } if (width < 0) - width = reply->width - x; + width = windowSize.width() - xIn; if (height < 0) - height = reply->height - y; - - geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), root); - xcb_get_geometry_reply_t *root_reply = - xcb_get_geometry_reply(xcb_connection(), geometry_cookie, NULL); - - if (!root_reply) { - free(reply); - return QPixmap(); - } - - if (reply->depth == root_reply->depth) { - // if the depth of the specified window and the root window are the - // same, grab pixels from the root window (so that we get the any - // overlapping windows and window manager frames) - - // map x and y to the root window - xcb_translate_coordinates_cookie_t translate_cookie = - xcb_translate_coordinates_unchecked(xcb_connection(), window, root, x, y); - - xcb_translate_coordinates_reply_t *translate_reply = - xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, NULL); - - if (!translate_reply) { - free(reply); - free(root_reply); - return QPixmap(); - } - - x = translate_reply->dst_x; - y = translate_reply->dst_y; - - window = root; - - free(translate_reply); - free(reply); - reply = root_reply; - } else { - free(root_reply); - root_reply = 0; - } + height = windowSize.height() - yIn; xcb_get_window_attributes_reply_t *attributes_reply = xcb_get_window_attributes_reply(xcb_connection(), xcb_get_window_attributes_unchecked(xcb_connection(), window), NULL); - if (!attributes_reply) { - free(reply); + if (!attributes_reply) return QPixmap(); - } const xcb_visualtype_t *visual = screen->visualForId(attributes_reply->visual); free(attributes_reply); xcb_pixmap_t pixmap = xcb_generate_id(xcb_connection()); - xcb_create_pixmap(xcb_connection(), reply->depth, pixmap, window, width, height); + xcb_create_pixmap(xcb_connection(), effectiveDepth, pixmap, window, width, height); uint32_t gc_value_mask = XCB_GC_SUBWINDOW_MODE; uint32_t gc_value_list[] = { XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS }; @@ -766,9 +769,7 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) xcb_copy_area(xcb_connection(), window, pixmap, gc, x, y, 0, 0, width, height); - QPixmap result = qt_xcb_pixmapFromXPixmap(connection(), pixmap, width, height, reply->depth, visual); - - free(reply); + QPixmap result = qt_xcb_pixmapFromXPixmap(connection(), pixmap, width, height, effectiveDepth, visual); xcb_free_gc(xcb_connection(), gc); xcb_free_pixmap(xcb_connection(), pixmap); From a85ed40004e5bfe08b773737af176fbd22b529c9 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 25 Jan 2017 14:14:14 +0100 Subject: [PATCH 60/70] Doc: Documentation template: Bump copyright year Change-Id: Ic2dfce35f9bfabc94b170f3dfaa3172630918330 Reviewed-by: Leena Miettinen --- doc/global/config.qdocconf | 2 +- doc/global/html-footer-online.qdocconf | 2 +- doc/global/html-footer.qdocconf | 2 +- doc/global/qt-module-defaults-online.qdocconf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/global/config.qdocconf b/doc/global/config.qdocconf index ac9e7ac2746..0c22d70529e 100644 --- a/doc/global/config.qdocconf +++ b/doc/global/config.qdocconf @@ -3,7 +3,7 @@ dita.metadata.default.author = Qt Project dita.metadata.default.permissions = all dita.metadata.default.publisher = Qt Project -dita.metadata.default.copyryear = 2016 +dita.metadata.default.copyryear = 2017 dita.metadata.default.copyrholder = The Qt Company Ltd dita.metadata.default.audience = programmer diff --git a/doc/global/html-footer-online.qdocconf b/doc/global/html-footer-online.qdocconf index 86f75ab0732..d6cf5d2122d 100644 --- a/doc/global/html-footer-online.qdocconf +++ b/doc/global/html-footer-online.qdocconf @@ -78,7 +78,7 @@ HTML.footer += \ " \n" \ "\n" \ "\n" \ diff --git a/doc/global/html-footer.qdocconf b/doc/global/html-footer.qdocconf index d350bc47721..5a0fbd85e11 100644 --- a/doc/global/html-footer.qdocconf +++ b/doc/global/html-footer.qdocconf @@ -8,7 +8,7 @@ HTML.footer = \ "\n" \ "
\n" \ "

\n" \ - " © 2016 The Qt Company Ltd.\n" \ + " © 2017 The Qt Company Ltd.\n" \ " Documentation contributions included herein are the copyrights of\n" \ " their respective owners.
" \ " The documentation provided herein is licensed under the terms of the" \ diff --git a/doc/global/qt-module-defaults-online.qdocconf b/doc/global/qt-module-defaults-online.qdocconf index fb8c2618046..15c193d698c 100644 --- a/doc/global/qt-module-defaults-online.qdocconf +++ b/doc/global/qt-module-defaults-online.qdocconf @@ -5,7 +5,7 @@ HTML.footer = \ "

\n" \ "

\n" \ - " © 2016 The Qt Company Ltd.\n" \ + " © 2017 The Qt Company Ltd.\n" \ " Documentation contributions included herein are the copyrights of\n" \ " their respective owners. " \ " The documentation provided herein is licensed under the terms of the" \ From 8d752b5151c9890b76d50c4a479ab32dd0eca10c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 26 Jan 2017 10:28:41 +0100 Subject: [PATCH 61/70] Accept all formatting characters as valid input Amends 7896ae052ad2c0c6ae2ebfc64cc2f525185198a8. The previous change focused only on ZWJ and ZWNJ, but there are many other formatting characters that we need to support and that may be rejected by the German keyboard-hack. This opens up for all characters in the Other_Format category. Task-number: QTBUG-58364 Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696 Reviewed-by: Simon Hausmann Reviewed-by: Lars Knoll --- src/gui/text/qinputcontrol.cpp | 6 ++--- .../text/qinputcontrol/tst_qinputcontrol.cpp | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp index af21ee86ee2..2f7dcfcd2b3 100644 --- a/src/gui/text/qinputcontrol.cpp +++ b/src/gui/text/qinputcontrol.cpp @@ -62,9 +62,9 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const const QChar c = text.at(0); - // ZWNJ and ZWJ. This needs to go before the next test, since CTRL+SHIFT is - // used to input it on Windows. - if (c == QChar(0x200C) || c == QChar(0x200D)) + // Formatting characters such as ZWNJ, ZWJ, RLM, etc. This needs to go before the + // next test, since CTRL+SHIFT is sometimes used to input it on Windows. + if (c.category() == QChar::Other_Format) return true; // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards diff --git a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp index ad5ba6affb3..173e137d17f 100644 --- a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp +++ b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp @@ -59,6 +59,28 @@ void tst_QInputControl::isAcceptableInput_data() QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true; QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true; QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true; + QTest::newRow("rlm") << QString(QChar(0x200F)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rlm-with-ctrl") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rlm-with-ctrl-shift") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lrm") << QString(QChar(0x200E)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lrm-with-ctrl") << QString(QChar(0x200E)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lrm-with-ctrl-shift") << QString(QChar(0x200E)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("rlo") << QString(QChar(0x202E)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rlo-with-ctrl") << QString(QChar(0x202E)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rlo-with-ctrl-shift") << QString(QChar(0x202E)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lro") << QString(QChar(0x202D)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lro-with-ctrl") << QString(QChar(0x202D)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lro-with-ctrl-shift") << QString(QChar(0x202D)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lre") << QString(QChar(0x202B)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lre-with-ctrl") << QString(QChar(0x202B)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lre-with-ctrl-shift") << QString(QChar(0x202B)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("rle") << QString(QChar(0x202A)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rle-with-ctrl") << QString(QChar(0x202A)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rle-with-ctrl-shift") << QString(QChar(0x202A)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("pdf") << QString(QChar(0x202C)) << Qt::KeyboardModifiers() << true; + QTest::newRow("pdf-with-ctrl") << QString(QChar(0x202C)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("pdf-with-ctrl-shift") << QString(QChar(0x202C)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + } void tst_QInputControl::isAcceptableInput() From 798ed169d86a192c0e6efe63702992b26f7f0775 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Jan 2017 10:08:14 +0100 Subject: [PATCH 62/70] Fix printsupport dependencies This makes -no-feature-printer and -no-feature-combobox work. Change-Id: I1097ab0a81f1c92b808c3e36ced0db9117db559a Reviewed-by: Lars Knoll --- src/printsupport/configure.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index a4855212fd6..dfef0bcd6c6 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -28,13 +28,13 @@ "label": "CUPS", "purpose": "Provides support for the Common Unix Printing System.", "section": "Painting", - "condition": "libs.cups", + "condition": "libs.cups && features.printer", "output": [ "privateFeature", "feature" ] }, "cupsjobwidget": { "label": "CUPS job control widget", "section": "Widgets", - "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox", + "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox && features.combobox", "output": [ "privateFeature", "feature" ] }, "printer": { From 0d3b3534ee2828f760c4c9e79afa7336e57e12f8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Jan 2017 11:48:27 +0100 Subject: [PATCH 63/70] Fix build with -no-feature-lineedit Change-Id: I171aed5d134db88f211da0e1a6ce236e32f3c35c Reviewed-by: Lars Knoll --- src/widgets/accessible/rangecontrols.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp index 2f781fe619d..602d0c7e113 100644 --- a/src/widgets/accessible/rangecontrols.cpp +++ b/src/widgets/accessible/rangecontrols.cpp @@ -81,10 +81,14 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const QAccessibleInterface *QAccessibleAbstractSpinBox::lineEditIface() const { +#if QT_CONFIG(lineedit) // QAccessibleLineEdit is only used to forward the text functions if (!lineEdit) lineEdit = new QAccessibleLineEdit(abstractSpinBox()->lineEdit()); return lineEdit; +#else + return nullptr; +#endif } QString QAccessibleAbstractSpinBox::text(QAccessible::Text t) const From 1327526d8eae28926b9cb9168d88df614fe87355 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Jan 2017 11:48:47 +0100 Subject: [PATCH 64/70] Remove duplicated feature definition The "spinbox" feature was defined twice, and in two different ways. Change-Id: Iabc8939036e2166c5c5a417181ae8fb244829123 Reviewed-by: Lars Knoll --- src/widgets/configure.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 84500bff21e..e7007f71b78 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -173,7 +173,7 @@ "label": "QSpinBox", "purpose": "Provides spin boxes handling integers and discrete sets of values.", "section": "Widgets", - "condition": "features.spinwidget && features.lineedit && features.validator", + "condition": "features.lineedit && features.validator", "output": [ "publicFeature", "feature" ] }, "tabbar": { @@ -332,12 +332,6 @@ "condition": "features.graphicsview", "output": [ "publicFeature", "feature" ] }, - "spinbox": { - "label": "QSpinBox", - "purpose": "Provides spinbox control widgets.", - "section": "Widgets", - "output": [ "publicFeature", "feature" ] - }, "textedit": { "label": "QTextEdit", "purpose": "Supports rich text editing.", From 52d9fd74b13e7c730cd3f353bfbc7a64b15e9038 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 26 Jan 2017 14:26:39 +0100 Subject: [PATCH 65/70] Make custom colors in QColorDialog permanent [ChangeLog][QtWidgets][QColorDialog] Fixed long standing bug that prevented custom colors in QColorDialog to be stored in the settings. Task-number: QTBUG-58424 Change-Id: If3ee5eef75358d811f08e7ce52fb60622972ddd4 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qplatformdialoghelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index c36186b8153..5890eb4fb69 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -278,7 +278,7 @@ void QColorDialogStaticData::readSettings() void QColorDialogStaticData::writeSettings() const { #ifndef QT_NO_SETTINGS - if (!customSet) { + if (customSet) { QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]); From 0feeb6f6d2cfaa964763ca1fcab65672812b4eef Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 9 Jan 2017 22:42:30 +0000 Subject: [PATCH 66/70] Fix dock widget having the wrong parent after a drag When dragging a dock widget from a floating group to the main window reparentWidgets() is supposed to be called. It's usually triggered by some unrelated event, like a LayoutRequest. Instead of relying on luck for reparentWidgets() to get called be explicit, otherwise the dock widget that was dropped into main window will still have as parent the floating group window. The item.skip() condition seems overly restrictive. Task-number: QTBUG-58036 Change-Id: I65b5699e1acb6ca9bedb10620daa055fa9d91943 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockarealayout.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 30eaa73b9ef..b33f2dc798a 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2092,7 +2092,7 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent) const QDockAreaLayoutItem &item = item_list.at(i); if (item.flags & QDockAreaLayoutItem::GapItem) continue; - if (item.skip()) + if (!item.widgetItem && item.skip()) continue; if (item.subinfo) item.subinfo->reparentWidgets(parent); @@ -2608,7 +2608,9 @@ QLayoutItem *QDockAreaLayout::plug(const QList &path) Q_ASSERT(!path.isEmpty()); const int index = path.first(); Q_ASSERT(index >= 0 && index < QInternal::DockCount); - return docks[index].plug(path.mid(1)); + QLayoutItem *item = docks[index].plug(path.mid(1)); + docks[index].reparentWidgets(mainWindow); + return item; } QLayoutItem *QDockAreaLayout::unplug(const QList &path) From 6d5489f5df1220ac82d76bbee1f3caa93b34100d Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 25 Jan 2017 18:52:22 -0800 Subject: [PATCH 67/70] Apple: fix QMAKE_DEFAULT_INCDIRS so compiler invocations use the sysroot The compiler command line used to populate QMAKE_DEFAULT_INCDIRS must include the sysroot in order to generate the correct paths list. This fixes a regression introduced in afd8263 which in turn attempted to fix an earlier regression making it impossible to override the deployment target in user project files. Task-number: QTBUG-58325 Change-Id: I93e6b7ef90b2744dd2f03c77da31c692cb194976 Reviewed-by: Gabriel de Dietrich Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 15b08292359..6d96eaf6893 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -29,7 +29,18 @@ isEmpty($${target_prefix}.INCDIRS) { cmd_prefix = "set LC_ALL=C&" cmd_suffix = "NUL" } - output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$QMAKE_CXXFLAGS) -xc++ -E -v - 2>&1 $$cmd_suffix", lines) + + cxx_flags = $$QMAKE_CXXFLAGS + + # Manually inject the sysroot for Apple Platforms because its resolution + # normally does not happen until default_post.prf. This is especially + # important for moc to gain the correct default include directory list. + # While technically incorrect but without any likely practical effect, + # UIKit simulator platforms will see the device SDK's sysroot in + # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. + darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH + + output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ -E -v - 2>&1 $$cmd_suffix", lines) add_includes = false for (line, output) { line ~= s/^ *// # remove leading spaces From 20f7cfcbdab795b1730e3d1d14fc3833a7f5e705 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 26 Jan 2017 18:03:50 +0100 Subject: [PATCH 68/70] qnetworkproxy_mac - fix proxyAutoConfigCallback We have an invalid pointer dereference in our callback. Apple's docs are quite ambiguous, whatever we receive in our callback's 'client' parameter is our PACInfo, not clientContext's address. That's what we pass to CFNetworkExecuteProxyAutoConfigurationURL: "clientContext - A stream context containing a client info object and optionally retain and release callbacks for that object." This 'client info' is our PACInfo struct with 2 pointers. Now in a callback, 'client': "The client reference originally passed in the clientContext parameter of the ..." So apparently we should read this as "client info originally passed in ...." Otherwise incorrect cast results in invalid pointer (apparently the value of retain/release/copy pointers we carefully set to 0) and a crash on dereference. Task-number: QTBUG-56747 Change-Id: I89378f1582679638cd29a36c563e506d8f5af518 Reviewed-by: Gabriel de Dietrich --- src/network/kernel/qnetworkproxy_mac.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index c13a472b90d..92f91956b90 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -189,12 +189,19 @@ struct PACInfo { void proxyAutoConfigCallback(void *client, CFArrayRef proxylist, CFErrorRef error) { - PACInfo *info = reinterpret_cast(reinterpret_cast(client)->info); + Q_ASSERT(client); + + PACInfo *info = static_cast(client); info->done = true; - if (proxylist) + + if (error) { + CFRetain(error); + info->error = error; + } + if (proxylist) { CFRetain(proxylist); - info->proxies = proxylist; - info->error = error; + info->proxies = proxylist; + } } } // anon namespace From 9febc58d07cc19a7393b98fdafbc38ac25e52d6a Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Wed, 18 Jan 2017 21:54:26 +0900 Subject: [PATCH 69/70] Fix build without features.movie Change-Id: I244a618f8660262249455ee707b62e6355583a74 Reviewed-by: Lars Knoll --- src/gui/image/qmovie.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 1fdef4e230e..55ddd839b7e 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -170,11 +170,11 @@ \sa QMovie::stop() */ -#include "qglobal.h" +#include "qmovie.h" #ifndef QT_NO_MOVIE -#include "qmovie.h" +#include "qglobal.h" #include "qimage.h" #include "qimagereader.h" #include "qpixmap.h" From 02cc57f4edbae450ecfa8368052afa44f8aeee19 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Jan 2017 14:10:53 +0100 Subject: [PATCH 70/70] QKeySequenceEdit: Allow for the case where pressing SHIFT+letter gives a different letter On some keyboard layouts it is possible that pressing SHIFT+letter does not give the upper case version of the character. So we depend on QKeyMapper here to give us the right keysequence as then it will compare against a shortcut created with this combination then. Task-number: QTBUG-57928 Task-number: QTBUG-57931 Change-Id: I9421f3ab4d3f8d1ee42f9680200d4b017d551057 Reviewed-by: Oliver Wolff --- src/widgets/widgets/qkeysequenceedit.cpp | 32 +++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index 3252ce59414..4d86c7cfc77 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -43,6 +43,7 @@ #include "qboxlayout.h" #include "qlineedit.h" +#include QT_BEGIN_NAMESPACE @@ -80,15 +81,8 @@ void QKeySequenceEditPrivate::init() int QKeySequenceEditPrivate::translateModifiers(Qt::KeyboardModifiers state, const QString &text) { + Q_UNUSED(text); int result = 0; - // The shift modifier only counts when it is not used to type a symbol - // that is only reachable using the shift key anyway - if ((state & Qt::ShiftModifier) && (text.isEmpty() || - !text.at(0).isPrint() || - text.at(0).isLetterOrNumber() || - text.at(0).isSpace())) - result |= Qt::SHIFT; - if (state & Qt::ControlModifier) result |= Qt::CTRL; if (state & Qt::MetaModifier) @@ -272,7 +266,27 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e) if (d->keyNum >= QKeySequencePrivate::MaxKeyCount) return; - nextKey |= d->translateModifiers(e->modifiers(), e->text()); + if (e->modifiers() & Qt::ShiftModifier) { + QList possibleKeys = QKeyMapper::possibleKeys(e); + int pkTotal = possibleKeys.count(); + if (!pkTotal) + return; + bool found = false; + for (int i = 0; i < possibleKeys.size(); ++i) { + if (possibleKeys.at(i) - nextKey == int(e->modifiers()) + || (possibleKeys.at(i) == nextKey && e->modifiers() == Qt::ShiftModifier)) { + nextKey = possibleKeys.at(i); + found = true; + break; + } + } + // Use as fallback + if (!found) + nextKey = possibleKeys.first(); + } else { + nextKey |= d->translateModifiers(e->modifiers(), e->text()); + } + d->key[d->keyNum] = nextKey; d->keyNum++;