From 78a6b807195b5dee50f5f6b2e1a86f49af60cb39 Mon Sep 17 00:00:00 2001 From: Artem Pisarenko Date: Thu, 16 Jan 2020 14:47:00 +0600 Subject: [PATCH 01/71] Fix win32 support for linking against static builds in CMake CMake mkspec feature sets CMAKE_PRL_FILE_LOCATION_* values inconsistent with actual .prl file names being generated/installed, causing dependency extraction mechanism in Qt5BasicConfig.cmake.in to not work (function _qt5_$${CMAKE_MODULE_NAME}_process_prl_file silently fails to find file at given location and skips filling libs deps). [ChangeLog][CMake][Windows] Fixed linking with Qt static build Fixes: QTBUG-81401 Change-Id: I5861cc0c42163d898ba55ad83cbad1994dcb1db2 Reviewed-by: Alexandru Croitor --- mkspecs/features/create_cmake.prf | 41 ++++++++++--------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 346fbf2467c..0d93597012c 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -212,21 +212,17 @@ contains(CONFIG, plugin) { CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _) win32 { + CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl + CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl isEmpty(CMAKE_STATIC_TYPE) { CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.dll - CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl - CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl } else:mingw { CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.a - CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.prl - CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.prl } else { # MSVC static CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.lib - CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl - CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl } } else { mac { @@ -316,36 +312,25 @@ mac { CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.dll CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll + !isEmpty(CMAKE_STATIC_TYPE) { + CMAKE_STATIC_WINDOWS_BUILD = "true" + + CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl + CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl + } + mingw { CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a - !isEmpty(CMAKE_STATIC_TYPE) { - CMAKE_STATIC_WINDOWS_BUILD = "true" - CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a - CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a - - CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.prl - CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl - } else { - CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a - CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a - } + CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a + CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a } else { CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib - !isEmpty(CMAKE_STATIC_TYPE) { - CMAKE_STATIC_WINDOWS_BUILD = "true" - CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib - CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib - - CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl - CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl - } else { - CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib - CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib - } + CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib + CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib } } else { !isEmpty(CMAKE_STATIC_TYPE) { From 520f7bb8323814593b9733aee3b800884cd39dff Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 18 Jan 2020 16:07:21 +0800 Subject: [PATCH 02/71] Doc: Fix QSql*Model snippets - QSqlQueryModel docs contained a snippet about QSqlTableModel. - Snippet #25 was about QSqlTableModel, but it was previously unused. - This patch ensures that snippet code matches the corresponding text descriptions. Change-Id: I2a5ffbe0978ef9b8d0b027db59647b824e52d214 Reviewed-by: Samuel Gaist --- src/sql/doc/snippets/sqldatabase/sqldatabase.cpp | 10 +++++----- src/sql/models/qsqlquerymodel.cpp | 4 ++-- src/sql/models/qsqltablemodel.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp index bba0487452e..a45b5f409a0 100644 --- a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp +++ b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp @@ -249,16 +249,15 @@ void QSqlQueryModel_snippets() } //! [21] - QSqlTableModel model; - model.setTable("employee"); - model.select(); + QSqlQueryModel model; + model.setQuery("SELECT name, salary FROM employee"); int salary = model.record(4).value("salary").toInt(); //! [21] Q_UNUSED(salary); { //! [22] - int salary = model.data(model.index(4, 2)).toInt(); + int salary = model.data(model.index(4, 1)).toInt(); //! [22] Q_UNUSED(salary); } @@ -308,7 +307,8 @@ void QSqlTableModel_snippets() //! [25] QSqlTableModel model; model.setTable("employee"); - QString name = model.record(4).value("name").toString(); + model.select(); + int salary = model.record(4).value("salary").toInt(); //! [25] } } diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index c0b1061c6ba..31d0ec985dc 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -124,8 +124,8 @@ int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const \snippet sqldatabase/sqldatabase.cpp 21 The code snippet above extracts the \c salary field from record 4 in - the result set of the query \c{SELECT * from employee}. Assuming - that \c salary is column 2, we can rewrite the last line as follows: + the result set of the \c SELECT query. Since \c salary is the 2nd + column (or column index 1), we can rewrite the last line as follows: \snippet sqldatabase/sqldatabase.cpp 22 diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 4bc9a8c2f84..969194983e4 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -222,7 +222,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement, QSqlTableModel can also be used to access a database programmatically, without binding it to a view: - \snippet sqldatabase/sqldatabase.cpp 21 + \snippet sqldatabase/sqldatabase.cpp 25 The code snippet above extracts the \c salary field from record 4 in the result set of the query \c{SELECT * from employee}. From 21ee3b17b746f6d2e0e59836dfc4b9d0587a6bec Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Thu, 16 Jan 2020 16:00:02 +0100 Subject: [PATCH 03/71] Doc: Add the line-height CSS property to the list Apparently, it is one of the text CSS properties that Qt supports. Fixes: QTBUG-34053 Task-number: QTBUG-34053 Change-Id: I3076ab2f51f1519f41610b1e81dfecbb8dbc0256 Reviewed-by: Paul Wicking --- src/gui/doc/src/richtext.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index 24fd4240b34..d3197f159c5 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -1269,6 +1269,14 @@ \row \li \c word-spacing \li px \li Specifies an alternate spacing between each word. + \row \li \c line-height + \li [% | px | pt | cm] + \li Specifies the height of a line. It can be one of the + following: + \list + \li fixed line height in pixels, points, or centimeters. + \li a percent of the current font size. + \endlist \endtable \section1 Supported CSS Selectors From eb18be36ad013c80fe982a77b3eadb9791f96298 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 4 Dec 2019 10:55:42 +0100 Subject: [PATCH 04/71] Mark QApplication::globalStrut as deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This property is obsolete with today's user interface reality, and was never consistently implemented in all styles and widgets. Deprecating it for Qt 5.15 as preparating for removing the code for Qt 6. [ChangeLog][QtWidgets][QApplication] The globalStrut property has been deprecated and will be removed from Qt 6 Change-Id: Iaea88e563144481a395de6cf0745a512e386407d Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge Reviewed-by: Simon Hausmann --- src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp | 2 +- src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp | 2 +- src/widgets/kernel/qapplication.cpp | 1 + src/widgets/kernel/qapplication.h | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp index f1f51c0582a..138d0dfa1b9 100644 --- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) //! [3] QSize MyWidget::sizeHint() const { - return QSize(80, 25).expandedTo(QApplication::globalStrut()); + return QSize(80, 25); } //! [3] diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp index 5e1f0883e74..a7bce6d378b 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) //! [3] QSize MyWidget::sizeHint() const { - return QSize(80, 25).expandedTo(QApplication::globalStrut()); + return QSize(80, 25); } //! [3] diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index eea97b2c0bc..842c0ea9e6d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1224,6 +1224,7 @@ void QApplication::setColorSpec(int spec) \property QApplication::globalStrut \brief the minimum size that any GUI element that the user can interact with should have + \deprecated For example, no button should be resized to be smaller than the global strut size. The strut size should be considered when reimplementing GUI diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 27e743a28d4..6de72899f1a 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -79,7 +79,9 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication #if QT_CONFIG(wheelevent) Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines) #endif +#if QT_DEPRECATED_SINCE(5, 15) Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut) +#endif Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime) Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance) #ifndef QT_NO_STYLE_STYLESHEET @@ -158,8 +160,10 @@ public: static void setWheelScrollLines(int); static int wheelScrollLines(); #endif +#if QT_DEPRECATED_SINCE(5, 15) static void setGlobalStrut(const QSize &); static QSize globalStrut(); +#endif static void setStartDragTime(int ms); static int startDragTime(); From 477dc115670d7c122d6590b9be10e076ebff8d08 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Thu, 16 Jan 2020 20:26:03 +0100 Subject: [PATCH 05/71] QTabBar: fix QStyleOptionTab::position During 556712f511a02ff8101e648d2e6f0090231d4f3d a small regression was introduced which set a wrong value for QStyleOptionTab::position. Fixes: QTBUG-81393 Change-Id: Ie8c66186b1b79c97bf77c7b139e08840233b7b66 Reviewed-by: Timur Pocheptsov --- src/widgets/widgets/qtabbar.cpp | 2 +- .../widgets/widgets/qtabbar/tst_qtabbar.cpp | 36 +++++++++++++------ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index a7b115a1bc6..df480629dac 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -208,7 +208,7 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) option->selectedPosition = QStyleOptionTab::NotAdjacent; const bool paintBeginning = (tabIndex == firstVisible) || (dragInProgress && tabIndex == pressedIndex + 1); - const bool paintEnd = (tabIndex == lastVisible - 1) || (dragInProgress && tabIndex == pressedIndex - 1); + const bool paintEnd = (tabIndex == lastVisible) || (dragInProgress && tabIndex == pressedIndex - 1); if (paintBeginning) { if (paintEnd) option->position = QStyleOptionTab::OnlyOneTab; diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp index bc1496d0f60..e27600bad20 100644 --- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp @@ -33,6 +33,7 @@ #include #include +#include class tst_QTabBar : public QObject { @@ -279,30 +280,53 @@ void tst_QTabBar::hideTab() QTEST(tabbar.currentIndex(), "finalIndex"); } +class TabBar : public QTabBar +{ +public: + using QTabBar::QTabBar; + using QTabBar::initStyleOption; + using QTabBar::moveTab; +}; + void tst_QTabBar::hideAllTabs() { - QTabBar tabbar; + TabBar tabbar; + auto checkPositions = [&tabbar](const QVector &positions) + { + QStyleOptionTab option; + int iPos = 0; + for (int i = 0; i < tabbar.count(); ++i) { + if (!tabbar.isTabVisible(i)) + continue; + tabbar.initStyleOption(&option, i); + QCOMPARE(option.position, positions.at(iPos++)); + } + }; tabbar.addTab("foo"); tabbar.addTab("bar"); tabbar.addTab("baz"); tabbar.setCurrentIndex(0); + checkPositions({QStyleOptionTab::Beginning, QStyleOptionTab::Middle, QStyleOptionTab::End}); // Check we don't crash trying to hide an unexistant tab QSize prevSizeHint = tabbar.sizeHint(); tabbar.setTabVisible(3, false); + checkPositions({QStyleOptionTab::Beginning, QStyleOptionTab::Middle, QStyleOptionTab::End}); QCOMPARE(tabbar.currentIndex(), 0); QSize sizeHint = tabbar.sizeHint(); QVERIFY(sizeHint.width() == prevSizeHint.width()); prevSizeHint = sizeHint; tabbar.setTabVisible(1, false); + checkPositions({QStyleOptionTab::Beginning, QStyleOptionTab::End}); QCOMPARE(tabbar.currentIndex(), 0); sizeHint = tabbar.sizeHint(); QVERIFY(sizeHint.width() < prevSizeHint.width()); prevSizeHint = sizeHint; tabbar.setTabVisible(2, false); + checkPositions({QStyleOptionTab::OnlyOneTab}); QCOMPARE(tabbar.currentIndex(), 0); sizeHint = tabbar.sizeHint(); QVERIFY(sizeHint.width() < prevSizeHint.width()); @@ -571,14 +595,6 @@ void tst_QTabBar::selectionBehaviorOnRemove() QCOMPARE(tabbar.currentIndex(), expected); } -class TabBar : public QTabBar -{ - Q_OBJECT -public: - void callMoveTab(int from, int to){ moveTab(from, to); } -}; - - Q_DECLARE_METATYPE(QTabBar::Shape) void tst_QTabBar::moveTab_data() { @@ -613,7 +629,7 @@ void tst_QTabBar::moveTab() bar.setShape(shape); while(--tabs >= 0) bar.addTab(QString::number(tabs)); - bar.callMoveTab(from, to); + bar.moveTab(from, to); } From 4b875caa6b47df1e22214593acad95865910c5fe Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 20 Jan 2020 20:33:07 +1000 Subject: [PATCH 06/71] wasm: guard nonthreaded builds from using threading.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2873cb902d17632a923dc3bd1a6e8e01af1693d4 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmeventdispatcher.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp index d89cd78b285..ca8db9b2154 100644 --- a/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp +++ b/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp @@ -33,9 +33,11 @@ #include +#if QT_CONFIG(thread) #if (__EMSCRIPTEN_major__ > 1 || __EMSCRIPTEN_minor__ > 38 || __EMSCRIPTEN_minor__ == 38 && __EMSCRIPTEN_tiny__ >= 22) # define EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD #endif +#endif #ifdef EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD #include From dd23313d66846022894b56ad25b6c2c0fdb54762 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Jan 2020 16:02:31 +0100 Subject: [PATCH 07/71] eglfs: find correct framebuffer index even if device node is symlink Using the Vivante driver on a board with different device trees I found the need to let udev point me to the framebuffer actually connected to HDMI by adding a symlink. Since the extraction of the framebuffer index failed and always returned 0 the GUI still always showed up on the first framebuffer. Change-Id: Ib4aa0fdd6e85d296c17fd977921cbc78e52dcdcf Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/api/qeglfsdeviceintegration.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 81bad45cd2f..dbfb0e60580 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -52,6 +52,7 @@ #include #include #if QT_CONFIG(regularexpression) +# include # include #endif #include @@ -144,7 +145,12 @@ int QEglFSDeviceIntegration::framebufferIndex() const int fbIndex = 0; #if QT_CONFIG(regularexpression) QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); - QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName())); + QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName())); + QRegularExpressionMatch match; + if (fbinfo.isSymLink()) + match = fbIndexRx.match(fbinfo.symLinkTarget()); + else + match = fbIndexRx.match(fbinfo.fileName()); if (match.hasMatch()) fbIndex = match.captured(1).toInt(); #endif From f3ecda32e0f7bd21b44e7737d2939dcce2c26517 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 11 Dec 2019 14:50:40 +0100 Subject: [PATCH 08/71] Move QOpenGLPaintEngine and related classes from QtGui to QtOpenGL Also moves the openglwindow test to the opengl folder, as it makes use of these classes. Task-number: QTBUG-74409 Change-Id: Id9f0013cedcc8bd1e87122c005641d7298525045 Reviewed-by: Laszlo Agocs --- examples/gui/gui.pro | 2 -- examples/opengl/opengl.pro | 1 + .../{gui => opengl}/openglwindow/main.cpp | 0 .../openglwindow/openglwindow.cpp | 0 .../openglwindow/openglwindow.h | 0 .../openglwindow/openglwindow.pri | 1 + .../openglwindow/openglwindow.pro | 2 +- .../opengl/paintedwindow/paintedwindow.pro | 2 ++ .../widgets/painting/shared/arthurwidgets.cpp | 2 +- .../windowcontainer/windowcontainer.cpp | 2 +- .../windowcontainer/windowcontainer.pro | 2 +- src/gui/opengl/opengl.pri | 21 ------------------- src/opengl/opengl.pro | 21 +++++++++++++++++++ .../opengl/qopengl2pexvertexarray.cpp | 2 +- .../opengl/qopengl2pexvertexarray_p.h | 3 +-- .../opengl/qopenglcustomshaderstage.cpp | 2 +- .../opengl/qopenglcustomshaderstage_p.h | 6 +++--- .../opengl/qopenglengineshadermanager.cpp | 4 ++-- .../opengl/qopenglengineshadermanager_p.h | 7 +++---- .../opengl/qopenglengineshadersource_p.h | 3 +-- src/{gui => }/opengl/qopenglgradientcache.cpp | 4 ++-- src/{gui => }/opengl/qopenglgradientcache_p.h | 3 +-- src/{gui => }/opengl/qopenglpaintdevice.cpp | 4 ++-- src/{gui => }/opengl/qopenglpaintdevice.h | 6 +++--- src/{gui => }/opengl/qopenglpaintdevice_p.h | 5 ++--- src/{gui => }/opengl/qopenglpaintengine.cpp | 16 +++++++------- src/{gui => }/opengl/qopenglpaintengine_p.h | 5 ++--- src/{gui => }/opengl/qopenglshadercache_p.h | 4 ++-- src/{gui => }/opengl/qopengltexturecache.cpp | 4 ++-- src/{gui => }/opengl/qopengltexturecache_p.h | 6 +++--- .../opengl/qopengltextureglyphcache.cpp | 6 +++--- .../opengl/qopengltextureglyphcache_p.h | 6 +++--- .../opengl/qopengltextureuploader.cpp | 2 +- .../opengl/qopengltextureuploader_p.h | 6 +++--- src/opengl/qopenglwidget.cpp | 6 ++++-- src/opengl/qopenglwindow.cpp | 2 +- .../platforms/minimalegl/minimalegl.pro | 1 + .../minimalegl/qminimaleglbackingstore.cpp | 2 +- tests/auto/gui/qopengl/qopengl.pro | 2 +- tests/auto/gui/qopengl/tst_qopengl.cpp | 3 +-- tests/auto/other/lancelot/lancelot.pro | 1 + .../widgets/qopenglwidget/qopenglwidget.pro | 2 +- .../gui/painting/lancebench/lancebench.pro | 2 +- 43 files changed, 90 insertions(+), 91 deletions(-) rename examples/{gui => opengl}/openglwindow/main.cpp (100%) rename examples/{gui => opengl}/openglwindow/openglwindow.cpp (100%) rename examples/{gui => opengl}/openglwindow/openglwindow.h (100%) rename examples/{gui => opengl}/openglwindow/openglwindow.pri (87%) rename examples/{gui => opengl}/openglwindow/openglwindow.pro (55%) rename src/{gui => }/opengl/qopengl2pexvertexarray.cpp (99%) rename src/{gui => }/opengl/qopengl2pexvertexarray_p.h (98%) rename src/{gui => }/opengl/qopenglcustomshaderstage.cpp (98%) rename src/{gui => }/opengl/qopenglcustomshaderstage_p.h (95%) rename src/{gui => }/opengl/qopenglengineshadermanager.cpp (99%) rename src/{gui => }/opengl/qopenglengineshadermanager_p.h (98%) rename src/{gui => }/opengl/qopenglengineshadersource_p.h (99%) rename src/{gui => }/opengl/qopenglgradientcache.cpp (98%) rename src/{gui => }/opengl/qopenglgradientcache_p.h (97%) rename src/{gui => }/opengl/qopenglpaintdevice.cpp (99%) rename src/{gui => }/opengl/qopenglpaintdevice.h (95%) rename src/{gui => }/opengl/qopenglpaintdevice_p.h (94%) rename src/{gui => }/opengl/qopenglpaintengine.cpp (99%) rename src/{gui => }/opengl/qopenglpaintengine_p.h (98%) rename src/{gui => }/opengl/qopenglshadercache_p.h (96%) rename src/{gui => }/opengl/qopengltexturecache.cpp (98%) rename src/{gui => }/opengl/qopengltexturecache_p.h (95%) rename src/{gui => }/opengl/qopengltextureglyphcache.cpp (99%) rename src/{gui => }/opengl/qopengltextureglyphcache_p.h (97%) rename src/{gui => }/opengl/qopengltextureuploader.cpp (99%) rename src/{gui => }/opengl/qopengltextureuploader_p.h (95%) diff --git a/examples/gui/gui.pro b/examples/gui/gui.pro index b8080c20751..275adc804d4 100644 --- a/examples/gui/gui.pro +++ b/examples/gui/gui.pro @@ -6,5 +6,3 @@ CONFIG += no_docs_target SUBDIRS += analogclock SUBDIRS += rasterwindow -qtHaveModule(gui):qtConfig(opengl): \ - SUBDIRS += openglwindow diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 89b3e1d86e0..74c39a1e27e 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -2,6 +2,7 @@ TEMPLATE = subdirs SUBDIRS = hellowindow \ paintedwindow \ + openglwindow \ qopenglwindow qtHaveModule(widgets) { diff --git a/examples/gui/openglwindow/main.cpp b/examples/opengl/openglwindow/main.cpp similarity index 100% rename from examples/gui/openglwindow/main.cpp rename to examples/opengl/openglwindow/main.cpp diff --git a/examples/gui/openglwindow/openglwindow.cpp b/examples/opengl/openglwindow/openglwindow.cpp similarity index 100% rename from examples/gui/openglwindow/openglwindow.cpp rename to examples/opengl/openglwindow/openglwindow.cpp diff --git a/examples/gui/openglwindow/openglwindow.h b/examples/opengl/openglwindow/openglwindow.h similarity index 100% rename from examples/gui/openglwindow/openglwindow.h rename to examples/opengl/openglwindow/openglwindow.h diff --git a/examples/gui/openglwindow/openglwindow.pri b/examples/opengl/openglwindow/openglwindow.pri similarity index 87% rename from examples/gui/openglwindow/openglwindow.pri rename to examples/opengl/openglwindow/openglwindow.pri index 45b0b0cd299..30320df3b71 100644 --- a/examples/gui/openglwindow/openglwindow.pri +++ b/examples/opengl/openglwindow/openglwindow.pri @@ -1,3 +1,4 @@ +QT += opengl INCLUDEPATH += $$PWD SOURCES += $$PWD/openglwindow.cpp HEADERS += $$PWD/openglwindow.h diff --git a/examples/gui/openglwindow/openglwindow.pro b/examples/opengl/openglwindow/openglwindow.pro similarity index 55% rename from examples/gui/openglwindow/openglwindow.pro rename to examples/opengl/openglwindow/openglwindow.pro index 93f18f3d3f8..8b1ae71c14f 100644 --- a/examples/gui/openglwindow/openglwindow.pro +++ b/examples/opengl/openglwindow/openglwindow.pro @@ -3,5 +3,5 @@ include(openglwindow.pri) SOURCES += \ main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/gui/openglwindow +target.path = $$[QT_INSTALL_EXAMPLES]/opengl/openglwindow INSTALLS += target diff --git a/examples/opengl/paintedwindow/paintedwindow.pro b/examples/opengl/paintedwindow/paintedwindow.pro index 1846aa4049c..569eebe674c 100644 --- a/examples/opengl/paintedwindow/paintedwindow.pro +++ b/examples/opengl/paintedwindow/paintedwindow.pro @@ -1,3 +1,5 @@ +QT += opengl + HEADERS += paintedwindow.h SOURCES += paintedwindow.cpp main.cpp diff --git a/examples/widgets/painting/shared/arthurwidgets.cpp b/examples/widgets/painting/shared/arthurwidgets.cpp index c7c851270bd..e24130e4640 100644 --- a/examples/widgets/painting/shared/arthurwidgets.cpp +++ b/examples/widgets/painting/shared/arthurwidgets.cpp @@ -62,8 +62,8 @@ #include #include #include -#include #if QT_CONFIG(opengl) +#include #include #endif diff --git a/examples/widgets/windowcontainer/windowcontainer.cpp b/examples/widgets/windowcontainer/windowcontainer.cpp index b920c854200..f7c146e2a93 100644 --- a/examples/widgets/windowcontainer/windowcontainer.cpp +++ b/examples/widgets/windowcontainer/windowcontainer.cpp @@ -60,7 +60,7 @@ #include -// Making use of the class from the opengl example in gui. +// Making use of the class from the openglwindow example class Window : public OpenGLWindow { Q_OBJECT diff --git a/examples/widgets/windowcontainer/windowcontainer.pro b/examples/widgets/windowcontainer/windowcontainer.pro index 9ac7e4a5abf..664ac938a20 100644 --- a/examples/widgets/windowcontainer/windowcontainer.pro +++ b/examples/widgets/windowcontainer/windowcontainer.pro @@ -6,4 +6,4 @@ QT += widgets target.path = $$[QT_INSTALL_EXAMPLES]/widgets/windowcontainer INSTALLS += target -include(../../gui/openglwindow/openglwindow.pri) +include(../../opengl/openglwindow/openglwindow.pri) diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index 26060ea5df3..d9f0e0d6cc7 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -10,20 +10,9 @@ qtConfig(opengl) { opengl/qopenglfunctions.h \ opengl/qopenglframebufferobject.h \ opengl/qopenglframebufferobject_p.h \ - opengl/qopenglpaintdevice.h \ - opengl/qopenglpaintdevice_p.h \ opengl/qopenglbuffer.h \ opengl/qopenglshaderprogram.h \ opengl/qopenglextensions_p.h \ - opengl/qopenglgradientcache_p.h \ - opengl/qopengltexturecache_p.h \ - opengl/qopenglengineshadermanager_p.h \ - opengl/qopengl2pexvertexarray_p.h \ - opengl/qopenglpaintengine_p.h \ - opengl/qopenglengineshadersource_p.h \ - opengl/qopenglcustomshaderstage_p.h \ - opengl/qopengltextureglyphcache_p.h \ - opengl/qopenglshadercache_p.h \ opengl/qopenglversionfunctions.h \ opengl/qopenglversionfunctionsfactory_p.h \ opengl/qopenglvertexarrayobject.h \ @@ -31,7 +20,6 @@ qtConfig(opengl) { opengl/qopengltexture.h \ opengl/qopengltexture_p.h \ opengl/qopengltexturehelper_p.h \ - opengl/qopengltextureuploader_p.h \ opengl/qopenglpixeltransferoptions.h \ opengl/qopenglextrafunctions.h \ opengl/qopenglprogrambinarycache_p.h @@ -39,23 +27,14 @@ qtConfig(opengl) { SOURCES += opengl/qopengl.cpp \ opengl/qopenglfunctions.cpp \ opengl/qopenglframebufferobject.cpp \ - opengl/qopenglpaintdevice.cpp \ opengl/qopenglbuffer.cpp \ opengl/qopenglshaderprogram.cpp \ - opengl/qopenglgradientcache.cpp \ - opengl/qopengltexturecache.cpp \ - opengl/qopenglengineshadermanager.cpp \ - opengl/qopengl2pexvertexarray.cpp \ - opengl/qopenglpaintengine.cpp \ - opengl/qopenglcustomshaderstage.cpp \ - opengl/qopengltextureglyphcache.cpp \ opengl/qopenglversionfunctions.cpp \ opengl/qopenglversionfunctionsfactory.cpp \ opengl/qopenglvertexarrayobject.cpp \ opengl/qopengltextureblitter.cpp \ opengl/qopengltexture.cpp \ opengl/qopengltexturehelper.cpp \ - opengl/qopengltextureuploader.cpp \ opengl/qopenglpixeltransferoptions.cpp \ opengl/qopenglprogrambinarycache.cpp diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index a726db2be96..6c2a9698209 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -10,11 +10,32 @@ qtConfig(opengl): CONFIG += opengl qtConfig(opengles2): CONFIG += opengles2 HEADERS += \ + qopengl2pexvertexarray_p.h \ + qopenglcustomshaderstage_p.h \ qopengldebug.h \ + qopenglengineshadermanager_p.h \ + qopenglengineshadersource_p.h \ + qopenglgradientcache_p.h \ + qopenglpaintdevice.h \ + qopenglpaintdevice_p.h \ + qopenglpaintengine_p.h \ + qopenglshadercache_p.h \ + qopengltexturecache_p.h \ + qopengltextureglyphcache_p.h \ + qopengltextureuploader_p.h \ qopenglwindow.h \ qtopenglglobal.h SOURCES += \ + qopengl2pexvertexarray.cpp \ + qopenglcustomshaderstage.cpp \ + qopenglengineshadermanager.cpp \ + qopenglgradientcache.cpp \ + qopenglpaintdevice.cpp \ + qopenglpaintengine.cpp \ + qopengltexturecache.cpp \ + qopengltextureglyphcache.cpp \ + qopengltextureuploader.cpp \ qopenglwindow.cpp \ qopengldebug.cpp diff --git a/src/gui/opengl/qopengl2pexvertexarray.cpp b/src/opengl/qopengl2pexvertexarray.cpp similarity index 99% rename from src/gui/opengl/qopengl2pexvertexarray.cpp rename to src/opengl/qopengl2pexvertexarray.cpp index 04781f63c7f..df0fb764c91 100644 --- a/src/gui/opengl/qopengl2pexvertexarray.cpp +++ b/src/opengl/qopengl2pexvertexarray.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/opengl/qopengl2pexvertexarray_p.h similarity index 98% rename from src/gui/opengl/qopengl2pexvertexarray_p.h rename to src/opengl/qopengl2pexvertexarray_p.h index 5dc060ff3d0..3ef26e908d8 100644 --- a/src/gui/opengl/qopengl2pexvertexarray_p.h +++ b/src/opengl/qopengl2pexvertexarray_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,6 @@ #ifndef QOPENGL2PEXVERTEXARRAY_P_H #define QOPENGL2PEXVERTEXARRAY_P_H -#include #include #include diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/opengl/qopenglcustomshaderstage.cpp similarity index 98% rename from src/gui/opengl/qopenglcustomshaderstage.cpp rename to src/opengl/qopenglcustomshaderstage.cpp index a95a0a57673..7a32b2fbc00 100644 --- a/src/gui/opengl/qopenglcustomshaderstage.cpp +++ b/src/opengl/qopenglcustomshaderstage.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/opengl/qopenglcustomshaderstage_p.h similarity index 95% rename from src/gui/opengl/qopenglcustomshaderstage_p.h rename to src/opengl/qopenglcustomshaderstage_p.h index ce3e9efd237..255c115e3c3 100644 --- a/src/gui/opengl/qopenglcustomshaderstage_p.h +++ b/src/opengl/qopenglcustomshaderstage_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class QPainter; class QOpenGLCustomShaderStagePrivate; -class Q_GUI_EXPORT QOpenGLCustomShaderStage +class Q_OPENGL_EXPORT QOpenGLCustomShaderStage { Q_DECLARE_PRIVATE(QOpenGLCustomShaderStage) public: diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/opengl/qopenglengineshadermanager.cpp similarity index 99% rename from src/gui/opengl/qopenglengineshadermanager.cpp rename to src/opengl/qopenglengineshadermanager.cpp index a569975486e..09bd9ff0962 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/opengl/qopenglengineshadermanager.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -40,7 +40,7 @@ #include "qopenglengineshadermanager_p.h" #include "qopenglengineshadersource_p.h" #include "qopenglpaintengine_p.h" -#include "qopenglshadercache_p.h" +#include #include #include diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/opengl/qopenglengineshadermanager_p.h similarity index 98% rename from src/gui/opengl/qopenglengineshadermanager_p.h rename to src/opengl/qopenglengineshadermanager_p.h index 14c79f5de36..71e62142789 100644 --- a/src/gui/opengl/qopenglengineshadermanager_p.h +++ b/src/opengl/qopenglengineshadermanager_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -220,7 +220,6 @@ #ifndef QOPENGLENGINE_SHADER_MANAGER_H #define QOPENGLENGINE_SHADER_MANAGER_H -#include #include #include #include @@ -255,7 +254,7 @@ static const GLuint QT_PMV_MATRIX_3_ATTR = 5; class QOpenGLEngineShaderProg; -class Q_GUI_EXPORT QOpenGLEngineSharedShaders +class Q_OPENGL_EXPORT QOpenGLEngineSharedShaders { Q_GADGET public: @@ -406,7 +405,7 @@ public: } }; -class Q_GUI_EXPORT QOpenGLEngineShaderManager : public QObject +class Q_OPENGL_EXPORT QOpenGLEngineShaderManager : public QObject { Q_OBJECT public: diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/opengl/qopenglengineshadersource_p.h similarity index 99% rename from src/gui/opengl/qopenglengineshadersource_p.h rename to src/opengl/qopenglengineshadersource_p.h index 3ac599b6c23..49d17c8d79d 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/opengl/qopenglengineshadersource_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -52,7 +52,6 @@ #ifndef QOPENGL_ENGINE_SHADER_SOURCE_H #define QOPENGL_ENGINE_SHADER_SOURCE_H -#include #include "qopenglengineshadermanager_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/opengl/qopenglgradientcache.cpp similarity index 98% rename from src/gui/opengl/qopenglgradientcache.cpp rename to src/opengl/qopenglgradientcache.cpp index 3aa4c0d2e60..7a932a19bbc 100644 --- a/src/gui/opengl/qopenglgradientcache.cpp +++ b/src/opengl/qopenglgradientcache.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -44,7 +44,7 @@ #include #include #include "qopenglfunctions.h" -#include "qopenglextensions_p.h" +#include #ifndef GL_RGBA16 #define GL_RGBA16 0x805B diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/opengl/qopenglgradientcache_p.h similarity index 97% rename from src/gui/opengl/qopenglgradientcache_p.h rename to src/opengl/qopenglgradientcache_p.h index 1d34223bdd7..da070ae2337 100644 --- a/src/gui/opengl/qopenglgradientcache_p.h +++ b/src/opengl/qopenglgradientcache_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,6 @@ // We mean it. // -#include #include #include #include diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/opengl/qopenglpaintdevice.cpp similarity index 99% rename from src/gui/opengl/qopenglpaintdevice.cpp rename to src/opengl/qopenglpaintdevice.cpp index 3920a10467d..811425cf692 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/opengl/qopenglpaintdevice.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE \class QOpenGLPaintDevice \brief The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter. \since 5.0 - \inmodule QtGui + \inmodule QtOpenGL \ingroup painting-3D diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/opengl/qopenglpaintdevice.h similarity index 95% rename from src/gui/opengl/qopenglpaintdevice.h rename to src/opengl/qopenglpaintdevice.h index 54118f29262..f4e1ce4a2e5 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/opengl/qopenglpaintdevice.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -40,7 +40,7 @@ #ifndef QOPENGLPAINTDEVICE_H #define QOPENGLPAINTDEVICE_H -#include +#include #ifndef QT_NO_OPENGL @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QOpenGLPaintDevicePrivate; -class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice +class Q_OPENGL_EXPORT QOpenGLPaintDevice : public QPaintDevice { Q_DECLARE_PRIVATE(QOpenGLPaintDevice) public: diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/opengl/qopenglpaintdevice_p.h similarity index 94% rename from src/gui/opengl/qopenglpaintdevice_p.h rename to src/opengl/qopenglpaintdevice_p.h index 3683ebebaca..f4f02e7b573 100644 --- a/src/gui/opengl/qopenglpaintdevice_p.h +++ b/src/opengl/qopenglpaintdevice_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,6 @@ // We mean it. // -#include #include QT_BEGIN_NAMESPACE @@ -59,7 +58,7 @@ QT_BEGIN_NAMESPACE class QOpenGLContext; class QPaintEngine; -class Q_GUI_EXPORT QOpenGLPaintDevicePrivate +class Q_OPENGL_EXPORT QOpenGLPaintDevicePrivate { public: QOpenGLPaintDevicePrivate(const QSize &size); diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/opengl/qopenglpaintengine.cpp similarity index 99% rename from src/gui/opengl/qopenglpaintengine.cpp rename to src/opengl/qopenglpaintengine.cpp index b53c9a3eab0..4168067e8fa 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/opengl/qopenglpaintengine.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -62,8 +62,8 @@ // #define QT_OPENGL_CACHE_AS_VBOS -#include "qopenglgradientcache_p.h" -#include "qopengltexturecache_p.h" +#include +#include #include "qopenglpaintengine_p.h" #include "qopenglpaintdevice_p.h" @@ -81,9 +81,9 @@ #include #include -#include "qopenglengineshadermanager_p.h" -#include "qopengl2pexvertexarray_p.h" -#include "qopengltextureglyphcache_p.h" +#include +#include +#include #include @@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); +Q_OPENGL_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); ////////////////////////////////// Private Methods ////////////////////////////////////////// @@ -1348,7 +1348,7 @@ void QOpenGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) d->fill(path); } -Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/opengl/qopenglpaintengine_p.h similarity index 98% rename from src/gui/opengl/qopenglpaintengine_p.h rename to src/opengl/qopenglpaintengine_p.h index 81f17572b2c..9dc92e38105 100644 --- a/src/gui/opengl/qopenglpaintengine_p.h +++ b/src/opengl/qopenglpaintengine_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,6 @@ // We mean it. // -#include #include #include @@ -109,7 +108,7 @@ public: QRect rectangleClip; }; -class Q_GUI_EXPORT QOpenGL2PaintEngineEx : public QPaintEngineEx +class Q_OPENGL_EXPORT QOpenGL2PaintEngineEx : public QPaintEngineEx { Q_DECLARE_PRIVATE(QOpenGL2PaintEngineEx) public: diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/opengl/qopenglshadercache_p.h similarity index 96% rename from src/gui/opengl/qopenglshadercache_p.h rename to src/opengl/qopenglshadercache_p.h index 0f730602b0d..88efa342164 100644 --- a/src/gui/opengl/qopenglshadercache_p.h +++ b/src/opengl/qopenglshadercache_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,7 @@ #ifndef QOPENGLSHADERCACHE_P_H #define QOPENGLSHADERCACHE_P_H -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/opengl/qopengltexturecache.cpp similarity index 98% rename from src/gui/opengl/qopengltexturecache.cpp rename to src/opengl/qopengltexturecache.cpp index ef07dbe109a..5256c429e06 100644 --- a/src/gui/opengl/qopengltexturecache.cpp +++ b/src/opengl/qopengltexturecache.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qopengltexturecache_p.h" -#include "qopengltextureuploader_p.h" +#include #include #include #include diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/opengl/qopengltexturecache_p.h similarity index 95% rename from src/gui/opengl/qopengltexturecache_p.h rename to src/opengl/qopengltexturecache_p.h index 88ef06e744a..14e03ebea17 100644 --- a/src/gui/opengl/qopengltexturecache_p.h +++ b/src/opengl/qopengltexturecache_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,7 @@ #ifndef QOPENGLTEXTURECACHE_P_H #define QOPENGLTEXTURECACHE_P_H -#include +#include #include #include #include @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class QOpenGLCachedTexture; -class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource +class Q_OPENGL_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource { public: static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context); diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/opengl/qopengltextureglyphcache.cpp similarity index 99% rename from src/gui/opengl/qopengltextureglyphcache.cpp rename to src/opengl/qopengltextureglyphcache.cpp index 41027d26e05..66fd3a75077 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/opengl/qopengltextureglyphcache.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -38,9 +38,9 @@ ****************************************************************************/ #include "qopengltextureglyphcache_p.h" -#include "qopenglpaintengine_p.h" +#include #include "private/qopenglengineshadersource_p.h" -#include "qopenglextensions_p.h" +#include #include #include diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/opengl/qopengltextureglyphcache_p.h similarity index 97% rename from src/gui/opengl/qopengltextureglyphcache_p.h rename to src/opengl/qopengltextureglyphcache_p.h index 4bea4a463a7..15ecd6209bb 100644 --- a/src/gui/opengl/qopengltextureglyphcache_p.h +++ b/src/opengl/qopengltextureglyphcache_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #include #include #include @@ -107,7 +107,7 @@ public: int m_height; }; -class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache +class Q_OPENGL_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache { public: QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix, const QColor &color = QColor()); diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/opengl/qopengltextureuploader.cpp similarity index 99% rename from src/gui/opengl/qopengltextureuploader.cpp rename to src/opengl/qopengltextureuploader.cpp index 9e393bc47a5..469ddc56c17 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/opengl/qopengltextureuploader.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/gui/opengl/qopengltextureuploader_p.h b/src/opengl/qopengltextureuploader_p.h similarity index 95% rename from src/gui/opengl/qopengltextureuploader_p.h rename to src/opengl/qopengltextureuploader_p.h index 0dcf709d7e5..cea6d97658e 100644 --- a/src/gui/opengl/qopengltextureuploader_p.h +++ b/src/opengl/qopengltextureuploader_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -52,14 +52,14 @@ #define QOPENGLTEXTUREUPLOADER_P_H #include -#include +#include #include QT_BEGIN_NAMESPACE class QImage; -class Q_GUI_EXPORT QOpenGLTextureUploader +class Q_OPENGL_EXPORT QOpenGLTextureUploader { public: enum BindOption { diff --git a/src/opengl/qopenglwidget.cpp b/src/opengl/qopenglwidget.cpp index a6c63ae034e..91e9fd545d6 100644 --- a/src/opengl/qopenglwidget.cpp +++ b/src/opengl/qopenglwidget.cpp @@ -45,14 +45,16 @@ #include #include #include -#include #include #include +#include + #include #include #include -#include #include +#include + #include QT_BEGIN_NAMESPACE diff --git a/src/opengl/qopenglwindow.cpp b/src/opengl/qopenglwindow.cpp index 8cdf134bfdd..9328d9b46a6 100644 --- a/src/opengl/qopenglwindow.cpp +++ b/src/opengl/qopenglwindow.cpp @@ -39,7 +39,6 @@ #include "qopenglwindow.h" #include -#include #include #include #include @@ -47,6 +46,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index b7dde9069f6..3f6ae4e2487 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -21,6 +21,7 @@ HEADERS = qminimaleglintegration.h \ qminimaleglscreen.h qtConfig(opengl) { + QT += opengl SOURCES += qminimaleglbackingstore.cpp HEADERS += qminimaleglbackingstore.h } diff --git a/src/plugins/platforms/minimalegl/qminimaleglbackingstore.cpp b/src/plugins/platforms/minimalegl/qminimaleglbackingstore.cpp index dc8dd74312c..2319762f31a 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglbackingstore.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglbackingstore.cpp @@ -40,7 +40,7 @@ #include "qminimaleglbackingstore.h" #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro index 722c99ee0b3..604aa59d8a9 100644 --- a/tests/auto/gui/qopengl/qopengl.pro +++ b/tests/auto/gui/qopengl/qopengl.pro @@ -4,7 +4,7 @@ CONFIG += testcase TARGET = tst_qopengl -QT += gui-private core-private testlib +QT += opengl gui-private core-private testlib SOURCES += tst_qopengl.cpp diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index ede1e58a53c..3b39c8c4740 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -26,14 +26,13 @@ ** ****************************************************************************/ - +#include #include #include #include #include #include #include -#include #include #include #include diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index 6ece7315edd..5b9117983ab 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,6 +1,7 @@ CONFIG += testcase TARGET = tst_lancelot QT += testlib gui-private +qtConfig(opengl): QT += opengl SOURCES += tst_lancelot.cpp \ paintcommands.cpp diff --git a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro index 039f5a71b8f..f78dc510bff 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro +++ b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro @@ -1,5 +1,5 @@ CONFIG += testcase TARGET = tst_qopenglwidget -QT += opengl gui-private core-private testlib widgets +QT += opengl opengl-private gui-private core-private testlib widgets SOURCES += tst_qopenglwidget.cpp diff --git a/tests/benchmarks/gui/painting/lancebench/lancebench.pro b/tests/benchmarks/gui/painting/lancebench/lancebench.pro index 6458c508613..5647d26de34 100644 --- a/tests/benchmarks/gui/painting/lancebench/lancebench.pro +++ b/tests/benchmarks/gui/painting/lancebench/lancebench.pro @@ -2,7 +2,7 @@ TEMPLATE = app TARGET = tst_bench_lancebench QT += testlib gui-private - +qtConfig(opengl): QT += opengl SOURCES += tst_lancebench.cpp From 85e3e88e1e68d9834346593c6b4819694f8a1a59 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 11 Feb 2019 11:02:15 +0100 Subject: [PATCH 09/71] Handle wide images in raster engine QImages internally use a qsizetype bytes_per_line, so should QRasterBuffer, even if this won't be relevant until Qt 6. Task-number: QTBUG-73731 Fixes: QTBUG-75082 Change-Id: Id296795d54f3ff36c48c1ebae0594a72b8e33b52 Reviewed-by: Albert Astals Cid Reviewed-by: Eirik Aavitsland --- src/gui/painting/qpaintengine_raster_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 089aadc3f71..1244ea67099 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -434,14 +434,14 @@ public: QImage::Format prepare(QImage *image); - uchar *scanLine(int y) { Q_ASSERT(y>=0); Q_ASSERT(y=0); Q_ASSERT(y - int stride() { return bytes_per_line / sizeof(T); } + int stride() { return static_cast(bytes_per_line / sizeof(T)); } uchar *buffer() const { return m_buffer; } @@ -456,7 +456,7 @@ public: private: int m_width; int m_height; - int bytes_per_line; + qsizetype bytes_per_line; int bytes_per_pixel; uchar *m_buffer; }; From 0a4c5b5119ccefc355fe737f03ec330e70c33ec9 Mon Sep 17 00:00:00 2001 From: Alexandra Cherdantseva Date: Fri, 17 Jan 2020 12:32:27 +0300 Subject: [PATCH 10/71] wasm: fix redundant string conversions between wasm and JavaScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid redundant conversions from UTF16 to UTF8 to UTF16 with help of new class QWasmString static methods: + QWasmString::fromQString to convert QString to js string using js Module.UTF16ToString + QWasmString::toQString to convert js string to QString using js Module.stringToUTF16 Fixed document.getElementById calls for cavasId with unicode characters. Change-Id: I3fc55bfeb6aeda75fa3acd85d22cea667b542f38 Reviewed-by: Morten Johan Sørvig Reviewed-by: Lorn Potter --- mkspecs/wasm-emscripten/qmake.conf | 1 + src/plugins/platforms/wasm/qwasmclipboard.cpp | 38 ++++++------ src/plugins/platforms/wasm/qwasmcursor.cpp | 7 ++- .../platforms/wasm/qwasmeventtranslator.cpp | 6 +- .../platforms/wasm/qwasmintegration.cpp | 11 ++-- src/plugins/platforms/wasm/qwasmscreen.cpp | 4 +- src/plugins/platforms/wasm/qwasmservices.cpp | 6 +- src/plugins/platforms/wasm/qwasmstring.cpp | 61 +++++++++++++++++++ src/plugins/platforms/wasm/qwasmstring.h | 45 ++++++++++++++ src/plugins/platforms/wasm/wasm.pro | 6 +- 10 files changed, 151 insertions(+), 34 deletions(-) create mode 100644 src/plugins/platforms/wasm/qwasmstring.cpp create mode 100644 src/plugins/platforms/wasm/qwasmstring.h diff --git a/mkspecs/wasm-emscripten/qmake.conf b/mkspecs/wasm-emscripten/qmake.conf index 48c3fb7359b..f4e95014158 100644 --- a/mkspecs/wasm-emscripten/qmake.conf +++ b/mkspecs/wasm-emscripten/qmake.conf @@ -35,6 +35,7 @@ EMCC_COMMON_LFLAGS += \ -s USE_WEBGL2=1 \ -s NO_EXIT_RUNTIME=0 \ -s ERROR_ON_UNDEFINED_SYMBOLS=1 \ + -s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \ --bind # The -s arguments can also be used with release builds, diff --git a/src/plugins/platforms/wasm/qwasmclipboard.cpp b/src/plugins/platforms/wasm/qwasmclipboard.cpp index fb46f1534f3..f02c2c6ccb8 100644 --- a/src/plugins/platforms/wasm/qwasmclipboard.cpp +++ b/src/plugins/platforms/wasm/qwasmclipboard.cpp @@ -29,6 +29,7 @@ #include "qwasmclipboard.h" #include "qwasmwindow.h" +#include "qwasmstring.h" #include #include @@ -40,22 +41,22 @@ using namespace emscripten; // there has got to be a better way... -static QByteArray g_clipboardArray; -static QByteArray g_clipboardFormat; +static QString g_clipboardText; +static QString g_clipboardFormat; static val getClipboardData() { - return val(g_clipboardArray.constData()); + return QWasmString::fromQString(g_clipboardText); } static val getClipboardFormat() { - return val(g_clipboardFormat.constData()); + return QWasmString::fromQString(g_clipboardFormat); } static void pasteClipboardData(emscripten::val format, emscripten::val dataPtr) { - QString formatString = QString::fromStdString(format.as()); + QString formatString = QWasmString::toQString(format); QByteArray dataArray = QByteArray::fromStdString(dataPtr.as()); QMimeData *mMimeData = new QMimeData; mMimeData->setData(formatString, dataArray); @@ -102,11 +103,10 @@ static void qClipboardPasteTo(val event) bool hasClipboardApi = QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi; val clipdata = hasClipboardApi ? val::global("Module").call("qtGetClipboardData") : - event["clipboardData"].call("getData", std::string("text")); + event["clipboardData"].call("getData", val("text")); - const std::string data = clipdata.as(); - if (data.length() > 0) { - QString qstr = QString::fromStdString(data); + const QString qstr = QWasmString::toQString(clipdata); + if (qstr.length() > 0) { QMimeData *mMimeData = new QMimeData; mMimeData->setText(qstr); QWasmClipboard::qWasmClipboardPaste(mMimeData); @@ -133,7 +133,7 @@ QWasmClipboard::QWasmClipboard() QWasmClipboard::~QWasmClipboard() { - g_clipboardArray.clear(); + g_clipboardText.clear(); g_clipboardFormat.clear(); } @@ -148,11 +148,11 @@ QMimeData* QWasmClipboard::mimeData(QClipboard::Mode mode) void QWasmClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode) { if (mimeData->hasText()) { - g_clipboardFormat = mimeData->formats().at(0).toUtf8(); - g_clipboardArray = mimeData->text().toUtf8(); + g_clipboardFormat = mimeData->formats().at(0); + g_clipboardText = mimeData->text(); } else if (mimeData->hasHtml()) { - g_clipboardFormat =mimeData->formats().at(0).toUtf8(); - g_clipboardArray = mimeData->html().toUtf8(); + g_clipboardFormat = mimeData->formats().at(0); + g_clipboardText = mimeData->html(); } QPlatformClipboard::setMimeData(mimeData, mode); @@ -199,13 +199,13 @@ void QWasmClipboard::installEventHandlers(const QString &canvasId) // Fallback path for browsers which do not support direct clipboard access val document = val::global("document"); - val canvas = document.call("getElementById", val(canvasId.toUtf8().constData())); + val canvas = document.call("getElementById", QWasmString::fromQString(canvasId)); - canvas.call("addEventListener", std::string("cut"), + canvas.call("addEventListener", val("cut"), val::module_property("qtClipboardCutTo")); - canvas.call("addEventListener", std::string("copy"), + canvas.call("addEventListener", val("copy"), val::module_property("qtClipboardCopyTo")); - canvas.call("addEventListener", std::string("paste"), + canvas.call("addEventListener", val("paste"), val::module_property("qtClipboardPasteTo")); } @@ -226,6 +226,6 @@ void QWasmClipboard::writeTextToClipboard() val txt = module.call("qtGetClipboardData"); val format = module.call("qtGetClipboardFormat"); val navigator = val::global("navigator"); - navigator["clipboard"].call("writeText", txt.as()); + navigator["clipboard"].call("writeText", txt); } } diff --git a/src/plugins/platforms/wasm/qwasmcursor.cpp b/src/plugins/platforms/wasm/qwasmcursor.cpp index c04fa6441a6..616456b2fab 100644 --- a/src/plugins/platforms/wasm/qwasmcursor.cpp +++ b/src/plugins/platforms/wasm/qwasmcursor.cpp @@ -29,6 +29,7 @@ #include "qwasmcursor.h" #include "qwasmscreen.h" +#include "qwasmstring.h" #include #include @@ -56,11 +57,11 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window) htmlCursorName = "auto"; // Set cursor on the canvas - QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8(); + val jsCanvasId = QWasmString::fromQString(QWasmScreen::get(screen)->canvasId()); val document = val::global("document"); - val canvas = document.call("getElementById", val(canvasId.constData())); + val canvas = document.call("getElementById", jsCanvasId); val canvasStyle = canvas["style"]; - canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData())); + canvasStyle.set("cursor", val(htmlCursorName.constData())); } QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape) diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index 8b7d00082f1..1ccac87afa0 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -32,6 +32,7 @@ #include "qwasmcompositor.h" #include "qwasmintegration.h" #include "qwasmclipboard.h" +#include "qwasmstring.h" #include #include @@ -355,9 +356,10 @@ void QWasmEventTranslator::initEventHandlers() if (emscripten::val::global("window")["safari"].isUndefined()) { val document = val::global("document"); - val canvas = document.call("getElementById", val(canvasId)); + val jsCanvasId = QWasmString::fromQString(screen()->canvasId()); + val canvas = document.call("getElementById", jsCanvasId); canvas.call("addEventListener", - std::string("wheel"), + val("wheel"), val::module_property("qtMouseWheelEvent")); } } diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 1e9f68027c0..fd53cd0baef 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -36,6 +36,7 @@ #include "qwasmclipboard.h" #include "qwasmservices.h" #include "qwasmoffscreensurface.h" +#include "qwasmstring.h" #include "qwasmwindow.h" #ifndef QT_NO_OPENGL @@ -67,19 +68,19 @@ static void browserBeforeUnload(emscripten::val) static void addCanvasElement(emscripten::val canvas) { - QString canvasId = QString::fromStdString(canvas["id"].as()); + QString canvasId = QWasmString::toQString(canvas["id"]); QWasmIntegration::get()->addScreen(canvasId); } static void removeCanvasElement(emscripten::val canvas) { - QString canvasId = QString::fromStdString(canvas["id"].as()); + QString canvasId = QWasmString::toQString(canvas["id"]); QWasmIntegration::get()->removeScreen(canvasId); } static void resizeCanvasElement(emscripten::val canvas) { - QString canvasId = QString::fromStdString(canvas["id"].as()); + QString canvasId = QWasmString::toQString(canvas["id"]); QWasmIntegration::get()->resizeScreen(canvasId); } @@ -115,11 +116,11 @@ QWasmIntegration::QWasmIntegration() int screenCount = qtCanvaseElements["length"].as(); for (int i = 0; i < screenCount; ++i) { emscripten::val canvas = qtCanvaseElements[i].as(); - QString canvasId = QString::fromStdString(canvas["id"].as()); + QString canvasId = QWasmString::toQString(canvas["id"]); addScreen(canvasId); } } else if (!canvas.isUndefined()){ - QString canvasId = QString::fromStdString(canvas["id"].as()); + QString canvasId = QWasmString::toQString(canvas["id"]); addScreen(canvasId); } diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index fe44fdb0963..d407111c2f9 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -32,6 +32,8 @@ #include "qwasmeventtranslator.h" #include "qwasmcompositor.h" #include "qwasmintegration.h" +#include "qwasmstring.h" + #include #include @@ -184,7 +186,7 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize() QSizeF canvasSize = cssSize * devicePixelRatio(); val document = val::global("document"); - val canvas = document.call("getElementById", val(canvasId.constData())); + val canvas = document.call("getElementById", QWasmString::fromQString(m_canvasId)); canvas.set("width", canvasSize.width()); canvas.set("height", canvasSize.height()); diff --git a/src/plugins/platforms/wasm/qwasmservices.cpp b/src/plugins/platforms/wasm/qwasmservices.cpp index 9328b8c0654..4eee3fe9723 100644 --- a/src/plugins/platforms/wasm/qwasmservices.cpp +++ b/src/plugins/platforms/wasm/qwasmservices.cpp @@ -28,6 +28,8 @@ ****************************************************************************/ #include "qwasmservices.h" +#include "qwasmstring.h" + #include #include @@ -37,8 +39,8 @@ QT_BEGIN_NAMESPACE bool QWasmServices::openUrl(const QUrl &url) { - QByteArray utf8Url = url.toString().toUtf8(); - emscripten::val::global("window").call("open", emscripten::val(utf8Url.constData()), emscripten::val("_blank")); + emscripten::val jsUrl = QWasmString::fromQString(url.toString()); + emscripten::val::global("window").call("open", jsUrl, emscripten::val("_blank")); return true; } diff --git a/src/plugins/platforms/wasm/qwasmstring.cpp b/src/plugins/platforms/wasm/qwasmstring.cpp new file mode 100644 index 00000000000..05b571c4594 --- /dev/null +++ b/src/plugins/platforms/wasm/qwasmstring.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwasmstring.h" + +QT_BEGIN_NAMESPACE + +using namespace emscripten; + +val QWasmString::fromQString(const QString &str) +{ + static const val UTF16ToString( + val::global("Module")["UTF16ToString"]); + + auto ptr = quintptr(str.utf16()); + return UTF16ToString(val(ptr)); +} + +QString QWasmString::toQString(const val &v) +{ + QString result; + if (!v.isString()) + return result; + + static const val stringToUTF16( + val::global("Module")["stringToUTF16"]); + static const val length("length"); + + result.resize(v[length].as()); + auto ptr = quintptr(result.utf16()); + stringToUTF16(v, val(ptr)); + return result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/wasm/qwasmstring.h b/src/plugins/platforms/wasm/qwasmstring.h new file mode 100644 index 00000000000..de5da928304 --- /dev/null +++ b/src/plugins/platforms/wasm/qwasmstring.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#pragma once + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWasmString +{ +public: + static emscripten::val fromQString(const QString &str); + static QString toQString(const emscripten::val &v); +}; +QT_END_NAMESPACE + diff --git a/src/plugins/platforms/wasm/wasm.pro b/src/plugins/platforms/wasm/wasm.pro index f8c81755257..a12ae068338 100644 --- a/src/plugins/platforms/wasm/wasm.pro +++ b/src/plugins/platforms/wasm/wasm.pro @@ -23,7 +23,8 @@ SOURCES = \ qwasmtheme.cpp \ qwasmclipboard.cpp \ qwasmservices.cpp \ - qwasmoffscreensurface.cpp + qwasmoffscreensurface.cpp \ + qwasmstring.cpp HEADERS = \ qwasmintegration.h \ @@ -39,7 +40,8 @@ HEADERS = \ qwasmtheme.h \ qwasmclipboard.h \ qwasmservices.h \ - qwasmoffscreensurface.h + qwasmoffscreensurface.h \ + qwasmstring.h wasmfonts.files = \ ../../../3rdparty/wasm/Vera.ttf \ From 751d0ace96a25a7362fe0a805f1aa22fa0aa77c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Jan 2020 17:37:23 +0100 Subject: [PATCH 11/71] Blacklist tst_QAbstractItemView::task200665_itemEntered on macOS Task-number: QTBUG-75786 Change-Id: I74720b4015e38c846dbc5c6a93f056f8deb3552a Reviewed-by: Simon Hausmann --- tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST diff --git a/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST b/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST new file mode 100644 index 00000000000..1233bec1665 --- /dev/null +++ b/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST @@ -0,0 +1,2 @@ +[task200665_itemEntered] +macos # Can't move cursor (QTBUG-76312) From 14690e9cf1bff2fed17333241bb7bc6422437f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Jan 2020 17:39:40 +0100 Subject: [PATCH 12/71] Blacklist two tst_QScroller tests on macOS Task-number: QTBUG-75786 Change-Id: I43e0a9a6e28a67f6aa1f2adaecd60ed0d65601d4 Reviewed-by: Simon Hausmann --- tests/auto/widgets/util/qscroller/BLACKLIST | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/auto/widgets/util/qscroller/BLACKLIST diff --git a/tests/auto/widgets/util/qscroller/BLACKLIST b/tests/auto/widgets/util/qscroller/BLACKLIST new file mode 100644 index 00000000000..347ab6440bb --- /dev/null +++ b/tests/auto/widgets/util/qscroller/BLACKLIST @@ -0,0 +1,5 @@ +[scrollTo] +macos + +[scroll] +macos From f047c44e71762c3203c2e9144ce6d64208490781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Jan 2020 17:51:21 +0100 Subject: [PATCH 13/71] Extend blacklisting for a few tests to include all macOS versions Task-number: QTBUG-75786 Change-Id: I06867de99a19f9e46ac0eeea10a7365a30c49c6d Reviewed-by: Simon Hausmann --- tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST | 2 +- tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST index 3e42a737dfd..9172149e330 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST +++ b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST @@ -1,2 +1,2 @@ [deleteChildrenWithRunningGroup] -osx-10.13 +macos diff --git a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST index 2b784414cd8..92f9680e7ee 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST @@ -1,2 +1,2 @@ [autoShow] -osx-10.13 +macos From c31c5d08d82c9ca1606138ae881e4577fa509b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Jan 2020 17:51:39 +0100 Subject: [PATCH 14/71] Blacklist tstPauseAnimation::noTimerUpdates on macOS Task-number: QTBUG-75786 Change-Id: I89d81a9d0f5f301f325044dee2395d441c0d5970 Reviewed-by: Simon Hausmann --- tests/auto/corelib/animation/qpauseanimation/BLACKLIST | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST index 33cd53d7882..714df08b184 100644 --- a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST +++ b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST @@ -1,5 +1,6 @@ [pauseAndPropertyAnimations] -osx +macos [multipleSequentialGroups] -osx - +macos +[noTimerUpdates] +macos From db81129240d1198884b4197857ec5934a5dc33d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 20 Jan 2020 15:07:34 +0100 Subject: [PATCH 15/71] macOS: Remove doc references to the Carbon framework Change-Id: I4d496acfc3d810d6334baba99cd697168bef0b75 Reviewed-by: Timur Pocheptsov --- src/corelib/global/qnamespace.qdoc | 2 +- src/gui/kernel/qevent.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index bebe67be3f9..1908fedead6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1017,7 +1017,7 @@ \value WA_MacNoClickThrough This value is obsolete and has no effect. - \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip + \value WA_MacOpaqueSizeGrip Indicates that the native size grip should be opaque instead of transparent (the default). This attribute is only applicable to \macos and is set by the widget's author. diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 0706ae3e907..de60a665171 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1150,8 +1150,8 @@ QKeyEvent::~QKeyEvent() Note: The native scan code may be 0, even if the key event contains extended information. - Note: On Mac OS/X, this function is not useful, because there is no - way to get the scan code from Carbon or Cocoa. The function always + Note: On \macos, this function is not useful, because there is no + way to get the scan code from the system APIs. The function always returns 1 (or 0 in the case explained above). */ From 92918e567ae194f0676adabaee88100e1c9e5d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 22 Jan 2020 12:34:26 +0100 Subject: [PATCH 16/71] Flatten version-specific blacklisting on macOS to all macOS versions We don't know which versions these blacklistings actually apply on unless we actually get macOS 10.14 and 10.15 into the CI and running tests, so let's start with that, and then granularize the blacklists after that. Task-number: QTBUG-75786 Change-Id: Id79642afa50cb20efa2cd209286b6933918d3a4a Reviewed-by: Simon Hausmann --- .../qsequentialanimationgroup/BLACKLIST | 4 +- .../corelib/kernel/qelapsedtimer/BLACKLIST | 2 +- .../auto/corelib/thread/qsemaphore/BLACKLIST | 6 +-- tests/auto/corelib/tools/qtimeline/BLACKLIST | 3 +- tests/auto/gui/kernel/qwindow/BLACKLIST | 4 +- .../network/access/qnetworkreply/BLACKLIST | 40 +++++++++---------- tests/auto/network/ssl/qsslsocket/BLACKLIST | 4 +- tests/auto/other/macnativeevents/BLACKLIST | 6 +-- tests/auto/widgets/dialogs/qdialog/BLACKLIST | 4 +- .../widgets/dialogs/qfiledialog2/BLACKLIST | 4 +- tests/auto/widgets/kernel/qwidget/BLACKLIST | 4 +- .../widgets/widgets/qdoublespinbox/BLACKLIST | 4 +- tests/auto/widgets/widgets/qmdiarea/BLACKLIST | 11 ++--- tests/auto/widgets/widgets/qmenu/BLACKLIST | 10 ++--- .../widgets/widgets/qtoolbutton/BLACKLIST | 2 +- 15 files changed, 47 insertions(+), 61 deletions(-) diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST index e516c0e8260..f07c0ec4a11 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST @@ -1,6 +1,6 @@ [finishWithUncontrolledAnimation] windows-10 msvc-2015 -osx-10.13 +macos [groupWithZeroDurationAnimations] -osx-10.13 +macos diff --git a/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST index 569880e1dbe..2317cf886cd 100644 --- a/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST +++ b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST @@ -1,3 +1,3 @@ [elapsed] -osx-10.13 +macos windows-10 diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST index d7af5c420b3..f7f6d5149c4 100644 --- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST +++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST @@ -2,9 +2,7 @@ osx [tryAcquireWithTimeout:0.2s] windows -osx-10.12 -osx-10.13 +macos [tryAcquireWithTimeout:2s] windows -osx-10.12 -osx-10.13 +macos diff --git a/tests/auto/corelib/tools/qtimeline/BLACKLIST b/tests/auto/corelib/tools/qtimeline/BLACKLIST index 9794b0059fa..961147a3cf0 100644 --- a/tests/auto/corelib/tools/qtimeline/BLACKLIST +++ b/tests/auto/corelib/tools/qtimeline/BLACKLIST @@ -2,6 +2,5 @@ windows-10 msvc-2015 osx [frameRate] -osx-10.12 -osx-10.13 +macos diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 27463adf998..44a55316abd 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -2,10 +2,10 @@ opensuse-leap [positioning:default] linux -osx-10.12 ci +macos ci winrt [positioning:fake] -osx-10.12 ci +macos ci [modalWithChildWindow] # QTBUG-66851 # QTBUG-69160 diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 2a0651f96f2..801ac65d719 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -49,21 +49,21 @@ windows-7sp1 windows-10 osx [backgroundRequest] -osx-10.12 +macos [connectToIPv6Address] -osx-10.12 +macos [deleteFromHttp] -osx-10.12 +macos [downloadProgress] -osx-10.12 +macos [encrypted] -osx-10.13 +macos [httpCanReadLine] -osx-10.12 +macos [httpRecursiveCreation] osx [httpWithNoCredentialUsage] -osx-10.12 +macos [ignoreSslErrorsList] osx [ignoreSslErrorsListWithSlot] @@ -71,27 +71,27 @@ osx [ioGetFromBuiltinHttp] osx [ioGetFromHttp] -osx-10.12 +macos [ioPostToHttpFromFile] -osx-10.13 +macos [ioPostToHttpFromSocketSynchronous] osx [ioPostToHttpUploadProgress] osx [ioPutToHttpFromFile] -osx-10.13 +macos [lastModifiedHeaderForHttp] -osx-10.12 +macos [multipartSkipIndices] -osx-10.12 +macos [nestedEventLoops] osx [postToHttp] -osx-10.12 +macos [postToHttpMultipart] -osx-10.12 +macos [postToHttpSynchronous] -osx-10.12 +macos [postToHttps] osx [postToHttpsMultipart] @@ -99,17 +99,17 @@ osx [postToHttpsSynchronous] osx [putGetDeleteGetFromHttp] -osx-10.12 +macos [putToHttpSynchronous] -osx-10.12 +macos [putToHttps] osx [putToHttpsSynchronous] osx [putWithRateLimiting] -osx-10.13 +macos [qtbug13431replyThrottling] -osx-10.12 +macos [receiveCookiesFromHttp] osx [receiveCookiesFromHttpSynchronous] @@ -119,7 +119,7 @@ osx [sendCookiesSynchronous] osx [sendCustomRequestToHttp] -osx-10.12 +macos [sslConfiguration] osx [synchronousRequest] diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST index 7b4a29f4630..749c59d968e 100644 --- a/tests/auto/network/ssl/qsslsocket/BLACKLIST +++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST @@ -3,9 +3,9 @@ windows [spontaneousWrite] windows-7sp1 [connectToHostEncrypted] -osx-10.13 +macos [setSslConfiguration] windows-10 msvc-2015 windows-7sp1 [connectToHostEncryptedWithVerificationPeerName] -osx-10.13 +macos diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST index 2922e22d9f7..b0a6551587d 100644 --- a/tests/auto/other/macnativeevents/BLACKLIST +++ b/tests/auto/other/macnativeevents/BLACKLIST @@ -19,7 +19,7 @@ osx osx [testMouseDragToNonClientArea] osx -osx-10.12 ci +macos ci # The following key tests fail after switching to synchronous # expose events, and we don't know why yet. QTBUG-62042 [testKeyPressOnToplevel] @@ -32,8 +32,8 @@ osx osx # QTQAINFRA-1292 [testPushButtonPressRelease] -osx-10.12 ci +macos ci # QTQAINFRA-1292 [testModifierCtrlWithDontSwapCtrlAndMeta] -osx-10.12 ci +macos ci diff --git a/tests/auto/widgets/dialogs/qdialog/BLACKLIST b/tests/auto/widgets/dialogs/qdialog/BLACKLIST index 72e3dff6dd5..ad86386895e 100644 --- a/tests/auto/widgets/dialogs/qdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qdialog/BLACKLIST @@ -1,4 +1,4 @@ [snapToDefaultButton] -osx-10.14 +macos [showFullScreen] -osx-10.13 ci +macos ci diff --git a/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST index 875855b59e4..9e14db48d02 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST @@ -1,4 +1,2 @@ [QTBUG4419_lineEditSelectAll] -osx-10.12 -osx-10.14 -osx-10.13 +macos diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index be19d8fd0b0..cf35491ec01 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -24,9 +24,7 @@ opensuse-42.3 [childEvents] macos [renderInvisible] -osx-10.12 -osx-10.11 -osx-10.14 +macos [optimizedResizeMove] osx [optimizedResize_topLevel] diff --git a/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST index 8f5648d0f9a..9da179e3658 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST +++ b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST @@ -1,4 +1,2 @@ [editingFinished] -osx-10.12 -osx-10.14 -osx-10.13 +macos diff --git a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST index 1dd876ea973..6010772be76 100644 --- a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST +++ b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST @@ -2,15 +2,12 @@ ubuntu-16.04 rhel-7.6 opensuse-leap -osx-10.11 -osx-10.13 +macos ubuntu-18.04 -osx-10.14 +macos rhel-7.4 -osx-10.12 +macos opensuse-42.3 [resizeTimer] -osx-10.12 -osx-10.14 -osx-10.13 +macos diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index ba9c184a67a..5677172f8ec 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,14 +1,12 @@ [task258920_mouseBorder] -osx-10.14 -osx-10.13 +macos [layoutDirection] -osx-10.12 -osx-10.13 +macos # Fails when enabling synchronous expose events QTBUG-62092 [pushButtonPopulateOnAboutToShow] -osx-10.13 +macos [tearOff] -osx-10.14 +macos [activeSubMenuPosition] winrt [submenuTearOffDontClose] diff --git a/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST index 52ba36562fc..315e179d0ad 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST +++ b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST @@ -1,2 +1,2 @@ [task176137_autoRepeatOfAction] -osx-10.13 +macos From d0e9e5a36e3e49ec9fb0fb3f1639c21e7414c615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Jan 2020 14:13:03 +0100 Subject: [PATCH 17/71] macOS: Work around CoreFoundation failing to resolve bundle resources When a framework is loaded from a Samba share CoreFoundation will fail to resolve its Resources directory, and hence its Info.plist, which means we can't look up the bundle by id. Until this has been fixed in CoreFoundation and/or the macOS Samba implementation we work around it by manually looking for QtCore. This fixes our particular use-case of finding QtCore so we can resolve the relocatable prefix, but there's still a potential issue if any other code tries to use CF for bundle lookups. We don't seem to have any of those in Qt itself, but this should be kept in mind if we see similar issues in the future. Change-Id: I8fd471e44f6afe33a7459ce550f0fcec9acfefb4 Reviewed-by: Alexandru Croitor --- src/corelib/global/qlibraryinfo.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index f0f77fe68ed..7d6beaf9c28 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -535,8 +535,25 @@ static QString getRelocatablePrefix() #if defined(QT_STATIC) prefixPath = prefixFromAppDirHelper(); #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework) - CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier( - CFSTR("org.qt-project.QtCore")); + auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore")); + if (!qtCoreBundle) { + // When running Qt apps over Samba shares, CoreFoundation will fail to find + // the Resources directory inside the bundle, This directory is a symlink, + // and CF relies on readdir() and dtent.dt_type to detect symlinks, which + // does not work reliably for Samba shares. We work around it by manually + // looking for the QtCore bundle. + auto allBundles = CFBundleGetAllBundles(); + auto bundleCount = CFArrayGetCount(allBundles); + for (int i = 0; i < bundleCount; ++i) { + auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i)); + auto url = QCFType(CFBundleCopyBundleURL(bundle)); + auto path = QCFType(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle)); + if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) { + qtCoreBundle = bundle; + break; + } + } + } Q_ASSERT(qtCoreBundle); QCFType qtCorePath = CFBundleCopyBundleURL(qtCoreBundle); From 0b28f1e3bae10def59e7fe8afac29ed5355a3f1e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 21 Jan 2020 15:01:55 +0100 Subject: [PATCH 18/71] Fix QLocale::system() and uiLanguages() for the mobile platforms On iOS, it was no longer using the Cocoa specific code needed to get the locale and uiLanguages information so this functionality is brought back as it was accidently lost. In addition, this has a side-effect of fixing a problem with Android versions below API 24 where it has no UiLanguages functionality so it gets the information based on the system locale as a fallback. Fixes: QTBUG-81307 Fixes: QTBUG-81357 Change-Id: I1709675b5bd5e9cedefb99eaec28279f20a347a4 Reviewed-by: Edward Welbourne --- src/corelib/text/qlocale.cpp | 2 ++ src/corelib/text/text.pri | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index e3530eeee10..d8c4b416248 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const for (const auto entry : qAsConst(uiLanguages)) locales.append(QLocale(entry)); } + if (locales.isEmpty()) + locales.append(systemLocale()->fallbackUiLocale()); } else #endif { diff --git a/src/corelib/text/text.pri b/src/corelib/text/text.pri index 25e281f37a2..d2a02059c7e 100644 --- a/src/corelib/text/text.pri +++ b/src/corelib/text/text.pri @@ -48,7 +48,7 @@ SOURCES += \ NO_PCH_SOURCES += text/qstring_compat.cpp false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator -!nacl:macos: { +!nacl:darwin: { SOURCES += text/qlocale_mac.mm } else:unix { From e0e7c42a19316c53fd3ab21133223b5ee788ba38 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 17 Jan 2020 15:06:47 +0100 Subject: [PATCH 19/71] Introduce VK_KHR_display support for i.MX8 devices The eglfs_viv backend has Vulkan support now. While the support code is common (lives in api/vulkan), we will not expose this for any other integration yet, without the appropriate testing. While putting this to eglfs seems unintuitive at first, it turns out that for Vivante in particular this is very useful, since we can rely on the existing framebuffer device infrastructure to solve certain problems (like the lack of vsync) The VK_KHR_display implementation of Vivante currently exhibits all the known issues of the old, fbdev-style EGL plumbing (presumably since it lives on top of that): - No vsync. This can be fixed by setting QT_QPA_EGLFS_FORCEVSYNC. - May need a manual call to fbset to set the correct resolution before launching the Qt app. - And of course it lacks all the multi-screen features provided by drm. - Plus, it seems the swapchain only supports a min/max buffer count of 1. This needs special handling in QRhi since until now we assumed that there was always at least 2 buffers available. [ChangeLog][Platform Specific Changes][Linux] Vulkan is now supported by eglfs (eglfs_viv backend) on i.MX8 devices with the Vivante graphics stack. This is done via VK_KHR_display so no windowing system is required. Task-number: QTBUG-78754 Change-Id: I7530aa026d4b904b9de83f9bdbdc4897ae770e71 Reviewed-by: Paul Olav Tvete --- src/gui/rhi/qrhivulkan.cpp | 17 +- src/plugins/platforms/eglfs/api/api.pri | 9 + .../eglfs/api/qeglfsdeviceintegration.cpp | 8 + .../eglfs/api/qeglfsdeviceintegration_p.h | 4 + .../platforms/eglfs/api/qeglfsintegration.cpp | 19 +- .../platforms/eglfs/api/qeglfsintegration_p.h | 3 + .../platforms/eglfs/api/qeglfswindow_p.h | 4 + .../eglfs/api/vulkan/qeglfsvulkaninstance.cpp | 280 ++++++++++++++++++ .../eglfs/api/vulkan/qeglfsvulkaninstance_p.h | 88 ++++++ .../eglfs/api/vulkan/qeglfsvulkanwindow.cpp | 75 +++++ .../eglfs/api/vulkan/qeglfsvulkanwindow_p.h | 74 +++++ .../eglfs_viv/qeglfsvivintegration.cpp | 21 ++ .../eglfs_viv/qeglfsvivintegration.h | 6 + .../eglfs/eglfsdeviceintegration.pro | 3 + 14 files changed, 602 insertions(+), 9 deletions(-) create mode 100644 src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance.cpp create mode 100644 src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance_p.h create mode 100644 src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow.cpp create mode 100644 src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow_p.h diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index f4c72d2ccac..e7faa0cadd4 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -1351,8 +1351,8 @@ bool QRhiVulkan::recreateSwapChain(QRhiSwapChain *swapChain) quint32 actualSwapChainBufferCount = 0; err = vkGetSwapchainImagesKHR(dev, swapChainD->sc, &actualSwapChainBufferCount, nullptr); - if (err != VK_SUCCESS || actualSwapChainBufferCount < 2) { - qWarning("Failed to get swapchain images: %d (count=%u)", err, actualSwapChainBufferCount); + if (err != VK_SUCCESS || actualSwapChainBufferCount == 0) { + qWarning("Failed to get swapchain images: %d", err); return false; } @@ -1528,7 +1528,8 @@ void QRhiVulkan::releaseSwapChainResources(QRhiSwapChain *swapChain) QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) { QVkSwapChain *swapChainD = QRHI_RES(QVkSwapChain, swapChain); - QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]); + const int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0; + QVkSwapChain::FrameResources &frame(swapChainD->frameRes[frameResIndex]); QRhiProfilerPrivate *rhiP = profilerPrivateOrNull(); if (!frame.imageAcquired) { @@ -1571,7 +1572,7 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin // will make B wait for A's frame 0 commands, so if a resource is written // in B's frame or when B checks for pending resource releases, that won't // mess up A's in-flight commands (as they are not in flight anymore). - waitCommandCompletion(int(swapChainD->currentFrameSlot)); + waitCommandCompletion(frameResIndex); // Now is the time to read the timestamps for the previous frame for this slot. if (frame.timestampQueryIndex >= 0) { @@ -1606,7 +1607,7 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin // when profiling is enabled, pick a free query (pair) from the pool int timestampQueryIdx = -1; - if (profilerPrivateOrNull()) { + if (profilerPrivateOrNull() && swapChainD->bufferCount > 1) { // no timestamps if not having at least 2 frames in flight for (int i = 0; i < timestampQueryPoolMap.count(); ++i) { if (!timestampQueryPoolMap.testBit(i)) { timestampQueryPoolMap.setBit(i); @@ -1648,7 +1649,8 @@ QRhi::FrameOpResult QRhiVulkan::endFrame(QRhiSwapChain *swapChain, QRhi::EndFram recordPrimaryCommandBuffer(&swapChainD->cbWrapper); - QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]); + int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0; + QVkSwapChain::FrameResources &frame(swapChainD->frameRes[frameResIndex]); QVkSwapChain::ImageResources &image(swapChainD->imageRes[swapChainD->currentImageIndex]); if (image.lastUse != QVkSwapChain::ImageResources::ScImageUseRender) { @@ -1860,7 +1862,8 @@ QRhi::FrameOpResult QRhiVulkan::endAndSubmitPrimaryCommandBuffer(VkCommandBuffer void QRhiVulkan::waitCommandCompletion(int frameSlot) { for (QVkSwapChain *sc : qAsConst(swapchains)) { - QVkSwapChain::FrameResources &frame(sc->frameRes[frameSlot]); + const int frameResIndex = sc->bufferCount > 1 ? frameSlot : 0; + QVkSwapChain::FrameResources &frame(sc->frameRes[frameResIndex]); if (frame.cmdFenceWaitable) { df->vkWaitForFences(dev, 1, &frame.cmdFence, VK_TRUE, UINT64_MAX); df->vkResetFences(dev, 1, &frame.cmdFence); diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri index a6d81016b6f..68965b58d89 100644 --- a/src/plugins/platforms/eglfs/api/api.pri +++ b/src/plugins/platforms/eglfs/api/api.pri @@ -23,4 +23,13 @@ qtConfig(opengl) { $$PWD/qeglfscontext_p.h } +qtConfig(vulkan) { + SOURCES += \ + $$PWD/vulkan/qeglfsvulkaninstance.cpp \ + $$PWD/vulkan/qeglfsvulkanwindow.cpp + HEADERS += \ + $$PWD/vulkan/qeglfsvulkaninstance_p.h \ + $$PWD/vulkan/qeglfsvulkanwindow_p.h +} + INCLUDEPATH += $$PWD diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index dbfb0e60580..e3145aa0b0b 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -381,6 +381,14 @@ void *QEglFSDeviceIntegration::wlDisplay() const return nullptr; } +#if QT_CONFIG(vulkan) +QPlatformVulkanInstance *QEglFSDeviceIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) +{ + Q_UNUSED(instance); + return nullptr; +} +#endif + EGLConfig QEglFSDeviceIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format) { class Chooser : public QEglConfigChooser { diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h index 71ffb4c69a4..08447a40ea9 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h @@ -108,6 +108,10 @@ public: virtual void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); virtual void *wlDisplay() const; +#if QT_CONFIG(vulkan) + virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance); +#endif + static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format); }; diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index d9a3545a956..e26d984cc1f 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -247,6 +247,13 @@ QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOf } #endif // QT_NO_OPENGL +#if QT_CONFIG(vulkan) +QPlatformVulkanInstance *QEglFSIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const +{ + return qt_egl_device_integration()->createPlatformVulkanInstance(instance); +} +#endif + bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { // We assume that devices will have more and not less capabilities @@ -283,7 +290,8 @@ enum ResourceType { NativeDisplay, XlibDisplay, WaylandDisplay, - EglSurface + EglSurface, + VkSurface }; static int resourceType(const QByteArray &key) @@ -296,7 +304,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("nativedisplay"), QByteArrayLiteral("display"), QByteArrayLiteral("server_wl_display"), - QByteArrayLiteral("eglsurface") + QByteArrayLiteral("eglsurface"), + QByteArrayLiteral("vksurface") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -364,6 +373,12 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi if (window && window->handle()) result = reinterpret_cast(static_cast(window->handle())->surface()); break; +#if QT_CONFIG(vulkan) + case VkSurface: + if (window && window->handle() && window->surfaceType() == QSurface::VulkanSurface) + result = static_cast(window->handle())->vulkanSurfacePtr(); + break; +#endif default: break; } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h index 898b3228348..b293651ce71 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -85,6 +85,9 @@ public: #ifndef QT_NO_OPENGL QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; +#endif +#if QT_CONFIG(vulkan) + QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; #endif bool hasCapability(QPlatformIntegration::Capability cap) const override; diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index be2a0630d3c..7bf74c25ee4 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE class QOpenGLCompositorBackingStore; class QPlatformTextureList; + #ifndef QT_NO_OPENGL class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow #else @@ -96,6 +97,9 @@ public: EGLNativeWindowType eglWindow() const; EGLSurface surface() const; QEglFSScreen *screen() const override; +#if QT_CONFIG(vulkan) + virtual void *vulkanSurfacePtr() { return nullptr; } +#endif bool hasNativeWindow() const { return m_flags.testFlag(HasNativeWindow); } diff --git a/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance.cpp b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance.cpp new file mode 100644 index 00000000000..a75251ca5f3 --- /dev/null +++ b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance.cpp @@ -0,0 +1,280 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfsvulkaninstance_p.h" +#include "qeglfswindow_p.h" +#include "qeglfshooks_p.h" +#include + +QT_BEGIN_NAMESPACE + +Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug) + +QEglFSVulkanInstance::QEglFSVulkanInstance(QVulkanInstance *instance) + : m_instance(instance) +{ + loadVulkanLibrary(QStringLiteral("vulkan")); +} + +void QEglFSVulkanInstance::createOrAdoptInstance() +{ + qCDebug(qLcEglDevDebug, "Creating Vulkan instance for VK_KHR_display"); + + const QByteArray extName = QByteArrayLiteral("VK_KHR_display"); + initInstance(m_instance, { extName }); + if (!m_vkInst) + return; + if (!enabledExtensions().contains(extName)) { + qWarning("Failed to enable VK_KHR_display extension"); + return; + } + +#if VK_KHR_display + m_getPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceDisplayPropertiesKHR"); + m_getDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkGetDisplayModePropertiesKHR"); + m_getPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + + m_getDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkGetDisplayPlaneSupportedDisplaysKHR"); + m_getDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkGetDisplayPlaneCapabilitiesKHR"); + + m_createDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR) + m_vkGetInstanceProcAddr(m_vkInst, "vkCreateDisplayPlaneSurfaceKHR"); +#endif + + m_enumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) + m_vkGetInstanceProcAddr(m_vkInst, "vkEnumeratePhysicalDevices"); + + // Use for first physical device, unless overridden by QT_VK_PHYSICAL_DEVICE_INDEX. + // This behavior matches what the Vulkan backend of QRhi would do. + + uint32_t physDevCount = 0; + m_enumeratePhysicalDevices(m_vkInst, &physDevCount, nullptr); + if (!physDevCount) { + qWarning("No physical devices"); + return; + } + QVarLengthArray physDevs(physDevCount); + VkResult err = m_enumeratePhysicalDevices(m_vkInst, &physDevCount, physDevs.data()); + if (err != VK_SUCCESS || !physDevCount) { + qWarning("Failed to enumerate physical devices: %d", err); + return; + } + + if (qEnvironmentVariableIsSet("QT_VK_PHYSICAL_DEVICE_INDEX")) { + int requestedPhysDevIndex = qEnvironmentVariableIntValue("QT_VK_PHYSICAL_DEVICE_INDEX"); + if (requestedPhysDevIndex >= 0 && uint32_t(requestedPhysDevIndex) < physDevCount) + m_physDev = physDevs[requestedPhysDevIndex]; + } + + if (m_physDev == VK_NULL_HANDLE) + m_physDev = physDevs[0]; +} + +bool QEglFSVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + QWindow *window) +{ + Q_UNUSED(physicalDevice); + Q_UNUSED(queueFamilyIndex); + Q_UNUSED(window); + return true; +} + +VkSurfaceKHR QEglFSVulkanInstance::createSurface(QEglFSWindow *window) +{ +#if VK_KHR_display + qCDebug(qLcEglDevDebug, "Creating VkSurfaceKHR via VK_KHR_display for window %p", (void *) window); + + if (!m_physDev) { + qWarning("No physical device, cannot create surface"); + return VK_NULL_HANDLE; + } + + uint32_t displayCount = 0; + VkResult err = m_getPhysicalDeviceDisplayPropertiesKHR(m_physDev, &displayCount, nullptr); + if (err != VK_SUCCESS) { + qWarning("Failed to get display properties: %d", err); + return VK_NULL_HANDLE; + } + + qCDebug(qLcEglDevDebug, "Display count: %u", displayCount); + + QVarLengthArray displayProps(displayCount); + m_getPhysicalDeviceDisplayPropertiesKHR(m_physDev, &displayCount, displayProps.data()); + + VkDisplayKHR display = VK_NULL_HANDLE; + VkDisplayModeKHR displayMode = VK_NULL_HANDLE; + uint32_t width = 0; + uint32_t height = 0; + + for (uint32_t i = 0; i < displayCount; ++i) { + const VkDisplayPropertiesKHR &disp(displayProps[i]); + qCDebug(qLcEglDevDebug, "Display #%u:\n display: %p\n name: %s\n dimensions: %ux%u\n resolution: %ux%u", + i, (void *) disp.display, disp.displayName, + disp.physicalDimensions.width, disp.physicalDimensions.height, + disp.physicalResolution.width, disp.physicalResolution.height); + + // Just pick the first display and the first mode. + if (i == 0) + display = disp.display; + + uint32_t modeCount = 0; + if (m_getDisplayModePropertiesKHR(m_physDev, disp.display, &modeCount, nullptr) != VK_SUCCESS) { + qWarning("Failed to get modes for display"); + continue; + } + QVarLengthArray modeProps(modeCount); + m_getDisplayModePropertiesKHR(m_physDev, disp.display, &modeCount, modeProps.data()); + for (uint32_t j = 0; j < modeCount; ++j) { + const VkDisplayModePropertiesKHR &mode(modeProps[j]); + qCDebug(qLcEglDevDebug, " Mode #%u:\n mode: %p\n visibleRegion: %ux%u\n refreshRate: %u", + j, (void *) mode.displayMode, + mode.parameters.visibleRegion.width, mode.parameters.visibleRegion.height, + mode.parameters.refreshRate); + if (j == 0) { + displayMode = mode.displayMode; + width = mode.parameters.visibleRegion.width; + height = mode.parameters.visibleRegion.height; + } + } + } + + if (display == VK_NULL_HANDLE || displayMode == VK_NULL_HANDLE) { + qWarning("Failed to choose display and mode"); + return VK_NULL_HANDLE; + } + uint32_t planeCount = 0; + err = m_getPhysicalDeviceDisplayPlanePropertiesKHR(m_physDev, &planeCount, nullptr); + if (err != VK_SUCCESS) { + qWarning("Failed to get plane properties: %d", err); + return VK_NULL_HANDLE; + } + + qCDebug(qLcEglDevDebug, "Plane count: %u", planeCount); + + QVarLengthArray planeProps(planeCount); + m_getPhysicalDeviceDisplayPlanePropertiesKHR(m_physDev, &planeCount, planeProps.data()); + + uint32_t planeIndex = UINT_MAX; + for (uint32_t i = 0; i < planeCount; ++i) { + uint32_t supportedDisplayCount = 0; + err = m_getDisplayPlaneSupportedDisplaysKHR(m_physDev, i, &supportedDisplayCount, nullptr); + if (err != VK_SUCCESS) { + qWarning("Failed to query supported displays for plane: %d", err); + return VK_NULL_HANDLE; + } + + QVarLengthArray supportedDisplays(supportedDisplayCount); + m_getDisplayPlaneSupportedDisplaysKHR(m_physDev, i, &supportedDisplayCount, supportedDisplays.data()); + qCDebug(qLcEglDevDebug, "Plane #%u supports %u displays, currently bound to display %p", + i, supportedDisplayCount, (void *) planeProps[i].currentDisplay); + + VkDisplayPlaneCapabilitiesKHR caps; + err = m_getDisplayPlaneCapabilitiesKHR(m_physDev, displayMode, i, &caps); + if (err != VK_SUCCESS) { + qWarning("Failed to query plane capabilities: %d", err); + return VK_NULL_HANDLE; + } + + qCDebug(qLcEglDevDebug, " supportedAlpha: %d (1=no, 2=global, 4=per pixel, 8=per pixel premul)\n" + " minSrc=%d, %d %ux%u\n" + " maxSrc=%d, %d %ux%u\n" + " minDst=%d, %d %ux%u\n" + " maxDst=%d, %d %ux%u", + int(caps.supportedAlpha), + caps.minSrcPosition.x, caps.minSrcPosition.y, caps.minSrcExtent.width, caps.minSrcExtent.height, + caps.maxSrcPosition.x, caps.maxSrcPosition.y, caps.maxSrcExtent.width, caps.maxSrcExtent.height, + caps.minDstPosition.x, caps.minDstPosition.y, caps.minDstExtent.width, caps.minDstExtent.height, + caps.maxDstPosition.x, caps.maxDstPosition.y, caps.maxDstExtent.width, caps.maxDstExtent.height); + + // if the plane is not in use and supports our chosen display, use that plane + if (supportedDisplays.contains(display) + && (planeProps[i].currentDisplay == VK_NULL_HANDLE || planeProps[i].currentDisplay == display)) + { + planeIndex = i; + } + } + + if (planeIndex == UINT_MAX) { + qWarning("Failed to find a suitable plane"); + return VK_NULL_HANDLE; + } + + qCDebug(qLcEglDevDebug, "Using plane #%u", planeIndex); + + VkDisplaySurfaceCreateInfoKHR surfaceCreateInfo = {}; + surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR; + surfaceCreateInfo.displayMode = displayMode; + surfaceCreateInfo.planeIndex = planeIndex; + surfaceCreateInfo.planeStackIndex = planeProps[planeIndex].currentStackIndex; + surfaceCreateInfo.transform = VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR; + surfaceCreateInfo.globalAlpha = 1.0f; + surfaceCreateInfo.alphaMode = VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR; + surfaceCreateInfo.imageExtent = { width, height }; + + VkSurfaceKHR surface = VK_NULL_HANDLE; + err = m_createDisplayPlaneSurfaceKHR(m_vkInst, &surfaceCreateInfo, nullptr, &surface); + if (err != VK_SUCCESS || surface == VK_NULL_HANDLE) { + qWarning("Failed to create surface: %d", err); + return VK_NULL_HANDLE; + } + + qCDebug(qLcEglDevDebug, "Created surface %p", (void *) surface); + + return surface; + +#else + Q_UNUSED(window); + qWarning("VK_KHR_display support was not compiled in, cannot create surface"); + return VK_NULL_HANDLE; +#endif +} + +void QEglFSVulkanInstance::presentAboutToBeQueued(QWindow *window) +{ + // support QT_QPA_EGLFS_FORCEVSYNC (i.MX8 with eglfs_viv) + qt_egl_device_integration()->waitForVSync(window->handle()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance_p.h b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance_p.h new file mode 100644 index 00000000000..9d6d47f4392 --- /dev/null +++ b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkaninstance_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEGLFSVULKANINSTANCE_H +#define QEGLFSVULKANINSTANCE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfsglobal_p.h" +#include + +QT_BEGIN_NAMESPACE + +class QEglFSWindow; + +class Q_EGLFS_EXPORT QEglFSVulkanInstance : public QBasicPlatformVulkanInstance +{ +public: + QEglFSVulkanInstance(QVulkanInstance *instance); + + void createOrAdoptInstance() override; + bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override; + void presentAboutToBeQueued(QWindow *window) override; + + VkSurfaceKHR createSurface(QEglFSWindow *window); + +private: + QVulkanInstance *m_instance; + VkPhysicalDevice m_physDev = VK_NULL_HANDLE; + PFN_vkEnumeratePhysicalDevices m_enumeratePhysicalDevices = nullptr; +#if VK_KHR_display + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR m_getPhysicalDeviceDisplayPropertiesKHR = nullptr; + PFN_vkGetDisplayModePropertiesKHR m_getDisplayModePropertiesKHR = nullptr; + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR m_getPhysicalDeviceDisplayPlanePropertiesKHR = nullptr; + PFN_vkGetDisplayPlaneSupportedDisplaysKHR m_getDisplayPlaneSupportedDisplaysKHR = nullptr; + PFN_vkGetDisplayPlaneCapabilitiesKHR m_getDisplayPlaneCapabilitiesKHR = nullptr; + PFN_vkCreateDisplayPlaneSurfaceKHR m_createDisplayPlaneSurfaceKHR = nullptr; +#endif +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow.cpp b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow.cpp new file mode 100644 index 00000000000..ae41ca00b6d --- /dev/null +++ b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfsvulkanwindow_p.h" + +QT_BEGIN_NAMESPACE + +QEglFSVulkanWindow::QEglFSVulkanWindow(QWindow *window) + : QEglFSWindow(window), + m_surface(VK_NULL_HANDLE) +{ +} + +QEglFSVulkanWindow::~QEglFSVulkanWindow() +{ + if (m_surface) { + QVulkanInstance *inst = window()->vulkanInstance(); + if (inst) + static_cast(inst->handle())->destroySurface(m_surface); + } +} + +void *QEglFSVulkanWindow::vulkanSurfacePtr() +{ + if (m_surface) + return &m_surface; + + QVulkanInstance *inst = window()->vulkanInstance(); + if (!inst) { + qWarning("Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?"); + return nullptr; + } + QEglFSVulkanInstance *eglfsInst = static_cast(inst->handle()); + m_surface = eglfsInst->createSurface(this); + + return &m_surface; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow_p.h b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow_p.h new file mode 100644 index 00000000000..492fb41ca4d --- /dev/null +++ b/src/plugins/platforms/eglfs/api/vulkan/qeglfsvulkanwindow_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEGLFSVULKANWINDOW_H +#define QEGLFSVULKANWINDOW_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfsglobal_p.h" +#include "qeglfswindow_p.h" +#include "qeglfsvulkaninstance_p.h" + +QT_BEGIN_NAMESPACE + +class Q_EGLFS_EXPORT QEglFSVulkanWindow : public QEglFSWindow +{ +public: + QEglFSVulkanWindow(QWindow *window); + ~QEglFSVulkanWindow(); + + void *vulkanSurfacePtr() override; + +private: + VkSurfaceKHR m_surface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp index 2fc076ad0c1..5e1d28a3539 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp @@ -41,6 +41,11 @@ #include #include +#if QT_CONFIG(vulkan) +#include "private/qeglfsvulkaninstance_p.h" +#include "private/qeglfsvulkanwindow_p.h" +#endif + #ifdef Q_OS_INTEGRITY extern "C" void VivanteInit(void); #endif @@ -97,4 +102,20 @@ void QEglFSVivIntegration::destroyNativeWindow(EGLNativeWindowType window) fbDestroyWindow(window); } +#if QT_CONFIG(vulkan) + +QEglFSWindow *QEglFSVivIntegration::createWindow(QWindow *window) const +{ + if (window->surfaceType() == QSurface::VulkanSurface) + return new QEglFSVulkanWindow(window); + return QEglFSDeviceIntegration::createWindow(window); +} + +QPlatformVulkanInstance *QEglFSVivIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) +{ + return new QEglFSVulkanInstance(instance); +} + +#endif // vulkan + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h index 4d1718afcf1..02b59c16b58 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h @@ -53,6 +53,12 @@ public: void destroyNativeWindow(EGLNativeWindowType window) override; EGLNativeDisplayType platformDisplay() const override; + // Vulkan support with VK_KHR_display +#if QT_CONFIG(vulkan) + QEglFSWindow *createWindow(QWindow *window) const override; + QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) override; +#endif + private: QSize mScreenSize; EGLNativeDisplayType mNativeDisplay; diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro index 8bb7b614f10..bd02aea4d30 100644 --- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro +++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro @@ -20,6 +20,9 @@ qtHaveModule(input_support-private): \ qtHaveModule(platformcompositor_support-private): \ QT += platformcompositor_support-private +qtConfig(vulkan): \ + QT += vulkan_support-private + # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 From eecd502ff39cf4de51f3b556280702d6f2e3ec76 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 13 Jan 2020 15:31:01 +0100 Subject: [PATCH 20/71] Regenerate qsb files for auto and manual tests They are now version 4, which is hopefully the final format, relying on nothing but QDataStream. Except for the qshader autotest which tests all the 1..4 versions and so needs appropriate test data. Also unifies the batch file naming. Change-Id: Iec478be86d14dbec7ffb9d5f9b62c14fca5d7c9e Reviewed-by: Eirik Aavitsland --- .../data/{compile.bat => buildshaders.bat} | 0 tests/auto/gui/rhi/qrhi/data/simple.frag.qsb | Bin 908 -> 730 bytes tests/auto/gui/rhi/qrhi/data/simple.vert.qsb | Bin 958 -> 791 bytes .../gui/rhi/qrhi/data/simpletextured.frag.qsb | Bin 1479 -> 1208 bytes .../gui/rhi/qrhi/data/simpletextured.vert.qsb | Bin 1195 -> 964 bytes .../auto/gui/rhi/qrhi/data/textured.frag.qsb | Bin 1997 -> 1574 bytes .../auto/gui/rhi/qrhi/data/textured.vert.qsb | Bin 1708 -> 1342 bytes .../manual/rhi/computebuffer/buffer.comp.qsb | Bin 2160 -> 1868 bytes tests/manual/rhi/computebuffer/main.frag.qsb | Bin 672 -> 584 bytes tests/manual/rhi/computebuffer/main.vert.qsb | Bin 852 -> 762 bytes tests/manual/rhi/computeimage/image.comp.qsb | Bin 1811 -> 1594 bytes tests/manual/rhi/cubemap/cubemap.frag.qsb | Bin 1311 -> 1089 bytes tests/manual/rhi/cubemap/cubemap.vert.qsb | Bin 1499 -> 1200 bytes tests/manual/rhi/instancing/inst.frag.qsb | Bin 936 -> 735 bytes tests/manual/rhi/instancing/inst.vert.qsb | Bin 1792 -> 1456 bytes tests/manual/rhi/mrt/mrt.frag.qsb | Bin 1934 -> 1594 bytes tests/manual/rhi/mrt/mrt.vert.qsb | Bin 1633 -> 1299 bytes tests/manual/rhi/shadowmap/buildshaders.sh | 5 ----- tests/manual/rhi/shadowmap/main.frag.qsb | Bin 2489 -> 2307 bytes tests/manual/rhi/shadowmap/main.vert.qsb | Bin 1595 -> 1587 bytes tests/manual/rhi/shadowmap/shadowmap.frag.qsb | Bin 408 -> 466 bytes tests/manual/rhi/shadowmap/shadowmap.vert.qsb | Bin 1215 -> 1083 bytes tests/manual/rhi/shared/color.frag.qsb | Bin 1483 -> 1179 bytes tests/manual/rhi/shared/color.vert.qsb | Bin 1648 -> 1318 bytes tests/manual/rhi/shared/texture.frag.qsb | Bin 1710 -> 1345 bytes tests/manual/rhi/shared/texture.vert.qsb | Bin 1897 -> 1574 bytes tests/manual/rhi/shared/texture_ms4.frag.qsb | Bin 1847 -> 1555 bytes 27 files changed, 5 deletions(-) rename tests/auto/gui/rhi/qrhi/data/{compile.bat => buildshaders.bat} (100%) delete mode 100755 tests/manual/rhi/shadowmap/buildshaders.sh diff --git a/tests/auto/gui/rhi/qrhi/data/compile.bat b/tests/auto/gui/rhi/qrhi/data/buildshaders.bat similarity index 100% rename from tests/auto/gui/rhi/qrhi/data/compile.bat rename to tests/auto/gui/rhi/qrhi/data/buildshaders.bat diff --git a/tests/auto/gui/rhi/qrhi/data/simple.frag.qsb b/tests/auto/gui/rhi/qrhi/data/simple.frag.qsb index 264b71ec0f52a346e22efda1ea21e0116560c7b5..c235108d39efc5b4850365823fc9d3ff9606c99f 100644 GIT binary patch literal 730 zcmV<00ww(b00w7xoUK$(PZL2DpHd2CKtWB^lNp1DHj=U>KuiinZTVwFG?W;U2J5oB zZP#pfo82uj5))1yJR0NKtKnii`2qM0egbZK@?=bm{@!-ByC6|Xe9dp(yf^P(-^@P7 zSU>B6C;^;jb>=daHCTx`%mUod;-@6`?=&EzzKQ7`jqez)XF9gX&nTQb9bfDi+O(*< zYNO;>j$7b-$1!!$QcXLP<-1&fdZ%JOFwf+3%7jpQ3&d=JKj)mPB~O`Imz?NXlvz=D z+ch*ZkeX(r*%o!nQT@ViYSZ>lEU01CmQYh!_0_7fb;_!q#`>`qRW+sj*Gx%ZDoT_% zC~w{_y?a%?yZPbM;urI9`}4~elT^+DmK69j@D_Lv90D2W*UO7b`mt-Bqa}rxkm&B$ z%lSO<%YYz1;2JO@?eCeI>v&Gx7n${}SXr&Cib_+}4Of($R@=0&$t$@$yHi0FYvVPY$MPlEQ93UFjZSO-2MX_(D0Vf8$H~6&LCQ3UZk>_ZbNCmOdl(-h z@nv*B=lObWdPbr1v$B(PHVT_?AcQ%FfHByR4#BZY27UP$yqW$ZwkiC`zW1?GK3I_M zimc}XyvhG+5UJbai`dbq5WpqaQ=S1?hrpU<-TNkeLCQl?cO5d>@*w)&LMRW*d=u~@ zzY%FOEJ6EO)Z53R0Z8$_K||j{5z>(K`+@G<=-y!1`+gQZZ=&zxrma~W-4Jsv!&j{u zT5OryMIPxrv!zecl4}+@?|7!&5VqPfytb+tBJjeb@qD+V`N0HGY8Z~;{G;g<8=poZVGTYurW{e%HJHlJnuV&=vw^8t1U4X00{0DYauau^p$xO@h}H zgJV=#JG(1aD{Z7%lO_~Qpgr^$OwYZRTuM&;0Xg*8Q^*hSEjjfR0wsCg(X6$xorFM6 z9r0-9edqm}XGS9;$`MfkczknfJ7M7;pcnWX*vk_QQV@A=Q1Nd|vZ3n(&e7}JT?Dz? z1HgB0h^U{UwraIig1G>|6g7Yw#B)T~fqSqW(0P;}g;}gKeOz4VHYL|li{1J{6htwd z8Dzcsu_d|Rk=`WH2~*cB@N+JeSJE(jCR{a(ocliCGt$q???>j7M*9J(V-AMk!u|3} zWu=s;YH4zcmrkcBpLzqQVN)>VHCI=+1Aq0cjr6ukjXa& zFZMfOY=#VYJdJvLOdc}vo~?9Om*7x5kK^Tc2$bmrc`d= zfa1X4nzJ%};y0_~{3~Yo z<sA-%?>lYXPxVLd- z{lTN9r~dxdlV5)sXG$OD(w`FUdHNmr6W9le(625oUFy2ob(_^U?28w?A3R=NESI_e z)LfiJN`DreTj^Whi=!l}DN$S<6_;`Ci;Ct!EJV$gA7D_nOJ(||vV3*G_;7y>@|fB7 z0Ta8^@}@rxRK9c8+_)|k-M?SCytK}>TsL#u1C+ymEdQ?<*7nl~)fxAE&F|g$Eb8w3 i9MVXq(wqPnr3O2 zGTQDoyVJ&m_$TPec=qC{|A2plM=$;bUN~_gCW`OPzG1f-O-OW_w=?s5pY!I;D`PCq z{1E|4vkr5Z#{`o=4zn5Y&uFlVjUlr8GK4*w=vl5O9GmB-bB19`>5BcXw0O^|7kJ0< zgaqcCVe}l);B8abnJMGQ;4qr4+7|KoLP+$LVPK#r3v&!;I`9`cF6};E`ts)XS>^t> zPxBvM9QR*Oe#NMc;gf*50Q4T{Gte+#TR`Q~@=D{E)6C;1@#74SgzIuCpU3$Y5C_Tt zO#)pe`KO}pI-YYNd8RzY*VZfRymDwZESE1i?T%={BA?6V*^|oZ#y!f^Fxk>0Msq5~ z*!J@7(&lEl#QOdI<{xw-VI82#&UwmMWo>!)5nx*&m4^BGFpJbc{3M-L@=eI$2~VHf znT6Bp{mQsM7lBpTUfg~Q>u4y>@LKC%WL#AKFGJS>j?fiGPGixDBzj6h#;y`N29cxh z5vWz1SK*ejo@`_bGdbj6p==^A1)9nMkoI9H8O(W1<=~^LsrZ0Q0&L?QVfk9_j^#>A zJ%}N~8S(TzCBT+JcmjTCUl%)KYk+CJ5t>&)2eGJH$Cb`F@vZ@i_#G9cFLMJ{_&Pbz zO^{DA|Fy=Io^LCu_;GfL`89>u9PJIluETzW>|l=W(q6v-)E^~YlJrL@XA$D3$rkcw z;cQVBbS1=30l{~=Kyju>e-Y5Mx!r%(}&u7BnkQy4|`|?J8Gux{^B9 zLCY~^VW4sC?diL$R-twMsw?b4)lQ&y-YPS>DXrU6)fD*kR~c=K3sm%^*|cC+t?Eu1 z$RjQABd~=y?6QMhR@m8~(V~cJ$*yaoq;9+kWsNTMU65V25w!XlX!Q`wzv}VmslkG_ V5&Bcf{g*$L$nV9&*iR34C!Vffm8<{& literal 958 zcmV;v13~-%00}a9oZVGVZxcrpe~#@qOrSBLrLB0CcR4t%F0NZ$=2Y4qn#kX-%H6}0Y%<^;e=v_FqLh5QQ^@njg_gpTRe<&Od? zKy?_KchMgD?O}m?SrhMPBPO>T7?GvS?5OmcUhE1!)e*|^8j*56xjDm9c_cgTW%^g% znqe%Cq~GTBEm7BL3a-5-8H-dHHx=(V(yugvSg{9;BelH1Q4_rFHCF9s^SgHw1U5D% z*-yuPrGM15oBBCQg>o}iqEs16e0M~s#BQ3`>`F;2F3B-cPFvtww^ic`H(K}cJ!Xz|76#%%3+ zBieFYgtFl|emkb}CdMm>=sh+nc9rn8*LzI)H(1R5ScU?fd{?%Prx0Bybd=BmMA!&6 zw?$J$Z_Ds@%YP?eh$mfCo?^mw0_kc%O9{G15ll@DTsg9}Xt|L7?!HUWs#F*|?Dj`Z zxZBg7FVlqM|C9E7e9&-)z<3X62lMOK=l*>3)$97DSI?$?zjv_z@cdtd>_Ns%OB`bG z8;w!q0hFyG*X9>)xW}dxO*qK^^P1X1``Uc9O6wQM9JyqtTr#e1$z~WtK}+#cZHzB1 z*Oz%+!@=i*PFH%ksaDEWxLIGkebIJ%z{W}_YuBM6fVGA7xs{dLJnZl9ue`%2)9Zs= zzjFu~)Rz|4zXh8787ShqJph>on!hL(wS5~ge8G!{ajxRmCg&R?W}QJ*eQkE_378ip zq27Js{~`3D_Wwc2Js|37VdiDFZ?r&}3W(USm7d1RDfb{gHnc8cm&*90lqasxe1uOd znxq@j@1}W@k{nFi5awBp!5{ig<&N0oF*fyxuCEC1==o3bek%v7OZt?@Sj@`v_($>6 zHyB_EWr^RQT^G@ZWPN&{(>^0scLt>-|5{gRY|i42o>z|iIocN>eQrl=tb*3(@HIDg zie!`a%&hD)JP+D9gwX|iPJRRAf6D3#*8h~nEMxUW8;kT;@!R@r9bn}zQ9{4dX@or2A<-mc7 zUgrJ%&3kWlJOcnHz^4gs9>5Ui2on6k1A;+5=b!~PsL+NoSkOhX8R4i17>kaB3p(r~ zmp;ZbJmMVrZAkai!ceyz!!pIvwVa|1OrvGlJ>jUmepk2i72)c;1w}DTG1RrZ7z_)F zHE>B-7A;$Cm#wa4qr=cLnxdx~W_nS%uLvBTizbSM;0|m(jdKP877NmRRW$M|=%8hH z_wI=+IDg{XD2l?zd(7 z9i!dpi&ocC-NIkghKb5iSA5-gZ-%P9XPE7vLC?{QeC0oAN4wit$BtA~SKZ0g|E?#y zq22#6=t=&V-Txm|7)8nl1xEHO+i#Z7f0x<+e)DST<6oXU{P{^vp*HN}$&BH=jPxrV zB2<2WbPDyGm9_Opp*GPWUL_`m=L~(m2J%^2B3%keP(0GBNT)dFQ%>fnqf7K9<5CWE z#F(Ml(=H zYthI;f>ui4&b-3fvzR%peG-4xX}*acMAmVe+2w0FvY+8yBil4a%F9WvaTfeN#x3#m z30evNs2`6e=({{|$Ula*DV#Ot=^Lfbl6b-z3`rmJFh{@3loz6qugqJ@mqRke&xd3Y zl3&1#BA$QLtBCknzFdGx2;<6NJ>|C3w~(Hv&2Kydkmhm>DJypuR9952r>=?W~L zW*x0J&3F;^PmcQR`zN`-q?x;Y}7uaV5Gnn&w?CUOsdQW+OgP3H$$UdnM#>*p&DNmkf-9@f97V4ACb3PP*nd8YO zSpFSXUh#Kco;QM$TTYohUNB6pJ80@+wWqskw}Hp1Yuqg z=ytkmX=V^afIZy|E$DM;34_lWjC5SJt)o=0XGWKGbJfExkpf-hlZ~)5@;N}ZDsq%B zt2_t!0ti+mDvJ9L3gL43ZIJat(-JI$No7Zm1kd-_XM&IRPY(smAUpOtB(<$$SteQK WyCLRf4f4@`=tDUCd+{em4DTuca%uwr literal 1479 zcmV;&1vvTu01nM~oZVMTZyQwZ`SO9_riueI6sz~_*-60|V1mX`Mb%QE|x`oChGIm0c>D&YJ4rMMx=3}Z(Hfa#kwGQ822Q66 z=scb^YETulO%7~73qsJRm@WmeN|@iqiF#?xv`VH`q4pT=VE~q1Gl=5k8XIhzWZE&@ zsNFucb2l3X$8_{sqiWc>8F~r2*D=py&SQQK+=q@4^^j>bJl81+o|~9U#2ARK3Z5iY z>qXr)>(<_QV&pZ4lkIi8sc95*)LL^~*4s`oCXQ9jn|BP#60aZFJZ)^jZwtV-fMYw$ zxaywEfT61j=5@>)g87{n#N0<^Tdz#lt96@(`#P|Xx3OOo?9BhfdjakG4d6pZPxvYs zUB8Z)R{G~;Dql)xpN7l zq1(D^_yG*NP+z-c6kTVp7527#asjQXZ(`>u`7R+V*-_JFc ztj49>!AY5r!}xd16ofbUV1s;dW_Ip=6EK?>pDZ{9MCcHOC$U6ooKRafWp^D6HbR87}w4U^7O*O;tcyNyns(XX8zs6l5SUU$=cn`U!7gv zq2Q8n8uM0?y548=n*+Z6@({Mx2C)1+rwm~S8Vcf|BzP(6bG2<#bqc>7fNo0R?VJPOpB=sRl_^23OS z{}X&W_7C4-mQ4u1Uu3*qzr>4){Xi?vf&GBwmt}+C4^jJldPDd@3f?RBKP*^#B>qvM zL;XpidnNu!iN~^Y$azfmP9l2*NkVKn7k%P837+?KK=v~!dwE&#z6Y;fKj(oB%crF7 zEV~5#VIN}ob{^>ZA^jzx0MxW7S6)*ly}p-7BZTQT~4{)EVm h%YGA)JcT$O+bUlTf8lTdYlMg=$I@N}-f; z=Favc$%Xq9DkAt9M0_s#Sl{*04y#|9F*F?u};8h(iTFOw1>5pTm3ryUm?7+uN``G^%2h9@yskPT;t0 z8863ribwf7k&$Y_?38bUF*G0KIn}d*K2hAk9wsGqI^!=V{6|qs`Wv!Jg&9MM7F%Gy ziueIud|m3&xY8i8q@U&a1=f+>U@no}U@jWR8|HXv$wP4)X5TEwxyZg*-UrfM!TBZT zMX_%2e1vNu|53ILv;QdXp~m(xjz#vnxK=vE9{}lppeBRk9M?U>+~;|phuAhO`KZ_n z=rJa1Q(Q+Ff0Z#mG5d^U0BJrqX%59rJD7CZjb>=s;$F)R%;pXr*QWDy-iYU zUtw?FFhbvH?~1nBvi*+Pu!Z!RH4H!S!bTt{O>xH!1LLJ3usv(KW>6MkS8Q#CzU}3k zZlhhC+TNax&C?=r5D^z0I|98r9@=RqBTtJ?>}Ljn=R6GqJAW)eSwvq(AF4DJW$4P! zBPOq;e3Vf*6y6WaT^ncH+fz&-##5gYFJGyoI4fYqbLdxyGRKx=u@VxMpdg+dgkGDF z$jzW5oRN9>EWL|24_;3qai8Lp?i3A!NObK6t@f;el%*W!SDJXmsBYJ>WEJ_SBuTrU zb3fnMTak+n7ICw9r1mD}Rzz-H(|bV&r^m0i4aaHr8U7{P{lrQp*p~l4wsb#~W3qa^ zviV@~%YCOhl>7F+GxNc$e)@WyN~-H1FOg~N2iU)3uW0H4S+6WDCtfhw?$KZ7*Kb-6 zlGiJx5{=`0+2yg{OxzfcordT7?z2GT*Qdk^K5wG7XIi!=7Ts3IX`)an7E17__V7ss z)WuDg^h_dWipOkL>9vHO+wRTFZ)DT^Ue5EB~(IwuCRojSP zJB(XfS=wx(eGQSkLk%Bg3N$0k`Q{Vwjykx+W-cX0(H+cM)x7h#qs mlx-g2wfaK+ZGtzoH1szO&errZ;{Vc;U&pbB0^kp=)}hEcm+V~t literal 1195 zcmV;c1XTL~01PR3oZVK{@7SGS@4EY8rBu08;*P3_6Nd`8g*zNLaNvlUzxU?Nn|Wr8#h4ngZ|)x+Ik@-|e#YVZIecdmjEymA_C44633y4MAAlOn*VzKP z2{ggFR!euKWimFOLOoOO3FN!txMf+k0sIN%yAS#TzXQ=KGnN6{H-RcZcL;MA=y75g zGZ^z@QS83uNb;E;!LIn&*MM#TeFl3;0ps*7#?lJ6TbG{-R%Ez8U++cZ5!gP813^ru z?_i9U=VC%Y2HRpFVjqv>3$0Hy4a*zNDZd6gzZ>jvnBQU%Jn8lW$Ws`f z?z*--^jt9-=8)jujP^KE4SQj<<^M@F{Kqm5x0{v2jK>?*{o89lzAtw&)4zPxU;J9% z`R-?RT^sN?r06a`0s0N73WD!}YSr}(W8|&Dw~D3y_!G|*=e267gx@Pb94Jq3Lx%J} zlr7tGthUSZwFSPlUEk()l}o;6_4=|4lTxuzVjt8uKdRDO1y2rJjQC8@H=FhOu?QdM z379n2_t$oIYE^c2cD4gpyRX1XK!B@3Jw~vyEP_?vJI^)Z*0x2hQaw_xVUSAcKKygY=OX=xki|Wh%;>BXQ$Mj+{x1 zz21nwrv6JtP;WRQr4s)(5zmcdWaDrGSBQHNJY%er&?4}=3Dr<=T%%CAj%|)zpk4as zkoFw_1wPWsmNCrEEW?~6)LyVwQ=l2uO@R#cy#dZs$}a5m$QuKHa5iwAguN$h5F&q! z_>5%1@gv?e@evRGhut0a0^ZTzRno!rB&~5jTVNC5PM+%|6faKtvl06l;3EHRwM$=T z4rbU~InZU$A7_5EjVoSK)jH}Te~H#<;-OrlSOU35vBU^(itv&u4nMXjvdt3C1+vZ3 zIUw&1SYM>L5bIr9U!uLB{S3*b$bN>-Fh=q@!b15C$W@$$b&mYsfrIbVGVMD0c(DXW)I&zdb=6Ct3J(VRTP&(rk4-L-1QY;p*KclxtTW zu4p0Okv-!*{3+a9(KOG&E`a}^9B4&?D=T>09oP0+u6o^zP5A3T4}808=`J=5esJJ9 z!p_4#GPAgF_wG_Ct_;2T2M0mfq0-4Hv^1m0VS53)^Tv}OaS(Q=A+6Fv;9;PyM;N?6 z%Lg90M0m%=7AzsGpnHY-NXz`;iSHCv1=ZQ4Sr~3^C>d^Wpc3{tRI!EY*(PcRJujvF J`~^txNDnT;T3G-9 diff --git a/tests/auto/gui/rhi/qrhi/data/textured.frag.qsb b/tests/auto/gui/rhi/qrhi/data/textured.frag.qsb index 0a039137ec436807ee374cfb2736fb786b7c93a6..018d732e2f3f225bfeeff50d2ac682a2864f0c6d 100644 GIT binary patch literal 1574 zcmV+>2HE)l01)1IoZVQ>ZyQAvAKP(0wzNr0)3hbfZPO3Caa_l^RfUr%#ZDTeLQtJT zXd9W0y-pU{YiqqWNvoo&5+|gJ1LDL5sTUOW#(^V(D;F*(e@BH7LZI?{J8!((kdGpv z9$0BS^WMDodvD&%ynSmSM3;~)sNSQAKKo>^Zrqi_QwmyC_rD;vqX_Z`kxmD5bYC4{p;b!Q^vDUI4qf)IK zu3m2#CCgpUYWK35*0QZi-Kmk5-oj6S)ii32s_CTjx@!VJvuwR>meP8woz?0smxzpB zag3E*y;^r5(5_o$*t6_doIUVFO8O)rxGl$wp-%uHF8wJbKi1DrdUlf?uUPMOy_gw? zW+}P0en&q~vaAFq;l?nZ1R8bgvb&QYF$V8=Mj%+MrqRxjdmPHLANJ4(ekfBZt>Ks@ z%cEAUmDPrfTlODp%Lem554*(P8vM55tXuYqzXQ(^?R5S{#(Sk&oJGj(FAW`6O_Tw>TsKbpzi{Ql7&KmPLb)2}Jcn~;p6&!GJZ zMhxlgHrfRE*Yh*8--YCUe9NE{1Q$gr0`v0_$&8N^?f7O zAu}rZKea@%vy%*hq3CeT@rjO#JYSqq_WtcXoYsk@+PLcS7gmk3>FBw7tzjV&$WF;|@mAsLI|+_cuaNtr9IbJr;gx{;PEI<2+#8KFn;r0WTd4qfHzVxF@ z&i6Qs|64y}gk=xkqYw0Fb*B)D!orn>FL)hlXTsdnv)g-lyScsI*N48uW4hCHO=(P6t+wP3VoX=J8`L2C%GavHBcIfDAv;4t-XUox z>iN}qo737LL-tNFo}y1O7SZIxYdk*(TG@_zwC~GEN5<#%2wCOL1^gqqX%AbjDa>|; zw)io`ekgh@;K$3*3VZVrZ#QUs1S6{LbhIJJlkINa8y&yB><_hLh`1*FS}^!1`W4_& z)vB?+%GbopGQFR9WUrs`!Yn@^)ESZTL?2`xUGKx}OP9AU8P~&%LHb7+YmoJicy<)8 ztMfh~yiul)F-`i%S+<+yUlo3?8fBW|8DaSo>`ynZ=PZxae1gY4><`gn%)5mB4GX_q zC*JSiL|K+%-^aR>pecq2IDV5HyF(nG_o3C}?Xi?0{uJL4;$6Y~ac_TQJdQC2`8v#e zk~zWa?c;SSnUl=_6f#7gV%~5-ZzP~cwntb_&7a-|_YCtV`RtuznR%?9Vi{xJIgU|? z_vaxnX+F*}X95`KI~aW)J<7Z|$2uC=BNe03fPRwoX>N?^zhL>YJmo4c5|ldLHUk% zAl@n9m0#2*^}F}7!GLg`os_CE1(tx@$-N714`kPpTbkLc=!R>_E#Hd7c1*0-rdd^k YN4@0;^)JOUhtIDWwtmn54X9|l;5Mx%ivR!s literal 1997 zcmV;;2Qv5o02JtWob6Z5ZyU!IfBcr#PAt3rh%L3*L`h8AGEJ#W5Lh3Ltq&`J69=Z; zs<8!nNiL;z$R)E}s*=+bfqf24yrdypNW%C*IqS(8Ak}40LSgKjH}fR8L;?^F>i>^81rk7hXMQG3xqWy%jVsK=&IR`Y@*LzmM@3G2SN%W7>W+cBb7)v)u{{zsevIRO!}1 zzdg+SO}ANb13uTEb&}DSk{|ozj3?rZtLcP+w^hPl4S4TF@**vJhlY6Gs@Ef_aYDtX z!)~Y1{n7J6M$T(Xtd=DQZb&||Pe&7dJBUHsse0kI=ry)Jpooo#Pg7KHw4AW#(?Z0r zse?p^a`)%)2NAq?&JbDD34?AmWXC0`s~i`N(F}CGhJHP!_43|l=o6SX(7%i+wVZA| z`*q(^JTtxtzavxZ$>$5!xL2>ab^GF_^7$(l%AE~|gII1j{(9G0cgw}80?z)1HSTVO zuCJsX!fKzh1NY6Y7q}2YO4Rq7aNADcgsxKH2IW@erdtg=gDec@yx)MOePzQ-)?1d1 z#zD4qc1$aRiij<7oVMPcwk%0*ma^HwAT^wAJZ@P@Wqa11%-M#m_inNAHUh8b+x*zu z-OXtWLcA#2y@w18n=P*f44$9O2`a@>g<5C`yMddE&CMniV%pbH;er|wDGX5hg%cOCdzxrSP2|pS)9ELPg0~NBM(3Br%0h- zwF9^6snv$JzR}jcoW76j`5^wsLSaZ+_g?33I>9zas271p@b=Wgf79RVjq(y)zTkw; zwZhtioW9k6E@NNyoj&#d=W<{&{4b^fE*hHZr$OTG!s>NRal z-bOFUx+rV58y#0;nkOlG8V}&(0GD;{=?l8JRb=~doI0tb2e)iYWK9*IZ}(mHR?NII z2Q(L3uXxp<)oIm3J9{N(FJCHMvPW9m&BP>u z$;#sD{N>A678v*CN02#yUix8q#R=9?ZtU)smKRs=il1LVzd3}LJzTf+o|fj=zRuz| zMwH&wC*YX2o?pF6R2iYf)X0cFANanu^&I6|oOu?Be*Oodcjm7ip|45rEeZe9&$J$+ z`$fRs5uS50TJLBaNxh#5ME_q8h>o}(fjzZje^Yi2t|+aXU%4&kFp-H%H|@a@8@%^z z{QqV%&pfwUg#3?0d_2RJGKl0^p&kTkw!IHk9FG@~J^4;p%NL*Lijp3eDD&O{NV3nk z8yl!J36&(glTdX2Tu9)@zTkI7O0wSYr?AK6Z&l{1yvJk8bJo?})O7yj<3~4*)e*re zk5!Mxn9SqCc8(EA5z9JK3RnMw1ZM*e+k0B{ne|hmi`R_dd$PZbwXvO2>pqt89#5Z^ zQGV#tV#4>5(yh-F7dyxH;5a5Y%=%0O$9EtVSNjPS4W1vxjO%V2{TTS!c3NU%<9|r- za6b-@Thy=9qs^>Gp^ra_ERi?wYo<-h`Z1xgy#t~zF8m{8azyj<`k>JG@jfhAlImRA zuZKkk%O4e8M@0UpvSVn;-hIOQPRshZtXckq@TP_TyVQSIot8EGGa>v>3ZAr_=Q)|1 z{Rx?81P`yz2<-*LH!f!(q5Tb%l<>0ehedW4Yxd#e;=ft(-68SMk06y%G1fdxpOa^V zY3H$jLd8e>_0O=@3TUm zmE1ciJeP5L_GMORC&foGiO+k`$@@9sc{ZZsR8PmSTAvnLPJEq;#K`#QbVNQc^1OFO z*8ha%7j>4K_adt@>CLFFk9&T#(XF}mOw$dWMj5ZahF6)h`t*+1texe*{Kgy##SWK) z{Mp{Y+sCz))S#~tQvf`y7!^UrS198%?;GNgkE(0esyt>3xwW+clAa$Gbb|N>H%@6dTG<|oB77OCO}%L>ZOCm z`@J8(nVlUNV{s-&3}!#`nZ=r{$XxjISc&A?OByU3{j3Hyb!LN)4V1$u)+M%@&;_hP z@vgE-vO};c1JwynMdu?{=-tDr%!I5SS**qX*Dn}ib78)(Gm+A|Jx%; zPCb!wx~6QWSP4oNU#MEXSvjctrHXyHXoT{*T`j$bKbhl2!wBlObHp99YSn9I(c;2u z-Z1LE7ZiPd7?h1?28U6uxTZhXoa0r~_w43;DC919+WyJB@jP^_nzl1@;0AuweU=9e z{`6^3x4d-4EjlyP`}>hVbNr}su;tcm-*z3as}YGtuY|Upw!(NV^fP^^@G$VL^o0bo z+_#!V*Y!$mR@rHlp<#Jo5f(40w93eB3}5%nBMZ3w{ky#AI>0&tsCRe(zhD5rW#|x- zPg9X$M4UPP?71upxC~&DgUA_GTd0Y`krUA~5`F$II;fVVgJ=1H=b#_-Vi>R+5+W;Y zu`eS#=f^2%w2o1;_hv3x>nZ~Jnsp8wyX<;Z^b(bU2wQ7dMO@{11E3Og*p-xoD}{Kw zc1d89RzL|b+L5>pg)o+EIgY`o;}Sh_{2X>X^DlPXFufCee_CC)Hr2)E+Z6vD2F=K- zM=+TEzhI!loDCt+&+>Z@S0>}5-`~CS*)QKLeEaB=7bypUIs?lDJm+A31%h8;=HYbT z0r_@*b*-dHKtCd27cgAn&zHz7XlRqoqHGK%hna@?cI0sW@QOoRqY2#zn;0$HR>bB7 zJ(o!T6Y=VcrJixE{Yx^YU2cca9Z2YyI@a0g>1hn$ieK{``a${9mXOZu6k*m{uiC3) z095bWMbE9fWuK?Fr}@U?!ed@IHcOVrSKMmNt^kpp$z<81!updu_1OvYK_re&&s0jv zwTK*P9f+OPy_L<)?L79g39+_b6HA8$S|(bH#DWxItio<<=V9E!#_C?DhHIp;hhX<{ zC(}Lv*w;SgA`T*W0HMzNo7_RWV@Xnv0H@ng`MS{FPOZLs5ObR z_8ZOByW{flPwlT6>MX!f3dQ=F9-HdGOdYU0I7tTp1Y|DC5R>Oh61X9f(`(<7VIS&s#`;E>e8**sgy=yXt|(gv8?1SP z;vwHnJjU7pA5~j-%SIQnn9#>twIs-1@l*7S$~p+kjYz#{w?uJ=DDFDd{#K+ekjcZsFyL|2Pu|}EioRXd>DV2`WT}4!=m4?w^5=8 ziN8s?ddVL7agw2af@(wkeOQ|q3*UE?{|*vd-yGrCLs%@*o=1KeEJm69W{yxlIqKyN zlIIAwTa^EE@In4fvbjZZu%1c6>;~nTB)dPL>Id>fiQbJa{O=SVIryFY3sw$DjNp&y~8(2^iDorcsD zGR()D@?hpoc^{J^vLSJ&22EoOxNzmBx-~9bn#dpE(uGT6Tr@0<8^zyw_q=&;+5(yw z6BBQ9`tCj7=iGDeJtKsO2yZAWxAHe^S}ZC;B=J3sZx0|L40GLe?C*e!0loz+1DXH} zfKz~GQLYwpj!`v*7>E;}nXBl8cl3=ywQ3cCZzjBRdtIk*O)rcK(F)mvfHdF=>s$nU ztTgKM$3P;id%bEKY%{q-cUtN`0+W7TyiA)p~F0g|}3BPV~w|EO?l&&tUW&I$RwiAkGqO`}w`Dznge(-xmaq}@;P zeLq5UA)JV`+a&UaSv1VGPz(&(H^GNwj zaxDxffgR+2Jy$TC+pO2O^+1GdglZu!O66+Kspm8mu7^$`x<*j>BIGQ_gOI-u-w;9- zwqv;khY}YPu9vuQZB0VgBH&6y>LuEbRM(i_m#2$LjAow%Rw56EYREaNLmNAuQiqIE zQ7>up7qT-;vswFkjy5n`&Y5d&ZcWdo$5V*=raGi=IJ)Ucy?|9arCItd*RXU5p&Uv( zP3Y@6E9dB*0^Q11^EdQ@WA9~QZ_eEYRGB9Y8B*`48U}5!CM#pYLwLKP@g7d7cPCVp z3!9`gN-j`1UmBeS&8i6awAVwr?y4#k6Di|eD~kFpDIN#AmP-9|5!Z6oZR}zYb6(h1Ju5oeDEhyrDJf#KQhD&o}V}v`vH~TQ(maT00ir9NZ80d;6 zo+uaIVun%wG~CWVs+`=;|E{X ze~{!uvqfo+)US)(qZ6dJjDl6Qt0hMpUK-IBE@Uof8LvXMGu6tvQO0B}H998FXXY=? zah!OR#L18zg}?3X5+4cSX|7n1sgQO^GHY+Oa!_zm+O^B zdNT`WSDNVs1m`UHZZwO?+erJl4>eB@WiSg>PdYlhHOhXMeyYNIS5zMv#Vq8@pt*3GyJ=NMlnDu+e&n(i7YjtIyA<1A`4`@1<}xV z9+f(3JH^rTacZQ*KCT>DBS~oh;M+(F*+Eiv2FMEjD6ij8_r<5n=Z%9#{BDiraZfJz z?LfE$?4eF@@#)rO-2##D3C0Vi`K3wvIv7v$9wG0Q1Xewa=VM>TQ5^npCja&e!Tp}} ziDC$Tb08n!A)gPkK3cc%nshBd#`mqI&ZBs^s7H_0eTg%_zaHXm7}vzPTnPC~e5YA& z59^(0-(Ly&MeCPC>w%Ep-H?iUbj90In(xPqYFGpGfxk(}nvQz7n0JRL?9&9VlZ+#} z%KrIum2(hbeQm5S=J_FW(#EpwtY;s~wsYKs>&3d0{UTjQdELda9KgDpbxGYa$K7m? z^!IWcJ*>aii#Ld^kLTUI?q^$V%unk9#u5E6`$qH=*qf*b&O70M1BUi@iu2gYxtQjf zr}Ydt`hy_XWw)qnlNH^`m9seVWg|bW26)@36yKzOqt~a=2-(#0&@VI_r$^U3sfj(h zD*u6fQD?=1Z`QXRoB+7Vf>yoQzKWeh7_e6TBFrf|GW~@F4czF;8?wL zf?T~n8{T0cXyO{U#zuS#HScZ;oR_m<-=b!adfTCn*MM8cv_jRy()1Gbn%B#L0sl*g zkc^Mids1H`!IXCAu5=5lQLjZb%+ba!ktomW6d@2aizHy_j%%4D=QodW&+4E1;z`Zr C6;~tx diff --git a/tests/manual/rhi/computebuffer/buffer.comp.qsb b/tests/manual/rhi/computebuffer/buffer.comp.qsb index b1a666f185c6b9b9e864eec1a1ab60e338a43758..6cb7e583652adbd2ebe35bec1d40544b45c42249 100644 GIT binary patch literal 1868 zcmV-S2ebG902#x0ob6d{Pa8)NUJN9}p-ISV(nR~HY+oi)mfD-umIl6%mRtA9*~McgYVJ0l3E7JA>1#~zI(eSyvy1tt9d^0(jP2u=C z*4aQm4>sMzqH5R<6Ml?c0DYIhl7@;zC;Z?9Uv(g%t`i+i*BLE%k!-o({#w8)74f1nNKfQH#aeuIKL)=}ETLVg%G zCh95eheC0OD6W#9(cG@XeF@k`#CWIh$M-8>gYh`|aFAhPiW~LUKt4n7oirXL-l)%$ ze3o>hgx9O#y+>oHzX~XQ6t5q~Fo%6KhPIc8*G0lc`Lf3K3i+y7R|KY%(f=A#ZH;~r z*gfPN`YBF?>^`D7_7jf*dPkd^z;TfB*iZQ$B)^XdBS!pC9wMFMGpx-$PGkKfk5b$| zl9M#vNB;QC!X5oNHlyTOf%eT^B`-?(N0sZROeR3do0N|+kg!J2$Yzu79IPvhsdg}| z>#v~cra2+M9^#p&Tyaev71&aq2QRGeIa&j~g0JLpp7e7Np@(EOc7bA`Ki2Ghs`FLN z<~r%W2OF&8hvbL)UjXwa@&6s{aqNbuot(=J4d;_atka?%398vJjSZ76)@X#r=V(tF z(Qw8!9IV?d4QE{Ajx|cr_#EvuDQzrG`NO#*PKM?_tl3PE{yVTid6N7lG+mDLS;E4) z+@@OfYFJaG|CapjkS?eBO>2J0d7A9hc)ktp4C#NM`pl7Tmg;j)s}GLhxA-2_=dOl5 zABsIs7%J}zp}a3?d0zju?3%l`F2{b2uU7qlZoNmJ<*8NlQHMNYB7_d@hbU(lwAit-c)3 zJ}^jADZ@UP-||A;u(DGe3ZZ7Uq_4*iJSQ){?ZamB^#AswMaN=q!)N(QrgY z#PlUVNF`ILJMy}HJ2yF%$xdZbcQTo&Y&x6EWD`vkB#lUOJe^D>8tNur6>1g@@-6Bx zH$DP%#u2A!cX%Yy4B5Os*!Vj}3uhM~X<;2k52MjgpS)y^tMg2wPhk0+G|5SmoHU6% z9%qN|nI0_)OLEanbu`#V*c8n|jZ#nz!&*a(50^riW|JF{+kVGfEa0UhlTp zkG7TYXx~^UmUfLgFH}>7vh4unnqguiY)x*r;Ju~?(qvh39nUv_4N{uG1;6RmpD)+l zptcUp&$qU!#zE041Ww>t=Jqz^RanMh-w4KdTHH{P=yR*?SQXxAs8qZG-I9@Ev2p=d z_Gvto*xnxFrnP57Dq9E-^A^LjFl^8~+LvJJ@768DEI`(5)D>)}uv52z_P^ELs!S*S z{lE8jw^(&d{_&h?Hh9;|ztvr`ePA(^xLCl)HO6s$P@?Zo>vwCK*R35J%2|&W(}|W{ z0SjHgLW2?PC(qq-*|Yq3N##K-Sz#nrVAv{okdUO;HWv~7&HOvgTkMMMkk8)VG?b|f$*XlN literal 2160 zcmV-$2#@yw032C(ob6aka~s7LZcCOQiV3!HAmCs+5iydj2uXg#@hdNbV{k%<^P-GP zj5H%>ur#APGxD{$*HwWkb}T3tE5ep7#gbyfA7DupKLxl|w~BMRPfM+_9H)5PyU8T& zo^$#;k3Nr{wi#m`jIkJFolE~He&{1H-^o}v%vqSfh%(m8DsIWBtl1w~>?H8JVD!O= zbH>J)97DZ~J;VIK^^8sH3gEYVc00lt{AV}e$5I5>8B4>wA4UB|+c9ltlQo}5U1+O_ z!Z(bn1^6}6S1*?>j}0F~ySC#8hEuWxghg4gUIy90<0!l3xc_v7pXwPJKwDL-TC_YL z=+8T(PoKg3utWOvphNA`@H}I8$*%fhpNJdM{QCrO!#xlw<_Oyz%w&UcjE7q;`&OWE z`+bPM1X=Az&Gv4eJA>S)?|)Qj)I zZq34Z+bZQ{jvz&B62>JM?~{$y12#$)6^Yf<%(+r4c%!NGcY~{*%;(t zINii{(SG~Lhb0*IVN`IR9a3h03GHi}qS|_u@E^d~fpIb-@k4hpj&;W_yIz&*>>=g! z-!RuGr}tr=WvzAgC>E}-JETX}*B8C5welqSffxl=t$lu4V%U3l43ElBjFsHF69|1r z<)@R?ZGaw{pZ&83m-T4mp4G3KhX$TpdB&M|^=pLbKvr<^DxJ9F~;%vi#7uc?|vLx2K z*dWZU)xv~FgR~b}1x+6MAhRaz;W;8BiF8!trbcV0vDS^ikn)no2RmQUs1LgoeM!K3 z>&YnP5?bKV2Bcb?j`*G?`DMTzqu60SuW5Tw^4GLIBq-*~paXdk@h?PX62-%4c?iJeO2>EfE-VyUM_;`lmI70D0LvpW@ zjs*FK^jYF5e@3;vCuwbj=y9?;Ky-%I2S^_0DH!pe6Z48*5ZWGIRPJuO6!8{I=9P)nwoiCIB{{cL%of5f|dpV`) zd97iqTjV1}IUA+5QNm)5#%O(!&ZIF-&pAyG=IwP&&pFL^%u$xs7wN3YYHK-)AMPFX zc3k{0(Xp}4<6>ncWX67Q-e zzuZP1?Jg7kH}FsSc}es0TALWG5dS-h!CS<;N-RcLNT~W>naBC5>Jo8tv2##_ZHzX2FlM>&5t$mL-osT@>})R9Zl~V&8YVd zVNtK@QJnt^C)JENtym}BNAT7%EoXe9eTi+jf5PR1Pvo-P^5Yd_*R2Oh@k>|%uW5xH zzQFTS(`l~pc7c~`;e3Rg6t|tZcwFA-I9@a2|B7>X@OK0bSByD9i5n@08^T%yl8Kk!b|1 zC1_!kh@(Q)GCO>HfhUs)9FrC?d?_HZnQZoge9oVro}9@~&E&He^7)ym+|+b_D%I42 zPNSwpp37uY4R+ICWoiKdb1m$!Z+r~gIfr_hxV;0G<_Yt7W9R;)wQzJnB^B0Qd@mjk z^~pD^@kDzYeFEk4v`L;e$+T%?YgNd#<;&?78(C z{uz+3uUC!TqE)Cnb>A{KHXv{UnS_I(p5{3*Ams5a%X6#>Z*)vHXO)l>Dl1+-_^b<4^JET z|K7kcQFToIcARf^aOXFFpnaeiO0q5wYmCGCphO>-)(_Jx_pD7D(&;6Oxl~KrW11u_gaJnJlR|h>{f`QGsDpW;Z3BzIE@)ZeU$DP0#XuGK&qQnXaQwwY$f3(p=*J zxw&%dZsDru`hH=>snr9mjSlO=S-y6+uw=vG7nB~{77d9S_tfXKRNtw(o-l9hy0$&rn=z2xybWUF3I0@k2w3^G}rk diff --git a/tests/manual/rhi/computebuffer/main.frag.qsb b/tests/manual/rhi/computebuffer/main.frag.qsb index f05da411e52e0d6c66a80d0d7c9b7304602e0b3f..09012b0800837812f9b0c996a151dd489b452384 100644 GIT binary patch literal 584 zcmV-O0=NAD00mrloV`=cZqq;zp8PjU1qCFyp+&hQ0vVTv3K1F(IaElMs0iw%sw`t~ z97~RE+3N^YRpK3Z56-+3FTe%C%z9%xHI+EA(Rg>i{buHy*$n`+AvYQgw0p3C1Z?nN z1`z~k$%gS;5BT@d(X(4Zjnh_h(4%BM*nwS*-i4-0e+#;5K0cYB7^!rP@e7mAZ$qn) zcn3Kf*(=)*3GburA%`#wj;j_%1o++{5$!E*2Y7k6uY}ua|M6B64DMVe1U=gamq?O^;hmQ`WVY8V_E8l z9uMu6NMqX(TzR3MR3@1tl_JwZ#T!x7?TT`Ke(umbG)ET~C=Na8Y$d{qZ@wxDD{-=LrY){Qe~&b@Qaow13iKtu-O z$J@gw&@89j)gkvN`{*s+9Kb7XI-b2*hph z%X&`?g&A-|ipzLQk1HCxk1=yiRsF-$2Vj+z-xSNo7W6IYx}@`e0pVu0F{Bm)r^N&*U~Yt^cq- zcX&0o{?Doxxc;;+#r9Yxj&I`x`rcvN%<$M7_t*KSF>0IUH1>j_;MXLcIIa{b3wq)t zn!1TnWZ6)BA&R@5Q!e)RU4GWA`oRIjA(Q9EGRWno|7ONAoMT6vAd7K~8hO*{TG}=f zBAHC1fO!{fD5+ZdbU)0!qSZJ-$K5%-nX_K^`O7_fHwxp}exbfHi!447y*>Mt6Afiz zr54p@F~MHAV^BS4yu+oW&M!8<*Sc0}^&bgvG?aGwK}<<`p(VHlF6dh6(9UPKKs)I5j`_=W^-w!_~eAi%zWqe%{eC_gj9$g7R&`QA|Z(hCjw?j z0)q12ILN<^Dz1YRDt#)K*6T7{oy?F`L>Ea(5tt=4wZ1y+95!PyXto~PQa(q@Q=F!&8FwyCs8HaynJ;Jp=27?;Ly4sTT?Fy~JyX6O@H97d#9Att;Fz zI1faJfAqAkvWltqRTX<=3}L(m%=nze)nFE4>Ym_7VkNb&C_ihczXYhn@2gvBomJS? zU}Z4xfqq@_*ST1OxAbK&2IpHUCq&_GJX6G0;5>`IB$o$xzMVNsKX(+HFVCdEIkc^1 z^cRq?lrN%f9pf!xT`ZI@qrH@GLq19*Z9s|t07N#;b9m3GT5G z`pfE0T7LocS5W5{FnFR^kP7w#9IS1mCdcRXu@}WqKeqMIW?oFG?|ujq(eT5*E9=U3 znZ3byz{Xy`#Z0x^l#W9_VA5-2gI-bwBik-u)@s`A6xVhDr!FRx7MOh_>A0LSYi-&8 zk5&cifW!K_&V#<63_SL9=n2<%;CuD?*&a>tm=6b=^3{B|M`;rC;DQD2(2GZI-($)O zh{hsH`a)5)9k?2@J@-Rbv~uLST|=(dYo|*2i%BKeJ24!j+N2nQ2l)u2)V(W2#Lp7p zHS7&zJ63;+l%C!-j4zq`ZZ{V0g$Jiz&m=q5mvfh0PBddUHUCzKscc#d9yHT>NR`MF zNfby;Q=h7egg=N!nF9R;QiAudNo1R5MY;6lMY)E;BzBGuPEMWuD2!w0AQ%0Ut~kghV25>1Gpr}3tz}J|8+!Zv#^%1tM1L<=Zpch|VQ&JC sQl}Ydp;{T98n`B;whq-nD`k;FKjey->4&_NN#S=={B{ZX0|+{}hGkXF z!5bfypCCDqA0X2i#_~)!ok03F=xLB+kk=pukX?{3fEi-8+cc$c9oAoSdB(ELG20gU zJFYLZe{LA<@}y(ovuicWjEw^RF32j#XCU$QCS$`Yrd<{9EmmU4Lu0O5XRz-K2%cqh zymM{Nk-HTk(;qVF`2v<+0A{mforLPJ{t?K8&&}=XcF~uuV)+rKXJag*aOfLX)gyn# z+NMxd8z4X%P#M*y?IkNFR;q80Us!^XUo38>7AX7=D8IqJNV1 z7AW5&%_T+tY1)teW#~tmxHGc<1`8gVr|>(bX07=mr*%M#6Q4DzeTw2Eep=O}@e_of zA;%V2(oc3}b-VHx{kaKC|*t>HpEn(i~`|&gX^G zw1bw#SKF2}?FQUeTO6z#k=+;V)_wdb9aG?I#GC2N>3aF(po4jhI_l}OA*o2 zZwp~8Y<;cfOY_JAtzHkC9pO>d_-Riw2CaD2Ao{-kFoaW#=7A8;l7Z(SGMrCNWugzn z!`OiS04XV&mo&0s#9fK@C0&UFMNO>kZtd+iHayq&8(aAAbVWB;_{-<7HgHs8k$bJI2sBaoUh#GQ$iE;qs92 zXk)p8oRHgi}aEG3T(>5aS!aBE=Z zv0b(f!5ORm3D*c0)1>tXQb-iN!jRs_bdMS-@qdE!(f>_~e}?2m z=nuv@OFX=1!Sf8oMEhBhhr}MnJ4dMn0Um_mLKhNux zIbyyB$uqi0F*3SDF|N=&XUNxW;#Vma(zT)b?eem^6fImPdF@`JLUhzJ{lBD&Rp^{ zoq5tJDmo_de*hh%Z;_p;*pJK#bK`zC9G~%}Ed z?|4py!;uXR#abVEWShHtMqM#*bM-Rufv9pk!cl^8ABMK8i`wByP`dH?)0z z?DySU_+f4}VCpdrC9wNmylp!k7gp~J9VZOp#10ak`a!b5VID8S=w&ks)9nqwB;VZZ z+k0)#N`o}^+*S*EB{cPNErr6wM+&uRFTE)6dORO`NzYvmWO76F68yFWsh5matB9aU z(#Wg0OCrUFL?CF9V6P9}) zn!`3oa@4}|Z$XRdZl+vTv6h2YlxJdGJr!zthFSx0J6b$1#Qzp_Wv@)pIbCKqh*;UT z3WnZC?}V5wlV4aX3Vh$ftP|hiV(N#X=`ip(5)4Bd*dlC9T|Z6$CGCBL^5J0(K``^k%^1eUd>G{CJ&)|f#{ah~Fg-l>nEQVlAGc+W(^?*Laldlxqz zuRnQi-HXCFw$_8~G@)YN1`j5cH&S-36Y|L2nDH8 z)lNgS|r-4QV%_$p31F1pz5)Q9((AI=nv?z$6k>7zBBJSW5=NadZ|>y z*z+m8qh>ER;LB$zaMlm9^YHsE{JsHe8&-j#|BB;Uj$4EM!~n`1G`i)r z8b%-zYSk*nEPHkUeYi%$MqXfVFT3mrIEpjhM!o3sYy|a!ou-Yxg|FNq<#`I$EUXn+ zAF<9{K77So1~8X9Veq=Sd=0%x9EJX6v45fKR3YjO==Y}2G?2xpf8%{9XJT4U4An0uEB)kwmYtS#N%{qZLtlU%Ve*+l{4P=4bL1zY&run|8WLrNj zcrmigclpYbuZS*n$x9@UkuRiAkZg(aMEWRb#Ds2KOcM8_po8ZZr(BN%J;>yl78Cq_ zn20?821!3j`i%6^e^Sg?>JO7I3i^X_ju8*n729p=pcQC?9z%| zmh3W$U5@yX-89+e$PTgh4wLx2rq~sT{|(s{$+n>QnkW7o)v6IM>hS`TxQ%*xUFq?t zh|kDI(l@&3n?&CQYwYcNWOIXL_zak!yFk8C{v1#?D^G%cx^IB!%d__J5W6-i^-(Cv3bXJll&~n;UiuK zxV&tN$;Y5fuQ{FC9Iqb`Qa1E@gCSB}ynpFDvTNCf<+=48zTwn1nw;LSxVQ(4dmZHV zIQX>X1a@x^aN|J|Tb^Ta?4PDn70#Az<~Us0;85(fo>z8ydq*!S23A`=OMD<^I9}l> z!MH1)VQC`wl<*aQR%7)PBcwJcj;}k#LbQ#?H=j;is)-vwjTwV^i@g_ z1FQnq)@0oxL`o#6nJF&+XVV!SLOxC=yCC%=Yky)|8&WgVng1}JUI$74W9a2Dgg5c9 zf}tNK9oMXfmd)oHc7T`&th!SvC3pG0)3C1KS9+raQ}=Nw_-BgWG)$WdtCxk2>A8Mj zxB(9xH<;!ykB44sbE)NpP5gV8udOwVor+x!-O#tK^>yf#(A2W|5DF7tA=H-Kv|FxS z=k1|qw6^PxOfHIEg5QcDwT!;Lo<#r#-hryC{P3VZ^}Q-H8Z12VBdRqpTM#>7rJ;<$r>YQ zDb7Qj(F^qvRH{Kv7tfg}_yyo9M$h8v-Q{}^$~Rk{@0XX|W*AU0F9K$PuRbU*I`C`< z=Ei-2QS|sYI$2Gx(JXf!udjtun8p53T_bp|N8nr|K(40Ay8y zaLo-H@{#p5yg1r{cl*P4D|V> Bo^}8L diff --git a/tests/manual/rhi/cubemap/cubemap.frag.qsb b/tests/manual/rhi/cubemap/cubemap.frag.qsb index d7cc0255548b77c5daf4c0b58823772480424c7b..f63e73e5cb35a650eb97372a69dec8309860c9aa 100644 GIT binary patch literal 1089 zcmV-H1it$K012vioXu9vZyQAvf3}l2+0e$MloXKAKseZ{W!7z|kP^Fq^U+F$lsIXl z8sl!(YkQHsYwfPBlmZGB5<&=Z;Sb0a<-)NX`9mtMh$G^_g^%}U-q?$qN=RHf$#`de z^LwB3*3SSi1!^X6o`oSazy=@x0%#(V!U=!#fbk&qBD9cYK^rQ_?@Ae^>of_Nke-1E z95}?)MP??Rz}91$IfpUq+vTAXgs$(2;w95C2A{dX#T=lU1F{Pp3ZUoU@o_w(<6{F&l8 zPO8{eaQ==ni{J-1rx4#+-`IQ@ix(kSlgYr8A?F()PO(VX1)PH9alVH08J77(-{Zs$ z==l}vB_HPa^7PpmoDB@P!5IZy!@I5>_@Up5M0O`9uHC5K5Y>*=bOKTFdwmyaqG%S1 zaB^~Ty}I>Yo^{Q#e|l)2(rJL*js42@_Rc!VZ2t$D1)SAeja@5fI}r+1uWjrfBX*PH z|7aExcZhyBBlYZ?SeSja-rEB>$UrK{WTY+!dA|v@?qDj2vjOn+g9IE^_ReEftFz5T zetxF(Xx&#Zbpgw7Ce@R$2aF}&qR*qNWn5Nw-`@QW#&4Xy)5*Je(m3sGQvQDoUAr`z zF$+JWlFMnbp2iz_k_+ae;`8N10_V~ z6tZi^*T0* zNlDj>3yzu-iVZ?1$aa0(8%vVbp5w)=s#R9&68K-Mg^|^Ea96MA1-C96Ti2R2Q6>mU zd?5YG>y}ApRa}wV3`v4+k7K(uOX5CyML6yX+Mjb`js`DxtxP1EROgs$9m+;*q0?5{osyB>n0p9upJs01I?@oXu9vZyQAvf3}l2-n7KD4QUBN1L0tc$k=J9s^+7#`D&y5fw&@$hyxc0zc)J@o5TpDUYOO} znfcB8nm2FfEfGbCs0-Z>cZ=H|PoCfvNB=GQu3n-6j7#KDor+|UO_IvAfSE~EjPvO0 z)Sw#1E_vYH2Sq{mK@Cs>v{Wy`K&Jk-sGZL=`9+mZOC9g zf3E?)KJv_ZqbA+yW)V|519}0J1ab1mzh+xNpe()D0b+WI)W5KbYr>Uxo0cmfg#4|XG$9+NYx+_t zkZ!>#Zp)JIb+XWz^R$8Ep#LAjjf|zyR=A@FGix`e8*<^(pZ|RS$6qdgzWK>F-~GgA zau5xY4=GB&fl>hP@I3;2d1iL*aocwt)%i=^M@M|1UlH@~j^|B9q?;N3pYiB_PY`CB!s;-;@Qyd@p%IwHu!& zU~TT4?mrIngu1UFbgq`4iv~So4>T5egWvntr}&#&xv}z)RPi{zWTG9;=AT-pwUhEs z(Zby2R&KNKC>9-#v-LPm zgwjEXZcO2P*T?YiejZ0SAG`j>-;IZ5TDLr7F_oj7mdwxk!U{BxIrG1${pC6HzIe$Mp|MLC8JfS-_sDGs zD}CqY* z1lp(0Ft9hNZJpEl-UU}&#VFumd%5mKc%IN}e?Y_4Aevz=^Y+3pvW3H8%P!TLWho}=(l=`bq-@P9P8luS zv+Cv7_?6k3LQ(O!aPU8dhq@+(l0xn9e79NhRrSag@C&00i25rS6USL9*4Inir?Tmd z4HSu!l9t^rcwC$y*7T&C!atAQl4PxQX}4JoMyXI2{yre-`CN!Cdt+ln=+ad}>6%a` zrWgW~UP$HA%%(4RUdv;|Zfi&}gypeimuXVmgIA1WmT7HyQb&PnWhPLQ3KfsQ#Z0I2 V$!c5)mu%J+meX!!@h|)5{pZ7OtuO!p diff --git a/tests/manual/rhi/cubemap/cubemap.vert.qsb b/tests/manual/rhi/cubemap/cubemap.vert.qsb index fae136337c21579275d5e93da010e5300f16efba..39419d6e4637286c511de525f78bfedf6784083e 100644 GIT binary patch literal 1200 zcmV;h1W)?_01NDRoZVJSZ(CIm9{bvPT(^nSG-+sQduR}HpfYv|RV62ZG*6_`L~#@a zmB={ub$pS1uXP_*O4WaWkdR=kn2U2uT!pYVcc5q=1|P=OjEUGSie65~1OKG=m2 z8b}S`sp)r5pxS7)gH(p4aYPpW!%A}?*CLV8T-?67@aH!-%U?eJ^oQ>scS;X_efS&s zYZ^*n8utteI=CO;{v`>pvADEMK@sjFj&DYK_~!{RkAN`6BFQFj3*0%}ui`$%o zkO|(qVMAhw-anS@*RcvnvyaR{aZ(C!0$3930 zo6FSqec7Y;k{(jBIPTl?M{&vHIF9Z2%SUlW3^#}F%bW9?UyxspMPuTxoq!ixFN%N8 zO0}!D!*o3o8($g8$$s+Gj~#KDr6X7c@}0qK=v=`r%=m742%b>!1hucLcQV)|t7?X@cFmbYbjfkh*UQY8nz z(<*87H^OqF$3V?$Qeq`Z&prx~yL z$(Ri-!=lR$T;Uj#?2}@;5{rTOSC}6~R8sPWd;y}zk)oaxxX&TJA5;$-QkIghW3ayx z^MfoSyvg_!<1_rOCgU^wmI+x4m9NRzEZZ4oY_|92fH|e$497*fZ!kZ~xlAB`mTjfj zHr3%Q+aBlq#@P0_j91C%eu8O@zsP>c-gT^V5~A57`5!2ucbVm!Pjg;tSP`nt5X(-p zPJ->vq4pr(&!YwM`x3`8%JwLR^DNi)FR=a3QHS`K8FPW{Tm;oyBW#EKTw>hc=>3M8 zem%D-h`zokx<`|?Q)`8FOU$&bpxUb7c(&}_IWv;`cDw#2edL>SrWyLSvnQNt+wwcr znkA%G$u#}I3u}SEDKPJu0+;^25;!F#^L_-OND37<4C27I1P`ycb0_pIFV}KwPGM?i zrxY_LVgrgeJ>CR5Vc&L+#34G7UNs0jdp8WMoN_?AUHK0oicL{DZA;js=m*t33%Q-0 ztD@#Q$T~9P*91*J0`Rkev6I;;b{|=!JuB|rR~aFf*D24U`MeG=zkm0W2oleDR=UY! zJ;m#B4TbisAoLtk!i-F6m9+HDJy?h6d*J6uOxGuq#X{jJPuHe`^`0$s?1t;L>0Smv z)v9`TsSUbTt@m&xvsYJ=M-?Z$Yu9BZa=I*0>L>GlX3mjCm7s2F{rd_|=6CJ?lHakx OjlR?AhvL5=g4b|#(_vx& literal 1499 zcmV<11tj_a01hR1oYhy&ZxdG#AA6nH*#vL`0h;i!kg9T8E1hd0#srq8NE4e(7rYvcrRwI8hSq0@^(aQ8yW8v*kK)Cc^ls1vB4z=^v9 z%x|?^HVoN+v7MxiV#TuTDs`~^RtMWhiFQ!SG-{UJmsLaY|*$IWpts3Nadl=u)8)e<*xNb{aw@^Pq?UfjZ;_O$WeauAuDeID6wJjm~VPpeqf!))_ayeD? z`86=BH&hLUoz@U-UcH%DRoNDv*VsHn8zuW1R$t@Y)MTskYRSd2m0PaP@^LLVevG$_ zDp(COGb$!TNjuesWjC)~&wF!g_2M}ZVxCQA;f(frgz=`TB8~)8N?e=a3dU}Q@g2{p zBSx*N*R;8X;?&Y~(OEC?!70{D=31+?rWePL=bEL;6?H`4bam6y`WLA7j%MpuTZXMe z3CFPZya~NovP-V+5$JZ&Dqq$suG7gvXXJJR|NlM0t)=7P9x3ZHE7PZc|7yDM`QzK) ze)G7QfB5rHzw$<|EB>M7yD|Ym6ZIkLkGP*pGqY!Sw;6XyHh#i8<$pcn0pEqCnXxgJ z?Uy^3k-O3-mM>7}5|hdo>_X&Fy%)iJDJ{$R4f#&S&rqT*uSb!ei(1{nK5dTEg9mXe zK>~j-D)&)8Fe-!xE-uZ${DVd4oD;uU=VS++BqpXJ>!C;ss*tO&+}?WTEzHlZ{6YL}h|#-f zFQ+K>A@=>ur@mJlaS>Ec(rItZPpPf>eZ1d^C+G)jk9RoE?FsB?fH^bZx9~Uhg#7;U zpv;L4*1_RYgZb|C)_JeL)0ahYUk`1?#h=HCZ@(Shic=!ENtiF3pE`e+?Na#2DiV88 zV)Sz5W%2(|f;-5i8j6)Kl=w)JEhTXx4vVxOtH8E<5e>IBJTsj~N?e3SIbPy)bKGOt*LT__fjPW!-jl@15@! zImuk0(gl0{BIo`f`S-aSwgyGc*OG1TBa*KvViaEv35Lggk?}k<0(-q}jN-}S-h9a4 zCHP=G65$ABoJ*yJV^BEe#HXVXA9#F3#=C)vdt=4h0q*ZbkI$Tjx)1my`Dak^WC?F~ z6tS0=agWFtuL?dP_+HspRq(yCmoaZG{CHKtriEvhVAJhAC&ZMX0r87<-;nWciDf^= zdxR??+`JBZgnO^VHz?eDJ%4=}&+nIhfIld9nePPFIZol-WBF4^cwbIQ%sV8mMXU&~ z%}$Z+5S^ItPeQv#=BL2Gc3%-+b_*Z-FeLJTe^~fGgAR`m2xeG#4w8Si`h|z>91`50 zuzu3N{lUFWQ26;`?;ed9W~JV$>e@s@cT4pmu4mmSPpYBZF&fo3`6s(RiS)qXOn~!P z2MLU>d0P1nSw--@3Ns6VuqU}9{yT^Q+j)hyy4rGdJA>rg%#B{Wn2(TcNflOCgX_(p zZTyD0#gBF}0ljwOlJO0&?uPdugueN`Ou(fXtmwF$x*0HdOsiNXhNc(sYhKm@0Df!m zooPqg$yLC}^^|twrXLYT*)S_I%!v zHXYdPhP{E*g8#=q;G;juM_)wGnK_fp8jFukGCOm=IoI#ZE@Q05^sKBvmN3{7TV|VtuCoOdewEeL+C4ly zbkc0->^yVv{Ekjqo!tdXQ{LE<5#lSVOvctg5Ah{cW)-|L_O*hE)Jpn`@I#x6#2a911Fob*?zPQ)I8Tvy!S`26ZQRIp&0MLvE2f=$>X-?z#B9iVl^rN)?rtr1qS zuyw-F|1o5b`EQW@8l7Vv`w(@7&VGW27s?B(5$_;W-dgwL(^e5Asf;7hYPp<;-p4r4 z8e!~v8G?JlZ3;j{5%@b|+N(B~5kf6dkj#r%4h05jH2D=5Fs9nz1$gy1^<>g9Q1CW`^i=97I-7 zy=xd(0{*>Tnt7uDq<-HpHq*zsC$7L7;vhLTn>zW1jGQv1sG9^?oFPYS zIQ|A1WYVAGqRs6CtH;F1>G8qI`Jj`;X*xKFCS^{i)a;70H}5+~M<=h{5}&s9QJzh1 zZpp4VJs+HT$tcLkg}P*@Fu3ui5jPew7y7cz$JN($t{Pz)1A7ypFz&50$M9lOprkbL zmvGuPR)SWtk#dJ;y|9{Ec5rRKKlom6(( zxhV{+y`IDvgY_tk;=e8-mcH*xoCnfhWb887-huHD#%IiVow2Hk7w)PLk~s|ht<6Q( zG58$=xntmR^A>W8vJ^?fUP!!={~yGA`#X78Sv&SRhB}+8p5eYU?$i;Zx}y-XT|m&%X5IjM#5RJ zt5B)R@Wb-`T|zx8BleTVao{^ zKY{%;wP3|y6*w_7wum=rT_p_dIoX%VeumD>$$o~;iP$f&o-*3tb@b=~oM3`-F^cgo zAlOT*6#EMK{|@Ms(b8h9fXxzCDqzP4~&pZ*J1{0;M}{=;==8b)>s=&*^*q8(x#|QmKvCH%!H{ zh~?W%#S)x!pxS3s$i5eQsWbs(>_&&LrJp9}WjNn*Ji-6>oK>i_xwfsE(tel)Qmpi3 z>V+;mPN6zn<3l`Az2H~;YjoE*&l1p3;Oi>^@uV5nylF-QWiKTo%OX}XlqnNMk_q5MWLvp0Y05R KKVJcZKlC&I1lUjj diff --git a/tests/manual/rhi/instancing/inst.vert.qsb b/tests/manual/rhi/instancing/inst.vert.qsb index de05eae80fa14a16a1cd23080a0727d931d7e99d..4b891636e7e97915238e3eabdac28ee8567d305e 100644 GIT binary patch literal 1456 zcmV;h1yA|_01`=fob6ceZW~1qU)xFAT$(n2+CcvhwoM7=)Hr7+DJUid6i_Lul&Fa! zq$sj3&N&>|ch=q7q*Rf31$Y`hBX|;Cf-eYWc4zPQ>`Pkl4T+QXc4y`{v$Hd^tkTpBzZXxV;M$WMxX>% z8T+Mxj*MmSNTbeRJM4rJ(&JL!4`M+q;FRPkg_FzCw~IG3%AZ;pw_!okNdn zSmzDP>IZ&1jJhc2*zAB6_5~k!tu?NibHnPmFM(%w!j_A@k8kmMnfrkPB^^5tSIgp( z&Yg#KGL zlFSLJXO--csxOBbKS&ehvU1P(6#^e^jCB>Vz*o2^!z(@Vxn&vI9ixj#Pw|f>KWKIO zCm#Q}>j}5hgdgdSfBeKs`LW+US;bfNnY-P@Tc&Lwvpb_(akZ~i42k5y%ME-GKc=pf+ zLq(N=*7Bg*;}ljeYi|bf+aW!yTG`q=tj)v2Sh%MiP)A1<-U`8@8^{nY%ew;rc()-M z=x8~)Z`vY`E&l3U`2|$fsO9QVIVb5r9ZlG3kzd#(%PnnFHeB2!BNv7$yqZ(w)ywJ} zkM){b2McMrqfX?BeiWdpF8^^EHKu+5>uLRu)mkdVvSDq4=BXbGi1@Li;~j^4S|qnog| z`|QO*b2|#-xcMyTWiOm@B{uo~7hiAh?7aBgx#TvasM-Y=Aw|?PH`4TDr!RUJ-28ku zvbTPd?;RM?Jl7o^Z(H+?+WPD6L0gt_=AEhcwye%e<-;iRPW+pe-_Gy(-G0Z`Ijl%Z zRFcv}6)64D(5oN6k<#G06~S7EFwN|iDIV@D*)kc08WoH1UU~u(nZ3bAJ{2S9AWA!w zgaVnIp{9|!gd^CbSO&(qsEcH`Ik$#Bl`3kMpGv={pGuCyz4-sHrT_TXQepIqNhe$V K8S@X-sq1tn*xgM4 literal 1792 zcmV+b2mkm002LH?ob4D*Zxcs!{F!7SkPto!Nz;L(=^9*PJAtBv&_Y^Ks;ERHLZ~US z*7iCq*z2&nb^|n0h19BtUW&N!NBRTW|ImA{J@m+>Qs0|-G(GsoTT1wK#V9B}a6fbS5D&tZH8W0H1cBgK8=+jT+(~mH|g>i`dJd;MdI#%F0JL~Xjg1xV_oM%|4zYToHhS9ff ztL58)TKkOf(Z`Up$-}z8ppWv!sm8EgH^}c7Q>a%{6xVf@F@yPm*J}jmRF?IGQ+ob? zhw&$j*Q66^7`q)9f630uk?Ll+O77Q8dS(b)ZwNB^5n;z6GAR+0y!hT+U0*HvL9?`Q z2}_9`0c-I=+EK6!pDc`y<%lX6p?FTfn1fMe=wC*}`xmTJ;MVyOMj2Tt2})XZO!)X+FoGqp#D7J8PQZzq0TuK37A9Mh-%4$Jq5yJw$Z)| zFqcu6_MuNH>SF0B3TV+9{0`<4C)(tiTr<77J{`QrjF zAJl)6c=HEcPSO-pM)=o&$&oC^c#Pt_OgTPGdAbJNBLrUu ziIXC4GR7x}KQD48@rvgR@toFpCJC>2-X)$Xjc1zhYhVT1{vPG~m^KuR6FiI*h_(m%}f;k<)AiqFrNjTxua zv|Ie6A?*z6hq~5^F7rAFY?m3hfKk~#M-V90Zj!(MDWGdMhWxN_L1myF#d!=UQ}(m8I} zfP$M0#~TNi2h5Vuww?gaR5usC%&P_NxRPmb>Ll@1qI`qXCyBSLco(=jDZrS1*J*Oh zmRTVCrBxuHtvv8606b1i)MHjk9*U<$ahFC{`&l!ynVonq9b(vvvisZdcU zNb|Il6l^px)+NXSKhJ{#yh4|E4MVHYENv#LLjRa?+(x_CwE5MJ9a!xeTr}EF{hATt zeW%mBh_BLvYmi_cDv{%D%!d-RxsX~)sEby+3xV6wYJ*tNl5!2Qr8BDP;G3I0-}W$( zZn<#({*tCE;`8RFauJ#KsCV3m8H0F$oE5;uvfc}9Gqymis3NSDBvxf{$W|>VYx?5; z6FMtrrm_xeb92)Vu$vulp~xFu&}g|Lgma>IfC1huhz1&381$Rch+~;Q+m&_!RMKj> z6f5UJI#5Odrko@fHqjDGTc^c~n`mT0tinqPMP53n&e5$m)H-Mg%N=DrJLq{XimLL@ ziKsDoh*!h<&sG{T#A3t3-EPbA1BiINtm5r;zo~VshY;352+@EV8nDQ58Nb?0tv#q0Wh?H2xY-=`%O`Nn7W zR&L+E^J)2jZV0(5`!qtxQH^w@ZpUr$vo^8wlg)^B{UTq#t3`8H?daHTwYS>V-_!>! zQO1#Xq~2SiIuE4Bx%8g+H(P!ydC%|k+NR23Q9wa)P?{(LrN1}y^6=YJ8eDBfFjpZA zGrO#l<2y^VO!l&B6^rcKp$9r=w1c&LN<@MqQd<5`BAIkdY}1G|;U3;WvGg^+Xcvht ivunhzdqp<*>n!zKc-hQ=kp74OV3~^H~F007wcN`o!HfqXIIdUm5zbM&iCC$t*Xc35k;tJ7M7x7}v#0^SPi)0)<4yWX1aSxu+i zvTR3>tje0!4ug&z>Z_f)_DIv=syBQqoZOt$n;Wfig6KY&x#3n>dz@G`E!Q)uekbg* z)onvxUbg*)ALNbEm6dXr&Wv^DE?qI!6?f@Mv91*9c7@@3aug+fqZ-k{tkZUae8aar zBetvu)>_l?q$%)TUii}CZ+W>LT5AqSD=QPa?Ry}4QLfJE9k>Gl?sbPxbCiZpJYu`1 zKYH9f5rB9%?|KCh3=V{5yxIiVW`gKl==p-eOrBB{4}6N@{D z#Q9_wu>?e$%YhSi0uN!xrl#Q3BvKlcc9BmHRhterA3B`8Ut| zzis_;`{xILwuiAYl{7yXCZT-=z>m-t;Cy-p9`03c%|1|g1s_l)uSO>coOvKjDabKR z#EwDJq2-~Skq(&;_c)9cYLMxOqtYt5D{-FFbB3P3(o>wd@!6{+CnEYeqV(orS*x(J zm^ho*_O=SCO26PN{Ylu-a^SXX8&j-^-KocQ090?gcHp=DdZ_2`jq39YiwpYVx>a)m z{ife+xee%;M!{sa7w6uYpnUXE9>tZSXD-Ls(yjY9@7%dpfv~slfK5nqMw|5>HiLvK z60S(ND&eYxrzAW@_~QH3B`a8SVCvh8^RVM8yjJf)`=}4zY6xZaDUTf2)9MgQ1w;HZ z#sN3K>D_%r>Z?*e#bZzry9BNd(Wj6y!(#$0`-Cv}ZV)ym*#PQYF%fV{ALg+!50mix?K6ddr2X8&weom=3tm%E?M-^4mD;&(fbPT1H-kMigNUWf;mce*=9hu51uyT zI`l=`eWb%RjeAcPbb}NxZVg$`4pL0wl}G!7jPC=&H^yZfypQqOChudMc9HinUK@Tb z%+dI7&^Ytbn3+h<#PUeYNw6H_KM3Zf*pN4aIiajcUyCr@+yoI&!xP=JulFBW26(lO6033`I;nLa4z;3?-Jo+yvx$u sCP_a{``2Z%L*85DYnt{ml>dTiP4QDm{>b0)zlG$O!tbwt0K40u1)5$iQ~&?~ literal 1934 zcmV;92XXiS02J7Gob4D*Zxcs!)}M(9B!oa|0?k5zIw2U_36K(+h7ghf4yYkxN4aLjI{v%5cD(9?|~B! z+fk-i_R%ol<}|dy*f@-HWP9o*Z3mc{>}smBIasv`Q#MUHN1>l)wK}`PHM&w=(Z;&= zLGQ2A_0iV4(yyZH*4DZP{!JIgH4KP*yJ75x7{9~Vc2;)mT+uCzf!^yL`$7{regxxv z4e5;enuv3hE!j@ic9yGQW=|l_&1?yUFQOwswp7jm{$Vrn7p%gP#&&1d6qA2ck-Ni_ATJ+YEjn?`e^Ms zt>OmzoKrtf@*yhONMFt>!erOddw6XO5KK8E?+eKN)08I+70gne|yn)#aU>N z6@Q-`V=Trz-z}Ry1}?DlRo=VudxC(v!S13blsv{vvcM7b&$Hvgi~E|d%FgPwvu1icMp zLR6bU_`{m{9@h?7RW=MXjJL@I4Ry(#0BNlNZzd?4U6q{iVhbwSTg{O*(@^x2n8u5){Old6vChVY} z2T4xC2Nbwl@dM#Lf;ECu1WSEG1Y@Rl0XD$(1v!lKJurh$k=Ofcz>mI0D33b)Hj)2P zqQ{6HB>Fb8jrd`LTL`xo;2k6z;(my@?I0Z}-$s74l03pY3AY>IcJdAN9VK`d!6@HB zyi%WBYn1dM+)X&tr;|QL`gA3}D1VS-BSgpXa2@{<(kJ!z5iIFP$v;U?)zQ=Bv!o9Z z{Up>!fMUf6_a|V&#EZFTCjZ{1Tx_R!p9QWCzD5zhUBnaNITrW_z!T$n6mokMxxEeK zUMKu}z=Lon$ub4kML12t?IRqnlooBPojan%V)8sZsaA=+<4R7TVS_j_!| z%$Kv4ex_jgMm_`Ee%@XhiB<8QUC18CpTx>YELQg5eAn?z^kCPubS^ar9*IBk;~wxfD6pwnptVr9>A<8YI4k`>9EYb+NmM_GcH#icGC{>{&OzOifp zw6M^xn?(mehsWxOj%O7xz;DhH%j_ldRgKu+)^FdbT?nAWG;TWy>0}>Qn4lo{*Fe2O z9<(JOvK47FvDU9A6G{3p6E{`HRF#p)>x~)Hb&SMwYZK!DFq#5(Ex+tKh=yp!aLWqw zRntC`r4fg3dsgA12-jLYl}yHZtTo?qI5;_-Ie%p?lXZ=o84*QKKMk61lx^3Fm0ZiT zIp2!CyiyV#4sSx+j^C(;@tU}0{nFhSMR=$IwQ9KQ_=(`NMb-|Yi*}Z$G%oXt_ivs> zoWx%tfy?>K1eD#l;T!YG1*zbLX;j%$74{b~ncOaea5Qmh5 z@+xcGH0t==K%M|q`elXZ8I7Yf{zBt(XzGZHM(Kb?JsnzOK1^!{A3*YaWg8m-{??MW z$<6IYDJLIF;%T~pA=cy$+n{X+(z~|l7QJH5*W)w2`V_nj^;!No=;w-slAVW1Dw#;J z3$v3K`zanxta|sx7Nju>7nQm5SI%9!G&2rvZ(ITypVo{rD-C2?39l)5O~D5gd_chm z6?~BJvma#U40jpc+#4ISQ*df%B3JK2zt+UG55bj*2f}l#rzLpAx@~P7#{X*gU9X*M z$~>UVgTjXZ;^4j(Zf8PH8x=kQE^?P}u}_3Oi~-!+np`IIPP7YpM4_XugHn$85GVcG z)6ypOSNJ;X__%I`?>q86qTt2|*Qdz3w62Lj1sAzXICTvpu*})HvvUub_=pU9XncS92X*;3$z6WJaR2}S diff --git a/tests/manual/rhi/mrt/mrt.vert.qsb b/tests/manual/rhi/mrt/mrt.vert.qsb index ff8c0e50bbf231234bbb3141d607be33fef7d077..ecd4a2eb71354a306f728e6e089f63f2a628589e 100644 GIT binary patch literal 1299 zcmV+u1?>6&01b$EoaI(sPh&+Gp3~FPa*&VZW6@=WSuv)lsqJpvkN^$4d=wKDLJ7gF zO}DhCa7=qnb3Pi#X8(aPG4awn6L0tf{)D~t-fQCpi3u0R8(rUb=AE8XD5%#C8D`#( zdFGjCI&+3G7H6`=pc<^k9M**Df~7;%UQ=OV8Dnk8@R-GXs1CCkq4desppLK(t6W3A zDSLn&v4Az8mx5OH*CSamk<|j!HuQ$byV}E$$_Px@W>uIR$)3>^t1Mjhzb*-C>!C}( z&|~vS#7qKNPTo5}P!q%kL|fc0ZD%~cp2>flm7MhMVn^Aa=p&m})j}nOXNVRtgR{UN zF8N0dNyK|{(Z>8vrRFppSJ*gKS{NUI`4~HHR(4JIz;u1{lnMEypHa;5EZ=f$$k)5# zVSf_Zqo4uVanZ-p>a@X52piYnw5v7CKNEA`1v|h2VthjIZ!2)rg80r7R+0G564n-s zQM`t_IlA!0L_Fk?pnPS|QycXqNyn`SU(8!2+)2VM68Co^ywH9Sv1cN@Cty@e#C5To z*uM+C0cbhYX~<6so#l_6gPo#2`j^NajKmG%r{V@_pb_3M;l%|HsmU;n9VMI*8aqns zM&A_JcZe5aeL(g&t>sOyCkRVoON}RJKE$7*HBJ)#lvuCyVSJkU6J+0`xrQkp?HTf6 ze3rOj{4wlJjD;r>{eOT5_jiSKe1o(oKy;AoCy+5M_)9M1l#d+VBL52McAw_|2F9TM zHs#zW9ON@cnvK&ubCmZduwE3*S)9&YoG4I)(q+`r zCF5l{3dv?>g|3d-1${vOS=ojmUPuEy`yZHTs zl=oYq98bOaDv2^(=<<7(hx#2jeucUUm*Ot?_trNypKDUi=OpVg!X^HCjmDyeIl0_2 z-FbM=r=h+Zxum{e{fkBwKiQZQqb=Kwt=?|kH=Ne{vYOQT=b>&Dd_<_b zjh&yzK&tpHZ?d1%IQ7^NW7#=MtaXpr^)d{hPpz8kcuvFT>AeNM1+Ot)I;qx8m#;ak zw$+4AE}O}*PfEql)@hCSZC;Gv=+usmO1~EIi*Gi3r1m!s*LHUH)?qp4JAk$O4_L_* zetVdbu8W1=?k-m8AbgwwZfR@dFs0%CXzVHEeVJm~=OFp!*IeMBf)#+e9Fwm&?7PrM zToe0T`i~*?l8<%w{{*OF`xt&zDra+C#({h4l3s-eQxv25Fb+R(L&XQidgG!$B7M=k zAMW+$#jfTNx8LV_^Ylnw0j4kQKiU75$#;s{lQ`>r-QWD{=wJS8{w*bX6JB{Ugwx=; J_#4JQ9F$+@n<4-J literal 1633 zcmV-n2A=r<01za2oaI-|Zxcrpf9thld-F-+08RK9nyO0r;W{KmhSnhVZq)tyXz>Fa^!|8wc=2b-YWIb`~w_&Xke(o|f|6N8I){{k zno}60_auOY>dZvF@TN!ThV&)VppIH*7K zAwV}YZL8|I^##Pf?ZLO2(*F(i4>ei`@HM4B2_?&}SoUV99(GWF8cMYJ5*eXGsaZw- zqcq9a&3egn$*deL{S?L7We(B7TMS?N&UYM@+yiq71rRz1@X zbPuIS&a*y8x#6y;zlg{27DzaRWu$ea8$kA|m=5dF*g1`2+4Ao)ZlLQiM07-Ant*D} zDf+FL<|1)T9721?$o7b_*d9mh-ND!!;Q4N|>{H<4(3F9Tp3yX7ts-656fUj(On#`_ zk>HSag&JbX5z8*uniW$_*G<1zD|mjTW|d}*kndUb%188*y*X^-K5M!2u&V=9%JzB#&2!Gs7*2t~%n0{AV{_08?j zd^H*k)Cr5QJ-@hV;%sB%0|c{iYRfpiE9eAK0Dr6K9%&w93qwSr8FBBvvI%F|ASyEm zpOwRKEgFp(iJ!&ri}y%0a92sYrr&gJ+Jvqc2Bn8o3aXY?pjA`h*Aev7BgpYwuFXl) z<$3KXbH$)7(k6;r(Y;HFM1>|e=P9EVW5sXB4Udgb9IGN@H5vpi3{E66uZ&6vr9u!V zEcSdmyd~NXVFXU+@M=^mW>qY$6z10!3f|2kmAFE!Xm2*@q$f}3(D~cOh`H^Xw%qjw zQE?8B<4)6ZP27Y9v$|h}*(kb2-;@BRTX0IZ%(Cyb)6ib>po0IyDPpyT)8Q%V&lj&Q zoQKBB(s!p)-fy!T@zm3YNjmE1x+;!T_vw4~3~3I(Gpop7TfA`bhNe>D2B*fftfqgz zq{&&0WX8vdca*;$qg<1NLVF$BH;su3ImyI0?N%c)Pr0At^K9NCvhTYv5hAQ6Ld9eKy>QlB$A=X-D;$Z8>rBAK0>v&Gp7o%%qVtFOM zBJwgf#d)XRuxdCM&t=Eqll;=9MfMRtdvG>_qjTTetN2=kPvay$de$#oJ%9P~+9JBM zdl|7--+-0Gg?S!p5iC>@V&$*2QjT!*%NMSu=o^cY3n+Ih1=?pA@{3;zi9-=AAk>S# zJ~^kci(|s2r->^RAKydq7ox9q{`jtmQGW)rDv-I@uh!A_)C*9&D}%ho`e+>!+z8e? z`u48NagX9f<-Q-~gfvXwzA-Kw<`!E2%CTV{{+8_RBg0WzGPcYUJ+k1ksmT^yDS7%E` zm%Nx<5A8^>d@vv3KFUjS9G4^ZlH45QW*B#gZGSsr7tK#a=ED)Y2XI$RuIutNX?z$* zl)nP$2+Aix<+Cn%aalifwrPsz>Bzdl_66$($3SDeZpMpCJ5)@%d2cV{^zhzZ_M3Qv zI6uU85!U-W?`L0*;(UOy6t;@-0P7?CLH04j_=D14#iR8jJRacr5bNq@d72M1kJeAH zZM1#{&n5=pT_^sZ$f5I{;W&12EM{>v&GUJbI0EWhd6@l~VPD>2{tUa(hv$U5*3aO|$u{47gB diff --git a/tests/manual/rhi/shadowmap/buildshaders.sh b/tests/manual/rhi/shadowmap/buildshaders.sh deleted file mode 100755 index 8991bb074aa..00000000000 --- a/tests/manual/rhi/shadowmap/buildshaders.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -qsb --glsl "120,300 es" --hlsl 50 --msl 12 shadowmap.vert -o shadowmap.vert.qsb -qsb --glsl "120,300 es" --hlsl 50 --msl 12 shadowmap.frag -o shadowmap.frag.qsb -qsb --glsl "120,300 es" --hlsl 50 --msl 12 main.vert -o main.vert.qsb -qsb --glsl "120,300 es" --hlsl 50 --msl 12 main.frag -o main.frag.qsb diff --git a/tests/manual/rhi/shadowmap/main.frag.qsb b/tests/manual/rhi/shadowmap/main.frag.qsb index 3001908b85be1e3c8acd6c10ae9dde0a1ef9d57a..373c62f76dc684c497d6be86e72484f82d449ab7 100644 GIT binary patch literal 2307 zcmV+e3HjyOwP@ zH3W45oVjL1ze2v!>pcvtx@#|sv20+fTw2&JF8I)`43fA0p&Yj z?yANxdl17gc(eodmci1y>=H1W!bfC!co5T3Fw%jbtZA%_9f9#!IeXA0W2Ea`g(oyK zO0fwX#tv66srZtQ>UndtQZH3oWs6VMEZ3}VIBvOG*(^qUyi=)_C-4^EDMlhKr&8bM zb+cwU4YOo%!8I9)IBv65a`|R!EAm=|!?jhlO*g%p=CyWXvJ+FSZ11?Md(h5~S+?(9 zs+f*ksMKBFa;!Cho{T*3wbaZ?-Po{OZig>0YxP-~^S;Xw@#&eP$F~v+9~+`4m;+z*gXNTyxt3XnlR0m+U%#brF&Cyajh4 zfcusuts3WLtKse>%TvOJB6+`RHh|8xcHLIfB0|TkHL6zAr&t3ReWV3J79)>*3vo>I z*B z*<2!@w=NnPO<#()LH=H0yZ7$%2_lK^UA`OBWN@bhGCbeo(&>$oU2B*SqRya<^EL>_ z`~6NCf@;w$xsV*w+=wR)c_j;ZBbiDjQ~6xBkVz$yWd5dYSNTRdgQ`os2popKkR_ zY5$`}JTnf?q@?$WL?LMulKDa=W90JSJRjpxK^g6|J;pB_8nhS+&C2A+=Z##!$R&() zx{ypjmW-oqC_%Sa+S;@r&+BL`6j~&LO-dxN>}G*+zpI7b8Esolr()MR7|$&y(r8+x zia_i@KWRu0C-8h9BC zl+ZTXR!MI_laZ=<58{Cx$aK*S$eNfaW4~yko3??u#r0BdNXDFE8A_H2;G?zxP@8 z?*rgYTS%TjnSREwQ{PRHPA@3l%Uj;hPbqCS?F5n;L(DzRcpu?ou zfX>I%`3IZ{LezQ=IR?HSAU@S2CFHk9345u?piyFs(2~F*=fgk2(rTsDv>kiP<nft53rN zW9`<)4YRpzq0wv0mv4Ur4A%hf!g#fx1zv%$F1{tXF@L_*5A5F_5^`^!fWS56^Ua%# zZ4R-}r$h4OZGoCkxqRM%U<9SgNRv+Hi$~=gob~NG{)^wgk24(3`#id!od0@;V8-73 z5Yl4)<_Mh46;94!vPIc?`i~g?v@G#;_!Hn%T4A!K` zcWhl@_)C$0UQ1%k!v{TiqB(hZjEdi+q@NikdmAHPFfQJEFUA&V(7)59A7S+2To-(n z>{-@q?GxJo9)7N^98&3g2eZ*3+MCodNDz|$HJG8N4G?= z(f!Pjp9-GS;__wS3X1iRkcrR7;3>>x-#rfWePWMfE^@f{lRbR|M>O9i34VrfV*n#B z_Fw3c`4NDRFu$jd5j;q`QQi>A3X}d3dJfV0Fk%(qob;ZiTux{sN&3^|dy4cU zoFUv8$;oQ|=V&ddt$(e{UeRQszasrC@v8knc#d$2{*q*$QSdyI{ae9TnC#hE$iE=- zKR%<3zXPV1WMgg&Xu6JxJ@jGR+cRBol;CN~HSG16KShu}K=2%BK-%X>{vgq#ZAS_J z9nqCArzP%Ljc-`vL%G95r*xj6^{e0k=G95UoghEeZ-$chJkg)h?Dz`duK|QIULc$r z-vizeCTs5`trw~1o+de%gZR!oN-)yDNHP2-`FEahXwNI6OEUHn@x4gvMe5%#(KE(4 zrrA11`|wMUiTQkyaG1|O1{%c03I8|XHz*GOgf+xZz%Xd~r!`+^NVZxlYBnzHW8-DQ z+Z3Ng!hM%wzC<{T;p>E3X0lF}#GdzwJo-A5wS;R|$PN|rmzm7gD$Wm;pk!#fw zj25oIEXk#`4#{P9m$K~CfQvRjo{FOIOYFBk6h&Y9QlLej@&nq3zV#>c4-~xs1$xfR z+1=sAiqfQQP-Lay?wmRIIrDLL$QTPT#zx@ZeZP9o!A=u;<8c2TQpXsZfae;sSc_Ge z$=b|db+!RLo$bN%Hr!jR!a9-GururI1sHn;S`OL`XdglVPtG$I zV`jV4b)6>pvXAiy`;2Wt`)P!+G1jzdx@%hPz|M3m@F~s?HrMVLw!39H)8m2t5q4nI zz#!WG2DBxzdnSqct*(oPF^`|a_Bd#`jc_wZyBwsVPjl>4x#^y{V62p_yol` z6-K{Wx@((<+wf5bf1fFH9AT{ktOuOm7_%A;Ws0Z9kk2t60^jrtYP_J2;^oRb??5{w z+x27EhJ2fQ`|eG2U`nyC+I@E7`F4xY)@lAei`_WY^;J`MrcQl6yYJFk!sqFTS}R@0 z*cN8k)MQ}eDN}N))KCQ01}5ICAx){H=xJzRI64RObYpNGKAlwj-W2hXUibC91K(00O7KaPEZal!MiLqcU#xG9I|8u{6b*{(Iab%QUp3|DVf9Jk&ytL1n= zcg$9O4nI=+<#@d7KrM63httt(1{YF`@woJkgJ1Cv;vB9<(}Dya<~Y>iVlTz3kUnxS zfpP$n$Nhva#vcV%TDsZRDgXdIwz$8N`Q5uUyeG8e?(Pstv)wBgzz;}*Njm{+vmFSd z;+D}?49lm4rw)7tNypXq4Cw9d&hnbohHhJADx4ik4UGW%&WKskOs?A0N-uIV)wies5;sf;GCOsS}4 zvYAY_SeP&6v+0cLKCk4mXuBq9Rm*AuDGwwZD1#bJ9hs+|+2Dzbz?T#~IW2er1BhZN zr2Mkx%ixU^dn7)Mreh411BEId8i9d+8-0PMQ$5O|BvQd5S*D^$XsP@x1e291NvBI0 zt&}O2@_DULgpBaZJRvv}y}l>;n@46ciAv{X#T1KLp`;bkS}s@0q@i?X(KpnfdMtgl z4JiILIt!~W9!KO7RZZXWnE<|`Kd;Fpg{zD&faIPDrDP|nnztTo>wcxB--B>{oWUq6 zfJz_$5cZzL@I+0cig})dhgyANxla)bP_0j}m{ed6IfJ6;WlU$15{7mpEM(RtX5>`R zP=a^Uz`rfAVNEO()3MsyuI?JV;!9LKSWzS$lmw`R{ZefZ8yEXV{7MSob$e^$_MOU_ zZ8=V51NVi`#n}bE^Y(YvZr!@QuJr)4s^ON{;XM!I7x?y_%8qXD87`?fu*|w(s9?P$ zlD(3{pzn*sy~eSDZwTV04i68H06jUIYpqUVa00&o%xio$&};mAs8{(fqFzIl8V-4l zqcE@03wo7fgI?oE)N2UXYYgHZ;M`#4i!bxUz?$OTJ_DY;8dp}gP;=O>6F2q2j#Kn{cbkHAjGZRE;fXI6tN?{19q?a`siggN37oJS#J9&D zcxmbnAR!6wZ4_5zQtZ(Lr;4Ql#(EG;u>7a-Ytb`xGZ?84 z;2up~T{!Pwrrnv`jVVi6yrO&Wl9&9YoX%+Q0@Zf_|}3K$4XOg?{yIz zav2TxIPn=M5~D4oK800mRNn8JwgE!zy4mPAVZcrY_BcX;VOOl`J)`D2!z>Kv95nF1 z!Iz_u$Ywr*e6G9b_-Dh~UGqlOQ=lM_ir_JUv{6 zb_)2Ajwizr_`~S7kmu?CV3Y3Fw%W;H*-{nMayDXcqoq zUV^i4$Sv?-d>6<*_A!P_ef^8%&ke=bsOU%i{tVq!+NhX^KrYlL7b3a0`e^-f;Xb)A z$vy6)1#(e8C&>4Sh$Z6lU8mfrapoybufM9~YpImW$2?U{)%w!H-9WnK>sDu&1f9^C&@PIJ4L!;WPgI5BQ$=N z#wQf{DH=Zy70-!3#QdGPxV-0S;Jipapgu2G7s>xiESPi8|0J|O{C=~12E2Szq0bWE zB=pnd*NE_KM4at#vU`DQIjyt|+0RkzS+bA)Jkc(bo_Qty0t?QLyzzxTe^*5B@e1<4 zMY7)fV1Jcp9{*J-zT)-QpgsNgxDYm3gSYFvZA7$KQYwCEZvX+}gt-?;57r?5 z3Nk}|tYj>V(VQrR({!6m8NHnb3zk|G|2k(D@ z*+8BpvK=M@WTWzHO2& DcgzRq diff --git a/tests/manual/rhi/shadowmap/main.vert.qsb b/tests/manual/rhi/shadowmap/main.vert.qsb index 8b81a93c00573d0dfae0234495d586f07f135fb7..6392d17cd6341c2a88b5ab563854d387488e2438 100644 GIT binary patch literal 1587 zcmV-32F&>Y020%9oXuCwZyQAvf9ua=T~hZWG;L|SX$o?n7^ehODQ%QAZBwL_L~#`r zg%BKjlPt1#E$`ZGRYmFnE+A1AA;BMjDo`&ymRk=TkT}r)g9B0z6&EP)&Aizi+jSBS zAl4f1ytlviJu|xx01_ZC14kC>;DHYg1UNi!fuBF;3!;ng2cZRXFat|qLjz?Ng!J|@ zDOiIhtmCW??`r;&hDr!j4RzOXmSOIchR8;fDmuCWn`r#1CNR}Y;2`?92_>kYr#IjN z3YUb(By^{j(0+8%#}JE}D8K-Y#}FlO*H@A=aWi5Wua30rhVOW;HFl<8ntsq|mIG_8 zxo+MzExc-_VBD&;>Jt%Fbv8DGt8FZQvsCeJTyRRhWIAqOHGR7%*c0Z~glRTiXWeVm zNVV0(KV-E^ja!bpVYTe?xYe4QS+X0!f`=+fLC|p4nt?4J)ji({&_xpQoC=zB+}tQT z7|B`ZtsH62N8VVk3tM^R@+dMQZ6v-?U0q-X$_p??+XmY*P0BV|#d{pbnJ9tjxr^5? z%>4Mx-S2+A_eJrS->2ZWM{oW>S)NPFjF02k6T=GQ_!h^*6u{!eOP8M*vKk+ARnCbL z{q>xP?+wC?jS+7MhlL}D;}q#)%OCcrvcUsG5tsy5{E3DcGUR;<2f75OnO56I-4~2# zNpFYy$cR?)b~x8)U%H?6z)>Amu@10a^>BUN9ES%FVwn2GHj94PU^!K6Nkxl6(&4fM zT%@S>0eNhI(NpghKDz3Z8=mj22Uc!z)VeZPoU=%Y-LPi7THUGQWUP=MgZGNF@1N%U z_kpaNy5fA_yBFZvrRy{E^NSbB{yfSoaNbDf?2BY@O!M4ezQO!ZS8*v^%A~h=<53Gto$7b5GVXjlzC>EnV&aPNeyNE@{>=cWR-6<9w+bfp)M|K}e zdKa0%vbS8e$@XnJ&9m^a47I&r*TL!THI z*Km_)zIbi=+SfQg%sLci2%@X^Y51>S>OD(WMPvUQkBy|svou!u6m$29vzzLZ68Bj= zne%>7$&bHNpyva8g37b9Pin%UY|xsbxQ_wlATILp$e?p2(S}RnkFe3l2JzzJ45jyM z3eoDlOs}mJ{`Rol@O1ZS;bYe$eM0y}6Vhe zzNu^-WuLUK9O3sd=Fg&jit9MjSF|{if=-6?NQjAev`4a%2oeFyMACgkJ7Ce2^Q8J%|) zjzg#~4f6a;2wp<0wmADd!E`^Uy_OK?Pnz+A_@7~2hVVO77Ap4BBkzjoI=tN;Yy;uk02^S5|aOZ4KD+vO3rZ)MdhP+bz^1xv*o* zNdqL?5=UX=o}A^BE{q5T{h+jABek+}+A4c4lCH?xYoZrK0RFF|@1%A#?1_~|8t1Ls zTQVY~^8dIUb=-V=M@m|HcBNhDh8;8;E(xhdH7VSa8`x0I2;I(vt^V7Ef@S;vako#o l>gx2XrCZ3Sl~Lkg3!_w+|6kv4bnn;bGl}}vzX8rO&0uAxE!_YB literal 1595 zcmV-B2E_RQ01@qYoXuC=ZW~1u9(&{bY|{UhhM1OVT_GDH*9`$xaZ}MBlvD~dYN`sU zL}qP|lWpx?cYo59Qi+Rl4^^+)7vKT7;DQS-c?2Gzya6{zoHKKFXLgg&ph^f^v%7Ql zJLfy+%$c*hjIjcfKkJtV?Rz0kezF)FgY%DYJ`Q7)x!y32!am4~Fg9U)$rNT4#xuZ- zv%cSPBG>m=`YVqzHo`n-An^Xs4_$S?Jc07)(NN%dOLXQLn*#hf7?)st2TnXciuV0D zLSm4;3AfF*R<7L=M#t@h(TKf7}u);`p?+!aQ+6)lN94j5&arCQQ&T` z!J!NOzAWjOEH>C00`BNIu8-gAg(6D0XT}j1x?cmXJY~iU_9$Ks11{MzjN34_iMzWG zZpgR0u^D}a4$K(*ChyD1y?HOfxK8W$Z+LAMZaQ86;Z@fOXAZv^?^g`hM_rdK%`w5^ zP^?KBHZ!d`UN9r4Mh#i8H!$%@4K<89Djk6V#HI7FPRocj772bYrVYPWWPDK&cOop9 z5f;mWF>7-k^0N%%c2U{Kdr#4j+QB6<+tmyszgfk~7y`y%)y|Rh2vl-G=6zJ2msZwR z>S5Ha&wqsOvxDGiV)l@%PV|#OHeI>HFmK>GJH;?2OYV!GFRXZ%uit_zXpM3| zo&y@@h9LoNwx~oFI5k=F(%3G0pgz`yEs2cvJc44 zA(|upFkRcm{bR&~_fHyY(xmxx>W9j~7-8Qb|I38M`6-emwv(KG3^^@Qe2g%Ef&|z3 z3LMd|Bjh{!yGS`XO7aAAoG`}>%n6b|1B@-#Lg}3#4Ep;v#qk4Ra6UsglwSsKCP zyh}W%4IWPN#O9ft&9j6#Lw0bDE0mMd#8V;MUy#v@s=17ELE(B?hN0GTB6!NS<49B$0qSnaR;b-mSJlK8LE%3vzbpt;o_Nd4Oe*4oeuHC$O>v|(o$fo{H`AM+n zrpcJtW5X=)wL3;!vg&=e%dzxZSO?W)X)|>>i2K#V)mb^qEZS^-F=~|kY*}WlB!yCw zb+|K5xofIB^2d`62-k_PL(O5_%@w{8q7v*vskGInmjaoR+%C&h$PR2Ke`duPn=niF z#5OuTwEe;?OTSPHa~1GEMB)z{4KBi6S~kA%>vkT=>@Q`fv9d9GX^_ib*V8gI0VmlI^)Orn6Hp>UG8wgN>&*NU6LJXb2 tiG(yDf|lRDCpuBM8^i9%odo}FIczz>BYctAQ4;B6_5W4`e*^50);bhH9wq<) diff --git a/tests/manual/rhi/shadowmap/shadowmap.frag.qsb b/tests/manual/rhi/shadowmap/shadowmap.frag.qsb index 3cad114cf45cea12d997671d92348dc8e40ba06f..fabeb32e6564d1136967b5a431a50663210aef15 100644 GIT binary patch literal 466 zcmV;@0WJOj00Yr@oMT{MU}1n@VgV~uJr9ytvT|l#a!zSVs)9{!YDr>Fd~r!iPG*uF z7ec%^GdD#aMCfJMadDLvXXd3Vl;vlpDC8z) z<{4;ca#eHHa&dvI1`7Zgj6kFVp~1jUxh%D)I5R&_!Pvk+A+?yRpeQvt6D*LCnVwOg zkd~95SYnMKoS6p{XkP^=9e%+Le&I_7Xa}FAU*)ZH-I?E#nmkZEe34B(eVF2$ZH*RIX#8Lg*9ZY19RN)MSsVhd72zL5dA*0G}L<0W3a1068ePFf%E$ zgIvZA^c@>iP>_KM>{f1|2#9tEhL#>MHS3v}f)XABA2?be{^1A48Z7s~><|FTgZMy$ zfh=aAX$%ZI!12q1qD~kn1Cmn&t6~7N&48+y7!bJ;B>n>^0!kZyfi_w|LJ>J>qGv<~ I0BXd7Er#>E{r~^~ literal 408 zcmV;J0cZXI00S_1oP|)^PQpMC9WIJljhE;Ltl>oygB9@-F(mrJ3-Liepjp~!S!@^R z7D8hDD|(gHgAy&0`B@pgAelW(WANh__O) zS~08&Y`}U3?m^MkZ4zS6cIT;6)2Ux;TsS7b4JFGnxgC-%XU4IR%HX?{H*XTATZz;F z-V0!vdEP!{OzzOKz}_#3Rm}9j)&qPJVw(RV$7|~ff z)^a`Pe`V>W*fo@&lDUWlI7N=qBt~u|ny+w@ZP&y@b%KeO1I5oBhoff01U+eio(y|K z9z+9?HdkP&2wZZWb)R#BX|DN?xzkzQp^XJT2E5&I?;h`6-4i}-%8i5y$09_xQFmxz z&#a2m6qT*|hstkwf}^oakcyNqgJlaGibSMn1u$_3-9CD${>|Zc=BmNp<9`FaJhRsa Ca>OP8 diff --git a/tests/manual/rhi/shadowmap/shadowmap.vert.qsb b/tests/manual/rhi/shadowmap/shadowmap.vert.qsb index 37a5e6ecbf174582bca2f32392110369e81318f4..f224728ff2e9330a1081c440c49f3cff28631423 100644 GIT binary patch literal 1083 zcmV-B1jPFQ018xioW)j4ZyZGsu6>(vvb!PiBRPa7PS83;%WmR8BtMj3J2p}hTVBgD zN~~qPJ8KWxnOV)lGDO@tAsO)lkU&VtR}TCGE*v><;Kmgxkq=Q0KvLCRy)&D{5<)_> zRnuLsud1uNdJO>)b9 zFiVpbW%vgp$H|;XARkQFZmS!$EivO*q1kN)VY_Q@&l#~iu$}fh^r`O78AcS??v8Lx z#|nC8%M#LS+AxC9k6NMFjylFeL*VFiJu{rzpAybqZ`$}QHgQbbtu?(U9556+-R7zn z*rDyY;{N>}FSoW{;cL5tuD#gL3`5`EjzX(ao7BF0mLFRCaa^^kXe?oqV-T7<7IIr# zS47Kmk#*&6-Vzah(Ez_4%a^c|96m-QniUT*8p)BXCbu&yF{)SyaT%jkb-v2lx5CJG z$qCan3_2(YtPVbPg)ab&Zzgar0YP4?)r1wiqU;V8q+jyLwL6~gkY471qOSP~hN^VE zmdVN0CaDB_Rx7R~Rn4>8a)%YY-D9^Dd#U`hr+bE^NL(|LISE{yui;k6%`e$74qaKR==^UCgLnnnIdEK@aI$q|eg;YYU6F<*}je zBQC*=Y`(vr5%VjMO}$RCaU_9MAJ&m_Zi;0NaQ+oNZy zM-%G-x=rEmFpVY1_Mfwt$M;Bg?UwHaUMCclwMnsjr*TI#cFnfsi+RuK*sZ|)H9vtL=BOC^By#m)JZm9+&7f4FjtPb%qy)Y#~sEHsuEH-AIfDq6jV^T$Jw z`Vi0b_7}>VcGE=nqq2G;cTjXB%6;5jEECN)Fys+GqZ=b?))=J6i(zPezC5Ux>!Ok+ z?Y=uVXqSG`j`Mi(#-Lp$VK;~28|$~$zXEmV^h=Ni7&xgE{BJ||4~=##&YZ}kCkm8V z0Z;QBOHX0ulirgIn}A_^x#2}PnvWk^ppXRbPQ_P5kkj5s=<#bs!Mjj zCWqK`f9M6U{0;f~lRVFIV4c20Im9wpPU|A59?K(Yk>%7X6o*cQdPmvjWG?zaA=xs@ zbPWANy@Z$~OG|x>nPYp+Pw!WIYp7Sk8eHLB=btg$S&Ah>~5#)y%htBM6=Ji`Pj{Hf+(%7_*lZ;*B ze2R=+;{B#se~Q=I{tU+{u>BcO_aVjlan6hM?_wR3eM0i5D51LF!Y^UJ&haSUStDCSwN3E|9Pq_b@I7iM-tb!YNd@r8fG;`XKY`8kJMhSI|( BA#(r# literal 1215 zcmV;w1VH-$01G{MoV8Y4ZyQAv9^c|*b8VA`HbK=CBV?DzEFqvOX(F`+g-Q{Lk}5(9 z)oN{zolWgscP}BOp7pL17bGMc&F;>*eBYUK zX3j(ikrVot`{QZjB%sM_JW6=~j`u=Ah%w=~{U{8&kmWIsF}}elW9(tPgw43HA*b#QNn4l84Xwir%NHxhBLE?BB<@i}54z&I>UuBG+kqe(yf8 zp9JDgF6LjuyP6}t5OcYhzbqP#+j87aN-ti4e?m0K`6~*dAR18{@?R#%zNdN(p;lzJuNJ zRCc|<xwS(A<{skkz!JnT+Arv)^}t=1U2)3x?k4=;kNgGk=ac%2&t!Yq;-hkceNCwDjq z|KnBDs5tGGYRl~%>)!r-D>$}kPgq^s?L>A*S!=6i-)=rJD(Wm$uJ-yDQ@JjE^)zyP z1t;vV_C*TSw|zTQ8bJA$*EmtlFc`%!+VV2Nf5^WbVt+QGQ2ienr(Y}0cwwrLuav0} zWgP1zmR`XT%IU*1rr+B;2Rrp3Y}MC3HAz2%Z7sNbv$}QArWPXMAi`^ejz2n#zv(7a z9I`0^8)re#3Y34S{7~tgFvfDhx}?*TfMtke=NAxz&@EsLs5305BTPJV_>PYf*_L!H zY0IKRS{iUn@_QSYB+F}kidka&WM1KSRz?|^V~iQb*ycFi8{o(DTbVh2e9sdX&^&8zcHbyX&DNoMn0f zn@}XCg;qRdICSKXj*@Nt`0)r|#~pUS*eENxu#<-Bli5DQAm@X-@o(*;XRmtvZsPy| diff --git a/tests/manual/rhi/shared/color.frag.qsb b/tests/manual/rhi/shared/color.frag.qsb index 3a965682eb35a161681add883332c05727b4a3a8..51501ad5e6fd0e96b3751b5b79fc5285989ac25d 100644 GIT binary patch literal 1179 zcmV;M1Z4XF01J|MoYhv%ZyQAvpY{49+0Z0S(h?{|13}0sk+F-ZA~}gt?0g^iJiAn|Hj4BQskl@1ENL)eU58w!Q{(zo2apB{=nYZ3e>qhO7Nyanp z?fbot-_FbqV=T>NSD;U`0c$aXdCZ3HgGPnU{-ws^hSqbe12#JAvT6d6J_nIyM=S&s zV-qk&^IF0xC9E9CqX)Ao(rzX!W~0e81nfb0gIO$Krxao{O5u50hQ@ZRQrl{3DTh9D zknF3Zy$A^^BC)I(cW%{h75YKDP=2>4b5cje&HyqZ*U>E(^^?$F5Jjj$pTkJ-hh_hy zU?S-=_8Is?Ovl%|RnPW(CT-Bipk)Y62JkZ=AB7#rDlO*NoIwxdjF2%OucsSUa4PT@ zK@JgsHGqsUq8fL|e1)@+IviVx!%r@GWyqQ5?+U^+a5hUn6-Q ztWrW&1*m16Pg#T@?v4RXFt zxnH3CZi03}#E|jk$tEi}lKO{WqlvmD?s5XRI0p9;>2HG#$}ba^C3IIvrzCW*kPdVI z2-rftt`hzVJxAXgP|+kk`x`v03NI{8YduY+QB!_ivRuOs+a_Og%s{tWu+41iXhVzj zeamUTjX#Cs4NVLCmfPj7?wEa8=_VJbil+4gKQsakt6jUVacCXe(}VI!nZpjL#2QW; zq@q2DQJ7q@<%Pi+EFbMh-e`zjm@h6jn`4lcn*_eYY10BM?3;ex_6#>hqF2Xs6H(dxr~TM3#CmXwns|?)9+iJ%S*+g*7Hrn64J5N zJ?_cql_%7e8;pC84!()=-eKrk9nW_VBGLxcK=)5^nG8&0^fFNGS#7~lJ|e7Zx3+3-q&~jJHF^TKMUW zP8l{Fro`9&>9>;KBV6=}7Fae!ij~pUd9q!AM;};*@AbV-!1Mddd>8H`ynd{=O`lgi zr)SwPDHRJP_I`cm!xiFVf_RLYN@EU=?t`tv>fYXd4bmR&Jp%^6eD#l82fE)iA?0Cx zck8f69OKFV$plmG0Bze3B^uYk5nO-#S$UB&!PTE!&Q~FfPxI|LIc7hXIArezh+oii tEur6l6zc~!557+1g)PO{8TOve#nPH*F=kO*7sQ6hkCZ|IlUk4^1_NX} zyF0rK-JRLa%o4C|Y>eKT#+V+O;>9y2dep?D2akI959rZ&@}l+o-uq@}uxqXHPO1#}NM#&MBOqpb__biN|dO zq!@AkMRzBZJ+m?=wLhVIyoK)b0LP)>*k#wNT|(K{efV5c`XAtWSEGG^KvVkLpORv!biVxo(hVMq`-}3}Ux5=pVF~9N&TBySs+bPy z@w~ZpvuFqVEH~8k5MnxFF-=0b>Y70_rrB6rlPA&MVX{4DERKgUdkN%v#Xc# z{ZWG~mK0!l zdAG1*6$8JOhSro%Dlk-x1V+cWX$TyYT!B?FDIu8#!O5F6ZciEpS2VE*iYlUZO>Z9^ z64Zo(JCx9_T|#-blOAT_m1=$gn`qt)%#G}pm?n<#G;@eoq`VAk8#w|EqjJNbav_00 z=?55#a-$E-uV0#baPHvLhq*7lygTx!{OKQGnUuf*T_uz1l=|;SoNd?_w{Wh`UtYMT zsYGAngip!rKYmQWghn)@ql6padQWo=9b?U#(0XV*sqlyth`8 zl>}V`)#D_mUu#WA5zA9c%e;;6jllY-SYR&MjUY;dpd#9K)gW+Kz|u+U51R<>l3R zH2ZM*8F;#J=HAP%nO+6Yg2Thy(&hC!$M`JHoet36$FMEjQ`}Ssg&xqoo*oI)5%{Z6 z-xH|DI+oj(-%7Z|MByY7FU<_(wd^?W$-Qo_k5Jk+F#aP88+2&XaKMJZd^nqWO-$N89Ef?s5~52+Fo z)@4-b`!s&xwJ+=aIix3DDUPwg-wsf9M)*mFI~hmx2Gi?I-^KPBOy9-%k!K^qCsMJ(iqZj#dkW!H_(FbdB(qsGz6bvUWnla8K=c?XBkJfuVAz& zUgwy9koQUU40_bbd%vTE3Dw16|FuDMZIFgFHKKTUNc7j%U{9nAr{scI#UC~$%?F9e; diff --git a/tests/manual/rhi/shared/color.vert.qsb b/tests/manual/rhi/shared/color.vert.qsb index e34eae79a086852e031c6a26bd5f3e3e2d51ed17..e342718fecc9342286846f97a0c9647e93ecfd45 100644 GIT binary patch literal 1318 zcmV+>1=;!l01b$EoaI){Pa8)RpYF{_{OPPytd95-)NeBZSW+rBCJ*Ku>a<#?74(IARr)xf=F zr{*XYg5nFx7@0?n@)j9^03%34xcq|<)Tv=$x)6(Y{vwo>PzE0VKQe%|`#4B|e!jBz zY?-w-ia$O~cz-M&L=&&RiDR11by+kym_GpHcbEmJ-7Vm6udJ>;*JL`MQ(B*jDtr9~ ziFplmvRUNagUMm0V7>?Q4tf6ShC$a93GZ@EyTxlJkHq8>fZ9^=JpC~ z=WG+Ow%&pj2f-4pwGbA#2(U`K-I7Dx()#LNLc{l?v1g$7b%JSMLdw^^spEJFBdPr{(+?RHicD_fyp?4Bxy*KvF)p7m!ullzPbr0aE z1#JCXkIcr=Qyi*;6ZbA;0eug^Ztz)zN=+AJhrlc&58+y1prH@)+?M$y90ffiLwT#dVU& zJ0%9VN#f&?kAXBvdr(IieNQlXzNLMih+kc*$SYF3(}Y!|c&7<#9c)xw16>_m@FGGU z#L-9kik_usm=~u!u7~19y#nDT3AaeGKMKW#^urK66^eTdtRh0Li?@mE30PtMa+s5# zA7`?jb-{~@`$MOg@mwP~u5thW3IUXZ_h(AtyOcMUM*stWFe3I5TbNc)Li0*y%~zm*fTp9R{>JH%h0ygeZQ-+>L%?~={~!ohfE zC}*SOXNL6thN$P|ZKCdhC<{Kxxbyg|Wmg;Rn#rFwO~2A8!*Op|hl@tQ_pD~^WBf}W zFG2_8VY6dbnx+S*$K=8)e@!o?zOA?RQ)Gp~Wy((558HOTDZano_Dna`aH@7@?%*JV zmh0(=_V?9^MWrkFmfaItw`T&oZey0Zius!rV*KI@IqIR61x3Eju0R4N-Pue+a5Ui-_8; c>9<`Qja19nC!A8LU#gSflY~9gKVJnLlsrzGPyhe` literal 1648 zcmV-$29Nmw01za2oaI-|Zxcrpf9thlXY)zo08RK9nyO0r;X2?VL_U;+grrgmQ4%4l zfQ&!ZVZq)tyXz>Fa^!|8wc=2b-YWIb`~w_&))0g^bzaZF?H0L!j7eD6o1VSj>s6_m^Z_Vd_N zP<2WL-*Rk#kp#)vg_;SFfRa;nT-Z$#&A(eWY1}qTX8^i!-!bf2?AI8NaKF}D@q#we z5#pwx?syjK>)eN(Q`qldpThnCoqEuPz8ohVPQxc>kY2?e!+!HW=ug6SUU}9=|CxjO z(;ou#K*P2wj$4~Y?AsoEt1128;P_A@K7g+&{YfZVcG|bE-VjqWNWLK@=yVlM+{*=+)-N;$#P}{Df+(3%X+^JMN z(+_kHr%2ATK1aEc?x??r$MF`}aSF@WH?ZFTvRB1)M32VKsTWF?f0uCsU5_E6BNEdD zRH{zFZ^kqmiEH8z+B;6RM~ubxIAZTE#@+zWcN-<20vCsd3|#b#rVwit`!!AB67Og7 zL){LHlDsEnXx6@<>?5##& z%gpCaXVLlF#;CdDo3`Bb22pWdxaOUP<(jw&FGFR&3bS5t3%)4T z{SsSrB%oPP?;*9c)?SX{mZ#@Wo^Wm_2YY)l3{||j^I-ca*cUu!>Y3W35Npk6 z;$Z7R)~8m7T8C8(%@VKN9VDx zPtmmqo#sjWplvK(y>R*R+5)<>cNwu(-++}w#vISJ2o|acvDU9NQ;u-gmlv<5=>0^= zd6c`A0_`&l`Nc1V#Gwf05$Z*Mzg*MY#W~^9XU7$aj^DcY3(?;^fBa^}XgrHq706s1 zP<*sK^#T;_$`JEdAMr84jey_L-^!QsUPX(_eLvhP7uzq#w*7IkRZfq{&7k`Ajk%3S zq&IRVae$UgdUbZRZ~s>QH7$4tsFg#q{#=iZCP`BgvqLcT5JrJ?ccC{lE@7r-JinaD zeN3NW=;h2&Int>VU=MV3f~r3#IwPb7|0u3c=-bV=E0Co%$p@7ct!ZyiXC=^vUL5Jg zGuzndx)WLLMUXYpz)YZ>)nx{d%DIJKLW;$K@4&T1g9k`|Nv(2fMl2kTKDqqHQ)aXDfy$;~ounsJxd_O~N; z(fU+mJrc2d5O>8SUzevz^TRl!{1w=bpnMWkKI@Vem+yzpHcj%nGr~96zJPCV3^c~; zVZ6AsL&cqBf8VZG1m0rur6t_K-QVXGJqvOdBeVjt6tKP3HC zG~yrO`5>={SyvCs(|Uwy#6Q8d5&tZnO$@@jPV_&KLgzcpaqQ+;%pkXu*K;Uw1k|_k zF#9vjzP!csX^z`5*8dgmq4jZ=ImS3-&qk+hEOGUJ~8QfSBI)HE4Ev7YVCfwI7%*OU9 z;L@!{WMVvk-iu7x&zfM7N*Z5gL`W&MT%_*+5uNb`8J5DgHi uPm6o^l})(HgoUAHXCk#B@m^UUqG(tmlC*334cDekLCKhqO8)_E9k4ta> diff --git a/tests/manual/rhi/shared/texture.frag.qsb b/tests/manual/rhi/shared/texture.frag.qsb index 31bcd7105ea7b79523b69932bf3ee4c7fa9e7d12..ad11300a59424f6baaf0ee3ffe7ee1b5d046e008 100644 GIT binary patch literal 1345 zcmV-H1-|+K01X#-oXuBTZyQAvKJg_^-R9Cu(i^nXrnGj6j1z^bA{ScXT#5=QbqWzB zayRRZv&i;Z>vc#eMTj?qxIFM9D)qTiU*XU2ULn*M1mBrC6K~VBfW!k6jd#wO?>pzr znc1@wB1)0zJ?KYhiz*b6N8995fWMHc&?nI8PifR`%sE6GKsi*SIpFJ>V=TUi(M#*p z0gI>)PdhHfPzjA{Aet6N`$c;th8VJgK9K9=Yv6!@QuLB$A~0(t%1L}ZFQcHP1yk)} zdybE8d12cRnrggQ%(g<$^|iF=*EU;fqaHZX)N^XT31zk&g&j9i>z$44y{tlOIMJkP zY_+De1Q7T>r27DOn*K%*HW;ls_=%~E&9>8M)xB_{q#|z{vs+Gh*KgL;mgi2WtqPQG z5QJ5p3H&O2`OREj90N0{Ts6bgs1te)Js>&XBgVdJIcznenY#MC(J8oES3Y!~^b$GUH98f-&<% z-~K}M)!eONdLm_KLGTM-8avkZWui9IZzq7M@n_oUXt0Y*ukkHq9o)0o?brz>MVqkJsW_+wk$7nrn; zZExTOo(t+hD4Yv;qLd)wlpb?K`GK6)GRMjl$oNZ99#5`4EH6T4pJ#<<~B!)B?Lc2_M8|z z%Lhfr^GC?kfQ-zuJS;l4HzM|uTAxD9-TLvm$R}i;?VS``%;6I8n#d{PpBFy+KPCId znDfHVN$eLS9+vZ>yM+BpQ1@QKKA%F97A)s>pZJ@B%sCp6{LDyh4$1mI0xP5U&|p|U zEAPQ!!Dn<1jLl_OA0hKiI4a%l6UTHF_IT~D2>yiF;5@u4`tN}mA#-kziQe)~@4-`| z{{R@4&rtWwTisdF^~7|eqT{%3U=_TMbHYC>^Gen`EOURr!ew*nY^~xn+vCO_o{suW zx8A9GYP#V?PQ8MXRQK0svt51LZ&cslpTg!WE){LQIy9Yz*KRqkr!;G?TbsV)O>V#N z!XgBYt5^v-(K9r)Q;O8>+b%zI#r)dZ9!$R(C&uqHV0PMGn5zeFvrA^f4X+tDz6=jv0P);?xg0f?w|U}N@@#dBqhIBrpCKz`>6XT5TtQTOgo#g{EN zt%9NEtg$f!Re0{o1q+34o@T_xUUx1=haRGBGRfY-(mEJ9XS)u@bKlvWe^~wkOLO~2 Dw^y-A literal 1710 zcmV;f22uF{01yRuoXuBTZyQw*9^Ycey(GOPZIVK_O=;{Bj1z?_YMMZsq)kz1N}NJO z8@X$H?QCoBy1VO;-Vj1U0wFF!eL(FWsFW98kov$2{1zU0su1c6D&OqRX19sCiU&42 zKIhDt`DV_{oO32b6d|HGQOvnnx^DBN9wX{Re-(W^Mbv|FnM`U>iF7hZqY7QXOr;ve z1@sMSQXON9Z1CPii=wSF76}&GDYPV&bfcmhHH-%mtk_T+8nlz6G5^;|9^0Bj!8ed* zKIc|bV=P;3H0zo*Izv0Lb_gwxHiPytjNji!)Iqw@Y&mva>{u23fTl~V1N%x*-7Kq) zZW}^wP~|% zTC`2~SR38rM7yYE=vC8doCWp`o4$#7`tPIvB*N=N&4{Nz90UJ**ui>BEPRoTh*7Ck zW%*9#Z)lB@X7Rp$_L7Buk~r^>J@!Z0u7>JZ`g#FB71;amx%f8Ln&8`;;`o@=YAD40 zDdw~F+u$468Qw4OWWNd;hBSw^BtGT5nrGj|0zGl6*7c@`>Faqw0sg~OfFDDiun|7~ zFxt5IG_eQ1%52ZY2Vq-Z;XJV&t5tT`X>n?~P7B9p99Z*c%MlNk*S_byVEk>wg@l*f zGgy(HyS~9S_!}9bjO6p_rlpm2cebk6R+~z-ZmQ12HZpcIkxqN|D6k}bC#~RPCo1s% zggXP1!Y-Of-vhHG4Rb4Oe2C;>Zk{#;rva;Ls&xyQqwpzEf+NB!re1+A-Nqk-Vu<$+b3t9%mt9+(FU!0je_c(M;qjLTz z@$4BV%ICy9BO^>ZDCa#R=X9sY+!bTOUnJB%72Jf}fzR;yYka@5KZ@dM_c?n@FI%Q< zRvjg?m{sQH3-e0Bjkq#xHkvxvaJ+LPw6U>qp>Y1+QRF>lzt-*IEFZ+yn%?;GWuj6y#YVfk zT`aybpD5lKcYc(4W{E!gk?6ze%RTgjytQ+}f9?Yh$H&IqnzTgz*Dm3Sdi_bb^&?q3 zB{);qT4CwT(tYuFBoteJOk2iVzjkYX#{UmLKZp6NgvejTqJv4+ltg4s2z3uEXWcvS zGI4(%36Zm%N^a~mE@5c5M2*+FAjx~?=Ig+d zS;m~BoR$gvF;;MZ$)z!NPj3hQ?1NwO4y+D|t=^04>Cd9~UP0^+bJlrO zfer@nUGbCp4c6=}fru#O8c(lP91hUEc(>i15APVtaduik|EiyRu>zfBV1{ zb>}fRB0TQJ2qltx#twj=b#+L56#S+{Kes-3JuT~7bIqR*0FP^@w8;B+5Yr}PzDsDV zuS@Wv!rx7Po_PE`-y<|$-%s8hkd$?v_Xv&gdIc}$(&Ml>xIbQ&dB3bP-hg1S3||p1 z$viId$3>p?zbJ8Ip5r2)5!;8v9-e1~b`tT53KogZr=TQ+mwnqQ`X(`FAMFb&;mH zQtc{Fw@w{f|HFbs1lX>85&t_qC#Gy(Maq>cW$rWi?8-_TN!RX>2zScIGz$ug5X{k&Gdi0u}V%aGkH z;e4&!CY3w)Cc@j6N-O7yW_++=7?s;raseS1_-Rrw+SOdlZE3L9U?IN-OSs1T4v@Q> E$y*6=)&Kwi diff --git a/tests/manual/rhi/shared/texture.vert.qsb b/tests/manual/rhi/shared/texture.vert.qsb index 1b9e52890d6bf9830d55084f2c3ef087924a1e91..288cce8176492477bc259ef8f9ef66d89b1ccee4 100644 GIT binary patch literal 1574 zcmV+>2HE)l01&-+ob6Z5ZyQAvpS2yw*_Omfn-5YTlccnEK3qGvp;A7Y(6k9sAyyJa ztna?bC$coH`pT|nXH=a{tL5s5kz|@!xIyQ_PMz+qt z8qhDY2Ftgx-%cmW_E?>jVHAV68n0-mkU&+z_5qB}5qGI2PHHhwu0W^=>?Tlz{m0fp zk(KC;uiSXU@@ls0@Ju>wnl<067k$20FPo1|4y{`7v%K0km=l!k_`F=PfjXKq&AMZk zU9XC0UWW&;8U^o>?d(wG4-8qj_o#sLV(0wv9Eq%f zm`nzFL(n<&1oX?$&y(i|Z8o1l9i}2MAzBBN6WUvT92fY~T$T*{!AbQ6xdTz}v`#iCcj zD`o~d0zV6(^eG(iAP2E$gxl_yZxuJnVUw6j9*wuk#kgDYblhjdt+>!>9L@2kkycz- z!!3gQ&8_9FCsZp{+X&@Twf3v*?51-20-8EYu$2OK$4BANcqe-4gve)!+bi}2{%uFa zdlgoEs^*tc+3RVPchd@#YpqKyujOr99vDY{l=zHfYOA2X zDU~Jo;XKpU&jKIfX4u;3~Ej28C=;D&^LSX33q12Bp*`5!O{_)d{0DdRxLm|XwJpCh`9 zcqlh1ekC_47UcB%&5OyVv_6NznA?7LT zFd%fL{g-JjLlhs)a3`kFDIh=0RLelAG{v;mhj22^-bWuJFYaqmeTQu^20S>OiWq4wKd#EOu_XUbQ zPJD&wBTTP`xj_6JU^>P8r5^GZ!BZFU&<5u1Rm$xpvN6cy+C%;cU@&*1#KWBa3^vsM z_zmzV!?iw6a~LDrnAQ@>%P&;&a2!|cy+t$N*X(NP8a`4F7vWM}!~3&Ss9LpyLeb(vYwnDjxw=2KyPcB) z#+A;ybzfK0@8*1Gr(UzXM8z#S>E!P2oMye{&bzat&QS#Y#f9y(1lGJ2gI@EFpE%_p z_z-A8Ws=H6L!9@)B;+WeJi?SgvE~={EueOHr+CqIfOJHnu82!I0N`1M8KU!K^See_ z#J<2EAIY$QO0|4u$T$Vc^v@2Iwf*#fID)SaM0=KB_Z(DG YUn3o2s&wLYlj#Mo}2h$J+D0I8Hhltd^f zAlDzy;eq{Z?B^&cO%iqK$mdUdfh9l^pO}kngRQZG11=*(76oLH989Vd%FA za|ZesW+SF*y&)aDT&g-`vvmvhu*5zNeH8k~FtH|JY#c!wrJ9Em0)7E{0Q#N(VBccP zDK)!o_LJM~ZwxWEkJVf!U#b)@0`|Qs`_hp1H{kt=f#Zyo4QaobWgIu>xJ$ly_6Y2^ zvJ5I;Lnlm@spV0>73GU|F=JP7UO!W=o>)or*7w{uf#Z}%thEu# zq9QRa>fVbV*)3l z=-A3&9W%BXC2#XQf_}x&Wqx#w$D@KT!5RT$s{omZ#raSJQv$7t=TadxL*9X`0EWQu zQ<~3fmWAm@rzyrOel`P#{8%UBR=<gC765i7Rm$A8vtD&43p-10H}HSG zyvllkorNX+dI`oS7cO4v_~FN2%*R6m?N2)0?{0qk6BboGC>JyCQMmU$gFXs-;szkh zPF}up%aFzQ9u?uJSp9#$Kw{WHnM4A4-Lw})Xb;&-mT$40n?W5n9+U}CfzN0%-_v`X z#-9@X0-F9tpm8Smca#eoJIi6*Qn;Px3ni$nm0`BI8Guj)h33xfiP96>Gw!>an`p&Q z+ujb%f}wYvY^78!a|Jo8@6b%kE>?V z`@jLoH#9zeoA5DzdEwIa>$8*K*5-Ag^HnAq~Ton@Ut5ET=s+WrmpNZr6eyTuOYpv1%bY-KJ$uk+A zWfBZyWs10djb|EKp-Q$1ekkwnmXe41J_mWG*q3mR2?0Vk`HEXW2u8cfA9?bUc6u12 z(-6`jb_(9O``VQob_KwZA0j@ZF|}0C-k^#S{BR!ri5y}A_~`fRB!l!GqS22j&BrD| zH`VEWdh0wqn};=?L2}~)Th2W|c5q(DG`mP2)iBk3_S9ue!BhGP&F_Q24G4WxWEHqQ8zq01+JtKzl-n+kK494y#@i3;p0ft&1e}X)YVXgPm9F7q-#`Xl0b*KAxlK3Bq74M&6 zPHK8lO%HvJlH4DFuk7@bJmw)rbLb;Gn3L1QAESCqQa(Nh9i-nRnIz$0e$G&i`^fGY zlKTs?cuwy0YM;i`sbd#b!iW8in=RCGHXkk8Ub>Ki?YQ7%E?7Rl>J)RQ@e#Xo0S?tw zJU`=ov_+q)Z&-o8Dep*Ng) z7Z=q&ibC5=IBtVu^;0qE)zA2mEe8CHK!a2wsw^yv{obF1{E8@xFlA7zdU$Jcz^y@^ zExACtB2Xv9AsqzZnTHvo@o4>CqY$x=@dsx#L-Q_5~lt{Wc diff --git a/tests/manual/rhi/shared/texture_ms4.frag.qsb b/tests/manual/rhi/shared/texture_ms4.frag.qsb index 7f187ce7f0e81e6ce7205e22aab051b794e44bea..278313111b01c493bbd42fc9fcde99c97ed269c7 100644 GIT binary patch literal 1555 zcmV+u2JHC&01u{koTXP=ZxdG#KE7dNN@DJ}lrDtQUE(^936S78IM^|Pnx@5}jYK2Y zS#M%jzG=ONw1|pUszgYj6!IrFYvk$`a+P5 z3x#9F)$4_yKK;2^{!JZuE|!n|s=qLqC`JWDsGTPHgXASik_;_kxKms#J@J(@$DIh( zLCWWXeWs=uJ5HjIs3hk|-a^c0n4*Xrip#^YpTsh@#ON;U8$Ly zhDAY@rNz}5D*7YBpOSnL6M;&m z$A!B`Xd!G{AaCa@eQonh(6l(V651IdqJFG|JPSMcpV|StOhf%0{a{|a@}-3M!Kv+q zuxlxeCbre))av&Q?&6D086EPCxNY!1@a*I(z~lD~y&D{hbx9wwu=`t=N^K6*4 z%|f@;HNka@+V#N(RUejp{@V9@q(`LAb#JtqJv(<;l&KwX0FRY)&VLqhj(!GltaDAL zJ@#3TzU0Xnk$PmPj}LuZEGq0rW64t+`{gCKJ(eKylznxTQ5S!Q$SWxIkX)UhT!*l{ zhZXQ1Bc1c@ft|0p7;0cSN|AB+pP&`t2QDtQ@85t&KSln0_wNJOe&CE{p^pIL+y}wu zWN{(r<#B$8#F{%nXLL%_xb=-@5Sk%jk?wl9lK03^4Y~V-Gl7 zXMJ4bKCXA+<8Yk^=A1d+Ki|;!*!CWBo%isoK7P%|KLH@TYwI zlRo|__&EF-V3Xiad-yLRM+Wmg1}ulObqRaqBXH3hC(nado`CBL{4aaBu6Vez;991Y z=W{X#j74Bi@cvyOzH6v;OxWiohqJf<{3-b`$93>5c;X5>#1(;mOg^kHB35{?60m>= zy8$fdnS&+7mtZeqytA@n%PF4eEw6*EXzLt4dF2tGPZO zckzC+U7zG%sm6RfKIk_)n@XqFHu}AqZYVM;8;|!bbD&!ay-e|kafQB(R<~wNZ%r%o znq?)@>{tpvW!d;6H-PI(SGxmiTbMF@CY5{lbZ*tOwzjrIWV7Q9%qZ^rOOb=VVXCdJ z-f@GOxNUSiiS3^1&{3Hb*|%z&25D<+NreclfoWvw)pmbQrkQ7qykL>FC6#`y-Q)iW z2(3_$O9vz!G!*J4X2~fJ9}TA`qgXm2+*2tLjoKcSDiPvM(LVy!2hF}t7)thzFpLuz$8 zl?F!}Ax{snK-pc(FP5UpRFPeMdaAdZJ`Kfm%{_VCYve*j=P F!Vt^B7%Tt) literal 1847 zcmV-72gvvU01?!9oTXRWPZVbqKYL@BMFH{3rFIl+cLf(%Q9)P)xd;@+y4aE^!DV)U zv3u+6tfICJZDL~6#D~U*M*AO-v@d<|rA^cHPw8Wyd}w@W>^U>P*%=m0+c@OxeCPH% z=R4=SFht}dq99RV)Ol^Z@--cye)=YAr_NdsI z_e*ToK;=xnl+%pl#FaGb_AqrY^)gK`J>m&GZ6&HBy-=!{+{Q zNd#!6vMT=dVxQOYE1Dtm`qN%8^apy}fH}7LC9izOH1v%$|71De=i7RmzbosZB_jPP zuC998+!hhLvi^YW+V^i{H&OfSQK(ajjxI*W)v9uBT<4lue_eno_hNRji_U`!m2;b4-gq8&`C{LjIG_ zf((F?Zj@kTV)4@W_aFZ-G51TX@deEv{#ku#hAXRezTQM1&7?11?S^jz@th~%ym_!Nxi~&Qe|>_swzlT~gHIDv`lIEA zjIqYO+1g4^Pc9Dl?fvzH=}v@viwd`?)NJA0xIwhiOo3!`v*ji?_%LE^Da%4&1|CotX!AWh|EOS#0Wvm z!HFgJK3^+brGO<5TXP9m^LioYBTK#ZA=b%xY^wISk?gY~#D9Y2-ln!*?rqib3t4g8 z8_(9y@>>qmI*u}nxycPu$J$xsZJ+dZE^-gpr!UWyd5M1p-^v}4`#DP6*RRjRx3j&R{SCm{3%SUKz&AoBv0H%W#6AG57T6yk zd+j*6w!uCK`*!3h@-EEnUEn+X3HUqwDa3PlS-=7Cg57Uh#Lco&hc_#9z=2G}y6qgW?1=!e*UfLv!0U-&u5&hh&2lY3T3j8`lP z!B+ZMk9b3^sE`Ob*zhhkQLFZ{g9==A3}c~anu&8CbrEXtLJr= z>2*Ti<74Un`PEY{f#OU_mCu;C}YViADj8eR2mcIWBvJPc$Wqu_XR$`E0gLZAYd?7DF|f|V{+tKvya#ItSo7R@*(bx02@%$W ztlu%lyNFyn$lfn0?8Pz2pRkQ!TmsIR$8UTWzX`}cWE@sA2PYtHw zKLz~+<~s=8-;6L|pMcKYDqGU|7g*4K?9>Ztu9DT1;k;&Ma?5;m=Jb`3s4Fk)`D~B; zB-Tfw(Mp-Wrxf`HDVH*;rdVD>(Ww1(pzzHUeHc~vS6kE_V267hRf1k~&0|K^%#? zfrV1a!_TYbNh+qw5*fuf5YO74Rm_qwZh}7qmhb6Vb3GQf60-#Bn!dJf#^Uj~a*CZ3 zZVlq`A#YU$JZ9k-S|%H-*sv-?^~RMhWj94%{7stV8#QMTRaJUY2p#KB^g_zBPPpx@ l8mNhl`wuvOHF2+7eqe2AT;YN^asQ&S6GB!2{{d+A9WZ9L!yW(t From dd17456a8a69501428f3fdd2d2e25bb4286899da Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 20 Jan 2020 13:00:56 +0100 Subject: [PATCH 21/71] Deprecate QFont::ForceIntegerMetrics and QFont::OpenGLCompatible The ForceIntegerMetrics flag was added in Qt 4.7 specifically because of WebKit, which was rounding text metrics and getting mismatches with the underlying font engine whenever it supported fractional advances. For backwards compatibility with how the CoreText engine worked before this, we added a flag to allow rounding all metrics. Rounding advances gives very broken rendering and is hopefully not used by anyone anymore, so lets remove this flag in Qt 6. As for OpenGLCompatible, this flag is not used anywhere. I am not exactly sure what this flag did, but all fonts are "OpenGL-compatible" at this point. [ChangeLog][QtGui][QFont] Deprecated QFont::ForceIntegerMetrics and QFont::OpenGLCompatible, with the intention of removing them in Qt 6.0.0. Change-Id: I0a492c153348023f00d561bab8ab4b5104c6c7c4 Reviewed-by: Lars Knoll --- src/gui/text/qfont.cpp | 8 ++++---- src/gui/text/qfont.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 9ede90d8de9..2e7d898a70f 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1353,8 +1353,8 @@ QFont::StyleHint QFont::styleHint() const \value NoAntialias don't antialias the fonts. \value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible. \value PreferAntialias antialias if possible. - \value OpenGLCompatible forces the use of OpenGL compatible - fonts. + \value OpenGLCompatible This style strategy has been deprecated. All fonts are + OpenGL-compatible by default. \value NoFontMerging If the font selected for a certain writing system does not contain a character requested to draw, then Qt automatically chooses a similar looking font that contains the character. The NoFontMerging flag disables this feature. @@ -1373,8 +1373,8 @@ QFont::StyleHint QFont::styleHint() const \value PreferQuality prefer the best quality font. The font matcher will use the nearest standard point size that the font supports. - \value ForceIntegerMetrics forces the use of integer values in font engines that support fractional - font metrics. + \value ForceIntegerMetrics This style strategy has been deprecated. Use \l QFontMetrics to + retrieve rounded font metrics. */ /*! diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 683aa3bf652..e5734679ed4 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -80,8 +80,10 @@ public: PreferQuality = 0x0040, PreferAntialias = 0x0080, NoAntialias = 0x0100, - OpenGLCompatible = 0x0200, - ForceIntegerMetrics = 0x0400, +#if QT_DEPRECATED_SINCE(5, 15) + OpenGLCompatible Q_DECL_ENUMERATOR_DEPRECATED = 0x0200, + ForceIntegerMetrics Q_DECL_ENUMERATOR_DEPRECATED = 0x0400, +#endif NoSubpixelAntialias = 0x0800, PreferNoShaping = 0x1000, NoFontMerging = 0x8000 From 2b78e96d2341dc0bf53ab9ccb22cfa55bf1037e0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 20 Jan 2020 09:41:51 +0100 Subject: [PATCH 22/71] QNAM: Avoid compile error if QT_NO_SSL Change-Id: Iff8a0893cc7aca172c5b3f207a359762b270ed76 Reviewed-by: Jesus Fernandez --- src/network/access/qnetworkaccessmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1f05fd931f4..4c2ee138eda 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1776,6 +1776,8 @@ void QNetworkAccessManagerPrivate::_q_replyEncrypted(QNetworkReply *reply) #ifndef QT_NO_SSL Q_Q(QNetworkAccessManager); emit q->encrypted(reply); +#else + Q_UNUSED(reply); #endif } From ef14e775de9932fecea5443b976b950c311ba938 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Dec 2019 09:02:21 +0100 Subject: [PATCH 23/71] QMenu: Move exec(), popup() to private class Task-number: QTBUG-78966 Change-Id: I69257dc52706449a1e0babfc29e5f93f63d9291b Reviewed-by: Volker Hilsheimer Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qmenu.cpp | 180 ++++++++++++++++++---------------- src/widgets/widgets/qmenu_p.h | 2 + 2 files changed, 98 insertions(+), 84 deletions(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 8ba5b98fa9d..e3e3b07d714 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2319,76 +2319,82 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); - if (d->scroll) { // reset scroll state from last popup - if (d->scroll->scrollOffset) - d->itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll - d->scroll->scrollOffset = 0; - d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; + d->popup(p, atAction); +} + +void QMenuPrivate::popup(const QPoint &p, QAction *atAction) +{ + Q_Q(QMenu); + if (scroll) { // reset scroll state from last popup + if (scroll->scrollOffset) + itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll + scroll->scrollOffset = 0; + scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } - d->tearoffHighlighted = 0; - d->motions = 0; - d->doChildEffects = true; - d->updateLayoutDirection(); + tearoffHighlighted = 0; + motions = 0; + doChildEffects = true; + updateLayoutDirection(); // Ensure that we get correct sizeHints by placing this window on the correct screen. // However if the QMenu was constructed with a QDesktopScreenWidget as its parent, // then initialScreenIndex was set, so we should respect that for the lifetime of this menu. // Use d->popupScreen to remember, because initialScreenIndex will be reset after the first showing. // However if eventLoop exists, then exec() already did this by calling createWinId(); so leave it alone. (QTBUG-76162) - if (!d->eventLoop) { - const int screenIndex = d->topData()->initialScreenIndex; + if (!eventLoop) { + const int screenIndex = topData()->initialScreenIndex; if (screenIndex >= 0) - d->popupScreen = screenIndex; - if (auto s = QGuiApplication::screens().value(d->popupScreen)) { - if (d->setScreen(s)) - d->itemsDirty = true; - } else if (d->setScreenForPoint(p)) { - d->itemsDirty = true; + popupScreen = screenIndex; + if (auto s = QGuiApplication::screens().value(popupScreen)) { + if (setScreen(s)) + itemsDirty = true; + } else if (setScreenForPoint(p)) { + itemsDirty = true; } } - const bool contextMenu = d->isContextMenu(); - if (d->lastContextMenu != contextMenu) { - d->itemsDirty = true; - d->lastContextMenu = contextMenu; + const bool contextMenu = isContextMenu(); + if (lastContextMenu != contextMenu) { + itemsDirty = true; + lastContextMenu = contextMenu; } #if QT_CONFIG(menubar) // if this menu is part of a chain attached to a QMenuBar, set the // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type - setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast(d->topCausedWidget()) != 0); + q->setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast(topCausedWidget()) != nullptr); #endif - ensurePolished(); // Get the right font - emit aboutToShow(); - const bool actionListChanged = d->itemsDirty; + q->ensurePolished(); // Get the right font + emit q->aboutToShow(); + const bool actionListChanged = itemsDirty; QRect screen; #if QT_CONFIG(graphicsview) - bool isEmbedded = !bypassGraphicsProxyWidget(this) && QMenuPrivate::nearestGraphicsProxyWidget(this); + bool isEmbedded = !bypassGraphicsProxyWidget(q) && QMenuPrivate::nearestGraphicsProxyWidget(q); if (isEmbedded) - screen = d->popupGeometry(); + screen = popupGeometry(); else #endif - screen = d->popupGeometry(QDesktopWidgetPrivate::screenNumber(p)); - d->updateActionRects(screen); + screen = popupGeometry(QDesktopWidgetPrivate::screenNumber(p)); + updateActionRects(screen); QPoint pos; - QPushButton *causedButton = qobject_cast(d->causedPopup.widget); + QPushButton *causedButton = qobject_cast(causedPopup.widget); if (actionListChanged && causedButton) pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition(); else pos = p; - const QSize menuSizeHint(sizeHint()); + const QSize menuSizeHint(q->sizeHint()); QSize size = menuSizeHint; - const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, this); - bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); + const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q); + bool adjustToDesktop = !q->window()->testAttribute(Qt::WA_DontShowOnScreen); // if the screens have very different geometries and the menu is too big, we have to recalculate if ((size.height() > screen.height() || size.width() > screen.width()) || // Layout is not right, we might be able to save horizontal space - (d->ncols >1 && size.height() < screen.height())) { + (ncols >1 && size.height() < screen.height())) { size.setWidth(qMin(menuSizeHint.width(), screen.width() - desktopFrame * 2)); size.setHeight(qMin(menuSizeHint.height(), screen.height() - desktopFrame * 2)); adjustToDesktop = true; @@ -2397,61 +2403,61 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #ifdef QT_KEYPAD_NAVIGATION if (!atAction && QApplicationPrivate::keypadNavigationEnabled()) { // Try to have one item activated - if (d->defaultAction && d->defaultAction->isEnabled()) { - atAction = d->defaultAction; + if (defaultAction && defaultAction->isEnabled()) { + atAction = defaultAction; // TODO: This works for first level menus, not yet sub menus } else { - for (QAction *action : qAsConst(d->actions)) + for (QAction *action : qAsConst(actions)) if (action->isEnabled()) { atAction = action; break; } } - d->currentAction = atAction; + currentAction = atAction; } #endif - if (d->ncols > 1) { + if (ncols > 1) { pos.setY(screen.top() + desktopFrame); } else if (atAction) { - for (int i = 0, above_height = 0; i < d->actions.count(); i++) { - QAction *action = d->actions.at(i); + for (int i = 0, above_height = 0; i < actions.count(); i++) { + QAction *action = actions.at(i); if (action == atAction) { int newY = pos.y() - above_height; - if (d->scroll && newY < desktopFrame) { - d->scroll->scrollFlags = d->scroll->scrollFlags + if (scroll && newY < desktopFrame) { + scroll->scrollFlags = scroll->scrollFlags | QMenuPrivate::QMenuScroller::ScrollUp; - d->scroll->scrollOffset = newY; + scroll->scrollOffset = newY; newY = desktopFrame; } pos.setY(newY); - if (d->scroll && d->scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone - && !style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, nullptr, this)) { - int below_height = above_height + d->scroll->scrollOffset; - for (int i2 = i; i2 < d->actionRects.count(); i2++) - below_height += d->actionRects.at(i2).height(); + if (scroll && scroll->scrollFlags != QMenuPrivate::QMenuScroller::ScrollNone + && !q->style()->styleHint(QStyle::SH_Menu_FillScreenWithScroll, nullptr, q)) { + int below_height = above_height + scroll->scrollOffset; + for (int i2 = i; i2 < actionRects.count(); i2++) + below_height += actionRects.at(i2).height(); size.setHeight(below_height); } break; } else { - above_height += d->actionRects.at(i).height(); + above_height += actionRects.at(i).height(); } } } QPoint mouse = QCursor::pos(); - d->mousePopupPos = mouse; - const bool snapToMouse = !d->causedPopup.widget && (QRect(p.x() - 3, p.y() - 3, 6, 6).contains(mouse)); + mousePopupPos = mouse; + const bool snapToMouse = !causedPopup.widget && (QRect(p.x() - 3, p.y() - 3, 6, 6).contains(mouse)); if (adjustToDesktop) { // handle popup falling "off screen" - if (isRightToLeft()) { + if (q->isRightToLeft()) { if (snapToMouse) // position flowing left from the mouse pos.setX(mouse.x() - size.width()); #if QT_CONFIG(menubar) // if the menu is in a menubar or is a submenu, it should be right-aligned - if (qobject_cast(d->causedPopup.widget) || qobject_cast(d->causedPopup.widget)) + if (qobject_cast(causedPopup.widget) || qobject_cast(causedPopup.widget)) pos.rx() -= size.width(); #endif // QT_CONFIG(menubar) @@ -2475,8 +2481,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction) if (pos.y() < screen.top() + desktopFrame) pos.setY(screen.top() + desktopFrame); if (pos.y() + menuSizeHint.height() - 1 > screen.bottom() - desktopFrame) { - if (d->scroll) { - d->scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown); + if (scroll) { + scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown); int y = qMax(screen.y(),pos.y()); size.setHeight(screen.bottom() - (desktopFrame * 2) - y); } else { @@ -2485,13 +2491,13 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } } } - const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, this); - QMenu *caused = qobject_cast(d_func()->causedPopup.widget); + const int subMenuOffset = q->style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr, q); + QMenu *caused = qobject_cast(causedPopup.widget); if (caused && caused->geometry().width() + menuSizeHint.width() + subMenuOffset < screen.width()) { QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction)); const QPoint actionTopLeft = caused->mapToGlobal(parentActionRect.topLeft()); parentActionRect.moveTopLeft(actionTopLeft); - if (isRightToLeft()) { + if (q->isRightToLeft()) { if ((pos.x() + menuSizeHint.width() > parentActionRect.left() - subMenuOffset) && (pos.x() < parentActionRect.right())) { @@ -2513,61 +2519,61 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } } } - setGeometry(QRect(pos, size)); + q->setGeometry(QRect(pos, size)); #if QT_CONFIG(effects) - int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; + int hGuess = q->isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int vGuess = QEffects::DownScroll; - if (isRightToLeft()) { + if (q->isRightToLeft()) { if ((snapToMouse && (pos.x() + size.width() / 2 > mouse.x())) || - (qobject_cast(d->causedPopup.widget) && pos.x() + size.width() / 2 > d->causedPopup.widget->x())) + (qobject_cast(causedPopup.widget) && pos.x() + size.width() / 2 > causedPopup.widget->x())) hGuess = QEffects::RightScroll; } else { if ((snapToMouse && (pos.x() + size.width() / 2 < mouse.x())) || - (qobject_cast(d->causedPopup.widget) && pos.x() + size.width() / 2 < d->causedPopup.widget->x())) + (qobject_cast(causedPopup.widget) && pos.x() + size.width() / 2 < causedPopup.widget->x())) hGuess = QEffects::LeftScroll; } #if QT_CONFIG(menubar) if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) || - (qobject_cast(d->causedPopup.widget) && - pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) + (qobject_cast(causedPopup.widget) && + pos.y() + size.width() / 2 < causedPopup.widget->mapToGlobal(causedPopup.widget->pos()).y())) vGuess = QEffects::UpScroll; #endif if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) { bool doChildEffects = true; #if QT_CONFIG(menubar) - if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) { + if (QMenuBar *mb = qobject_cast(causedPopup.widget)) { doChildEffects = mb->d_func()->doChildEffects; mb->d_func()->doChildEffects = false; } else #endif - if (QMenu *m = qobject_cast(d->causedPopup.widget)) { + if (QMenu *m = qobject_cast(causedPopup.widget)) { doChildEffects = m->d_func()->doChildEffects; m->d_func()->doChildEffects = false; } if (doChildEffects) { if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)) - qFadeEffect(this); - else if (d->causedPopup.widget) - qScrollEffect(this, qobject_cast(d->causedPopup.widget) ? hGuess : vGuess); + qFadeEffect(q); + else if (causedPopup.widget) + qScrollEffect(q, qobject_cast(causedPopup.widget) ? hGuess : vGuess); else - qScrollEffect(this, hGuess | vGuess); + qScrollEffect(q, hGuess | vGuess); } else { // kill any running effect qFadeEffect(nullptr); qScrollEffect(nullptr); - show(); + q->show(); } } else #endif { - show(); + q->show(); } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(this, QAccessible::PopupMenuStart); + QAccessibleEvent event(q, QAccessible::PopupMenuStart); QAccessible::updateAccessibility(&event); #endif } @@ -2633,20 +2639,26 @@ QAction *QMenu::exec() QAction *QMenu::exec(const QPoint &p, QAction *action) { Q_D(QMenu); - ensurePolished(); - createWinId(); - QEventLoop eventLoop; - d->eventLoop = &eventLoop; + return d->exec(p, action); +} + +QAction *QMenuPrivate::exec(const QPoint &p, QAction *action) +{ + Q_Q(QMenu); + q->ensurePolished(); + q->createWinId(); + QEventLoop evtLoop; + eventLoop = &evtLoop; popup(p, action); - QPointer guard = this; - (void) eventLoop.exec(); + QPointer guard = q; + (void) evtLoop.exec(); if (guard.isNull()) return nullptr; - action = d->syncAction; - d->syncAction = nullptr; - d->eventLoop = nullptr; + action = syncAction; + syncAction = nullptr; + eventLoop = nullptr; return action; } diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index efbbc099a13..7d2d0ab4879 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -351,6 +351,8 @@ public: QRect popupGeometry(int screen) const; bool useFullScreenForPopup() const; int getLastVisibleAction() const; + void popup(const QPoint &p, QAction *atAction); + QAction *exec(const QPoint &p, QAction *action); //selection static QMenu *mouseDown; From a78d66743171557d79b16c08be775e3ac15bb4ef Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Dec 2019 09:33:50 +0100 Subject: [PATCH 24/71] Fix positioning of dynamically populated QToolButton::MenuButtonPopup's in screen corners The existing code positioning the menu in QToolButtonPrivate::popupTimerDone() had a clause checking whether any receivers were connnected to QMenu::aboutToShow() causing the sizeHint to be -1,-1 in that case (apparently trying to accommodate menus populated in slots). In that case, the checking for screen borders would not work, causing the similar checks in QMenu::popup() to trigger, potentially positioning the menu over the mouse. To solve this dilemma, add a parameter taking a std::function calulating the position of the menu from the sizeHint to QMenuPrivate::exec()/popup() and invoke that in QMenuPrivate::popup() after emitting QMenu::aboutToShow() when the sizeHint is known. Fixes: QTBUG-78966 Change-Id: I180bd2dc7eadcaca6cadca13745ed4a2dd89e412 Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qmenu.cpp | 10 +++-- src/widgets/widgets/qmenu_p.h | 8 +++- src/widgets/widgets/qtoolbutton.cpp | 67 ++++++++++++++++------------- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index e3e3b07d714..701035fc32b 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2322,7 +2322,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->popup(p, atAction); } -void QMenuPrivate::popup(const QPoint &p, QAction *atAction) +void QMenuPrivate::popup(const QPoint &p, QAction *atAction, PositionFunction positionFunction) { Q_Q(QMenu); if (scroll) { // reset scroll state from last popup @@ -2388,6 +2388,10 @@ void QMenuPrivate::popup(const QPoint &p, QAction *atAction) const QSize menuSizeHint(q->sizeHint()); QSize size = menuSizeHint; + + if (positionFunction) + pos = positionFunction(menuSizeHint); + const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, nullptr, q); bool adjustToDesktop = !q->window()->testAttribute(Qt::WA_DontShowOnScreen); @@ -2642,14 +2646,14 @@ QAction *QMenu::exec(const QPoint &p, QAction *action) return d->exec(p, action); } -QAction *QMenuPrivate::exec(const QPoint &p, QAction *action) +QAction *QMenuPrivate::exec(const QPoint &p, QAction *action, PositionFunction positionFunction) { Q_Q(QMenu); q->ensurePolished(); q->createWinId(); QEventLoop evtLoop; eventLoop = &evtLoop; - popup(p, action); + popup(p, action, positionFunction); QPointer guard = q; (void) evtLoop.exec(); diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 7d2d0ab4879..02fe9f31a1d 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -64,6 +64,8 @@ #include +#include + QT_REQUIRE_CONFIG(menu); QT_BEGIN_NAMESPACE @@ -302,6 +304,8 @@ class QMenuPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QMenu) public: + using PositionFunction = std::function; + QMenuPrivate() : itemsDirty(false), hasCheckableItems(false), @@ -351,8 +355,8 @@ public: QRect popupGeometry(int screen) const; bool useFullScreenForPopup() const; int getLastVisibleAction() const; - void popup(const QPoint &p, QAction *atAction); - QAction *exec(const QPoint &p, QAction *action); + void popup(const QPoint &p, QAction *atAction, PositionFunction positionFunction = {}); + QAction *exec(const QPoint &p, QAction *action, PositionFunction positionFunction = {}); //selection static QMenu *mouseDown; diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 263fe5d8ced..314c6ab40c2 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -723,38 +723,12 @@ void QToolButtonPrivate::_q_buttonReleased() popupTimer.stop(); } -void QToolButtonPrivate::popupTimerDone() +static QPoint positionMenu(const QToolButton *q, bool horizontal, + const QSize &sh) { - Q_Q(QToolButton); - popupTimer.stop(); - if (!menuButtonDown && !down) - return; - - menuButtonDown = true; - QPointer actualMenu; - bool mustDeleteActualMenu = false; - if(menuAction) { - actualMenu = menuAction->menu(); - } else if (defaultAction && defaultAction->menu()) { - actualMenu = defaultAction->menu(); - } else { - actualMenu = new QMenu(q); - mustDeleteActualMenu = true; - for(int i = 0; i < actions.size(); i++) - actualMenu->addAction(actions.at(i)); - } - repeat = q->autoRepeat(); - q->setAutoRepeat(false); - bool horizontal = true; -#if QT_CONFIG(toolbar) - QToolBar *tb = qobject_cast(parent); - if (tb && tb->orientation() == Qt::Vertical) - horizontal = false; -#endif QPoint p; const QRect rect = q->rect(); // Find screen via point in case of QGraphicsProxyWidget. QRect screen = QDesktopWidgetPrivate::availableGeometry(q->mapToGlobal(rect.center())); - QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint(); if (horizontal) { if (q->isRightToLeft()) { if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.bottom()) { @@ -788,6 +762,37 @@ void QToolButtonPrivate::popupTimerDone() } p.rx() = qMax(screen.left(), qMin(p.x(), screen.right() - sh.width())); p.ry() += 1; + return p; +} + +void QToolButtonPrivate::popupTimerDone() +{ + Q_Q(QToolButton); + popupTimer.stop(); + if (!menuButtonDown && !down) + return; + + menuButtonDown = true; + QPointer actualMenu; + bool mustDeleteActualMenu = false; + if (menuAction) { + actualMenu = menuAction->menu(); + } else if (defaultAction && defaultAction->menu()) { + actualMenu = defaultAction->menu(); + } else { + actualMenu = new QMenu(q); + mustDeleteActualMenu = true; + for (int i = 0; i < actions.size(); i++) + actualMenu->addAction(actions.at(i)); + } + repeat = q->autoRepeat(); + q->setAutoRepeat(false); + bool horizontal = true; +#if QT_CONFIG(toolbar) + QToolBar *tb = qobject_cast(parent); + if (tb && tb->orientation() == Qt::Vertical) + horizontal = false; +#endif QPointer that = q; actualMenu->setNoReplayFor(q); if (!mustDeleteActualMenu) //only if action are not in this widget @@ -796,7 +801,11 @@ void QToolButtonPrivate::popupTimerDone() actualMenu->d_func()->causedPopup.widget = q; actualMenu->d_func()->causedPopup.action = defaultAction; actionsCopy = q->actions(); //(the list of action may be modified in slots) - actualMenu->exec(p); + + // QTBUG-78966, Delay positioning until after aboutToShow(). + auto positionFunction = [q, horizontal](const QSize &sizeHint) { + return positionMenu(q, horizontal, sizeHint); }; + actualMenu->d_func()->exec({}, nullptr, positionFunction); if (!that) return; From 73d1476fb1397948a4d806bd921fce372bd8d63b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Dec 2019 17:54:48 +0100 Subject: [PATCH 25/71] Replace most use of QVariant::type and occurrences of QVariant::Type I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll --- .../serialization/convert/cborconverter.cpp | 4 +- .../convert/datastreamconverter.cpp | 6 +- .../serialization/convert/textconverter.cpp | 6 +- .../serialization/convert/xmlconverter.cpp | 20 +- examples/network/torrent/trackerclient.cpp | 2 +- .../itemviews/coloreditorfactory/window.cpp | 2 +- .../mysortfilterproxymodel.cpp | 2 +- .../tools/settingseditor/settingstree.cpp | 2 +- .../tools/settingseditor/variantdelegate.cpp | 132 ++--- .../tools/settingseditor/variantdelegate.h | 2 +- src/corelib/animation/qpropertyanimation.cpp | 6 +- src/corelib/io/qsettings.cpp | 34 +- src/corelib/itemmodels/qabstractitemmodel.cpp | 40 +- src/corelib/kernel/qmetaobject.cpp | 12 +- src/corelib/kernel/qmimedata.cpp | 72 +-- src/corelib/kernel/qvariant.cpp | 492 +++++++++--------- src/corelib/kernel/qvariant_p.h | 4 +- src/corelib/serialization/qjsoncbor.cpp | 38 +- src/corelib/serialization/qjsondocument.cpp | 10 +- src/corelib/serialization/qjsonvalue.cpp | 26 +- src/corelib/text/qlocale.cpp | 6 +- src/corelib/text/qlocale_unix.cpp | 12 +- src/corelib/time/qdatetime.cpp | 6 +- src/corelib/time/qdatetimeparser.cpp | 24 +- src/corelib/time/qdatetimeparser_p.h | 4 +- src/dbus/qdbusabstractinterface.cpp | 2 +- src/dbus/qdbusargument.h | 4 +- src/dbus/qdbusintegrator.cpp | 4 +- src/dbus/qdbusinterface.cpp | 18 +- src/dbus/qdbusmarshaller.cpp | 10 +- src/dbus/qdbusmessage.cpp | 2 +- src/dbus/qdbusmetaobject.cpp | 20 +- src/dbus/qdbusmetatype.cpp | 38 +- src/dbus/qdbusutil.cpp | 8 +- src/dbus/qdbusxmlgenerator.cpp | 6 +- src/gui/image/qbitmap.cpp | 2 +- src/gui/image/qicon.cpp | 2 +- src/gui/image/qimage.cpp | 2 +- src/gui/image/qpixmap.cpp | 2 +- src/gui/itemmodels/qstandarditemmodel.cpp | 2 +- src/gui/kernel/qcursor.cpp | 2 +- src/gui/kernel/qguivariant.cpp | 62 +-- src/gui/kernel/qinternalmimedata.cpp | 13 +- src/gui/kernel/qkeysequence.cpp | 2 +- src/gui/kernel/qpalette.cpp | 2 +- src/gui/math3d/qmatrix4x4.cpp | 2 +- src/gui/math3d/qquaternion.cpp | 2 +- src/gui/math3d/qvector2d.cpp | 2 +- src/gui/math3d/qvector3d.cpp | 2 +- src/gui/math3d/qvector4d.cpp | 2 +- src/gui/painting/qbrush.cpp | 2 +- src/gui/painting/qcolor.cpp | 2 +- src/gui/painting/qmatrix.cpp | 2 +- src/gui/painting/qpen.cpp | 2 +- src/gui/painting/qpolygon.cpp | 2 +- src/gui/painting/qregion.cpp | 2 +- src/gui/painting/qtransform.cpp | 2 +- src/gui/text/qcssparser.cpp | 20 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qplatformfontdatabase.cpp | 2 +- src/gui/text/qtextdocument.cpp | 6 +- src/gui/text/qtextdocumentlayout.cpp | 2 +- src/gui/text/qtextformat.cpp | 52 +- src/gui/text/qtexthtmlparser.cpp | 12 +- src/gui/text/qtextimagehandler.cpp | 8 +- src/gui/text/qtextodfwriter.cpp | 4 +- .../accessibility/qaccessiblebridgeutils.cpp | 2 +- .../linuxaccessibility/atspiadaptor.cpp | 2 +- .../themes/genericunix/qgenericunixthemes.cpp | 2 +- .../generic/tuiotouch/qtuiohandler.cpp | 40 +- src/plugins/platforms/xcb/qxcbclipboard.cpp | 3 +- src/plugins/platforms/xcb/qxcbdrag.cpp | 6 +- src/plugins/platforms/xcb/qxcbmime.cpp | 8 +- src/plugins/platforms/xcb/qxcbmime.h | 4 +- src/plugins/sqldrivers/ibase/qsql_ibase.cpp | 4 +- src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 116 ++--- src/plugins/sqldrivers/odbc/qsql_odbc.cpp | 6 +- src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 2 +- src/sql/kernel/qsqldriver.cpp | 22 +- src/sql/kernel/qsqlfield.cpp | 11 +- src/sql/kernel/qsqlfield.h | 2 +- src/sql/kernel/qsqlresult.cpp | 4 +- src/testlib/qtest.h | 2 +- src/testlib/qtestlog.cpp | 4 +- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 6 +- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 2 +- src/widgets/dialogs/qsidebar.cpp | 2 +- src/widgets/graphicsview/qgraphicsitem.cpp | 8 +- .../graphicsview/qgraphicsproxywidget.cpp | 10 +- src/widgets/graphicsview/qgraphicsscene.cpp | 8 +- src/widgets/graphicsview/qgraphicsview.cpp | 8 +- .../itemviews/qabstractitemdelegate.cpp | 18 +- src/widgets/itemviews/qabstractitemview.cpp | 2 +- src/widgets/itemviews/qheaderview.cpp | 2 +- src/widgets/itemviews/qitemdelegate.cpp | 22 +- src/widgets/itemviews/qitemeditorfactory.cpp | 34 +- src/widgets/itemviews/qstyleditemdelegate.cpp | 10 +- src/widgets/kernel/qsizepolicy.cpp | 2 +- src/widgets/kernel/qwidgetsvariant.cpp | 12 +- src/widgets/styles/qstylesheetstyle.cpp | 31 +- src/widgets/widgets/qabstractspinbox.cpp | 70 +-- src/widgets/widgets/qabstractspinbox_p.h | 2 +- src/widgets/widgets/qcombobox.cpp | 8 +- src/widgets/widgets/qdatetimeedit.cpp | 32 +- src/widgets/widgets/qdatetimeedit.h | 3 + src/widgets/widgets/qplaintextedit.cpp | 20 +- src/widgets/widgets/qspinbox.cpp | 4 +- src/widgets/widgets/qtextbrowser.cpp | 4 +- src/widgets/widgets/qtextedit.cpp | 24 +- 109 files changed, 947 insertions(+), 936 deletions(-) diff --git a/examples/corelib/serialization/convert/cborconverter.cpp b/examples/corelib/serialization/convert/cborconverter.cpp index 60410ed26a5..77df367e50c 100644 --- a/examples/corelib/serialization/convert/cborconverter.cpp +++ b/examples/corelib/serialization/convert/cborconverter.cpp @@ -134,7 +134,7 @@ static QVariant convertCborValue(const QCborValue &value) enum TrimFloatingPoint { Double, Float, Float16 }; static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrimming) { - if (v.userType() == QVariant::List) { + if (v.userType() == QMetaType::QVariantList) { const QVariantList list = v.toList(); QCborArray array; for (const QVariant &v : list) @@ -152,7 +152,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim return map; } - if (v.userType() == QVariant::Double && fpTrimming != Double) { + if (v.userType() == QMetaType::Double && fpTrimming != Double) { float f = float(v.toDouble()); if (fpTrimming == Float16) return float(qfloat16(f)); diff --git a/examples/corelib/serialization/convert/datastreamconverter.cpp b/examples/corelib/serialization/convert/datastreamconverter.cpp index 7e9f5e1bdcb..6f0ca41ff57 100644 --- a/examples/corelib/serialization/convert/datastreamconverter.cpp +++ b/examples/corelib/serialization/convert/datastreamconverter.cpp @@ -96,8 +96,8 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str QString indented = indent + QLatin1String(" "); int type = v.userType(); - if (type == qMetaTypeId() || type == QVariant::Map) { - const auto map = (type == QVariant::Map) ? + if (type == qMetaTypeId() || type == QMetaType::QVariantMap) { + const auto map = (type == QMetaType::QVariantMap) ? VariantOrderedMap(v.toMap()) : qvariant_cast(v); result = QLatin1String("Map {"); @@ -109,7 +109,7 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str } result.chop(1); // remove comma result += indent + QLatin1String("},"); - } else if (type == QVariant::List) { + } else if (type == QMetaType::QVariantList) { const QVariantList list = v.toList(); result = QLatin1String("List ["); diff --git a/examples/corelib/serialization/convert/textconverter.cpp b/examples/corelib/serialization/convert/textconverter.cpp index 7aed08f96c3..ae03b9a334b 100644 --- a/examples/corelib/serialization/convert/textconverter.cpp +++ b/examples/corelib/serialization/convert/textconverter.cpp @@ -56,21 +56,21 @@ static void dumpVariant(QTextStream &out, const QVariant &v) { switch (v.userType()) { - case QVariant::List: { + case QMetaType::QVariantList: { const QVariantList list = v.toList(); for (const QVariant &item : list) dumpVariant(out, item); break; } - case QVariant::String: { + case QMetaType::QString: { const QStringList list = v.toStringList(); for (const QString &s : list) out << s << Qt::endl; break; } - case QVariant::Map: { + case QMetaType::QVariantMap: { const QVariantMap map = v.toMap(); for (auto it = map.begin(); it != map.end(); ++it) { out << it.key() << " => "; diff --git a/examples/corelib/serialization/convert/xmlconverter.cpp b/examples/corelib/serialization/convert/xmlconverter.cpp index d9e724dfe13..42cb10100ad 100644 --- a/examples/corelib/serialization/convert/xmlconverter.cpp +++ b/examples/corelib/serialization/convert/xmlconverter.cpp @@ -284,18 +284,18 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options ba.resize(n); result = ba; } else { - int id = QVariant::Invalid; + int id = QMetaType::UnknownType; if (type == QLatin1String("datetime")) - id = QVariant::DateTime; + id = QMetaType::QDateTime; else if (type == QLatin1String("url")) - id = QVariant::Url; + id = QMetaType::QUrl; else if (type == QLatin1String("uuid")) - id = QVariant::Uuid; + id = QMetaType::QUuid; else if (type == QLatin1String("regex")) - id = QVariant::RegularExpression; + id = QMetaType::QRegularExpression; else id = QMetaType::type(type.toLatin1()); - if (id == QVariant::Invalid) { + if (id == QMetaType::UnknownType) { fprintf(stderr, "%lld:%lld: Invalid XML: unknown type '%s'.\n", xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString())); exit(EXIT_FAILURE); @@ -327,14 +327,14 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options static void variantToXml(QXmlStreamWriter &xml, const QVariant &v) { int type = v.userType(); - if (type == QVariant::List) { + if (type == QMetaType::QVariantList) { QVariantList list = v.toList(); xml.writeStartElement("list"); for (const QVariant &v : list) variantToXml(xml, v); xml.writeEndElement(); - } else if (type == QVariant::Map || type == qMetaTypeId()) { - const VariantOrderedMap map = (type == QVariant::Map) ? + } else if (type == QMetaType::QVariantMap || type == qMetaTypeId()) { + const VariantOrderedMap map = (type == QMetaType::QVariantMap) ? VariantOrderedMap(v.toMap()) : qvariant_cast(v); @@ -433,7 +433,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v) // does this convert to string? const char *typeName = v.typeName(); QVariant copy = v; - if (copy.convert(QVariant::String)) { + if (copy.convert(QMetaType::QString)) { xml.writeAttribute(typeString, QString::fromLatin1(typeName)); xml.writeCharacters(copy.toString()); } else { diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp index 540ab315577..a50a49fd64d 100644 --- a/examples/network/torrent/trackerclient.cpp +++ b/examples/network/torrent/trackerclient.cpp @@ -209,7 +209,7 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply) // store it peers.clear(); QVariant peerEntry = dict.value("peers"); - if (peerEntry.type() == QVariant::List) { + if (peerEntry.userType() == QMetaType::QVariantList) { QList peerTmp = peerEntry.toList(); for (int i = 0; i < peerTmp.size(); ++i) { TorrentPeer tmp; diff --git a/examples/widgets/itemviews/coloreditorfactory/window.cpp b/examples/widgets/itemviews/coloreditorfactory/window.cpp index e4a9379d8fe..25e196a80c8 100644 --- a/examples/widgets/itemviews/coloreditorfactory/window.cpp +++ b/examples/widgets/itemviews/coloreditorfactory/window.cpp @@ -61,7 +61,7 @@ Window::Window() QItemEditorCreatorBase *colorListCreator = new QStandardItemEditorCreator(); - factory->registerEditor(QVariant::Color, colorListCreator); + factory->registerEditor(QMetaType::QColor, colorListCreator); QItemEditorFactory::setDefaultFactory(factory); diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp index 4753d04d9b4..b0b4017e62a 100644 --- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp +++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp @@ -98,7 +98,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left, //! [4] //! [6] - if (leftData.type() == QVariant::DateTime) { + if (leftData.userType() == QMetaType::QDateTime) { return leftData.toDateTime() < rightData.toDateTime(); } else { static const QRegularExpression emailPattern("[\\w\\.]*@[\\w\\.]*"); diff --git a/examples/widgets/tools/settingseditor/settingstree.cpp b/examples/widgets/tools/settingseditor/settingstree.cpp index 49d299bf72d..9132368e4a5 100644 --- a/examples/widgets/tools/settingseditor/settingstree.cpp +++ b/examples/widgets/tools/settingseditor/settingstree.cpp @@ -208,7 +208,7 @@ void SettingsTree::updateChildItems(QTreeWidgetItem *parent) } QVariant value = settings->value(key); - if (value.type() == QVariant::Invalid) { + if (value.userType() == QMetaType::UnknownType) { child->setText(1, "Invalid"); } else { child->setText(1, value.typeName()); diff --git a/examples/widgets/tools/settingseditor/variantdelegate.cpp b/examples/widgets/tools/settingseditor/variantdelegate.cpp index 9772fe8a41d..eb822f0dc26 100644 --- a/examples/widgets/tools/settingseditor/variantdelegate.cpp +++ b/examples/widgets/tools/settingseditor/variantdelegate.cpp @@ -81,7 +81,7 @@ void VariantDelegate::paint(QPainter *painter, { if (index.column() == 2) { QVariant value = index.model()->data(index, Qt::UserRole); - if (!isSupportedType(value.type())) { + if (!isSupportedType(value.userType())) { QStyleOptionViewItem myOption = option; myOption.state &= ~QStyle::State_Enabled; QStyledItemDelegate::paint(painter, myOption, index); @@ -100,7 +100,7 @@ QWidget *VariantDelegate::createEditor(QWidget *parent, return nullptr; QVariant originalValue = index.model()->data(index, Qt::UserRole); - if (!isSupportedType(originalValue.type())) + if (!isSupportedType(originalValue.userType())) return nullptr; QLineEdit *lineEdit = new QLineEdit(parent); @@ -108,46 +108,46 @@ QWidget *VariantDelegate::createEditor(QWidget *parent, QRegularExpression regExp; - switch (originalValue.type()) { - case QVariant::Bool: + switch (originalValue.userType()) { + case QMetaType::Bool: regExp = boolExp; break; - case QVariant::ByteArray: + case QMetaType::QByteArray: regExp = byteArrayExp; break; - case QVariant::Char: + case QMetaType::QChar: regExp = charExp; break; - case QVariant::Color: + case QMetaType::QColor: regExp = colorExp; break; - case QVariant::Date: + case QMetaType::QDate: regExp = dateExp; break; - case QVariant::DateTime: + case QMetaType::QDateTime: regExp = dateTimeExp; break; - case QVariant::Double: + case QMetaType::Double: regExp = doubleExp; break; - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: regExp = signedIntegerExp; break; - case QVariant::Point: + case QMetaType::QPoint: regExp = pointExp; break; - case QVariant::Rect: + case QMetaType::QRect: regExp = rectExp; break; - case QVariant::Size: + case QMetaType::QSize: regExp = sizeExp; break; - case QVariant::Time: + case QMetaType::QTime: regExp = timeExp; break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: regExp = unsignedIntegerExp; break; default: @@ -189,18 +189,18 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, QVariant value; QRegularExpressionMatch match; - switch (originalValue.type()) { - case QVariant::Char: + switch (originalValue.userType()) { + case QMetaType::QChar: value = text.at(0); break; - case QVariant::Color: + case QMetaType::QColor: match = colorExp.match(text); value = QColor(qMin(match.captured(1).toInt(), 255), qMin(match.captured(2).toInt(), 255), qMin(match.captured(3).toInt(), 255), qMin(match.captured(4).toInt(), 255)); break; - case QVariant::Date: + case QMetaType::QDate: { QDate date = QDate::fromString(text, Qt::ISODate); if (!date.isValid()) @@ -208,7 +208,7 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, value = date; } break; - case QVariant::DateTime: + case QMetaType::QDateTime: { QDateTime dateTime = QDateTime::fromString(text, Qt::ISODate); if (!dateTime.isValid()) @@ -216,23 +216,23 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, value = dateTime; } break; - case QVariant::Point: + case QMetaType::QPoint: match = pointExp.match(text); value = QPoint(match.captured(1).toInt(), match.captured(2).toInt()); break; - case QVariant::Rect: + case QMetaType::QRect: match = rectExp.match(text); value = QRect(match.captured(1).toInt(), match.captured(2).toInt(), match.captured(3).toInt(), match.captured(4).toInt()); break; - case QVariant::Size: + case QMetaType::QSize: match = sizeExp.match(text); value = QSize(match.captured(1).toInt(), match.captured(2).toInt()); break; - case QVariant::StringList: + case QMetaType::QStringList: value = text.split(','); break; - case QVariant::Time: + case QMetaType::QTime: { QTime time = QTime::fromString(text, Qt::ISODate); if (!time.isValid()) @@ -242,33 +242,33 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, break; default: value = text; - value.convert(originalValue.type()); + value.convert(originalValue.userType()); } model->setData(index, displayText(value), Qt::DisplayRole); model->setData(index, value, Qt::UserRole); } -bool VariantDelegate::isSupportedType(QVariant::Type type) +bool VariantDelegate::isSupportedType(int type) { switch (type) { - case QVariant::Bool: - case QVariant::ByteArray: - case QVariant::Char: - case QVariant::Color: - case QVariant::Date: - case QVariant::DateTime: - case QVariant::Double: - case QVariant::Int: - case QVariant::LongLong: - case QVariant::Point: - case QVariant::Rect: - case QVariant::Size: - case QVariant::String: - case QVariant::StringList: - case QVariant::Time: - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::Bool: + case QMetaType::QByteArray: + case QMetaType::QChar: + case QMetaType::QColor: + case QMetaType::QDate: + case QMetaType::QDateTime: + case QMetaType::Double: + case QMetaType::Int: + case QMetaType::LongLong: + case QMetaType::QPoint: + case QMetaType::QRect: + case QMetaType::QSize: + case QMetaType::QString: + case QMetaType::QStringList: + case QMetaType::QTime: + case QMetaType::UInt: + case QMetaType::ULongLong: return true; default: return false; @@ -277,50 +277,50 @@ bool VariantDelegate::isSupportedType(QVariant::Type type) QString VariantDelegate::displayText(const QVariant &value) { - switch (value.type()) { - case QVariant::Bool: - case QVariant::ByteArray: - case QVariant::Char: - case QVariant::Double: - case QVariant::Int: - case QVariant::LongLong: - case QVariant::String: - case QVariant::UInt: - case QVariant::ULongLong: + switch (value.userType()) { + case QMetaType::Bool: + case QMetaType::QByteArray: + case QMetaType::QChar: + case QMetaType::Double: + case QMetaType::Int: + case QMetaType::LongLong: + case QMetaType::QString: + case QMetaType::UInt: + case QMetaType::ULongLong: return value.toString(); - case QVariant::Color: + case QMetaType::QColor: { QColor color = qvariant_cast(value); return QString("(%1,%2,%3,%4)") .arg(color.red()).arg(color.green()) .arg(color.blue()).arg(color.alpha()); } - case QVariant::Date: + case QMetaType::QDate: return value.toDate().toString(Qt::ISODate); - case QVariant::DateTime: + case QMetaType::QDateTime: return value.toDateTime().toString(Qt::ISODate); - case QVariant::Invalid: + case QMetaType::UnknownType: return ""; - case QVariant::Point: + case QMetaType::QPoint: { QPoint point = value.toPoint(); return QString("(%1,%2)").arg(point.x()).arg(point.y()); } - case QVariant::Rect: + case QMetaType::QRect: { QRect rect = value.toRect(); return QString("(%1,%2,%3,%4)") .arg(rect.x()).arg(rect.y()) .arg(rect.width()).arg(rect.height()); } - case QVariant::Size: + case QMetaType::QSize: { QSize size = value.toSize(); return QString("(%1,%2)").arg(size.width()).arg(size.height()); } - case QVariant::StringList: + case QMetaType::QStringList: return value.toStringList().join(','); - case QVariant::Time: + case QMetaType::QTime: return value.toTime().toString(Qt::ISODate); default: break; diff --git a/examples/widgets/tools/settingseditor/variantdelegate.h b/examples/widgets/tools/settingseditor/variantdelegate.h index 68f21fa3f6c..96e44fd181d 100644 --- a/examples/widgets/tools/settingseditor/variantdelegate.h +++ b/examples/widgets/tools/settingseditor/variantdelegate.h @@ -69,7 +69,7 @@ public: void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; - static bool isSupportedType(QVariant::Type type); + static bool isSupportedType(int type); static QString displayText(const QVariant &value); private: diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index c71a77e0732..d014b5c4413 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE void QPropertyAnimationPrivate::updateMetaProperty() { if (!target || propertyName.isEmpty()) { - propertyType = QVariant::Invalid; + propertyType = QMetaType::UnknownType; propertyIndex = -1; return; } @@ -102,11 +102,11 @@ void QPropertyAnimationPrivate::updateMetaProperty() propertyType = targetValue->property(propertyName).userType(); propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName); - if (propertyType != QVariant::Invalid) + if (propertyType != QMetaType::UnknownType) convertValues(propertyType); if (propertyIndex == -1) { //there is no Q_PROPERTY on the object - propertyType = QVariant::Invalid; + propertyType = QMetaType::UnknownType; if (!targetValue->dynamicPropertyNames().contains(propertyName)) qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData()); } else if (!targetValue->metaObject()->property(propertyIndex).isWritable()) { diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 9fc45e307db..b191397e7ee 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -396,12 +396,12 @@ QString QSettingsPrivate::variantToString(const QVariant &v) { QString result; - switch (v.type()) { - case QVariant::Invalid: + switch (v.userType()) { + case QMetaType::UnknownType: result = QLatin1String("@Invalid()"); break; - case QVariant::ByteArray: { + case QMetaType::QByteArray: { QByteArray a = v.toByteArray(); result = QLatin1String("@ByteArray(") + QLatin1String(a.constData(), a.size()) @@ -409,14 +409,14 @@ QString QSettingsPrivate::variantToString(const QVariant &v) break; } - case QVariant::String: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::Int: - case QVariant::UInt: - case QVariant::Bool: - case QVariant::Double: - case QVariant::KeySequence: { + case QMetaType::QString: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::Int: + case QMetaType::UInt: + case QMetaType::Bool: + case QMetaType::Double: + case QMetaType::QKeySequence: { result = v.toString(); if (result.contains(QChar::Null)) result = QLatin1String("@String(") + result + QLatin1Char(')'); @@ -425,17 +425,17 @@ QString QSettingsPrivate::variantToString(const QVariant &v) break; } #ifndef QT_NO_GEOM_VARIANT - case QVariant::Rect: { + case QMetaType::QRect: { QRect r = qvariant_cast(v); result = QString::asprintf("@Rect(%d %d %d %d)", r.x(), r.y(), r.width(), r.height()); break; } - case QVariant::Size: { + case QMetaType::QSize: { QSize s = qvariant_cast(v); result = QString::asprintf("@Size(%d %d)", s.width(), s.height()); break; } - case QVariant::Point: { + case QMetaType::QPoint: { QPoint p = qvariant_cast(v); result = QString::asprintf("@Point(%d %d)", p.x(), p.y()); break; @@ -446,7 +446,7 @@ QString QSettingsPrivate::variantToString(const QVariant &v) #ifndef QT_NO_DATASTREAM QDataStream::Version version; const char *typeSpec; - if (v.type() == QVariant::DateTime) { + if (v.userType() == QMetaType::QDateTime) { version = QDataStream::Qt_5_6; typeSpec = "@DateTime("; } else { @@ -1888,8 +1888,8 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti QVariant(QString("foo")).toList() returns an empty list, not a list containing "foo". */ - if (value.type() == QVariant::StringList - || (value.type() == QVariant::List && value.toList().size() != 1)) { + if (value.userType() == QMetaType::QStringList + || (value.userType() == QMetaType::QVariantList && value.toList().size() != 1)) { iniEscapedStringList(variantListToStringList(value.toList()), block, iniCodec); } else { iniEscapedString(variantToString(value), block, iniCodec); diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 46ac7036156..608407c1367 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -552,32 +552,32 @@ const QHash &QAbstractItemModelPrivate::defaultRoleNames() bool QAbstractItemModelPrivate::isVariantLessThan(const QVariant &left, const QVariant &right, Qt::CaseSensitivity cs, bool isLocaleAware) { - if (left.userType() == QVariant::Invalid) + if (left.userType() == QMetaType::UnknownType) return false; - if (right.userType() == QVariant::Invalid) + if (right.userType() == QMetaType::UnknownType) return true; switch (left.userType()) { - case QVariant::Int: + case QMetaType::Int: return left.toInt() < right.toInt(); - case QVariant::UInt: + case QMetaType::UInt: return left.toUInt() < right.toUInt(); - case QVariant::LongLong: + case QMetaType::LongLong: return left.toLongLong() < right.toLongLong(); - case QVariant::ULongLong: + case QMetaType::ULongLong: return left.toULongLong() < right.toULongLong(); case QMetaType::Float: return left.toFloat() < right.toFloat(); - case QVariant::Double: + case QMetaType::Double: return left.toDouble() < right.toDouble(); - case QVariant::Char: + case QMetaType::QChar: return left.toChar() < right.toChar(); - case QVariant::Date: + case QMetaType::QDate: return left.toDate() < right.toDate(); - case QVariant::Time: + case QMetaType::QTime: return left.toTime() < right.toTime(); - case QVariant::DateTime: + case QMetaType::QDateTime: return left.toDateTime() < right.toDateTime(); - case QVariant::String: + case QMetaType::QString: default: if (isLocaleAware) return left.toString().localeAwareCompare(right.toString()) < 0; @@ -591,19 +591,19 @@ static uint typeOfVariant(const QVariant &value) { //return 0 for integer, 1 for floating point and 2 for other switch (value.userType()) { - case QVariant::Bool: - case QVariant::Int: - case QVariant::UInt: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::Char: + case QMetaType::Bool: + case QMetaType::Int: + case QMetaType::UInt: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::QChar: case QMetaType::Short: case QMetaType::UShort: case QMetaType::UChar: case QMetaType::ULong: case QMetaType::Long: return 0; - case QVariant::Double: + case QMetaType::Double: case QMetaType::Float: return 1; default: @@ -2379,7 +2379,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, } else { // QString or regular expression based matching if (matchType == Qt::MatchRegularExpression) { if (rx.pattern().isEmpty()) { - if (value.type() == QVariant::RegularExpression) { + if (value.userType() == QMetaType::QRegularExpression) { rx = value.toRegularExpression(); } else { rx.setPattern(value.toString()); diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index fad47eee134..347fb1eb877 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2982,7 +2982,7 @@ int QMetaProperty::userType() const if (type == QMetaType::UnknownType) { type = registerPropertyType(); if (type == QMetaType::UnknownType) - return QVariant::Int; // Match behavior of QMetaType::type() + return QMetaType::Int; // Match behavior of QMetaType::type() } return type; } @@ -3100,7 +3100,7 @@ QVariant QMetaProperty::read(const QObject *object) const if (!object || !mobj) return QVariant(); - uint t = QVariant::Int; + uint t = QMetaType::Int; if (isEnumType()) { /* try to create a QVariant that can be converted to this enum @@ -3177,9 +3177,9 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const return false; QVariant v = value; - uint t = QVariant::Invalid; + uint t = QMetaType::UnknownType; if (isEnumType()) { - if (v.type() == QVariant::String) { + if (v.userType() == QMetaType::QString) { bool ok; if (isFlagType()) v = QVariant(menum.keysToValue(value.toByteArray(), &ok)); @@ -3187,13 +3187,13 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const v = QVariant(menum.keyToValue(value.toByteArray(), &ok)); if (!ok) return false; - } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) { + } else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) { int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData()) return false; v = QVariant(*reinterpret_cast(v.constData())); } - v.convert(QVariant::Int); + v.convert(QMetaType::Int); } else { int handle = priv(mobj->d.data)->propertyData + 3*idx; const char *typeName = nullptr; diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 00e5183eb16..fca258c9e3d 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -70,7 +70,7 @@ public: void setData(const QString &format, const QVariant &data); QVariant getData(const QString &format) const; - QVariant retrieveTypedData(const QString &format, QVariant::Type type) const; + QVariant retrieveTypedData(const QString &format, QMetaType::Type type) const; QVector dataList; }; @@ -108,23 +108,23 @@ QVariant QMimeDataPrivate::getData(const QString &format) const return data; } -QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Type type) const +QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const { Q_Q(const QMimeData); - QVariant data = q->retrieveData(format, type); + QVariant data = q->retrieveData(format, QVariant::Type(type)); // Text data requested: fallback to URL data if available if (format == QLatin1String("text/plain") && !data.isValid()) { - data = retrieveTypedData(textUriListLiteral(), QVariant::List); - if (data.type() == QVariant::Url) { + data = retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList); + if (data.userType() == QMetaType::QUrl) { data = QVariant(data.toUrl().toDisplayString()); - } else if (data.type() == QVariant::List) { + } else if (data.userType() == QMetaType::QVariantList) { QString text; int numUrls = 0; const QList list = data.toList(); for (int i = 0; i < list.size(); ++i) { - if (list.at(i).type() == QVariant::Url) { + if (list.at(i).userType() == QMetaType::QUrl) { text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n'); ++numUrls; } @@ -135,26 +135,26 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty } } - if (data.type() == type || !data.isValid()) + if (data.userType() == type || !data.isValid()) return data; // provide more conversion possiblities than just what QVariant provides // URLs can be lists as well... - if ((type == QVariant::Url && data.type() == QVariant::List) - || (type == QVariant::List && data.type() == QVariant::Url)) + if ((type == QMetaType::QUrl && data.userType() == QMetaType::QVariantList) + || (type == QMetaType::QVariantList && data.userType() == QMetaType::QUrl)) return data; // images and pixmaps are interchangeable - if ((type == QVariant::Pixmap && data.type() == QVariant::Image) - || (type == QVariant::Image && data.type() == QVariant::Pixmap)) + if ((type == QMetaType::QPixmap && data.userType() == QMetaType::QImage) + || (type == QMetaType::QImage && data.userType() == QMetaType::QPixmap)) return data; - if (data.type() == QVariant::ByteArray) { + if (data.userType() == QMetaType::QByteArray) { // see if we can convert to the requested type switch(type) { #if QT_CONFIG(textcodec) - case QVariant::String: { + case QMetaType::QString: { const QByteArray ba = data.toByteArray(); QTextCodec *codec = QTextCodec::codecForName("utf-8"); if (format == QLatin1String("text/html")) @@ -162,17 +162,17 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty return codec->toUnicode(ba); } #endif // textcodec - case QVariant::Color: { + case QMetaType::QColor: { QVariant newData = data; - newData.convert(QVariant::Color); + newData.convert(QMetaType::QColor); return newData; } - case QVariant::List: { + case QMetaType::QVariantList: { if (format != QLatin1String("text/uri-list")) break; Q_FALLTHROUGH(); } - case QVariant::Url: { + case QMetaType::QUrl: { QByteArray ba = data.toByteArray(); // Qt 3.x will send text/uri-list with a trailing // null-terminator (that is *not* sent for any other @@ -193,23 +193,23 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty break; } - } else if (type == QVariant::ByteArray) { + } else if (type == QMetaType::QByteArray) { // try to convert to bytearray - switch(data.type()) { - case QVariant::ByteArray: - case QVariant::Color: + switch (data.userType()) { + case QMetaType::QByteArray: + case QMetaType::QColor: return data.toByteArray(); - case QVariant::String: + case QMetaType::QString: return data.toString().toUtf8(); - case QVariant::Url: + case QMetaType::QUrl: return data.toUrl().toEncoded(); - case QVariant::List: { + case QMetaType::QVariantList: { // has to be list of URLs QByteArray result; QList list = data.toList(); for (int i = 0; i < list.size(); ++i) { - if (list.at(i).type() == QVariant::Url) { + if (list.at(i).userType() == QMetaType::QUrl) { result += list.at(i).toUrl().toEncoded(); result += "\r\n"; } @@ -340,14 +340,14 @@ QMimeData::~QMimeData() QList QMimeData::urls() const { Q_D(const QMimeData); - QVariant data = d->retrieveTypedData(textUriListLiteral(), QVariant::List); + QVariant data = d->retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList); QList urls; - if (data.type() == QVariant::Url) + if (data.userType() == QMetaType::QUrl) urls.append(data.toUrl()); - else if (data.type() == QVariant::List) { + else if (data.userType() == QMetaType::QVariantList) { QList list = data.toList(); for (int i = 0; i < list.size(); ++i) { - if (list.at(i).type() == QVariant::Url) + if (list.at(i).userType() == QMetaType::QUrl) urls.append(list.at(i).toUrl()); } } @@ -400,11 +400,11 @@ bool QMimeData::hasUrls() const QString QMimeData::text() const { Q_D(const QMimeData); - QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QVariant::String); + QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QMetaType::QString); if (!utf8Text.isNull()) return utf8Text.toString(); - QVariant data = d->retrieveTypedData(textPlainLiteral(), QVariant::String); + QVariant data = d->retrieveTypedData(textPlainLiteral(), QMetaType::QString); return data.toString(); } @@ -440,7 +440,7 @@ bool QMimeData::hasText() const QString QMimeData::html() const { Q_D(const QMimeData); - QVariant data = d->retrieveTypedData(textHtmlLiteral(), QVariant::String); + QVariant data = d->retrieveTypedData(textHtmlLiteral(), QMetaType::QString); return data.toString(); } @@ -482,7 +482,7 @@ bool QMimeData::hasHtml() const QVariant QMimeData::imageData() const { Q_D(const QMimeData); - return d->retrieveTypedData(applicationXQtImageLiteral(), QVariant::Image); + return d->retrieveTypedData(applicationXQtImageLiteral(), QMetaType::QImage); } /*! @@ -529,7 +529,7 @@ bool QMimeData::hasImage() const QVariant QMimeData::colorData() const { Q_D(const QMimeData); - return d->retrieveTypedData(applicationXColorLiteral(), QVariant::Color); + return d->retrieveTypedData(applicationXColorLiteral(), QMetaType::QColor); } /*! @@ -564,7 +564,7 @@ bool QMimeData::hasColor() const QByteArray QMimeData::data(const QString &mimeType) const { Q_D(const QMimeData); - QVariant data = d->retrieveTypedData(mimeType, QVariant::ByteArray); + QVariant data = d->retrieveTypedData(mimeType, QMetaType::QByteArray); return data.toByteArray(); } diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index f3ac3fcdbac..b417683d2a2 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -168,7 +168,7 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d) return qlonglong(d->data.l); case QMetaType::Float: return qRound64(d->data.f); - case QVariant::Double: + case QMetaType::Double: return qRound64(d->data.d); #ifndef QT_BOOTSTRAPPED case QMetaType::QJsonValue: @@ -184,9 +184,9 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d) static qulonglong qMetaTypeUNumber(const QVariant::Private *d) { switch (d->type) { - case QVariant::UInt: + case QMetaType::UInt: return d->data.u; - case QVariant::ULongLong: + case QMetaType::ULongLong: return d->data.ull; case QMetaType::UChar: return d->data.uc; @@ -204,13 +204,13 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) *ok = true; switch (uint(d->type)) { - case QVariant::String: + case QMetaType::QString: return v_cast(d)->toLongLong(ok); - case QVariant::Char: + case QMetaType::QChar: return v_cast(d)->unicode(); - case QVariant::ByteArray: + case QMetaType::QByteArray: return v_cast(d)->toLongLong(ok); - case QVariant::Bool: + case QMetaType::Bool: return qlonglong(d->data.b); #ifndef QT_BOOTSTRAPPED case QMetaType::QCborValue: @@ -222,8 +222,8 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) break; Q_FALLTHROUGH(); #endif - case QVariant::Double: - case QVariant::Int: + case QMetaType::Double: + case QMetaType::Int: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: @@ -231,8 +231,8 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) case QMetaType::Float: case QMetaType::LongLong: return qMetaTypeNumber(d); - case QVariant::ULongLong: - case QVariant::UInt: + case QMetaType::ULongLong: + case QMetaType::UInt: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -262,12 +262,12 @@ static qreal qConvertToRealNumber(const QVariant::Private *d, bool *ok) { *ok = true; switch (uint(d->type)) { - case QVariant::Double: + case QMetaType::Double: return qreal(d->data.d); case QMetaType::Float: return qreal(d->data.f); - case QVariant::ULongLong: - case QVariant::UInt: + case QMetaType::ULongLong: + case QMetaType::UInt: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -289,13 +289,13 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) *ok = true; switch (uint(d->type)) { - case QVariant::String: + case QMetaType::QString: return v_cast(d)->toULongLong(ok); - case QVariant::Char: + case QMetaType::QChar: return v_cast(d)->unicode(); - case QVariant::ByteArray: + case QMetaType::QByteArray: return v_cast(d)->toULongLong(ok); - case QVariant::Bool: + case QMetaType::Bool: return qulonglong(d->data.b); #ifndef QT_BOOTSTRAPPED case QMetaType::QCborValue: @@ -309,8 +309,8 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) break; Q_FALLTHROUGH(); #endif - case QVariant::Double: - case QVariant::Int: + case QMetaType::Double: + case QMetaType::Int: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: @@ -318,8 +318,8 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) case QMetaType::Float: case QMetaType::LongLong: return qulonglong(qMetaTypeNumber(d)); - case QVariant::ULongLong: - case QVariant::UInt: + case QMetaType::ULongLong: + case QMetaType::UInt: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -406,9 +406,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) switch (uint(t)) { #ifndef QT_BOOTSTRAPPED - case QVariant::Url: + case QMetaType::QUrl: switch (d->type) { - case QVariant::String: + case QMetaType::QString: *static_cast(result) = QUrl(*v_cast(d)); break; case QMetaType::QCborValue: @@ -423,18 +423,18 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; #endif // QT_BOOTSTRAPPED #if QT_CONFIG(itemmodel) - case QVariant::ModelIndex: + case QMetaType::QModelIndex: switch (d->type) { - case QVariant::PersistentModelIndex: + case QMetaType::QPersistentModelIndex: *static_cast(result) = QModelIndex(*v_cast(d)); break; default: return false; } break; - case QVariant::PersistentModelIndex: + case QMetaType::QPersistentModelIndex: switch (d->type) { - case QVariant::ModelIndex: + case QMetaType::QModelIndex: *static_cast(result) = QPersistentModelIndex(*v_cast(d)); break; default: @@ -442,10 +442,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } break; #endif // QT_CONFIG(itemmodel) - case QVariant::String: { + case QMetaType::QString: { QString *str = static_cast(result); switch (d->type) { - case QVariant::Char: + case QMetaType::QChar: *str = *v_cast(d); break; case QMetaType::Char: @@ -455,12 +455,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; case QMetaType::Short: case QMetaType::Long: - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: *str = QString::number(qMetaTypeNumber(d)); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UShort: case QMetaType::ULong: *str = QString::number(qMetaTypeUNumber(d)); @@ -468,32 +468,32 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Float: *str = QString::number(d->data.f, 'g', QLocale::FloatingPointShortest); break; - case QVariant::Double: + case QMetaType::Double: *str = QString::number(d->data.d, 'g', QLocale::FloatingPointShortest); break; #if QT_CONFIG(datestring) - case QVariant::Date: + case QMetaType::QDate: *str = v_cast(d)->toString(Qt::ISODate); break; - case QVariant::Time: + case QMetaType::QTime: *str = v_cast(d)->toString(Qt::ISODateWithMs); break; - case QVariant::DateTime: + case QMetaType::QDateTime: *str = v_cast(d)->toString(Qt::ISODateWithMs); break; #endif - case QVariant::Bool: + case QMetaType::Bool: *str = d->data.b ? QStringLiteral("true") : QStringLiteral("false"); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: *str = QString::fromUtf8(v_cast(d)->constData()); break; - case QVariant::StringList: + case QMetaType::QStringList: if (v_cast(d)->count() == 1) *str = v_cast(d)->at(0); break; #ifndef QT_BOOTSTRAPPED - case QVariant::Url: + case QMetaType::QUrl: *str = v_cast(d)->toString(); break; case QMetaType::QJsonValue: @@ -508,7 +508,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *str = v_cast(d)->toVariant().toString(); break; #endif - case QVariant::Uuid: + case QMetaType::QUuid: *str = v_cast(d)->toString(); break; case QMetaType::Nullptr: @@ -528,11 +528,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } break; } - case QVariant::Char: { + case QMetaType::QChar: { QChar *c = static_cast(result); switch (d->type) { - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: @@ -540,8 +540,8 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Float: *c = QChar(ushort(qMetaTypeNumber(d))); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -553,10 +553,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; } #ifndef QT_NO_GEOM_VARIANT - case QVariant::Size: { + case QMetaType::QSize: { QSize *s = static_cast(result); switch (d->type) { - case QVariant::SizeF: + case QMetaType::QSizeF: *s = v_cast(d)->toSize(); break; default: @@ -565,10 +565,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; } - case QVariant::SizeF: { + case QMetaType::QSizeF: { QSizeF *s = static_cast(result); switch (d->type) { - case QVariant::Size: + case QMetaType::QSize: *s = QSizeF(*(v_cast(d))); break; default: @@ -577,10 +577,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; } - case QVariant::Line: { + case QMetaType::QLine: { QLine *s = static_cast(result); switch (d->type) { - case QVariant::LineF: + case QMetaType::QLineF: *s = v_cast(d)->toLine(); break; default: @@ -589,10 +589,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; } - case QVariant::LineF: { + case QMetaType::QLineF: { QLineF *s = static_cast(result); switch (d->type) { - case QVariant::Line: + case QMetaType::QLine: *s = QLineF(*(v_cast(d))); break; default: @@ -601,27 +601,27 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; } #endif - case QVariant::StringList: - if (d->type == QVariant::List) { + case QMetaType::QStringList: + if (d->type == QMetaType::QVariantList) { QStringList *slst = static_cast(result); const QVariantList *list = v_cast(d); const int size = list->size(); slst->reserve(size); for (int i = 0; i < size; ++i) slst->append(list->at(i).toString()); - } else if (d->type == QVariant::String) { + } else if (d->type == QMetaType::QString) { QStringList *slst = static_cast(result); *slst = QStringList(*v_cast(d)); } else { return false; } break; - case QVariant::Date: { + case QMetaType::QDate: { QDate *dt = static_cast(result); - if (d->type == QVariant::DateTime) + if (d->type == QMetaType::QDateTime) *dt = v_cast(d)->date(); #if QT_CONFIG(datestring) - else if (d->type == QVariant::String) + else if (d->type == QMetaType::QString) *dt = QDate::fromString(*v_cast(d), Qt::ISODate); #endif else @@ -629,14 +629,14 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) return dt->isValid(); } - case QVariant::Time: { + case QMetaType::QTime: { QTime *t = static_cast(result); switch (d->type) { - case QVariant::DateTime: + case QMetaType::QDateTime: *t = v_cast(d)->time(); break; #if QT_CONFIG(datestring) - case QVariant::String: + case QMetaType::QString: *t = QTime::fromString(*v_cast(d), Qt::ISODate); break; #endif @@ -645,11 +645,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } return t->isValid(); } - case QVariant::DateTime: { + case QMetaType::QDateTime: { QDateTime *dt = static_cast(result); switch (d->type) { #if QT_CONFIG(datestring) - case QVariant::String: + case QMetaType::QString: *dt = QDateTime::fromString(*v_cast(d), Qt::ISODate); break; # ifndef QT_BOOTSTRAPPED @@ -661,7 +661,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; # endif #endif - case QVariant::Date: + case QMetaType::QDate: *dt = QDateTime(*v_cast(d)); break; default: @@ -669,13 +669,13 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } return dt->isValid(); } - case QVariant::ByteArray: { + case QMetaType::QByteArray: { QByteArray *ba = static_cast(result); switch (d->type) { - case QVariant::String: + case QMetaType::QString: *ba = v_cast(d)->toUtf8(); break; - case QVariant::Double: + case QMetaType::Double: *ba = QByteArray::number(d->data.d, 'g', QLocale::FloatingPointShortest); break; case QMetaType::Float: @@ -686,22 +686,22 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::UChar: *ba = QByteArray(1, d->data.c); break; - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: case QMetaType::Short: case QMetaType::Long: *ba = QByteArray::number(qMetaTypeNumber(d)); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UShort: case QMetaType::ULong: *ba = QByteArray::number(qMetaTypeUNumber(d)); break; - case QVariant::Bool: + case QMetaType::Bool: *ba = QByteArray(d->data.b ? "true" : "false"); break; - case QVariant::Uuid: + case QMetaType::QUuid: *ba = v_cast(d)->toByteArray(); break; case QMetaType::Nullptr: @@ -741,16 +741,16 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *static_cast(result) = ulong(qConvertToUnsignedNumber(d, ok)); return *ok; - case QVariant::Int: + case QMetaType::Int: *static_cast(result) = int(qConvertToNumber(d, ok)); return *ok; - case QVariant::UInt: + case QMetaType::UInt: *static_cast(result) = uint(qConvertToUnsignedNumber(d, ok)); return *ok; - case QVariant::LongLong: + case QMetaType::LongLong: *static_cast(result) = qConvertToNumber(d, ok); return *ok; - case QVariant::ULongLong: { + case QMetaType::ULongLong: { *static_cast(result) = qConvertToUnsignedNumber(d, ok); return *ok; } @@ -763,21 +763,21 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *static_cast(result) = qConvertToUnsignedNumber(d, ok); return *ok; } - case QVariant::Bool: { + case QMetaType::Bool: { bool *b = static_cast(result); switch(d->type) { - case QVariant::ByteArray: + case QMetaType::QByteArray: *b = qt_convertToBool(d); break; - case QVariant::String: + case QMetaType::QString: *b = qt_convertToBool(d); break; - case QVariant::Char: + case QMetaType::QChar: *b = !v_cast(d)->isNull(); break; - case QVariant::Double: - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Double: + case QMetaType::Int: + case QMetaType::LongLong: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: @@ -785,8 +785,8 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Float: *b = qMetaTypeNumber(d) != Q_INT64_C(0); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -810,31 +810,31 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } break; } - case QVariant::Double: { + case QMetaType::Double: { double *f = static_cast(result); switch (d->type) { - case QVariant::String: + case QMetaType::QString: *f = v_cast(d)->toDouble(ok); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: *f = v_cast(d)->toDouble(ok); break; - case QVariant::Bool: + case QMetaType::Bool: *f = double(d->data.b); break; case QMetaType::Float: *f = double(d->data.f); break; - case QVariant::LongLong: - case QVariant::Int: + case QMetaType::LongLong: + case QMetaType::Int: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: case QMetaType::Long: *f = double(qMetaTypeNumber(d)); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -861,28 +861,28 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Float: { float *f = static_cast(result); switch (d->type) { - case QVariant::String: + case QMetaType::QString: *f = v_cast(d)->toFloat(ok); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: *f = v_cast(d)->toFloat(ok); break; - case QVariant::Bool: + case QMetaType::Bool: *f = float(d->data.b); break; - case QVariant::Double: + case QMetaType::Double: *f = float(d->data.d); break; - case QVariant::LongLong: - case QVariant::Int: + case QMetaType::LongLong: + case QMetaType::Int: case QMetaType::Char: case QMetaType::SChar: case QMetaType::Short: case QMetaType::Long: *f = float(qMetaTypeNumber(d)); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: @@ -906,8 +906,8 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } break; } - case QVariant::List: - if (d->type == QVariant::StringList) { + case QMetaType::QVariantList: + if (d->type == QMetaType::QStringList) { QVariantList *lst = static_cast(result); const QStringList *slist = v_cast(d); const int size = slist->size(); @@ -935,11 +935,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) return false; } break; - case QVariant::Map: + case QMetaType::QVariantMap: if (qstrcmp(QMetaType::typeName(d->type), "QMap") == 0) { *static_cast(result) = *static_cast *>(d->data.shared->ptr); - } else if (d->type == QVariant::Hash) { + } else if (d->type == QMetaType::QVariantHash) { QVariantMap *map = static_cast(result); const QVariantHash *hash = v_cast(d); const auto end = hash->end(); @@ -963,11 +963,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) return false; } break; - case QVariant::Hash: + case QMetaType::QVariantHash: if (qstrcmp(QMetaType::typeName(d->type), "QHash") == 0) { *static_cast(result) = *static_cast *>(d->data.shared->ptr); - } else if (d->type == QVariant::Map) { + } else if (d->type == QMetaType::QVariantMap) { QVariantHash *hash = static_cast(result); const QVariantMap *map = v_cast(d); const auto end = map->end(); @@ -992,26 +992,26 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) } break; #ifndef QT_NO_GEOM_VARIANT - case QVariant::Rect: - if (d->type == QVariant::RectF) + case QMetaType::QRect: + if (d->type == QMetaType::QRectF) *static_cast(result) = (v_cast(d))->toRect(); else return false; break; - case QVariant::RectF: - if (d->type == QVariant::Rect) + case QMetaType::QRectF: + if (d->type == QMetaType::QRect) *static_cast(result) = *v_cast(d); else return false; break; - case QVariant::PointF: - if (d->type == QVariant::Point) + case QMetaType::QPointF: + if (d->type == QMetaType::QPoint) *static_cast(result) = *v_cast(d); else return false; break; - case QVariant::Point: - if (d->type == QVariant::PointF) + case QMetaType::QPoint: + if (d->type == QMetaType::QPointF) *static_cast(result) = (v_cast(d))->toPoint(); else return false; @@ -1022,12 +1022,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) return *ok; } #endif - case QVariant::Uuid: + case QMetaType::QUuid: switch (d->type) { - case QVariant::String: + case QMetaType::QString: *static_cast(result) = QUuid(*v_cast(d)); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: *static_cast(result) = QUuid(*v_cast(d)); break; #ifndef QT_BOOTSTRAPPED @@ -1067,7 +1067,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Nullptr: *static_cast(result) = QJsonValue(QJsonValue::Null); break; - case QVariant::Bool: + case QMetaType::Bool: *static_cast(result) = QJsonValue(d->data.b); break; case QMetaType::Int: @@ -1086,19 +1086,19 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *static_cast(result) = QJsonValue(qConvertToRealNumber(d, ok)); Q_ASSERT(ok); break; - case QVariant::String: + case QMetaType::QString: *static_cast(result) = QJsonValue(*v_cast(d)); break; - case QVariant::StringList: + case QMetaType::QStringList: *static_cast(result) = QJsonValue(QJsonArray::fromStringList(*v_cast(d))); break; - case QVariant::List: + case QMetaType::QVariantList: *static_cast(result) = QJsonValue(QJsonArray::fromVariantList(*v_cast(d))); break; - case QVariant::Map: + case QMetaType::QVariantMap: *static_cast(result) = QJsonValue(QJsonObject::fromVariantMap(*v_cast(d))); break; - case QVariant::Hash: + case QMetaType::QVariantHash: *static_cast(result) = QJsonValue(QJsonObject::fromVariantHash(*v_cast(d))); break; case QMetaType::QJsonObject: @@ -1128,10 +1128,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; case QMetaType::QJsonArray: switch (d->type) { - case QVariant::StringList: + case QMetaType::QStringList: *static_cast(result) = QJsonArray::fromStringList(*v_cast(d)); break; - case QVariant::List: + case QMetaType::QVariantList: *static_cast(result) = QJsonArray::fromVariantList(*v_cast(d)); break; case QMetaType::QJsonValue: @@ -1158,10 +1158,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; case QMetaType::QJsonObject: switch (d->type) { - case QVariant::Map: + case QMetaType::QVariantMap: *static_cast(result) = QJsonObject::fromVariantMap(*v_cast(d)); break; - case QVariant::Hash: + case QMetaType::QVariantHash: *static_cast(result) = QJsonObject::fromVariantHash(*v_cast(d)); break; case QMetaType::QJsonValue: @@ -1197,7 +1197,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::Nullptr: *static_cast(result) = QCborValue(QCborValue::Null); break; - case QVariant::Bool: + case QMetaType::Bool: *static_cast(result) = QCborValue(d->data.b); break; case QMetaType::Int: @@ -1219,39 +1219,39 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *static_cast(result) = QCborValue(qConvertToRealNumber(d, ok)); Q_ASSERT(ok); break; - case QVariant::String: + case QMetaType::QString: *static_cast(result) = *v_cast(d); break; - case QVariant::StringList: + case QMetaType::QStringList: *static_cast(result) = QCborArray::fromStringList(*v_cast(d)); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: *static_cast(result) = *v_cast(d); break; - case QVariant::Date: + case QMetaType::QDate: *static_cast(result) = QCborValue(QDateTime(*v_cast(d))); break; - case QVariant::DateTime: + case QMetaType::QDateTime: *static_cast(result) = QCborValue(*v_cast(d)); break; - case QVariant::Url: + case QMetaType::QUrl: *static_cast(result) = QCborValue(*v_cast(d)); break; #if QT_CONFIG(regularexpression) - case QVariant::RegularExpression: + case QMetaType::QRegularExpression: *static_cast(result) = QCborValue(*v_cast(d)); break; #endif - case QVariant::Uuid: + case QMetaType::QUuid: *static_cast(result) = QCborValue(*v_cast(d)); break; - case QVariant::List: + case QMetaType::QVariantList: *static_cast(result) = QCborArray::fromVariantList(*v_cast(d)); break; - case QVariant::Map: + case QMetaType::QVariantMap: *static_cast(result) = QCborMap::fromVariantMap(*v_cast(d)); break; - case QVariant::Hash: + case QMetaType::QVariantHash: *static_cast(result) = QCborMap::fromVariantHash(*v_cast(d)); break; case QMetaType::QJsonValue: @@ -1287,10 +1287,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; case QMetaType::QCborArray: switch (d->type) { - case QVariant::StringList: + case QMetaType::QStringList: *static_cast(result) = QCborArray::fromStringList(*v_cast(d)); break; - case QVariant::List: + case QMetaType::QVariantList: *static_cast(result) = QCborArray::fromVariantList(*v_cast(d)); break; case QMetaType::QCborValue: @@ -1317,10 +1317,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) break; case QMetaType::QCborMap: switch (d->type) { - case QVariant::Map: + case QMetaType::QVariantMap: *static_cast(result) = QCborMap::fromVariantMap(*v_cast(d)); break; - case QVariant::Hash: + case QMetaType::QVariantHash: *static_cast(result) = QCborMap::fromVariantHash(*v_cast(d)); break; case QMetaType::QCborValue: @@ -1349,10 +1349,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) default: #ifndef QT_NO_QOBJECT - if (d->type == QVariant::String || d->type == QVariant::ByteArray) { + if (d->type == QMetaType::QString || d->type == QMetaType::QByteArray) { QMetaEnum en = metaEnumFromType(t); if (en.isValid()) { - QByteArray keys = (d->type == QVariant::String) ? v_cast(d)->toUtf8() : *v_cast(d); + QByteArray keys = (d->type == QMetaType::QString) ? v_cast(d)->toUtf8() : *v_cast(d); int value = en.keysToValue(keys.constData(), ok); if (*ok) { switch (QMetaType::sizeOf(t)) { @@ -1457,7 +1457,7 @@ static void customConstruct(QVariant::Private *d, const void *copy) const uint size = type.sizeOf(); if (!size) { qWarning("Trying to construct an instance of an invalid type, type id: %i", d->type); - d->type = QVariant::Invalid; + d->type = QMetaType::UnknownType; return; } @@ -2438,43 +2438,43 @@ QVariant::Type QVariant::nameToType(const char *name) enum { MapFromThreeCount = 36 }; static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] = { - QVariant::Invalid, - QVariant::Map, - QVariant::List, - QVariant::String, - QVariant::StringList, - QVariant::Font, - QVariant::Pixmap, - QVariant::Brush, - QVariant::Rect, - QVariant::Size, - QVariant::Color, - QVariant::Palette, + QMetaType::UnknownType, + QMetaType::QVariantMap, + QMetaType::QVariantList, + QMetaType::QString, + QMetaType::QStringList, + QMetaType::QFont, + QMetaType::QPixmap, + QMetaType::QBrush, + QMetaType::QRect, + QMetaType::QSize, + QMetaType::QColor, + QMetaType::QPalette, 0, // ColorGroup - QVariant::Icon, - QVariant::Point, - QVariant::Image, - QVariant::Int, - QVariant::UInt, - QVariant::Bool, - QVariant::Double, + QMetaType::QIcon, + QMetaType::QPoint, + QMetaType::QImage, + QMetaType::Int, + QMetaType::UInt, + QMetaType::Bool, + QMetaType::Double, 0, // Buggy ByteArray, QByteArray never had id == 20 - QVariant::Polygon, - QVariant::Region, - QVariant::Bitmap, - QVariant::Cursor, - QVariant::SizePolicy, - QVariant::Date, - QVariant::Time, - QVariant::DateTime, - QVariant::ByteArray, - QVariant::BitArray, - QVariant::KeySequence, - QVariant::Pen, - QVariant::LongLong, - QVariant::ULongLong, + QMetaType::QPolygon, + QMetaType::QRegion, + QMetaType::QBitmap, + QMetaType::QCursor, + QMetaType::QSizePolicy, + QMetaType::QDate, + QMetaType::QTime, + QMetaType::QDateTime, + QMetaType::QByteArray, + QMetaType::QBitArray, + QMetaType::QKeySequence, + QMetaType::QPen, + QMetaType::LongLong, + QMetaType::ULongLong, #if QT_CONFIG(easingcurve) - QVariant::EasingCurve + QMetaType::QEasingCurve #endif }; @@ -2551,7 +2551,7 @@ void QVariant::load(QDataStream &s) */ void QVariant::save(QDataStream &s) const { - quint32 typeId = type(); + quint32 typeId = d.type >= QMetaType::User ? QMetaType::User : userType(); bool fakeUserType = false; if (s.version() < QDataStream::Qt_4_0) { int i; @@ -3294,80 +3294,80 @@ QVariantList QVariant::toList() const } -static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] = +static const quint32 qCanConvertMatrix[QMetaType::LastCoreType + 1] = { /*Invalid*/ 0, -/*Bool*/ 1 << QVariant::Double | 1 << QVariant::Int | 1 << QVariant::UInt - | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::ByteArray - | 1 << QVariant::String | 1 << QVariant::Char, +/*Bool*/ 1 << QMetaType::Double | 1 << QMetaType::Int | 1 << QMetaType::UInt + | 1 << QMetaType::LongLong | 1 << QMetaType::ULongLong | 1 << QMetaType::QByteArray + | 1 << QMetaType::QString | 1 << QMetaType::QChar, -/*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double - | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong - | 1 << QVariant::Char | 1 << QVariant::ByteArray | 1 << QVariant::Int, +/*Int*/ 1 << QMetaType::UInt | 1 << QMetaType::QString | 1 << QMetaType::Double + | 1 << QMetaType::Bool | 1 << QMetaType::LongLong | 1 << QMetaType::ULongLong + | 1 << QMetaType::QChar | 1 << QMetaType::QByteArray | 1 << QMetaType::Int, -/*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double - | 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong - | 1 << QVariant::Char | 1 << QVariant::ByteArray, +/*UInt*/ 1 << QMetaType::Int | 1 << QMetaType::QString | 1 << QMetaType::Double + | 1 << QMetaType::Bool | 1 << QMetaType::LongLong | 1 << QMetaType::ULongLong + | 1 << QMetaType::QChar | 1 << QMetaType::QByteArray, -/*LLong*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double - | 1 << QVariant::Bool | 1 << QVariant::UInt | 1 << QVariant::ULongLong - | 1 << QVariant::Char | 1 << QVariant::ByteArray, +/*LLong*/ 1 << QMetaType::Int | 1 << QMetaType::QString | 1 << QMetaType::Double + | 1 << QMetaType::Bool | 1 << QMetaType::UInt | 1 << QMetaType::ULongLong + | 1 << QMetaType::QChar | 1 << QMetaType::QByteArray, -/*ULlong*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double - | 1 << QVariant::Bool | 1 << QVariant::UInt | 1 << QVariant::LongLong - | 1 << QVariant::Char | 1 << QVariant::ByteArray, +/*ULlong*/ 1 << QMetaType::Int | 1 << QMetaType::QString | 1 << QMetaType::Double + | 1 << QMetaType::Bool | 1 << QMetaType::UInt | 1 << QMetaType::LongLong + | 1 << QMetaType::QChar | 1 << QMetaType::QByteArray, -/*double*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::ULongLong - | 1 << QVariant::Bool | 1 << QVariant::UInt | 1 << QVariant::LongLong - | 1 << QVariant::ByteArray, +/*double*/ 1 << QMetaType::Int | 1 << QMetaType::QString | 1 << QMetaType::ULongLong + | 1 << QMetaType::Bool | 1 << QMetaType::UInt | 1 << QMetaType::LongLong + | 1 << QMetaType::QByteArray, -/*QChar*/ 1 << QVariant::Int | 1 << QVariant::UInt | 1 << QVariant::LongLong - | 1 << QVariant::ULongLong, +/*QChar*/ 1 << QMetaType::Int | 1 << QMetaType::UInt | 1 << QMetaType::LongLong + | 1 << QMetaType::ULongLong, /*QMap*/ 0, -/*QList*/ 1 << QVariant::StringList, +/*QList*/ 1 << QMetaType::QStringList, -/*QString*/ 1 << QVariant::StringList | 1 << QVariant::ByteArray | 1 << QVariant::Int - | 1 << QVariant::UInt | 1 << QVariant::Bool | 1 << QVariant::Double - | 1 << QVariant::Date | 1 << QVariant::Time | 1 << QVariant::DateTime - | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char - | 1 << QVariant::Url | 1 << QVariant::Uuid, +/*QString*/ 1 << QMetaType::QStringList | 1 << QMetaType::QByteArray | 1 << QMetaType::Int + | 1 << QMetaType::UInt | 1 << QMetaType::Bool | 1 << QMetaType::Double + | 1 << QMetaType::QDate | 1 << QMetaType::QTime | 1 << QMetaType::QDateTime + | 1 << QMetaType::LongLong | 1 << QMetaType::ULongLong | 1 << QMetaType::QChar + | 1 << QMetaType::QUrl | 1 << QMetaType::QUuid, -/*QStringList*/ 1 << QVariant::List | 1 << QVariant::String, +/*QStringList*/ 1 << QMetaType::QVariantList | 1 << QMetaType::QString, -/*QByteArray*/ 1 << QVariant::String | 1 << QVariant::Int | 1 << QVariant::UInt | 1 << QVariant::Bool - | 1 << QVariant::Double | 1 << QVariant::LongLong | 1 << QVariant::ULongLong - | 1 << QVariant::Uuid, +/*QByteArray*/ 1 << QMetaType::QString | 1 << QMetaType::Int | 1 << QMetaType::UInt | 1 << QMetaType::Bool + | 1 << QMetaType::Double | 1 << QMetaType::LongLong | 1 << QMetaType::ULongLong + | 1 << QMetaType::QUuid, /*QBitArray*/ 0, -/*QDate*/ 1 << QVariant::String | 1 << QVariant::DateTime, +/*QDate*/ 1 << QMetaType::QString | 1 << QMetaType::QDateTime, -/*QTime*/ 1 << QVariant::String | 1 << QVariant::DateTime, +/*QTime*/ 1 << QMetaType::QString | 1 << QMetaType::QDateTime, -/*QDateTime*/ 1 << QVariant::String | 1 << QVariant::Date, +/*QDateTime*/ 1 << QMetaType::QString | 1 << QMetaType::QDate, -/*QUrl*/ 1 << QVariant::String, +/*QUrl*/ 1 << QMetaType::QString, /*QLocale*/ 0, -/*QRect*/ 1 << QVariant::RectF, +/*QRect*/ 1 << QMetaType::QRectF, -/*QRectF*/ 1 << QVariant::Rect, +/*QRectF*/ 1 << QMetaType::QRect, -/*QSize*/ 1 << QVariant::SizeF, +/*QSize*/ 1 << QMetaType::QSizeF, -/*QSizeF*/ 1 << QVariant::Size, +/*QSizeF*/ 1 << QMetaType::QSize, -/*QLine*/ 1 << QVariant::LineF, +/*QLine*/ 1 << QMetaType::QLineF, -/*QLineF*/ 1 << QVariant::Line, +/*QLineF*/ 1 << QMetaType::QLine, -/*QPoint*/ 1 << QVariant::PointF, +/*QPoint*/ 1 << QMetaType::QPointF, -/*QPointF*/ 1 << QVariant::Point, +/*QPointF*/ 1 << QMetaType::QPoint, /*QRegExp*/ 0, @@ -3375,7 +3375,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] = /*QEasingCurve*/ 0, -/*QUuid*/ 1 << QVariant::String | 1 << QVariant::ByteArray, +/*QUuid*/ 1 << QMetaType::QString | 1 << QMetaType::QByteArray, }; static const size_t qCanConvertMatrixMaximumTargetType = 8 * sizeof(*qCanConvertMatrix); @@ -3915,7 +3915,7 @@ static bool qIsNumericType(uint tp) static bool qIsFloatingPoint(uint tp) { - return tp == QVariant::Double || tp == QMetaType::Float; + return tp == QMetaType::Double || tp == QMetaType::Float; } static int normalizeLowerRanks(uint tp) @@ -3927,13 +3927,13 @@ static int normalizeLowerRanks(uint tp) Q_UINT64_C(1) << QMetaType::UChar | Q_UINT64_C(1) << QMetaType::Short | Q_UINT64_C(1) << QMetaType::UShort; - return numericTypeBits & (Q_UINT64_C(1) << tp) ? QVariant::Int : tp; + return numericTypeBits & (Q_UINT64_C(1) << tp) ? uint(QMetaType::Int) : tp; } static int normalizeLong(uint tp) { - const uint IntType = sizeof(long) == sizeof(int) ? QVariant::Int : QVariant::LongLong; - const uint UIntType = sizeof(ulong) == sizeof(uint) ? QVariant::UInt : QVariant::ULongLong; + const uint IntType = sizeof(long) == sizeof(int) ? QMetaType::Int : QMetaType::LongLong; + const uint UIntType = sizeof(ulong) == sizeof(uint) ? QMetaType::UInt : QMetaType::ULongLong; return tp == QMetaType::Long ? IntType : tp == QMetaType::ULong ? UIntType : tp; } @@ -3975,13 +3975,13 @@ static int numericTypePromotion(uint t1, uint t2) // if any of the two is ULongLong, then it wins (highest rank, unsigned) // otherwise, if one of the two is LongLong, then the other is either LongLong too or lower-ranked // otherwise, if one of the two is UInt, then the other is either UInt too or Int - if (t1 == QVariant::ULongLong || t2 == QVariant::ULongLong) - return QVariant::ULongLong; - if (t1 == QVariant::LongLong || t2 == QVariant::LongLong) - return QVariant::LongLong; - if (t1 == QVariant::UInt || t2 == QVariant::UInt) - return QVariant::UInt; - return QVariant::Int; + if (t1 == QMetaType::ULongLong || t2 == QMetaType::ULongLong) + return QMetaType::ULongLong; + if (t1 == QMetaType::LongLong || t2 == QMetaType::LongLong) + return QMetaType::LongLong; + if (t1 == QMetaType::UInt || t2 == QMetaType::UInt) + return QMetaType::UInt; + return QMetaType::Int; } static int integralCompare(uint promotedType, const QVariant::Private *d1, const QVariant::Private *d2) @@ -3994,13 +3994,13 @@ static int integralCompare(uint promotedType, const QVariant::Private *d1, const qlonglong l2 = qConvertToNumber(d2, &ok); Q_ASSERT(ok); - if (promotedType == QVariant::Int) + if (promotedType == QMetaType::Int) return int(l1) < int(l2) ? -1 : int(l1) == int(l2) ? 0 : 1; - if (promotedType == QVariant::UInt) + if (promotedType == QMetaType::UInt) return uint(l1) < uint(l2) ? -1 : uint(l1) == uint(l2) ? 0 : 1; - if (promotedType == QVariant::LongLong) + if (promotedType == QMetaType::LongLong) return l1 < l2 ? -1 : l1 == l2 ? 0 : 1; - if (promotedType == QVariant::ULongLong) + if (promotedType == QMetaType::ULongLong) return qulonglong(l1) < qulonglong(l2) ? -1 : qulonglong(l1) == qulonglong(l2) ? 0 : 1; Q_UNREACHABLE(); diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index b8b63b5e6fd..94781a9957e 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -362,7 +362,7 @@ class QVariantConstructor FilteredConstructor(const QVariantConstructor &tc) { // ignore types that lives outside of the current library - tc.m_x->type = QVariant::Invalid; + tc.m_x->type = QMetaType::UnknownType; } }; public: @@ -430,7 +430,7 @@ public: {} ~QVariantDestructor() { - m_d->type = QVariant::Invalid; + m_d->type = QMetaType::UnknownType; m_d->is_null = true; m_d->is_shared = false; } diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp index 5097f4eb81d..ee4dd904166 100644 --- a/src/corelib/serialization/qjsoncbor.cpp +++ b/src/corelib/serialization/qjsoncbor.cpp @@ -640,9 +640,9 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant) // Handle strings and byte arrays directly, to avoid creating a temporary // dummy container to hold their data. int type = variant.userType(); - if (type == QVariant::String) { + if (type == QMetaType::QString) { d->append(variant.toString()); - } else if (type == QVariant::ByteArray) { + } else if (type == QMetaType::QByteArray) { QByteArray ba = variant.toByteArray(); d->appendByteData(ba.constData(), ba.size(), QCborValue::ByteArray); } else { @@ -703,45 +703,45 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant) QCborValue QCborValue::fromVariant(const QVariant &variant) { switch (variant.userType()) { - case QVariant::Invalid: + case QMetaType::UnknownType: return {}; case QMetaType::Nullptr: return nullptr; - case QVariant::Bool: + case QMetaType::Bool: return variant.toBool(); case QMetaType::Short: case QMetaType::UShort: - case QVariant::Int: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::UInt: + case QMetaType::Int: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UInt: return variant.toLongLong(); case QMetaType::Float: - case QVariant::Double: + case QMetaType::Double: return variant.toDouble(); - case QVariant::String: + case QMetaType::QString: return variant.toString(); - case QVariant::StringList: + case QMetaType::QStringList: return QCborArray::fromStringList(variant.toStringList()); - case QVariant::ByteArray: + case QMetaType::QByteArray: return variant.toByteArray(); - case QVariant::DateTime: + case QMetaType::QDateTime: return QCborValue(variant.toDateTime()); #ifndef QT_BOOTSTRAPPED - case QVariant::Url: + case QMetaType::QUrl: return QCborValue(variant.toUrl()); #endif - case QVariant::Uuid: + case QMetaType::QUuid: return QCborValue(variant.toUuid()); - case QVariant::List: + case QMetaType::QVariantList: return QCborArray::fromVariantList(variant.toList()); - case QVariant::Map: + case QMetaType::QVariantMap: return QCborMap::fromVariantMap(variant.toMap()); - case QVariant::Hash: + case QMetaType::QVariantHash: return QCborMap::fromVariantHash(variant.toHash()); #ifndef QT_BOOTSTRAPPED #if QT_CONFIG(regularexpression) - case QVariant::RegularExpression: + case QMetaType::QRegularExpression: return QCborValue(variant.toRegularExpression()); #endif case QMetaType::QJsonValue: diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp index fe0500bdef1..0be0fc020d3 100644 --- a/src/corelib/serialization/qjsondocument.cpp +++ b/src/corelib/serialization/qjsondocument.cpp @@ -405,17 +405,17 @@ QJsonDocument QJsonDocument::fromVariant(const QVariant &variant) { QJsonDocument doc; - switch (variant.type()) { - case QVariant::Map: + switch (variant.userType()) { + case QMetaType::QVariantMap: doc.setObject(QJsonObject::fromVariantMap(variant.toMap())); break; - case QVariant::Hash: + case QMetaType::QVariantHash: doc.setObject(QJsonObject::fromVariantHash(variant.toHash())); break; - case QVariant::List: + case QMetaType::QVariantList: doc.setArray(QJsonArray::fromVariantList(variant.toList())); break; - case QVariant::StringList: + case QMetaType::QStringList: doc.d = qt_make_unique(); doc.d->value = QCborArray::fromStringList(variant.toStringList()); break; diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index 7b6728d5259..caf81c79efa 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -447,29 +447,29 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) switch (variant.userType()) { case QMetaType::Nullptr: return QJsonValue(Null); - case QVariant::Bool: + case QMetaType::Bool: return QJsonValue(variant.toBool()); - case QVariant::Int: + case QMetaType::Int: case QMetaType::Float: - case QVariant::Double: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::UInt: + case QMetaType::Double: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UInt: return QJsonValue(variant.toDouble()); - case QVariant::String: + case QMetaType::QString: return QJsonValue(variant.toString()); - case QVariant::StringList: + case QMetaType::QStringList: return QJsonValue(QJsonArray::fromStringList(variant.toStringList())); - case QVariant::List: + case QMetaType::QVariantList: return QJsonValue(QJsonArray::fromVariantList(variant.toList())); - case QVariant::Map: + case QMetaType::QVariantMap: return QJsonValue(QJsonObject::fromVariantMap(variant.toMap())); - case QVariant::Hash: + case QMetaType::QVariantHash: return QJsonValue(QJsonObject::fromVariantHash(variant.toHash())); #ifndef QT_BOOTSTRAPPED - case QVariant::Url: + case QMetaType::QUrl: return QJsonValue(variant.toUrl().toString(QUrl::FullyEncoded)); - case QVariant::Uuid: + case QMetaType::QUuid: return variant.toUuid().toString(QUuid::WithoutBraces); case QMetaType::QJsonValue: return variant.toJsonValue(); diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 93a8abb1ce4..fb45b829677 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -2430,7 +2430,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca { QTime time; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, nullptr, &time); @@ -2469,7 +2469,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca { QDate date; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, &date, nullptr); @@ -2510,7 +2510,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal QTime time; QDate date; - QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) return QDateTime(date, time); diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index 5e1e47eae76..207331b8ac5 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -234,16 +234,16 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const case CurrencySymbol: return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt())); case CurrencyToString: { - switch (in.type()) { - case QVariant::Int: + switch (in.userType()) { + case QMetaType::Int: return lc_monetary.toCurrencyString(in.toInt()); - case QVariant::UInt: + case QMetaType::UInt: return lc_monetary.toCurrencyString(in.toUInt()); - case QVariant::Double: + case QMetaType::Double: return lc_monetary.toCurrencyString(in.toDouble()); - case QVariant::LongLong: + case QMetaType::LongLong: return lc_monetary.toCurrencyString(in.toLongLong()); - case QVariant::ULongLong: + case QMetaType::ULongLong: return lc_monetary.toCurrencyString(in.toULongLong()); default: break; diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 67d37f19d8e..80751e60a01 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -1791,7 +1791,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar { QDate date; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) dt.fromString(string, &date, nullptr); @@ -2537,7 +2537,7 @@ QTime QTime::fromString(const QString &string, const QString &format) { QTime time; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar()); + QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, QCalendar()); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) dt.fromString(string, nullptr, &time); @@ -5482,7 +5482,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format, QC QTime time; QDate date; - QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) return QDateTime(date, time); diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 31d8e6cc200..70460ae6322 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -425,7 +425,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) switch (sect) { case 'H': case 'h': - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { const Section hour = (sect == 'h') ? Hour12Section : Hour24Section; const SectionNode sn = { hour, i - add, countRepeat(newFormat, i, 2), 0 }; newSectionNodes.append(sn); @@ -436,7 +436,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 'm': - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { const SectionNode sn = { MinuteSection, i - add, countRepeat(newFormat, i, 2), 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); @@ -446,7 +446,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 's': - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { const SectionNode sn = { SecondSection, i - add, countRepeat(newFormat, i, 2), 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); @@ -457,7 +457,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) break; case 'z': - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { const SectionNode sn = { MSecSection, i - add, countRepeat(newFormat, i, 3) < 3 ? 1 : 3, 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); @@ -468,7 +468,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) break; case 'A': case 'a': - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { const bool cap = (sect == 'A'); const SectionNode sn = { AmPmSection, i - add, (cap ? 1 : 0), 0 }; newSectionNodes.append(sn); @@ -482,7 +482,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 'y': - if (parserType != QVariant::Time) { + if (parserType != QMetaType::QTime) { const int repeat = countRepeat(newFormat, i, 4); if (repeat >= 2) { const SectionNode sn = { repeat == 4 ? YearSection : YearSection2Digits, @@ -496,7 +496,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 'M': - if (parserType != QVariant::Time) { + if (parserType != QMetaType::QTime) { const SectionNode sn = { MonthSection, i - add, countRepeat(newFormat, i, 4), 0 }; newSectionNodes.append(sn); newSeparators.append(unquote(newFormat.midRef(index, i - index))); @@ -506,7 +506,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 'd': - if (parserType != QVariant::Time) { + if (parserType != QMetaType::QTime) { const int repeat = countRepeat(newFormat, i, 4); const Section sectionType = (repeat == 4 ? DayOfWeekSectionLong : (repeat == 3 ? DayOfWeekSectionShort : DaySection)); @@ -519,7 +519,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 't': - if (parserType != QVariant::Time) { + if (parserType != QMetaType::QTime) { const SectionNode sn = { TimeZoneSection, i - add, countRepeat(newFormat, i, 4), 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); @@ -1252,7 +1252,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, return StateNode(); } - if (parserType != QVariant::Time) { + if (parserType != QMetaType::QTime) { if (year % 100 != year2digits && (isSet & YearSection2Digits)) { if (!(isSet & YearSection)) { year = (year / 100) * 100; @@ -1322,7 +1322,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, } } - if (parserType != QVariant::Date) { + if (parserType != QMetaType::QDate) { if (isSet & Hour12Section) { const bool hasHour = isSet & Hour24Section; if (ampm == -1) { @@ -1360,7 +1360,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, // If hour wasn't specified, check the default we're using exists on the // given date (which might be a spring-forward, skipping an hour). - if (parserType == QVariant::DateTime && !(isSet & HourSectionMask) && !when.isValid()) { + if (parserType == QMetaType::QDateTime && !(isSet & HourSectionMask) && !when.isValid()) { qint64 msecs = when.toMSecsSinceEpoch(); // Fortunately, that gets a useful answer, even though when is invalid ... const QDateTime replace = diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h index ec4e4e4df25..5c612ef6a4c 100644 --- a/src/corelib/time/qdatetimeparser_p.h +++ b/src/corelib/time/qdatetimeparser_p.h @@ -83,7 +83,7 @@ public: FromString, DateTimeEdit }; - QDateTimeParser(QVariant::Type t, Context ctx, const QCalendar &cal = QCalendar()) + QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar()) : currentSectionIndex(-1), cachedDay(-1), parserType(t), fixday(false), spec(Qt::LocalTime), context(ctx), calendar(cal) { @@ -295,7 +295,7 @@ protected: // for the benefit of QDateTimeEditPrivate QStringList separators; QString displayFormat; QLocale defaultLocale; - QVariant::Type parserType; + QMetaType::Type parserType; bool fixday; Qt::TimeSpec spec; // spec if used by QDateTimeEdit Context context; diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 8a11767140c..d603264a1e2 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -157,7 +157,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu const int type = mp.userType(); // is this metatype registered? const char *expectedSignature = ""; - if (int(mp.type()) != QMetaType::QVariant) { + if (int(mp.userType()) != QMetaType::QVariant) { expectedSignature = QDBusMetaType::typeToSignature(type); if (expectedSignature == nullptr) { qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 477bd1e8fd2..339f8c5dc8e 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -330,7 +330,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QMap &m inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map) { - arg.beginMap(QVariant::String, qMetaTypeId()); + arg.beginMap(QMetaType::QString, qMetaTypeId()); QVariantMap::ConstIterator it = map.constBegin(); QVariantMap::ConstIterator end = map.constEnd(); for ( ; it != end; ++it) { @@ -379,7 +379,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash & inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map) { - arg.beginMap(QVariant::String, qMetaTypeId()); + arg.beginMap(QMetaType::QString, qMetaTypeId()); QVariantHash::ConstIterator it = map.constBegin(); QVariantHash::ConstIterator end = map.constEnd(); for ( ; it != end; ++it) { diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index bca02be59e1..669b330f1db 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1822,7 +1822,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError hook.service = QDBusUtil::dbusService(); hook.path.clear(); // no matching hook.obj = this; - hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void + hook.params << QMetaType::Void << QMetaType::QString; // both functions take a QString as parameter and return void hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)"); Q_ASSERT(hook.midx != -1); @@ -1836,7 +1836,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError // we don't use connectSignal here because the rules are added by connectSignal on a per-need basis hook.params.clear(); hook.params.reserve(4); - hook.params << QMetaType::Void << QVariant::String << QVariant::String << QVariant::String; + hook.params << QMetaType::Void << QMetaType::QString << QMetaType::QString << QMetaType::QString; hook.midx = staticMetaObject.indexOfSlot("serviceOwnerChangedNoLock(QString,QString,QString)"); Q_ASSERT(hook.midx != -1); signalHooks.insert(QLatin1String("NameOwnerChanged:" DBUS_INTERFACE_DBUS), hook); diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index fb958a89544..c1b0feea378 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -55,7 +55,7 @@ static void copyArgument(void *to, int id, const QVariant &arg) { if (id == arg.userType()) { switch (id) { - case QVariant::Bool: + case QMetaType::Bool: *reinterpret_cast(to) = arg.toBool(); return; @@ -71,35 +71,35 @@ static void copyArgument(void *to, int id, const QVariant &arg) *reinterpret_cast(to) = qvariant_cast(arg); return; - case QVariant::Int: + case QMetaType::Int: *reinterpret_cast(to) = arg.toInt(); return; - case QVariant::UInt: + case QMetaType::UInt: *reinterpret_cast(to) = arg.toUInt(); return; - case QVariant::LongLong: + case QMetaType::LongLong: *reinterpret_cast(to) = arg.toLongLong(); return; - case QVariant::ULongLong: + case QMetaType::ULongLong: *reinterpret_cast(to) = arg.toULongLong(); return; - case QVariant::Double: + case QMetaType::Double: *reinterpret_cast(to) = arg.toDouble(); return; - case QVariant::String: + case QMetaType::QString: *reinterpret_cast(to) = arg.toString(); return; - case QVariant::ByteArray: + case QMetaType::QByteArray: *reinterpret_cast(to) = arg.toByteArray(); return; - case QVariant::StringList: + case QMetaType::QStringList: *reinterpret_cast(to) = arg.toStringList(); return; } diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index 46b41d1c07f..c80131f41df 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -190,7 +190,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg) const QVariant &value = arg.variant(); int id = value.userType(); - if (id == QVariant::Invalid) { + if (id == QMetaType::UnknownType) { qWarning("QDBusMarshaller: cannot add a null QDBusVariant"); error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); return false; @@ -384,7 +384,7 @@ void QDBusMarshaller::error(const QString &msg) bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) { int id = arg.userType(); - if (id == QVariant::Invalid) { + if (id == QMetaType::UnknownType) { qWarning("QDBusMarshaller: cannot add an invalid QVariant"); error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); return false; @@ -485,12 +485,12 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) case DBUS_TYPE_ARRAY: // could be many things // find out what kind of array it is - switch (arg.type()) { - case QVariant::StringList: + switch (arg.userType()) { + case QMetaType::QStringList: append( arg.toStringList() ); return true; - case QVariant::ByteArray: + case QMetaType::QByteArray: append( arg.toByteArray() ); return true; diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 71cdec93caa..10d2f07d4d2 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -276,7 +276,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn, for ( ; it != end; ++it) { int id = it->userType(); const char *signature = QDBusMetaType::typeToSignature(id); - if ((id != QVariant::StringList && id != QVariant::ByteArray && + if ((id != QMetaType::QStringList && id != QMetaType::QByteArray && qstrlen(signature) != 1) || id == qMetaTypeId()) { // yes, we are // we must marshall and demarshall again so as to create QDBusArgument diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 3c529ab755f..5265568f423 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -158,10 +158,10 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, const char *direction, int id) { Type result; - result.id = QVariant::Invalid; + result.id = QMetaType::UnknownType; int type = QDBusMetaType::signatureToType(signature); - if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) { + if (type == QMetaType::UnknownType && !qt_dbus_metaobject_skip_annotations) { // it's not a type normally handled by our meta type system // it must contain an annotation QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName"); @@ -189,7 +189,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, type = QMetaType::type(typeName); } - if (type == QVariant::Invalid || signature != QDBusMetaType::typeToSignature(type)) { + if (type == QMetaType::UnknownType || signature != QDBusMetaType::typeToSignature(type)) { // type is still unknown or doesn't match back to the signature that it // was expected to, so synthesize a fake type typeName = "QDBusRawType<0x" + signature.toHex() + ">*"; @@ -197,16 +197,16 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, } result.name = typeName; - } else if (type == QVariant::Invalid) { + } else if (type == QMetaType::UnknownType) { // this case is used only by the qdbus command-line tool // invalid, let's create an impossible type that contains the signature if (signature == "av") { result.name = "QVariantList"; - type = QVariant::List; + type = QMetaType::QVariantList; } else if (signature == "a{sv}") { result.name = "QVariantMap"; - type = QVariant::Map; + type = QMetaType::QVariantMap; } else if (signature == "a{ss}") { result.name = "QMap"; type = qMetaTypeId >(); @@ -246,7 +246,7 @@ void QDBusMetaObjectGenerator::parseMethods() const QDBusIntrospection::Argument &arg = m.inputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "In", i); - if (type.id == QVariant::Invalid) { + if (type.id == QMetaType::UnknownType) { ok = false; break; } @@ -265,7 +265,7 @@ void QDBusMetaObjectGenerator::parseMethods() const QDBusIntrospection::Argument &arg = m.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i); - if (type.id == QVariant::Invalid) { + if (type.id == QMetaType::UnknownType) { ok = false; break; } @@ -322,7 +322,7 @@ void QDBusMetaObjectGenerator::parseSignals() const QDBusIntrospection::Argument &arg = s.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i); - if (type.id == QVariant::Invalid) { + if (type.id == QMetaType::UnknownType) { ok = false; break; } @@ -358,7 +358,7 @@ void QDBusMetaObjectGenerator::parseProperties() const QDBusIntrospection::Property &p = *prop_it; Property mp; Type type = findType(p.type.toLatin1(), p.annotations); - if (type.id == QVariant::Invalid) + if (type.id == QMetaType::UnknownType) continue; QByteArray name = p.name.toLatin1(); diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index e3804f74f83..bcbb22fba65 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -325,7 +325,7 @@ int QDBusMetaType::signatureToType(const char *signature) switch (signature[0]) { case DBUS_TYPE_BOOLEAN: - return QVariant::Bool; + return QMetaType::Bool; case DBUS_TYPE_BYTE: return QMetaType::UChar; @@ -337,22 +337,22 @@ int QDBusMetaType::signatureToType(const char *signature) return QMetaType::UShort; case DBUS_TYPE_INT32: - return QVariant::Int; + return QMetaType::Int; case DBUS_TYPE_UINT32: - return QVariant::UInt; + return QMetaType::UInt; case DBUS_TYPE_INT64: - return QVariant::LongLong; + return QMetaType::LongLong; case DBUS_TYPE_UINT64: - return QVariant::ULongLong; + return QMetaType::ULongLong; case DBUS_TYPE_DOUBLE: - return QVariant::Double; + return QMetaType::Double; case DBUS_TYPE_STRING: - return QVariant::String; + return QMetaType::QString; case DBUS_TYPE_OBJECT_PATH: return QDBusMetaTypeId::objectpath(); @@ -369,13 +369,13 @@ int QDBusMetaType::signatureToType(const char *signature) case DBUS_TYPE_ARRAY: // special case switch (signature[1]) { case DBUS_TYPE_BYTE: - return QVariant::ByteArray; + return QMetaType::QByteArray; case DBUS_TYPE_STRING: - return QVariant::StringList; + return QMetaType::QStringList; case DBUS_TYPE_VARIANT: - return QVariant::List; + return QMetaType::QVariantList; case DBUS_TYPE_OBJECT_PATH: return qMetaTypeId >(); @@ -409,7 +409,7 @@ const char *QDBusMetaType::typeToSignature(int type) case QMetaType::UChar: return DBUS_TYPE_BYTE_AS_STRING; - case QVariant::Bool: + case QMetaType::Bool: return DBUS_TYPE_BOOLEAN_AS_STRING; case QMetaType::Short: @@ -418,29 +418,29 @@ const char *QDBusMetaType::typeToSignature(int type) case QMetaType::UShort: return DBUS_TYPE_UINT16_AS_STRING; - case QVariant::Int: + case QMetaType::Int: return DBUS_TYPE_INT32_AS_STRING; - case QVariant::UInt: + case QMetaType::UInt: return DBUS_TYPE_UINT32_AS_STRING; - case QVariant::LongLong: + case QMetaType::LongLong: return DBUS_TYPE_INT64_AS_STRING; - case QVariant::ULongLong: + case QMetaType::ULongLong: return DBUS_TYPE_UINT64_AS_STRING; - case QVariant::Double: + case QMetaType::Double: return DBUS_TYPE_DOUBLE_AS_STRING; - case QVariant::String: + case QMetaType::QString: return DBUS_TYPE_STRING_AS_STRING; - case QVariant::StringList: + case QMetaType::QStringList: return DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING; // as - case QVariant::ByteArray: + case QMetaType::QByteArray: return DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING; // ay } diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 09311d1ad4f..b4ee6811ac5 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -82,7 +82,7 @@ static bool variantToString(const QVariant &arg, QString &out) { int argType = arg.userType(); - if (argType == QVariant::StringList) { + if (argType == QMetaType::QStringList) { out += QLatin1Char('{'); const QStringList list = arg.toStringList(); for (const QString &item : list) @@ -90,7 +90,7 @@ static bool variantToString(const QVariant &arg, QString &out) if (!list.isEmpty()) out.chop(2); out += QLatin1Char('}'); - } else if (argType == QVariant::ByteArray) { + } else if (argType == QMetaType::QByteArray) { out += QLatin1Char('{'); QByteArray list = arg.toByteArray(); for (int i = 0; i < list.count(); ++i) { @@ -100,7 +100,7 @@ static bool variantToString(const QVariant &arg, QString &out) if (!list.isEmpty()) out.chop(2); out += QLatin1Char('}'); - } else if (argType == QVariant::List) { + } else if (argType == QMetaType::QVariantList) { out += QLatin1Char('{'); const QList list = arg.toList(); for (const QVariant &item : list) { @@ -148,7 +148,7 @@ static bool variantToString(const QVariant &arg, QString &out) if (!variantToString(v, out)) return false; out += QLatin1Char(']'); - } else if (arg.canConvert(QVariant::String)) { + } else if (arg.canConvert(QMetaType::QString)) { out += QLatin1Char('\"') + arg.toString() + QLatin1Char('\"'); } else { out += QLatin1Char('['); diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp index c6b3b90508b..7370ce0de36 100644 --- a/src/dbus/qdbusxmlgenerator.cpp +++ b/src/dbus/qdbusxmlgenerator.cpp @@ -113,7 +113,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method QLatin1String(signature), accessAsString(mp.isReadable(), mp.isWritable())); - if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { + if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) { const char *typeName = QMetaType::typeName(typeId); retval += QLatin1String(">\n \n \n") .arg(typeNameToXml(typeName)); @@ -161,7 +161,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method .arg(typeNameToXml(typeName)); // do we need to describe this argument? - if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid) + if (QDBusMetaType::signatureToType(typeName) == QMetaType::UnknownType) xml += QLatin1String(" \n") .arg(typeNameToXml(QMetaType::typeName(typeId))); } else { @@ -208,7 +208,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method qUtf16Printable(name), signature, isOutput ? "out" : "in"); // do we need to describe this argument? - if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { + if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) { const char *typeName = QMetaType::typeName(types.at(j)); xml += QString::fromLatin1(" \n") .arg(isOutput ? QLatin1String("Out") : QLatin1String("In")) diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 455045eb571..a44f7151b15 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -218,7 +218,7 @@ QBitmap::~QBitmap() */ QBitmap::operator QVariant() const { - return QVariant(QVariant::Bitmap, this); + return QVariant(QMetaType::QBitmap, this); } static QBitmap makeBitmap(QImage &&image, Qt::ImageConversionFlags flags) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 19be066d234..38285dd827c 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -782,7 +782,7 @@ QIcon &QIcon::operator=(const QIcon &other) */ QIcon::operator QVariant() const { - return QVariant(QVariant::Icon, this); + return QVariant(QMetaType::QIcon, this); } /*! \fn int QIcon::serialNumber() const diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 3ddc52bed41..62d2d0e948b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1067,7 +1067,7 @@ int QImage::devType() const */ QImage::operator QVariant() const { - return QVariant(QVariant::Image, this); + return QVariant(QMetaType::QImage, this); } /*! diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 3fce64cb206..e914d7697f1 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -402,7 +402,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap) */ QPixmap::operator QVariant() const { - return QVariant(QVariant::Pixmap, this); + return QVariant(QMetaType::QPixmap, this); } /*! diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 9bdc22b49eb..fc9424763ef 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -926,7 +926,7 @@ void QStandardItem::setData(const QVariant &value, int role) for (it = d->values.begin(); it != d->values.end(); ++it) { if ((*it).role == role) { if (value.isValid()) { - if ((*it).value.type() == value.type() && (*it).value == value) + if ((*it).value.userType() == value.userType() && (*it).value == value) return; (*it).value = value; } else { diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index f5a794b642d..339284aa30f 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -657,7 +657,7 @@ QCursor &QCursor::operator=(const QCursor &c) */ QCursor::operator QVariant() const { - return QVariant(QVariant::Cursor, this); + return QVariant(QMetaType::QCursor, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index 4ed9d032f66..596b7e44fdb 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -178,25 +178,25 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) { switch (t) { - case QVariant::ByteArray: - if (d->type == QVariant::Color) { + case QMetaType::QByteArray: + if (d->type == QMetaType::QColor) { const QColor *c = v_cast(d); *static_cast(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1(); return true; } break; - case QVariant::String: { + case QMetaType::QString: { QString *str = static_cast(result); switch (d->type) { #ifndef QT_NO_SHORTCUT - case QVariant::KeySequence: + case QMetaType::QKeySequence: *str = (*v_cast(d)).toString(QKeySequence::NativeText); return true; #endif - case QVariant::Font: + case QMetaType::QFont: *str = v_cast(d)->toString(); return true; - case QVariant::Color: { + case QMetaType::QColor: { const QColor *c = v_cast(d); *str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); return true; @@ -206,85 +206,85 @@ static bool convert(const QVariant::Private *d, int t, } break; } - case QVariant::Pixmap: - if (d->type == QVariant::Image) { + case QMetaType::QPixmap: + if (d->type == QMetaType::QImage) { *static_cast(result) = QPixmap::fromImage(*v_cast(d)); return true; - } else if (d->type == QVariant::Bitmap) { + } else if (d->type == QMetaType::QBitmap) { *static_cast(result) = *v_cast(d); return true; - } else if (d->type == QVariant::Brush) { + } else if (d->type == QMetaType::QBrush) { if (v_cast(d)->style() == Qt::TexturePattern) { *static_cast(result) = v_cast(d)->texture(); return true; } } break; - case QVariant::Image: - if (d->type == QVariant::Pixmap) { + case QMetaType::QImage: + if (d->type == QMetaType::QPixmap) { *static_cast(result) = v_cast(d)->toImage(); return true; - } else if (d->type == QVariant::Bitmap) { + } else if (d->type == QMetaType::QBitmap) { *static_cast(result) = v_cast(d)->toImage(); return true; } break; - case QVariant::Bitmap: - if (d->type == QVariant::Pixmap) { + case QMetaType::QBitmap: + if (d->type == QMetaType::QPixmap) { *static_cast(result) = *v_cast(d); return true; - } else if (d->type == QVariant::Image) { + } else if (d->type == QMetaType::QImage) { *static_cast(result) = QBitmap::fromImage(*v_cast(d)); return true; } break; #ifndef QT_NO_SHORTCUT - case QVariant::Int: - if (d->type == QVariant::KeySequence) { + case QMetaType::Int: + if (d->type == QMetaType::QKeySequence) { const QKeySequence &seq = *v_cast(d); *static_cast(result) = seq.isEmpty() ? 0 : seq[0]; return true; } break; #endif - case QVariant::Font: - if (d->type == QVariant::String) { + case QMetaType::QFont: + if (d->type == QMetaType::QString) { QFont *f = static_cast(result); f->fromString(*v_cast(d)); return true; } break; - case QVariant::Color: - if (d->type == QVariant::String) { + case QMetaType::QColor: + if (d->type == QMetaType::QString) { static_cast(result)->setNamedColor(*v_cast(d)); return static_cast(result)->isValid(); - } else if (d->type == QVariant::ByteArray) { + } else if (d->type == QMetaType::QByteArray) { static_cast(result)->setNamedColor(QLatin1String(*v_cast(d))); return true; - } else if (d->type == QVariant::Brush) { + } else if (d->type == QMetaType::QBrush) { if (v_cast(d)->style() == Qt::SolidPattern) { *static_cast(result) = v_cast(d)->color(); return true; } } break; - case QVariant::Brush: - if (d->type == QVariant::Color) { + case QMetaType::QBrush: + if (d->type == QMetaType::QColor) { *static_cast(result) = QBrush(*v_cast(d)); return true; - } else if (d->type == QVariant::Pixmap) { + } else if (d->type == QMetaType::QPixmap) { *static_cast(result) = QBrush(*v_cast(d)); return true; } break; #ifndef QT_NO_SHORTCUT - case QVariant::KeySequence: { + case QMetaType::QKeySequence: { QKeySequence *seq = static_cast(result); switch (d->type) { - case QVariant::String: + case QMetaType::QString: *seq = QKeySequence(*v_cast(d)); return true; - case QVariant::Int: + case QMetaType::Int: *seq = QKeySequence(d->data.i); return true; default: @@ -294,7 +294,7 @@ static bool convert(const QVariant::Private *d, int t, } #endif #ifndef QT_NO_ICON - case QVariant::Icon: { + case QMetaType::QIcon: { if (ok) *ok = false; return false; diff --git a/src/gui/kernel/qinternalmimedata.cpp b/src/gui/kernel/qinternalmimedata.cpp index 8f4da1afb56..d5cdc743ee9 100644 --- a/src/gui/kernel/qinternalmimedata.cpp +++ b/src/gui/kernel/qinternalmimedata.cpp @@ -112,22 +112,23 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type { QVariant data = retrieveData_sys(mimeType, type); if (mimeType == QLatin1String("application/x-qt-image")) { - if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) { + if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty())) { // try to find an image QStringList imageFormats = imageReadMimeFormats(); for (int i = 0; i < imageFormats.size(); ++i) { data = retrieveData_sys(imageFormats.at(i), type); - if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) + if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty())) continue; break; } } + int typeId = type; // we wanted some image type, but all we got was a byte array. Convert it to an image. - if (data.type() == QVariant::ByteArray - && (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap)) + if (data.userType() == QMetaType::QByteArray + && (typeId == QMetaType::QImage || typeId == QMetaType::QPixmap || typeId == QMetaType::QBitmap)) data = QImage::fromData(data.toByteArray()); - } else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) { + } else if (mimeType == QLatin1String("application/x-color") && data.userType() == QMetaType::QByteArray) { QColor c; QByteArray ba = data.toByteArray(); if (ba.size() == 8) { @@ -140,7 +141,7 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type } else { qWarning("Qt: Invalid color format"); } - } else if (data.type() != type && data.type() == QVariant::ByteArray) { + } else if (data.userType() != int(type) && data.userType() == QMetaType::QByteArray) { // try to use mime data's internal conversion stuf. QInternalMimeData *that = const_cast(this); that->setData(mimeType, data.toByteArray()); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e1244e1006a..3a3dd42cae3 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1404,7 +1404,7 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const */ QKeySequence::operator QVariant() const { - return QVariant(QVariant::KeySequence, this); + return QVariant(QMetaType::QKeySequence, this); } /*! \fn QKeySequence::operator int () const diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index fc063bc72c5..397c50f3dc9 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -714,7 +714,7 @@ QPalette &QPalette::operator=(const QPalette &p) */ QPalette::operator QVariant() const { - return QVariant(QVariant::Palette, this); + return QVariant(QMetaType::QPalette, this); } /*! diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index ad4cdfdbf4a..6666eb037f3 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -2007,7 +2007,7 @@ void QMatrix4x4::optimize() */ QMatrix4x4::operator QVariant() const { - return QVariant(QVariant::Matrix4x4, this); + return QVariant(QMetaType::QMatrix4x4, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 899ec12eb34..5f15949c5b8 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -983,7 +983,7 @@ QQuaternion QQuaternion::nlerp */ QQuaternion::operator QVariant() const { - return QVariant(QVariant::Quaternion, this); + return QVariant(QMetaType::QQuaternion, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index c04f8b1cbfe..5f651cf3761 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -531,7 +531,7 @@ QVector4D QVector2D::toVector4D() const */ QVector2D::operator QVariant() const { - return QVariant(QVariant::Vector2D, this); + return QVariant(QMetaType::QVector2D, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 4f72c1da660..08c3de99d2a 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -706,7 +706,7 @@ QVector4D QVector3D::toVector4D() const */ QVector3D::operator QVariant() const { - return QVariant(QVariant::Vector3D, this); + return QVariant(QMetaType::QVector3D, this); } /*! diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index 3a68bd6cb78..070ea7454ea 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -608,7 +608,7 @@ QVector3D QVector4D::toVector3DAffine() const */ QVector4D::operator QVariant() const { - return QVariant(QVariant::Vector4D, this); + return QVariant(QMetaType::QVector4D, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 83032bdc4fe..e84916e063a 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -672,7 +672,7 @@ QBrush &QBrush::operator=(const QBrush &b) */ QBrush::operator QVariant() const { - return QVariant(QVariant::Brush, this); + return QVariant(QMetaType::QBrush, this); } /*! diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 8780cce2230..917706e8cf4 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -2980,7 +2980,7 @@ bool QColor::operator!=(const QColor &color) const noexcept */ QColor::operator QVariant() const { - return QVariant(QVariant::Color, this); + return QVariant(QMetaType::QColor, this); } /*! \internal diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index b1f01332b6d..890b0079de0 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -1087,7 +1087,7 @@ QMatrix &QMatrix::operator=(const QMatrix &matrix) noexcept */ QMatrix::operator QVariant() const { - return QVariant(QVariant::Matrix, this); + return QVariant(QMetaType::QMatrix, this); } Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m) diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 1a940443d19..01e581d2ed9 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -408,7 +408,7 @@ QPen &QPen::operator=(const QPen &p) noexcept */ QPen::operator QVariant() const { - return QVariant(QVariant::Pen, this); + return QVariant(QMetaType::QPen, this); } /*! diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 3bf6004fcce..20337477b73 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -716,7 +716,7 @@ QPolygon QPolygonF::toPolygon() const */ QPolygon::operator QVariant() const { - return QVariant(QVariant::Polygon, this); + return QVariant(QMetaType::QPolygon, this); } /***************************************************************************** diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 783b02fb931..44ee038194b 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -599,7 +599,7 @@ QRegion& QRegion::operator^=(const QRegion &r) */ QRegion::operator QVariant() const { - return QVariant(QVariant::Region, this); + return QVariant(QMetaType::QRegion, this); } /*! diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index d75b66c50b5..279a817ff1e 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2155,7 +2155,7 @@ QTransform::TransformationType QTransform::type() const */ QTransform::operator QVariant() const { - return QVariant(QVariant::Transform, this); + return QVariant(QMetaType::QTransform, this); } diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index c0b0071e4df..a12eb985282 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -707,7 +707,7 @@ static Qt::Alignment parseAlignment(const QCss::Value *values, int count) static ColorData parseColorValue(QCss::Value v) { if (v.type == Value::Identifier || v.type == Value::String) { - v.variant.convert(QVariant::Color); + v.variant.convert(QMetaType::QColor); v.type = Value::Color; } @@ -1143,7 +1143,7 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) { s.chop(2); value.variant = s; - if (value.variant.convert(QVariant::Int)) { + if (value.variant.convert(QMetaType::Int)) { font->setPixelSize(value.variant.toInt()); valid = true; } @@ -1420,9 +1420,9 @@ QColor Declaration::colorValue(const QPalette &pal) const return QColor(); if (d->parsed.isValid()) { - if (d->parsed.type() == QVariant::Color) + if (d->parsed.userType() == QMetaType::QColor) return qvariant_cast(d->parsed); - if (d->parsed.type() == QVariant::Int) + if (d->parsed.userType() == QMetaType::Int) return pal.color((QPalette::ColorRole)(d->parsed.toInt())); } @@ -1442,9 +1442,9 @@ QBrush Declaration::brushValue(const QPalette &pal) const return QBrush(); if (d->parsed.isValid()) { - if (d->parsed.type() == QVariant::Brush) + if (d->parsed.userType() == QMetaType::QBrush) return qvariant_cast(d->parsed); - if (d->parsed.type() == QVariant::Int) + if (d->parsed.userType() == QMetaType::Int) return pal.color((QPalette::ColorRole)(d->parsed.toInt())); } @@ -1469,9 +1469,9 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const needParse = 0; QList v = d->parsed.toList(); for (i = 0; i < qMin(v.count(), 4); i++) { - if (v.at(i).type() == QVariant::Brush) { + if (v.at(i).userType() == QMetaType::QBrush) { c[i] = qvariant_cast(v.at(i)); - } else if (v.at(i).type() == QVariant::Int) { + } else if (v.at(i).userType() == QMetaType::Int) { c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt())); } else { needParse |= (1<parsed.isValid()) { QList v = d->parsed.toList(); for (i = 0; i < qMin(d->values.count(), 4); i++) { - if (v.at(i).type() == QVariant::Color) { + if (v.at(i).userType() == QMetaType::QColor) { c[i] = qvariant_cast(v.at(i)); } else { c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt())); @@ -2723,7 +2723,7 @@ bool Parser::parseTerm(Value *value) switch (lookup()) { case NUMBER: value->type = Value::Number; - value->variant.convert(QVariant::Double); + value->variant.convert(QMetaType::Double); break; case PERCENTAGE: value->type = Value::Percentage; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 2e7d898a70f..8f0d7d9d382 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1753,7 +1753,7 @@ bool QFont::operator!=(const QFont &f) const */ QFont::operator QVariant() const { - return QVariant(QVariant::Font, this); + return QVariant(QMetaType::QFont, this); } /*! diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 02e25bb6afc..48ba8987f3d 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -82,7 +82,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void * if (!fontName.isEmpty() && pixelSize) { QFont::Weight fontWeight = QFont::Normal; - if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt) + if (weight.userType() == QMetaType::Int || weight.userType() == QMetaType::UInt) fontWeight = QFont::Weight(weight.toInt()); QFont::Style fontStyle = static_cast(style.toInt()); diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 2d7f2bb844a..46cfc79643c 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2234,7 +2234,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) } if (!r.isNull()) { - if (type == ImageResource && r.type() == QVariant::ByteArray) { + if (type == ImageResource && r.userType() == QMetaType::QByteArray) { if (qApp->thread() != QThread::currentThread()) { // must use images in non-GUI threads QImage image; @@ -3049,12 +3049,12 @@ QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cach for (; it != priv->cachedResources.constEnd(); ++it) { const QVariant &v = it.value(); - if (v.type() == QVariant::Image && !isPixmap) { + if (v.userType() == QMetaType::QImage && !isPixmap) { if (qvariant_cast(v).cacheKey() == cacheKey) break; } - if (v.type() == QVariant::Pixmap && isPixmap) { + if (v.userType() == QMetaType::QPixmap && isPixmap) { if (qvariant_cast(v).cacheKey() == cacheKey) break; } diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index e21a8d8d527..9d708735903 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -248,7 +248,7 @@ public: if (v.isNull()) { return cellPadding; } else { - Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float); + Q_ASSERT(v.userType() == QMetaType::Double || v.userType() == QMetaType::Float); return QFixed::fromReal(v.toReal() * deviceScale); } } diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index e3bd49a15ef..10b8ade1178 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -144,7 +144,7 @@ QT_BEGIN_NAMESPACE */ QTextLength::operator QVariant() const { - return QVariant(QVariant::TextLength, this); + return QVariant(QMetaType::QTextLength, this); } #ifndef QT_NO_DATASTREAM @@ -288,20 +288,20 @@ static inline uint variantHash(const QVariant &variant) { // simple and fast hash functions to differentiate between type and value switch (variant.userType()) { // sorted by occurrence frequency - case QVariant::String: return qHash(variant.toString()); - case QVariant::Double: return qHash(variant.toDouble()); - case QVariant::Int: return 0x811890 + variant.toInt(); - case QVariant::Brush: + case QMetaType::QString: return qHash(variant.toString()); + case QMetaType::Double: return qHash(variant.toDouble()); + case QMetaType::Int: return 0x811890 + variant.toInt(); + case QMetaType::QBrush: return 0x01010101 + hash(qvariant_cast(variant)); - case QVariant::Bool: return 0x371818 + variant.toBool(); - case QVariant::Pen: return 0x02020202 + hash(qvariant_cast(variant)); - case QVariant::List: + case QMetaType::Bool: return 0x371818 + variant.toBool(); + case QMetaType::QPen: return 0x02020202 + hash(qvariant_cast(variant)); + case QMetaType::QVariantList: return 0x8377 + qvariant_cast(variant).count(); - case QVariant::Color: return hash(qvariant_cast(variant)); - case QVariant::TextLength: + case QMetaType::QColor: return hash(qvariant_cast(variant)); + case QMetaType::QTextLength: return 0x377 + hash(qvariant_cast(variant).rawValue()); case QMetaType::Float: return qHash(variant.toFloat()); - case QVariant::Invalid: return 0; + case QMetaType::UnknownType: return 0; default: break; } return qHash(variant.typeName()); @@ -874,7 +874,7 @@ QTextFormat::~QTextFormat() */ QTextFormat::operator QVariant() const { - return QVariant(QVariant::TextFormat, this); + return QVariant(QMetaType::QTextFormat, this); } /*! @@ -984,7 +984,7 @@ bool QTextFormat::boolProperty(int propertyId) const if (!d) return false; const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Bool) + if (prop.userType() != QMetaType::Bool) return false; return prop.toBool(); } @@ -1004,7 +1004,7 @@ int QTextFormat::intProperty(int propertyId) const if (!d) return def; const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Int) + if (prop.userType() != QMetaType::Int) return def; return prop.toInt(); } @@ -1022,7 +1022,7 @@ qreal QTextFormat::doubleProperty(int propertyId) const if (!d) return 0.; const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float) + if (prop.userType() != QMetaType::Double && prop.userType() != QMetaType::Float) return 0.; return qvariant_cast(prop); } @@ -1040,7 +1040,7 @@ QString QTextFormat::stringProperty(int propertyId) const if (!d) return QString(); const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::String) + if (prop.userType() != QMetaType::QString) return QString(); return prop.toString(); } @@ -1058,7 +1058,7 @@ QColor QTextFormat::colorProperty(int propertyId) const if (!d) return QColor(); const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Color) + if (prop.userType() != QMetaType::QColor) return QColor(); return qvariant_cast(prop); } @@ -1076,7 +1076,7 @@ QPen QTextFormat::penProperty(int propertyId) const if (!d) return QPen(Qt::NoPen); const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Pen) + if (prop.userType() != QMetaType::QPen) return QPen(Qt::NoPen); return qvariant_cast(prop); } @@ -1094,7 +1094,7 @@ QBrush QTextFormat::brushProperty(int propertyId) const if (!d) return QBrush(Qt::NoBrush); const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::Brush) + if (prop.userType() != QMetaType::QBrush) return QBrush(Qt::NoBrush); return qvariant_cast(prop); } @@ -1126,13 +1126,13 @@ QVector QTextFormat::lengthVectorProperty(int propertyId) const if (!d) return vector; const QVariant prop = d->property(propertyId); - if (prop.userType() != QVariant::List) + if (prop.userType() != QMetaType::QVariantList) return vector; QList propertyList = prop.toList(); for (int i=0; i(var)); } @@ -1222,7 +1222,7 @@ int QTextFormat::objectIndex() const if (!d) return -1; const QVariant prop = d->property(ObjectIndex); - if (prop.userType() != QVariant::Int) // #### + if (prop.userType() != QMetaType::Int) // #### return -1; return prop.toInt(); } @@ -1859,9 +1859,9 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) QString QTextCharFormat::anchorName() const { QVariant prop = property(AnchorName); - if (prop.userType() == QVariant::StringList) + if (prop.userType() == QMetaType::QStringList) return prop.toStringList().value(0); - else if (prop.userType() != QVariant::String) + else if (prop.userType() != QMetaType::QString) return QString(); return prop.toString(); } @@ -1878,9 +1878,9 @@ QString QTextCharFormat::anchorName() const QStringList QTextCharFormat::anchorNames() const { QVariant prop = property(AnchorName); - if (prop.userType() == QVariant::StringList) + if (prop.userType() == QMetaType::QStringList) return prop.toStringList(); - else if (prop.userType() != QVariant::String) + else if (prop.userType() != QMetaType::QString) return QStringList(); return QStringList(prop.toString()); } diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 3b9f2d253e5..f0035443913 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1451,19 +1451,19 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo if (QCoreApplication::instance()->thread() != QThread::currentThread()) { // must use images in non-GUI threads - if (val.type() == QVariant::Image) { + if (val.userType() == QMetaType::QImage) { QImage image = qvariant_cast(val); charFormat.setBackground(image); - } else if (val.type() == QVariant::ByteArray) { + } else if (val.userType() == QMetaType::QByteArray) { QImage image; if (image.loadFromData(val.toByteArray())) { charFormat.setBackground(image); } } } else { - if (val.type() == QVariant::Image || val.type() == QVariant::Pixmap) { + if (val.userType() == QMetaType::QImage || val.userType() == QMetaType::QPixmap) { charFormat.setBackground(qvariant_cast(val)); - } else if (val.type() == QVariant::ByteArray) { + } else if (val.userType() == QMetaType::QByteArray) { QPixmap pm; if (pm.loadFromData(val.toByteArray())) { charFormat.setBackground(pm); @@ -1907,9 +1907,9 @@ void QTextHtmlParser::importStyleSheet(const QString &href) QVariant res = resourceProvider->resource(QTextDocument::StyleSheetResource, href); QString css; - if (res.type() == QVariant::String) { + if (res.userType() == QMetaType::QString) { css = res.toString(); - } else if (res.type() == QVariant::ByteArray) { + } else if (res.userType() == QMetaType::QByteArray) { // #### detect @charset css = QString::fromUtf8(res.toByteArray()); } diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index 14018f34da7..0d87a2135d9 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -88,9 +88,9 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con qreal sourcePixelRatio = 1.0; name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio); const QVariant data = doc->resource(QTextDocument::ImageResource, url); - if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) { + if (data.userType() == QMetaType::QPixmap || data.userType() == QMetaType::QImage) { pm = qvariant_cast(data); - } else if (data.type() == QVariant::ByteArray) { + } else if (data.userType() == QMetaType::QByteArray) { pm.loadFromData(data.toByteArray()); } @@ -170,9 +170,9 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const qreal sourcePixelRatio = 1.0; name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio); const QVariant data = doc->resource(QTextDocument::ImageResource, url); - if (data.type() == QVariant::Image) { + if (data.userType() == QMetaType::QImage) { image = qvariant_cast(data); - } else if (data.type() == QVariant::ByteArray) { + } else if (data.userType() == QMetaType::QByteArray) { image.loadFromData(data.toByteArray()); } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 408e3ec167e..155ec43c50a 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -455,9 +455,9 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF name.prepend(QLatin1String("qrc")); QUrl url = QUrl(name); const QVariant variant = m_document->resource(QTextDocument::ImageResource, url); - if (variant.type() == QVariant::Image) { + if (variant.userType() == QMetaType::QImage) { image = qvariant_cast(variant); - } else if (variant.type() == QVariant::ByteArray) { + } else if (variant.userType() == QMetaType::QByteArray) { data = variant.toByteArray(); QBuffer buffer(&data); diff --git a/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp b/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp index f280e65c297..a15b93e31ee 100644 --- a/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp +++ b/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp @@ -93,7 +93,7 @@ bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionNa if (!success) return false; stepSize = (max - min) / 10; // this is pretty arbitrary, we just need to provide something - const int typ = currentVariant.type(); + const int typ = currentVariant.userType(); if (typ != QMetaType::Float && typ != QMetaType::Double) { // currentValue is an integer. Round it up to ensure stepping in case it was below 1 stepSize = qCeil(stepSize); diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 0f34e1a4ca0..012edc82e44 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -2250,7 +2250,7 @@ bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString qCDebug(lcAccessibilityAtspi) << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); return false; } - if (!value.canConvert(QVariant::Double)) { + if (!value.canConvert(QMetaType::Double)) { qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::valueInterface: Could not convert to double: " << function; } diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 70d56160750..36d9e4e0659 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -517,7 +517,7 @@ QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue) // causing recursion. QString fontDescription; QString fontFamily; - if (fontValue.type() == QVariant::StringList) { + if (fontValue.userType() == QMetaType::QStringList) { const QStringList list = fontValue.toStringList(); if (!list.isEmpty()) { fontFamily = list.first(); diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index cb82672acd3..6ad4597b19e 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -226,7 +226,7 @@ void QTuioHandler::process2DCurSource(const QOscMessage &message) return; } - if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) { + if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::QByteArray) { qCWarning(lcTuioSource, "Ignoring malformed TUIO source message (bad argument type)"); return; } @@ -248,7 +248,7 @@ void QTuioHandler::process2DCurAlive(const QOscMessage &message) QMap newActiveCursors; for (int i = 1; i < arguments.count(); ++i) { - if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) { + if (QMetaType::Type(arguments.at(i).userType()) != QMetaType::Int) { qCWarning(lcTuioHandler) << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')'; return; } @@ -293,12 +293,12 @@ void QTuioHandler::process2DCurSet(const QOscMessage &message) return; } - if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int || - QMetaType::Type(arguments.at(2).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(3).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(4).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(5).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(6).type()) != QMetaType::Float + if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::Int || + QMetaType::Type(arguments.at(2).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(3).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(4).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(5).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(6).userType()) != QMetaType::Float ) { qCWarning(lcTuioSet) << "Ignoring malformed TUIO set message with bad types: " << arguments; return; @@ -391,7 +391,7 @@ void QTuioHandler::process2DObjSource(const QOscMessage &message) return; } - if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) { + if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::QByteArray) { qCWarning(lcTuioSource, "Ignoring malformed TUIO source message (bad argument type)"); return; } @@ -413,7 +413,7 @@ void QTuioHandler::process2DObjAlive(const QOscMessage &message) QMap newActiveTokens; for (int i = 1; i < arguments.count(); ++i) { - if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) { + if (QMetaType::Type(arguments.at(i).userType()) != QMetaType::Int) { qCWarning(lcTuioHandler) << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')'; return; } @@ -458,16 +458,16 @@ void QTuioHandler::process2DObjSet(const QOscMessage &message) return; } - if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int || - QMetaType::Type(arguments.at(2).type()) != QMetaType::Int || - QMetaType::Type(arguments.at(3).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(4).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(5).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(6).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(7).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(8).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(9).type()) != QMetaType::Float || - QMetaType::Type(arguments.at(10).type()) != QMetaType::Float) { + if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::Int || + QMetaType::Type(arguments.at(2).userType()) != QMetaType::Int || + QMetaType::Type(arguments.at(3).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(4).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(5).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(6).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(7).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(8).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(9).userType()) != QMetaType::Float || + QMetaType::Type(arguments.at(10).userType()) != QMetaType::Float) { qCWarning(lcTuioSet) << "Ignoring malformed TUIO set message with bad types: " << arguments; return; } diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index c2d9d060fb4..fe9ddfece7d 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -123,8 +123,9 @@ protected: return list.contains(format); } - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const override + QVariant retrieveData_sys(const QString &fmt, QVariant::Type type) const override { + auto requestedType = QMetaType::Type(type); if (fmt.isEmpty() || isEmpty()) return QByteArray(); diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 47d58fa8807..e76fc8bd401 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -114,7 +114,7 @@ protected: QStringList formats_sys() const override; QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override; - QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const; + QVariant xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const; QXcbDrag *drag; }; @@ -1248,11 +1248,11 @@ QXcbDropData::~QXcbDropData() QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const { QByteArray mime = mimetype.toLatin1(); - QVariant data = xdndObtainData(mime, requestedType); + QVariant data = xdndObtainData(mime, QMetaType::Type(requestedType)); return data; } -QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const +QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const { QByteArray result; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index d611f86a9ce..0b3219f792d 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -159,7 +159,7 @@ QVector QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con } QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &d, const QString &format, - QVariant::Type requestedType, const QByteArray &encoding) + QMetaType::Type requestedType, const QByteArray &encoding) { QByteArray data = d; QString atomName = mimeAtomToString(connection, a); @@ -169,7 +169,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, && atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) { #if QT_CONFIG(textcodec) - if (requestedType == QVariant::String) { + if (requestedType == QMetaType::QString) { QTextCodec *codec = QTextCodec::codecForName(encoding); if (codec) return codec->toUnicode(data); @@ -264,7 +264,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, return QVariant(); } -xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType, +xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType, const QVector &atoms, QByteArray *requestedEncoding) { requestedEncoding->clear(); @@ -297,7 +297,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString // for string/text requests try to use a format with a well-defined charset // first to avoid encoding problems - if (requestedType == QVariant::String + if (requestedType == QMetaType::QString && format.startsWith(QLatin1String("text/")) && !format.contains(QLatin1String("charset="))) { diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h index f2136ec9f44..dcb4f6b6c6a 100644 --- a/src/plugins/platforms/xcb/qxcbmime.h +++ b/src/plugins/platforms/xcb/qxcbmime.h @@ -60,8 +60,8 @@ public: static bool mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data, xcb_atom_t *atomFormat, int *dataFormat); static QVariant mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format, - QVariant::Type requestedType, const QByteArray &encoding); - static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType, + QMetaType::Type requestedType, const QByteArray &encoding); + static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType, const QVector &atoms, QByteArray *requestedEncoding); }; diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp index d0928fe6ab7..7bacb59994e 100644 --- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp +++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp @@ -730,7 +730,7 @@ static char* createArrayBuffer(char *buffer, const QList &list, if (curDim != dim) { for(i = 0; i < list.size(); ++i) { - if (list.at(i).type() != QVariant::List) { // dimensions mismatch + if (list.at(i).userType() != QVariant::List) { // dimensions mismatch error = QLatin1String("Array dimensons mismatch. Fieldname: %1"); return 0; } @@ -1162,7 +1162,7 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx) // null value QVariant v; v.convert(qIBaseTypeName2(d->sqlda->sqlvar[i].sqltype, d->sqlda->sqlvar[i].sqlscale < 0)); - if(v.type() == QVariant::Double) { + if (v.userType() == QVariant::Double) { switch(numericalPrecisionPolicy()) { case QSql::LowPrecisionInt32: v.convert(QVariant::Int); diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index 0e195cfdb41..90a810d5163 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp @@ -223,13 +223,13 @@ public: { QMyField() : outField(0), nullIndicator(false), bufLength(0ul), - myField(0), type(QVariant::Invalid) + myField(0), type(QMetaType::UnknownType) {} char *outField; my_bool nullIndicator; ulong bufLength; MYSQL_FIELD *myField; - QVariant::Type type; + QMetaType::Type type; }; QVector fields; @@ -263,25 +263,25 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, } -static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags) +static QMetaType::Type qDecodeMYSQLType(int mysqltype, uint flags) { - QVariant::Type type; + QMetaType::Type type; switch (mysqltype) { case FIELD_TYPE_TINY : - type = static_cast((flags & UNSIGNED_FLAG) ? QMetaType::UChar : QMetaType::Char); + type = (flags & UNSIGNED_FLAG) ? QMetaType::UChar : QMetaType::Char; break; case FIELD_TYPE_SHORT : - type = static_cast((flags & UNSIGNED_FLAG) ? QMetaType::UShort : QMetaType::Short); + type = (flags & UNSIGNED_FLAG) ? QMetaType::UShort : QMetaType::Short; break; case FIELD_TYPE_LONG : case FIELD_TYPE_INT24 : - type = (flags & UNSIGNED_FLAG) ? QVariant::UInt : QVariant::Int; + type = (flags & UNSIGNED_FLAG) ? QMetaType::UInt : QMetaType::Int; break; case FIELD_TYPE_YEAR : - type = QVariant::Int; + type = QMetaType::Int; break; case FIELD_TYPE_LONGLONG : - type = (flags & UNSIGNED_FLAG) ? QVariant::ULongLong : QVariant::LongLong; + type = (flags & UNSIGNED_FLAG) ? QMetaType::ULongLong : QMetaType::LongLong; break; case FIELD_TYPE_FLOAT : case FIELD_TYPE_DOUBLE : @@ -289,19 +289,19 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags) #if defined(FIELD_TYPE_NEWDECIMAL) case FIELD_TYPE_NEWDECIMAL: #endif - type = QVariant::Double; + type = QMetaType::Double; break; case FIELD_TYPE_DATE : - type = QVariant::Date; + type = QMetaType::QDate; break; case FIELD_TYPE_TIME : // A time field can be within the range '-838:59:59' to '838:59:59' so // use QString instead of QTime since QTime is limited to 24 hour clock - type = QVariant::String; + type = QMetaType::QString; break; case FIELD_TYPE_DATETIME : case FIELD_TYPE_TIMESTAMP : - type = QVariant::DateTime; + type = QMetaType::QDateTime; break; case FIELD_TYPE_STRING : case FIELD_TYPE_VAR_STRING : @@ -309,12 +309,12 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags) case FIELD_TYPE_TINY_BLOB : case FIELD_TYPE_MEDIUM_BLOB : case FIELD_TYPE_LONG_BLOB : - type = (flags & BINARY_FLAG) ? QVariant::ByteArray : QVariant::String; + type = (flags & BINARY_FLAG) ? QMetaType::QByteArray : QMetaType::QString; break; default: case FIELD_TYPE_ENUM : case FIELD_TYPE_SET : - type = QVariant::String; + type = QMetaType::QString; break; } return type; @@ -323,7 +323,7 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags) static QSqlField qToField(MYSQL_FIELD *field, QTextCodec *tc) { QSqlField f(toUnicode(tc, field->name), - qDecodeMYSQLType(int(field->type), field->flags), + QVariant::Type(qDecodeMYSQLType(int(field->type), field->flags)), toUnicode(tc, field->table)); f.setRequired(IS_NOT_NULL(field->flags)); f.setLength(field->length); @@ -610,7 +610,7 @@ QVariant QMYSQLResult::data(int field) QString val; if (d->preparedQuery) { if (f.nullIndicator) - return QVariant(f.type); + return QVariant(QVariant::Type(f.type)); if (qIsInteger(f.type)) { QVariant variant(f.type, f.outField); @@ -622,34 +622,34 @@ QVariant QMYSQLResult::data(int field) return variant; } - if (f.type != QVariant::ByteArray) + if (f.type != QMetaType::QByteArray) val = toUnicode(d->drv_d_func()->tc, f.outField, f.bufLength); } else { if (d->row[field] == NULL) { // NULL value - return QVariant(f.type); + return QVariant(QVariant::Type(f.type)); } fieldLength = mysql_fetch_lengths(d->result)[field]; - if (f.type != QVariant::ByteArray) + if (f.type != QMetaType::QByteArray) val = toUnicode(d->drv_d_func()->tc, d->row[field], fieldLength); } switch (static_cast(f.type)) { - case QVariant::LongLong: + case QMetaType::LongLong: return QVariant(val.toLongLong()); - case QVariant::ULongLong: + case QMetaType::ULongLong: return QVariant(val.toULongLong()); case QMetaType::Char: case QMetaType::Short: - case QVariant::Int: + case QMetaType::Int: return QVariant(val.toInt()); case QMetaType::UChar: case QMetaType::UShort: - case QVariant::UInt: + case QMetaType::UInt: return QVariant(val.toUInt()); - case QVariant::Double: { + case QMetaType::Double: { QVariant v; bool ok=false; double dbl = val.toDouble(&ok); @@ -673,13 +673,13 @@ QVariant QMYSQLResult::data(int field) return v; return QVariant(); } - case QVariant::Date: + case QMetaType::QDate: return qDateFromString(val); - case QVariant::Time: + case QMetaType::QTime: return qTimeFromString(val); - case QVariant::DateTime: + case QMetaType::QDateTime: return qDateTimeFromString(val); - case QVariant::ByteArray: { + case QMetaType::QByteArray: { QByteArray ba; if (d->preparedQuery) { @@ -689,7 +689,7 @@ QVariant QMYSQLResult::data(int field) } return QVariant(ba); } - case QVariant::String: + case QMetaType::QString: default: return QVariant(val); } @@ -867,21 +867,21 @@ void QMYSQLResult::virtual_hook(int id, void *data) QSqlResult::virtual_hook(id, data); } -static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type) +static MYSQL_TIME *toMySqlDate(QDate date, QTime time, int type) { - Q_ASSERT(type == QVariant::Time || type == QVariant::Date - || type == QVariant::DateTime); + Q_ASSERT(type == QMetaType::QTime || type == QMetaType::QDate + || type == QMetaType::QDateTime); MYSQL_TIME *myTime = new MYSQL_TIME; memset(myTime, 0, sizeof(MYSQL_TIME)); - if (type == QVariant::Time || type == QVariant::DateTime) { + if (type == QMetaType::QTime || type == QMetaType::QDateTime) { myTime->hour = time.hour(); myTime->minute = time.minute(); myTime->second = time.second(); myTime->second_part = time.msec() * 1000; } - if (type == QVariant::Date || type == QVariant::DateTime) { + if (type == QMetaType::QDate || type == QMetaType::QDateTime) { myTime->year = date.year(); myTime->month = date.month(); myTime->day = date.day(); @@ -971,30 +971,30 @@ bool QMYSQLResult::exec() currBind->length = 0; currBind->is_unsigned = 0; - switch (val.type()) { - case QVariant::ByteArray: + switch (val.userType()) { + case QMetaType::QByteArray: currBind->buffer_type = MYSQL_TYPE_BLOB; currBind->buffer = const_cast(val.toByteArray().constData()); currBind->buffer_length = val.toByteArray().size(); break; - case QVariant::Time: - case QVariant::Date: - case QVariant::DateTime: { - MYSQL_TIME *myTime = toMySqlDate(val.toDate(), val.toTime(), val.type()); + case QMetaType::QTime: + case QMetaType::QDate: + case QMetaType::QDateTime: { + MYSQL_TIME *myTime = toMySqlDate(val.toDate(), val.toTime(), val.userType()); timeVector.append(myTime); currBind->buffer = myTime; - switch(val.type()) { - case QVariant::Time: + switch (val.userType()) { + case QMetaType::QTime: currBind->buffer_type = MYSQL_TYPE_TIME; myTime->time_type = MYSQL_TIMESTAMP_TIME; break; - case QVariant::Date: + case QMetaType::QDate: currBind->buffer_type = MYSQL_TYPE_DATE; myTime->time_type = MYSQL_TIMESTAMP_DATE; break; - case QVariant::DateTime: + case QMetaType::QDateTime: currBind->buffer_type = MYSQL_TYPE_DATETIME; myTime->time_type = MYSQL_TIMESTAMP_DATETIME; break; @@ -1004,32 +1004,32 @@ bool QMYSQLResult::exec() currBind->buffer_length = sizeof(MYSQL_TIME); currBind->length = 0; break; } - case QVariant::UInt: - case QVariant::Int: + case QMetaType::UInt: + case QMetaType::Int: currBind->buffer_type = MYSQL_TYPE_LONG; currBind->buffer = data; currBind->buffer_length = sizeof(int); - currBind->is_unsigned = (val.type() != QVariant::Int); + currBind->is_unsigned = (val.userType() != QMetaType::Int); break; - case QVariant::Bool: + case QMetaType::Bool: currBind->buffer_type = MYSQL_TYPE_TINY; currBind->buffer = data; currBind->buffer_length = sizeof(bool); currBind->is_unsigned = false; break; - case QVariant::Double: + case QMetaType::Double: currBind->buffer_type = MYSQL_TYPE_DOUBLE; currBind->buffer = data; currBind->buffer_length = sizeof(double); break; - case QVariant::LongLong: - case QVariant::ULongLong: + case QMetaType::LongLong: + case QMetaType::ULongLong: currBind->buffer_type = MYSQL_TYPE_LONGLONG; currBind->buffer = data; currBind->buffer_length = sizeof(qint64); - currBind->is_unsigned = (val.type() == QVariant::ULongLong); + currBind->is_unsigned = (val.userType() == QMetaType::ULongLong); break; - case QVariant::String: + case QMetaType::QString: default: { QByteArray ba = fromUnicode(d->drv_d_func()->tc, val.toString()); stringVector.append(ba); @@ -1548,16 +1548,16 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons if (field.isNull()) { r = QStringLiteral("NULL"); } else { - switch(field.type()) { - case QVariant::Double: + switch (+field.type()) { + case QMetaType::Double: r = QString::number(field.value().toDouble(), 'g', field.precision()); break; - case QVariant::String: + case QMetaType::QString: // Escape '\' characters r = QSqlDriver::formatValue(field, trimStrings); r.replace(QLatin1String("\\"), QLatin1String("\\\\")); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: if (isOpen()) { const QByteArray ba = field.value().toByteArray(); // buffer has to be at least length*2+1 bytes diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 7709b13cd15..33bad23e3b3 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -1422,7 +1422,7 @@ bool QODBCResult::exec() SQLLEN *ind = &indicators[i]; if (val.isNull()) *ind = SQL_NULL_DATA; - switch (val.type()) { + switch (val.userType()) { case QVariant::Date: { QByteArray &ba = tmpStorage[i]; ba.resize(sizeof(DATE_STRUCT)); @@ -1694,7 +1694,7 @@ bool QODBCResult::exec() return true; for (i = 0; i < values.count(); ++i) { - switch (values.at(i).type()) { + switch (values.at(i).userType()) { case QVariant::Date: { DATE_STRUCT ds = *((DATE_STRUCT *)const_cast(tmpStorage.at(i).constData())); values[i] = QVariant(QDate(ds.year, ds.month, ds.day)); @@ -1735,7 +1735,7 @@ bool QODBCResult::exec() break; } } if (indicators[i] == SQL_NULL_DATA) - values[i] = QVariant(values[i].type()); + values[i] = QVariant(QVariant::Type(values[i].userType())); } return true; } diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 65d3f0a5803..551d7624349 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -505,7 +505,7 @@ bool QSQLiteResult::exec() if (value.isNull()) { res = sqlite3_bind_null(d->stmt, i + 1); } else { - switch (value.type()) { + switch (value.userType()) { case QVariant::ByteArray: { const QByteArray *ba = static_cast(value.constData()); res = sqlite3_bind_blob(d->stmt, i + 1, ba->constData(), diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index fcd3c70a043..d1c9057aacb 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -612,30 +612,30 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const if (field.isNull()) r = nullTxt; else { - switch (field.type()) { - case QVariant::Int: - case QVariant::UInt: - if (field.value().type() == QVariant::Bool) + switch (+field.type()) { + case QMetaType::Int: + case QMetaType::UInt: + if (field.value().userType() == QMetaType::Bool) r = field.value().toBool() ? QLatin1String("1") : QLatin1String("0"); else r = field.value().toString(); break; #if QT_CONFIG(datestring) - case QVariant::Date: + case QMetaType::QDate: if (field.value().toDate().isValid()) r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate) + QLatin1Char('\''); else r = nullTxt; break; - case QVariant::Time: + case QMetaType::QTime: if (field.value().toTime().isValid()) r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); else r = nullTxt; break; - case QVariant::DateTime: + case QMetaType::QDateTime: if (field.value().toDateTime().isValid()) r = QLatin1Char('\'') + field.value().toDateTime().toString(Qt::ISODate) + QLatin1Char('\''); @@ -643,8 +643,8 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const r = nullTxt; break; #endif - case QVariant::String: - case QVariant::Char: + case QMetaType::QString: + case QMetaType::QChar: { QString result = field.value().toString(); if (trimStrings) { @@ -658,10 +658,10 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const r = QLatin1Char('\'') + result + QLatin1Char('\''); break; } - case QVariant::Bool: + case QMetaType::Bool: r = QString::number(field.value().toBool()); break; - case QVariant::ByteArray : { + case QMetaType::QByteArray : { if (hasFeature(BLOB)) { QByteArray ba = field.value().toByteArray(); QString res; diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp index 5a6d173b3bd..86a22bae106 100644 --- a/src/sql/kernel/qsqlfield.cpp +++ b/src/sql/kernel/qsqlfield.cpp @@ -48,7 +48,7 @@ class QSqlFieldPrivate public: QSqlFieldPrivate(const QString &name, QVariant::Type type, const QString &tableName) : - ref(1), nm(name), table(tableName), def(QVariant()), type(type), + ref(1), nm(name), table(tableName), def(QVariant()), type(QMetaType::Type(type)), req(QSqlField::Unknown), len(-1), prec(-1), tp(-1), ro(false), gen(true), autoval(false) {} @@ -86,7 +86,7 @@ public: QString nm; QString table; QVariant def; - QVariant::Type type; + QMetaType::Type type; QSqlField::RequiredStatus req; int len; int prec; @@ -399,7 +399,7 @@ QString QSqlField::name() const */ QVariant::Type QSqlField::type() const { - return d->type; + return QVariant::Type(d->type); } /*! @@ -411,12 +411,11 @@ QVariant::Type QSqlField::type() const void QSqlField::setType(QVariant::Type type) { detach(); - d->type = type; + d->type = QMetaType::Type(type); if (!val.isValid()) val = QVariant(type); } - /*! Returns \c true if the field's value is read-only; otherwise returns false. @@ -526,7 +525,7 @@ bool QSqlField::isGenerated() const */ bool QSqlField::isValid() const { - return d->type != QVariant::Invalid; + return d->type != QMetaType::UnknownType; } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/sql/kernel/qsqlfield.h b/src/sql/kernel/qsqlfield.h index 8650ba8715f..892420d26ef 100644 --- a/src/sql/kernel/qsqlfield.h +++ b/src/sql/kernel/qsqlfield.h @@ -55,7 +55,7 @@ public: enum RequiredStatus { Unknown = -1, Optional = 0, Required = 1 }; explicit QSqlField(const QString& fieldName = QString(), - QVariant::Type type = QVariant::Invalid); + QVariant::Type type = {}); QSqlField(const QString &fieldName, QVariant::Type type, const QString &tableName); diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index cc91c6d0ed7..a41b3d8424c 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -645,7 +645,7 @@ bool QSqlResult::exec() for (i = d->holders.count() - 1; i >= 0; --i) { holder = d->holders.at(i).holderName; val = d->values.value(d->indexes.value(holder).value(0,-1)); - QSqlField f(QLatin1String(""), val.type()); + QSqlField f(QLatin1String(""), QVariant::Type(val.userType())); f.setValue(val); query = query.replace(d->holders.at(i).holderPos, holder.length(), driver()->formatValue(f)); @@ -659,7 +659,7 @@ bool QSqlResult::exec() if (i == -1) continue; QVariant var = d->values.value(idx); - QSqlField f(QLatin1String(""), var.type()); + QSqlField f(QLatin1String(""), QVariant::Type(var.userType())); if (var.isNull()) f.clear(); else diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 3b1ffb389e4..0298ff96e3f 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -218,7 +218,7 @@ template<> inline char *toString(const QVariant &v) vstring.append(type); if (!v.isNull()) { vstring.append(','); - if (v.canConvert(QVariant::String)) { + if (v.canConvert(QMetaType::QString)) { vstring.append(v.toString().toLocal8Bit()); } else { diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index f3ebf343c51..27767407847 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -152,7 +152,7 @@ namespace QTest { inline bool matches(QtMsgType tp, const QString &message) const { return tp == type - && (pattern.type() == QVariant::String ? + && (pattern.userType() == QMetaType::QString ? stringsMatch(pattern.toString(), message) : #if QT_CONFIG(regularexpression) pattern.toRegularExpression().match(message).hasMatch()); @@ -292,7 +292,7 @@ void QTestLog::printUnhandledIgnoreMessages() QString message; QTest::IgnoreResultList *list = QTest::ignoreResultList; while (list) { - if (list->pattern.type() == QVariant::String) { + if (list->pattern.userType() == QMetaType::QString) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { #if QT_CONFIG(regularexpression) diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 81ebafad790..768594efb46 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -115,7 +115,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { .arg(typeNameToXml(typeName)); // do we need to describe this argument? - if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid) + if (QDBusMetaType::signatureToType(typeName) == QMetaType::UnknownType) xml += QString::fromLatin1(" \n") .arg(typeNameToXml(mm.normalizedType.constData())); } else { @@ -159,7 +159,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { isOutput ? QLatin1String("out") : QLatin1String("in")); // do we need to describe this argument? - if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { + if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) { const char *typeName = QMetaType::typeName(types.at(j)); xml += QString::fromLatin1(" \n") .arg(isOutput ? QLatin1String("Out") : QLatin1String("In")) @@ -225,7 +225,7 @@ static QString generateInterfaceXml(const ClassDef *mo) QLatin1String(signature), QLatin1String(accessvalues[access])); - if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) { + if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) { retval += QString::fromLatin1(">\n \n \n") .arg(typeNameToXml(mp.type.constData())); } else { diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 9cf753a3f12..9825596f3d9 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -211,7 +211,7 @@ static QString classNameForInterface(const QString &interface, ClassType classTy static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out", bool isSignal = false) { int type = QDBusMetaType::signatureToType(signature.toLatin1()); - if (type == QVariant::Invalid) { + if (type == QMetaType::UnknownType) { QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName"); if (paramId >= 0) annotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId); diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index dfb707eda05..4272b612ec1 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -163,7 +163,7 @@ bool QUrlModel::dropMimeData(const QMimeData *data, Qt::DropAction action, */ bool QUrlModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (value.type() == QVariant::Url) { + if (value.userType() == QMetaType::QUrl) { QUrl url = value.toUrl(); QModelIndex dirIndex = fileSystemModel->index(url.toLocalFile()); //On windows the popup display the "C:\", convert to nativeSeparators diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 6f1eb4b346d..a2120e53fe1 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10511,13 +10511,13 @@ QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const v = int(inputMethodHints()); else if (dd->control) v = dd->control->inputMethodQuery(query, QVariant()); - if (v.type() == QVariant::RectF) + if (v.userType() == QMetaType::QRectF) v = v.toRectF().translated(-dd->controlOffset()); - else if (v.type() == QVariant::PointF) + else if (v.userType() == QMetaType::QPointF) v = v.toPointF() - dd->controlOffset(); - else if (v.type() == QVariant::Rect) + else if (v.userType() == QMetaType::QRect) v = v.toRect().translated(-dd->controlOffset().toPoint()); - else if (v.type() == QVariant::Point) + else if (v.userType() == QMetaType::QPoint) v = v.toPoint() - dd->controlOffset().toPoint(); return v; } diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 4d4958c674c..eb8acf1f279 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1441,17 +1441,17 @@ QVariant QGraphicsProxyWidget::inputMethodQuery(Qt::InputMethodQuery query) cons focusWidget = d->widget; QVariant v = focusWidget->inputMethodQuery(query); QPointF focusWidgetPos = subWidgetRect(focusWidget).topLeft(); - switch (v.type()) { - case QVariant::RectF: + switch (v.userType()) { + case QMetaType::QRectF: v = v.toRectF().translated(focusWidgetPos); break; - case QVariant::PointF: + case QMetaType::QPointF: v = v.toPointF() + focusWidgetPos; break; - case QVariant::Rect: + case QMetaType::QRect: v = v.toRect().translated(focusWidgetPos.toPoint()); break; - case QVariant::Point: + case QMetaType::QPoint: v = v.toPoint() + focusWidgetPos.toPoint(); break; default: diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 1c6e68def14..1cb24f74b6c 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -3190,13 +3190,13 @@ QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const return QVariant(); const QTransform matrix = d->focusItem->sceneTransform(); QVariant value = d->focusItem->inputMethodQuery(query); - if (value.type() == QVariant::RectF) + if (value.userType() == QMetaType::QRectF) value = matrix.mapRect(value.toRectF()); - else if (value.type() == QVariant::PointF) + else if (value.userType() == QMetaType::QPointF) value = matrix.map(value.toPointF()); - else if (value.type() == QVariant::Rect) + else if (value.userType() == QMetaType::QRect) value = matrix.mapRect(value.toRect()); - else if (value.type() == QVariant::Point) + else if (value.userType() == QMetaType::QPoint) value = matrix.map(value.toPoint()); return value; } diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 7589a1ebbd5..e1a829f779e 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2589,13 +2589,13 @@ QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const return QVariant(); QVariant value = d->scene->inputMethodQuery(query); - if (value.type() == QVariant::RectF) + if (value.userType() == QMetaType::QRectF) value = d->mapRectFromScene(value.toRectF()); - else if (value.type() == QVariant::PointF) + else if (value.userType() == QMetaType::QPointF) value = mapFromScene(value.toPointF()); - else if (value.type() == QVariant::Rect) + else if (value.userType() == QMetaType::QRect) value = d->mapRectFromScene(value.toRect()).toRect(); - else if (value.type() == QVariant::Point) + else if (value.userType() == QMetaType::QPoint) value = mapFromScene(value.toPoint()); return value; } diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index bb47881c030..c5b22b56679 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -585,27 +585,27 @@ QString QAbstractItemDelegatePrivate::textForRole(Qt::ItemDataRole role, const Q case QMetaType::Float: text = locale.toString(value.toFloat()); break; - case QVariant::Double: + case QMetaType::Double: text = locale.toString(value.toDouble(), 'g', precision); break; - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: text = locale.toString(value.toLongLong()); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: text = locale.toString(value.toULongLong()); break; - case QVariant::Date: + case QMetaType::QDate: text = locale.toString(value.toDate(), formatType); break; - case QVariant::Time: + case QMetaType::QTime: text = locale.toString(value.toTime(), formatType); break; - case QVariant::DateTime: + case QMetaType::QDateTime: text = locale.toString(value.toDateTime(), formatType); break; - case QVariant::Type(QMetaType::QJsonValue): { + case QMetaType::QJsonValue: { const QJsonValue val = value.toJsonValue(); if (val.isBool()) { text = QVariant(val.toBool()).toString(); diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 0e54cf235fa..2524d4acfa8 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2339,7 +2339,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) QVariant variant; if (d->model) variant = d->model->data(currentIndex(), Qt::DisplayRole); - if (variant.type() == QVariant::String) + if (variant.userType() == QMetaType::QString) QGuiApplication::clipboard()->setText(variant.toString()); event->accept(); } diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 790f3054634..84e2fd72a96 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3660,7 +3660,7 @@ void QHeaderViewPrivate::flipSortIndicator(int section) sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder; } else { const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole); - if (value.canConvert(QVariant::Int)) + if (value.canConvert(QMetaType::Int)) sortOrder = static_cast(value.toInt()); else sortOrder = Qt::AscendingOrder; diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp index daea907963c..4420d39b8e0 100644 --- a/src/widgets/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -414,7 +414,7 @@ void QItemDelegate::paint(QPainter *painter, if (value.isValid()) { // ### we need the pixmap to call the virtual function pixmap = decoration(opt, value); - if (value.type() == QVariant::Icon) { + if (value.userType() == QMetaType::QIcon) { d->tmp.icon = qvariant_cast(value); d->tmp.mode = d->iconMode(option.state); d->tmp.state = d->iconState(option.state); @@ -969,12 +969,12 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option, QPixmap QItemDelegate::decoration(const QStyleOptionViewItem &option, const QVariant &variant) const { Q_D(const QItemDelegate); - switch (variant.type()) { - case QVariant::Icon: { + switch (variant.userType()) { + case QMetaType::QIcon: { QIcon::Mode mode = d->iconMode(option.state); QIcon::State state = d->iconState(option.state); return qvariant_cast(variant).pixmap(option.decorationSize, mode, state); } - case QVariant::Color: { + case QMetaType::QColor: { static QPixmap pixmap(option.decorationSize); pixmap.fill(qvariant_cast(variant)); return pixmap; } @@ -1060,24 +1060,24 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option, if (role == Qt::CheckStateRole) return doCheck(option, option.rect, value); if (value.isValid() && !value.isNull()) { - switch (value.type()) { - case QVariant::Invalid: + switch (value.userType()) { + case QMetaType::UnknownType: break; - case QVariant::Pixmap: { + case QMetaType::QPixmap: { const QPixmap &pixmap = qvariant_cast(value); return QRect(QPoint(0, 0), pixmap.size() / pixmap.devicePixelRatio() ); } - case QVariant::Image: { + case QMetaType::QImage: { const QImage &image = qvariant_cast(value); return QRect(QPoint(0, 0), image.size() / image.devicePixelRatio() ); } - case QVariant::Icon: { + case QMetaType::QIcon: { QIcon::Mode mode = d->iconMode(option.state); QIcon::State state = d->iconState(option.state); QIcon icon = qvariant_cast(value); QSize size = icon.actualSize(option.decorationSize, mode, state); return QRect(QPoint(0, 0), size); } - case QVariant::Color: + case QMetaType::QColor: return QRect(QPoint(0, 0), option.decorationSize); - case QVariant::String: + case QMetaType::QString: default: { const QString text = d->valueToText(value, option); value = index.data(Qt::FontRole); diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index f874597d59e..fe9b482122f 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -241,21 +241,21 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) { switch (userType) { #if QT_CONFIG(combobox) - case QVariant::Bool: { + case QMetaType::Bool: { QBooleanComboBox *cb = new QBooleanComboBox(parent); cb->setFrame(false); cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); return cb; } #endif #if QT_CONFIG(spinbox) - case QVariant::UInt: { + case QMetaType::UInt: { QSpinBox *sb = new QUIntSpinBox(parent); sb->setFrame(false); sb->setMinimum(0); sb->setMaximum(INT_MAX); sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy()); return sb; } - case QVariant::Int: { + case QMetaType::Int: { QSpinBox *sb = new QSpinBox(parent); sb->setFrame(false); sb->setMinimum(INT_MIN); @@ -264,25 +264,25 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) return sb; } #endif #if QT_CONFIG(datetimeedit) - case QVariant::Date: { + case QMetaType::QDate: { QDateTimeEdit *ed = new QDateEdit(parent); ed->setFrame(false); return ed; } - case QVariant::Time: { + case QMetaType::QTime: { QDateTimeEdit *ed = new QTimeEdit(parent); ed->setFrame(false); return ed; } - case QVariant::DateTime: { + case QMetaType::QDateTime: { QDateTimeEdit *ed = new QDateTimeEdit(parent); ed->setFrame(false); return ed; } #endif #if QT_CONFIG(label) - case QVariant::Pixmap: + case QMetaType::QPixmap: return new QLabel(parent); #endif #if QT_CONFIG(spinbox) - case QVariant::Double: { + case QMetaType::Double: { QDoubleSpinBox *sb = new QDoubleSpinBox(parent); sb->setFrame(false); sb->setMinimum(-DBL_MAX); @@ -291,7 +291,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) return sb; } #endif #if QT_CONFIG(lineedit) - case QVariant::String: + case QMetaType::QString: default: { // the default editor is a lineedit QExpandingLineEdit *le = new QExpandingLineEdit(parent); @@ -311,24 +311,24 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const { switch (userType) { #if QT_CONFIG(combobox) - case QVariant::Bool: + case QMetaType::Bool: return "currentIndex"; #endif #if QT_CONFIG(spinbox) - case QVariant::UInt: - case QVariant::Int: - case QVariant::Double: + case QMetaType::UInt: + case QMetaType::Int: + case QMetaType::Double: return "value"; #endif #if QT_CONFIG(datetimeedit) - case QVariant::Date: + case QMetaType::QDate: return "date"; - case QVariant::Time: + case QMetaType::QTime: return "time"; - case QVariant::DateTime: + case QMetaType::QDateTime: return "dateTime"; #endif - case QVariant::String: + case QMetaType::QString: default: // the default editor is a lineedit return "text"; diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index f42af2ea004..c685cc7f052 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -302,8 +302,8 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, value = index.data(Qt::DecorationRole); if (value.isValid() && !value.isNull()) { option->features |= QStyleOptionViewItem::HasDecoration; - switch (value.type()) { - case QVariant::Icon: { + switch (value.userType()) { + case QMetaType::QIcon: { option->icon = qvariant_cast(value); QIcon::Mode mode; if (!(option->state & QStyle::State_Enabled)) @@ -319,19 +319,19 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, qMin(option->decorationSize.height(), actualSize.height())); break; } - case QVariant::Color: { + case QMetaType::QColor: { QPixmap pixmap(option->decorationSize); pixmap.fill(qvariant_cast(value)); option->icon = QIcon(pixmap); break; } - case QVariant::Image: { + case QMetaType::QImage: { QImage image = qvariant_cast(value); option->icon = QIcon(QPixmap::fromImage(image)); option->decorationSize = image.size() / image.devicePixelRatio(); break; } - case QVariant::Pixmap: { + case QMetaType::QPixmap: { QPixmap pixmap = qvariant_cast(value); option->icon = QIcon(pixmap); option->decorationSize = pixmap.size() / pixmap.devicePixelRatio(); diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp index 54bf8fe0dc8..c4372a9fbc7 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -439,7 +439,7 @@ void QSizePolicy::setControlType(ControlType type) noexcept */ QSizePolicy::operator QVariant() const { - return QVariant(QVariant::SizePolicy, this); + return QVariant(QMetaType::QSizePolicy, this); } #ifndef QT_NO_DATASTREAM diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 41600d21438..edb166e8d5a 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -51,12 +51,12 @@ namespace { static void construct(QVariant::Private *x, const void *copy) { switch (x->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: v_construct(x, copy); break; default: qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type); - x->type = QVariant::Invalid; + x->type = QMetaType::UnknownType; return; } x->is_null = !copy; @@ -65,7 +65,7 @@ static void construct(QVariant::Private *x, const void *copy) static void clear(QVariant::Private *d) { switch (d->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: v_clear(d); break; default: @@ -73,7 +73,7 @@ static void clear(QVariant::Private *d) return; } - d->type = QVariant::Invalid; + d->type = QMetaType::UnknownType; d->is_null = true; d->is_shared = false; } @@ -88,7 +88,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) { Q_ASSERT(a->type == b->type); switch(a->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: return *v_cast(a) == *v_cast(b); default: Q_ASSERT(false); @@ -111,7 +111,7 @@ static void streamDebug(QDebug dbg, const QVariant &v) { QVariant::Private *d = const_cast(&v.data_ptr()); switch (d->type) { - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: dbg.nospace() << *v_cast(d); break; default: diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2eccb244319..1e032b237a9 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -1547,11 +1547,10 @@ public: } } } - QString valueStr; - if(value.type() == QVariant::StringList || value.type() == QVariant::List) - valueStr = value.toStringList().join(QLatin1Char(' ')); - else - valueStr = value.toString(); + QString valueStr = (value.userType() == QMetaType::QStringList + || value.userType() == QMetaType::QVariantList) + ? value.toStringList().join(QLatin1Char(' ')) + : value.toString(); cache[name] = valueStr; return valueStr; } @@ -2611,16 +2610,16 @@ void QStyleSheetStyle::setProperties(QWidget *w) QVariant v; const QVariant value = w->property(property.toLatin1()); - switch (value.type()) { - case QVariant::Icon: v = decl.iconValue(); break; - case QVariant::Image: v = QImage(decl.uriValue()); break; - case QVariant::Pixmap: v = QPixmap(decl.uriValue()); break; - case QVariant::Rect: v = decl.rectValue(); break; - case QVariant::Size: v = decl.sizeValue(); break; - case QVariant::Color: v = decl.colorValue(); break; - case QVariant::Brush: v = decl.brushValue(); break; + switch (value.userType()) { + case QMetaType::QIcon: v = decl.iconValue(); break; + case QMetaType::QImage: v = QImage(decl.uriValue()); break; + case QMetaType::QPixmap: v = QPixmap(decl.uriValue()); break; + case QMetaType::QRect: v = decl.rectValue(); break; + case QMetaType::QSize: v = decl.sizeValue(); break; + case QMetaType::QColor: v = decl.colorValue(); break; + case QMetaType::QBrush: v = decl.brushValue(); break; #ifndef QT_NO_SHORTCUT - case QVariant::KeySequence: v = QKeySequence(decl.d->values.at(0).variant.toString()); break; + case QMetaType::QKeySequence: v = QKeySequence(decl.d->values.at(0).variant.toString()); break; #endif default: v = decl.d->values.at(0).variant; break; } @@ -4648,7 +4647,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op } if (baseStyle()->property("_q_styleSheetRealCloseButton").toBool()) - baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant(QVariant::Invalid)); + baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant()); } QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap, @@ -6128,7 +6127,7 @@ void QStyleSheetStyle::saveWidgetFont(QWidget* w, const QFont& font) const void QStyleSheetStyle::clearWidgetFont(QWidget* w) const { - w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid)); + w->setProperty("_q_styleSheetWidgetFont", QVariant()); } // Polish palette that should be used for a particular widget, with particular states diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 6a0d2f50199..04176ab5e26 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -570,7 +570,7 @@ void QAbstractSpinBox::clear() QAbstractSpinBox::StepEnabled QAbstractSpinBox::stepEnabled() const { Q_D(const QAbstractSpinBox); - if (d->readOnly || d->type == QVariant::Invalid) + if (d->readOnly || d->type == QMetaType::UnknownType) return StepNone; if (d->wrapping) return StepEnabled(StepUpEnabled | StepDownEnabled); @@ -723,7 +723,7 @@ void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) d->edit->setFocusProxy(this); d->edit->setAcceptDrops(false); - if (d->type != QVariant::Invalid) { + if (d->type != QMetaType::UnknownType) { connect(d->edit, SIGNAL(textChanged(QString)), this, SLOT(_q_editorTextChanged(QString))); connect(d->edit, SIGNAL(cursorPositionChanged(int,int)), @@ -1421,7 +1421,7 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event) */ QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate() - : edit(nullptr), type(QVariant::Invalid), spinClickTimerId(-1), + : edit(nullptr), type(QMetaType::UnknownType), spinClickTimerId(-1), spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1), effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false), @@ -1805,7 +1805,7 @@ void QAbstractSpinBoxPrivate::setValue(const QVariant &val, EmitPolicy ep, void QAbstractSpinBoxPrivate::updateEdit() { Q_Q(QAbstractSpinBox); - if (type == QVariant::Invalid) + if (type == QMetaType::UnknownType) return; const QString newText = specialValue() ? specialValueText : prefix + textFromValue(value) + suffix; if (newText == edit->displayText() || cleared) @@ -1865,8 +1865,8 @@ QVariant QAbstractSpinBoxPrivate::getZeroVariant() const { QVariant ret; switch (type) { - case QVariant::Int: ret = QVariant((int)0); break; - case QVariant::Double: ret = QVariant((double)0.0); break; + case QMetaType::Int: ret = QVariant(0); break; + case QMetaType::Double: ret = QVariant(0.0); break; default: break; } return ret; @@ -1913,7 +1913,7 @@ QVariant QAbstractSpinBoxPrivate::valueFromText(const QString &) const void QAbstractSpinBoxPrivate::interpret(EmitPolicy ep) { Q_Q(QAbstractSpinBox); - if (type == QVariant::Invalid || cleared) + if (type == QMetaType::UnknownType || cleared) return; QVariant v = getZeroVariant(); @@ -2013,11 +2013,11 @@ void QSpinBoxValidator::fixup(QString &input) const QVariant operator+(const QVariant &arg1, const QVariant &arg2) { QVariant ret; - if (Q_UNLIKELY(arg1.type() != arg2.type())) + if (Q_UNLIKELY(arg1.userType() != arg2.userType())) qWarning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, __LINE__); - switch (arg1.type()) { - case QVariant::Int: { + switch (arg1.userType()) { + case QMetaType::Int: { const int int1 = arg1.toInt(); const int int2 = arg2.toInt(); if (int1 > 0 && (int2 >= INT_MAX - int1)) { @@ -2031,9 +2031,9 @@ QVariant operator+(const QVariant &arg1, const QVariant &arg2) } break; } - case QVariant::Double: ret = QVariant(arg1.toDouble() + arg2.toDouble()); break; + case QMetaType::Double: ret = QVariant(arg1.toDouble() + arg2.toDouble()); break; #if QT_CONFIG(datetimeparser) - case QVariant::DateTime: { + case QMetaType::QDateTime: { QDateTime a2 = arg2.toDateTime(); QDateTime a1 = arg1.toDateTime().addDays(QDATETIMEEDIT_DATE_MIN.daysTo(a2.date())); a1.setTime(a1.time().addMSecs(a2.time().msecsSinceStartOfDay())); @@ -2055,13 +2055,13 @@ QVariant operator+(const QVariant &arg1, const QVariant &arg2) QVariant operator-(const QVariant &arg1, const QVariant &arg2) { QVariant ret; - if (Q_UNLIKELY(arg1.type() != arg2.type())) + if (Q_UNLIKELY(arg1.userType() != arg2.userType())) qWarning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, __LINE__); - switch (arg1.type()) { - case QVariant::Int: ret = QVariant(arg1.toInt() - arg2.toInt()); break; - case QVariant::Double: ret = QVariant(arg1.toDouble() - arg2.toDouble()); break; - case QVariant::DateTime: { + switch (arg1.userType()) { + case QMetaType::Int: ret = QVariant(arg1.toInt() - arg2.toInt()); break; + case QMetaType::Double: ret = QVariant(arg1.toDouble() - arg2.toDouble()); break; + case QMetaType::QDateTime: { QDateTime a1 = arg1.toDateTime(); QDateTime a2 = arg2.toDateTime(); int days = a2.daysTo(a1); @@ -2090,13 +2090,13 @@ QVariant operator*(const QVariant &arg1, double multiplier) { QVariant ret; - switch (arg1.type()) { - case QVariant::Int: + switch (arg1.userType()) { + case QMetaType::Int: ret = static_cast(qBound(INT_MIN, arg1.toInt() * multiplier, INT_MAX)); break; - case QVariant::Double: ret = QVariant(arg1.toDouble() * multiplier); break; + case QMetaType::Double: ret = QVariant(arg1.toDouble() * multiplier); break; #if QT_CONFIG(datetimeparser) - case QVariant::DateTime: { + case QMetaType::QDateTime: { double days = QDATETIMEEDIT_DATE_MIN.daysTo(arg1.toDateTime().date()) * multiplier; const qint64 daysInt = qint64(days); days -= daysInt; @@ -2119,17 +2119,17 @@ double operator/(const QVariant &arg1, const QVariant &arg2) double a1 = 0; double a2 = 0; - switch (arg1.type()) { - case QVariant::Int: + switch (arg1.userType()) { + case QMetaType::Int: a1 = (double)arg1.toInt(); a2 = (double)arg2.toInt(); break; - case QVariant::Double: + case QMetaType::Double: a1 = arg1.toDouble(); a2 = arg2.toDouble(); break; #if QT_CONFIG(datetimeparser) - case QVariant::DateTime: + case QMetaType::QDateTime: a1 = QDATETIMEEDIT_DATE_MIN.daysTo(arg1.toDate()); a2 = QDATETIMEEDIT_DATE_MIN.daysTo(arg2.toDate()); a1 += arg1.toDateTime().time().msecsSinceStartOfDay() / (36e5 * 24); @@ -2144,9 +2144,9 @@ double operator/(const QVariant &arg1, const QVariant &arg2) int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant &arg2) { - switch (arg2.type()) { - case QVariant::Date: - Q_ASSERT_X(arg1.type() == QVariant::Date, "QAbstractSpinBoxPrivate::variantCompare", + switch (arg2.userType()) { + case QMetaType::QDate: + Q_ASSERT_X(arg1.userType() == QMetaType::QDate, "QAbstractSpinBoxPrivate::variantCompare", qPrintable(QString::fromLatin1("Internal error 1 (%1)"). arg(QString::fromLatin1(arg1.typeName())))); if (arg1.toDate() == arg2.toDate()) { @@ -2156,8 +2156,8 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant } else { return 1; } - case QVariant::Time: - Q_ASSERT_X(arg1.type() == QVariant::Time, "QAbstractSpinBoxPrivate::variantCompare", + case QMetaType::QTime: + Q_ASSERT_X(arg1.userType() == QMetaType::QTime, "QAbstractSpinBoxPrivate::variantCompare", qPrintable(QString::fromLatin1("Internal error 2 (%1)"). arg(QString::fromLatin1(arg1.typeName())))); if (arg1.toTime() == arg2.toTime()) { @@ -2169,7 +2169,7 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant } - case QVariant::DateTime: + case QMetaType::QDateTime: if (arg1.toDateTime() == arg2.toDateTime()) { return 0; } else if (arg1.toDateTime() < arg2.toDateTime()) { @@ -2177,7 +2177,7 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant } else { return 1; } - case QVariant::Int: + case QMetaType::Int: if (arg1.toInt() == arg2.toInt()) { return 0; } else if (arg1.toInt() < arg2.toInt()) { @@ -2185,7 +2185,7 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant } else { return 1; } - case QVariant::Double: + case QMetaType::Double: if (arg1.toDouble() == arg2.toDouble()) { return 0; } else if (arg1.toDouble() < arg2.toDouble()) { @@ -2193,8 +2193,8 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant } else { return 1; } - case QVariant::Invalid: - if (arg2.type() == QVariant::Invalid) + case QMetaType::UnknownType: + if (arg2.userType() == QMetaType::UnknownType) return 0; Q_FALLTHROUGH(); default: diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h index ad169fde199..63b19c7317f 100644 --- a/src/widgets/widgets/qabstractspinbox_p.h +++ b/src/widgets/widgets/qabstractspinbox_p.h @@ -127,7 +127,7 @@ public: QLineEdit *edit; QString prefix, suffix, specialValueText; QVariant value, minimum, maximum, singleStep; - QVariant::Type type; + QMetaType::Type type; int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval; int effectiveSpinRepeatRate; uint buttonState; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index d786c7ff83b..9826cabe50d 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -144,11 +144,11 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt menuOption.menuItemType = QStyleOptionMenuItem::Normal; QVariant variant = index.model()->data(index, Qt::DecorationRole); - switch (variant.type()) { - case QVariant::Icon: + switch (variant.userType()) { + case QMetaType::QIcon: menuOption.icon = qvariant_cast(variant); break; - case QVariant::Color: { + case QMetaType::QColor: { static QPixmap pixmap(option.decorationSize); pixmap.fill(qvariant_cast(variant)); menuOption.icon = pixmap; @@ -1888,7 +1888,7 @@ void QComboBoxPrivate::updateDelegate(bool force) QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const { QVariant decoration = model->data(index, Qt::DecorationRole); - if (decoration.type() == QVariant::Pixmap) + if (decoration.userType() == QMetaType::QPixmap) return QIcon(qvariant_cast(decoration)); else return qvariant_cast(decoration); diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 5f415aca425..63d5ae268e2 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -195,11 +195,19 @@ QDateTimeEdit::QDateTimeEdit(const QTime &time, QWidget *parent) d->init(time.isValid() ? time : QDATETIMEEDIT_TIME_MIN); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) /*! \internal */ - QDateTimeEdit::QDateTimeEdit(const QVariant &var, QVariant::Type parserType, QWidget *parent) + : QDateTimeEdit(var, QMetaType::Type(parserType), parent) +{ } +/*! + \internal +*/ +#endif + +QDateTimeEdit::QDateTimeEdit(const QVariant &var, QMetaType::Type parserType, QWidget *parent) : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) { Q_D(QDateTimeEdit); @@ -1564,7 +1572,7 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event) QTimeEdit::QTimeEdit(QWidget *parent) - : QDateTimeEdit(QDATETIMEEDIT_TIME_MIN, QVariant::Time, parent) + : QDateTimeEdit(QDATETIMEEDIT_TIME_MIN, QMetaType::QTime, parent) { connect(this, &QTimeEdit::timeChanged, this, &QTimeEdit::userTimeChanged); } @@ -1575,7 +1583,7 @@ QTimeEdit::QTimeEdit(QWidget *parent) */ QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent) - : QDateTimeEdit(time, QVariant::Time, parent) + : QDateTimeEdit(time, QMetaType::QTime, parent) { connect(this, &QTimeEdit::timeChanged, this, &QTimeEdit::userTimeChanged); } @@ -1634,7 +1642,7 @@ QTimeEdit::~QTimeEdit() */ QDateEdit::QDateEdit(QWidget *parent) - : QDateTimeEdit(QDATETIMEEDIT_DATE_INITIAL, QVariant::Date, parent) + : QDateTimeEdit(QDATETIMEEDIT_DATE_INITIAL, QMetaType::QDate, parent) { connect(this, &QDateEdit::dateChanged, this, &QDateEdit::userDateChanged); } @@ -1645,7 +1653,7 @@ QDateEdit::QDateEdit(QWidget *parent) */ QDateEdit::QDateEdit(const QDate &date, QWidget *parent) - : QDateTimeEdit(date, QVariant::Date, parent) + : QDateTimeEdit(date, QMetaType::QDate, parent) { connect(this, &QDateEdit::dateChanged, this, &QDateEdit::userDateChanged); } @@ -1682,13 +1690,13 @@ QDateEdit::~QDateEdit() QDateTimeEditPrivate::QDateTimeEditPrivate() - : QDateTimeParser(QVariant::DateTime, QDateTimeParser::DateTimeEdit, QCalendar()) + : QDateTimeParser(QMetaType::QDateTime, QDateTimeParser::DateTimeEdit, QCalendar()) { hasHadFocus = false; formatExplicitlySet = false; cacheGuard = false; fixday = true; - type = QVariant::DateTime; + type = QMetaType::QDateTime; sections = { }; cachedDay = -1; currentSectionIndex = FirstSectionIndex; @@ -2430,22 +2438,22 @@ void QDateTimeEdit::initStyleOption(QStyleOptionSpinBox *option) const void QDateTimeEditPrivate::init(const QVariant &var) { Q_Q(QDateTimeEdit); - switch (var.type()) { - case QVariant::Date: + switch (var.userType()) { + case QMetaType::QDate: value = var.toDate().startOfDay(); updateTimeSpec(); q->setDisplayFormat(defaultDateFormat); if (sectionNodes.isEmpty()) // ### safeguard for broken locale q->setDisplayFormat(QLatin1String("dd/MM/yyyy")); break; - case QVariant::DateTime: + case QMetaType::QDateTime: value = var; updateTimeSpec(); q->setDisplayFormat(defaultDateTimeFormat); if (sectionNodes.isEmpty()) // ### safeguard for broken locale q->setDisplayFormat(QLatin1String("dd/MM/yyyy hh:mm:ss")); break; - case QVariant::Time: + case QMetaType::QTime: value = QDateTime(QDATETIMEEDIT_DATE_INITIAL, var.toTime()); updateTimeSpec(); q->setDisplayFormat(defaultTimeFormat); @@ -2524,7 +2532,7 @@ void QDateTimeEditPrivate::updateEditFieldGeometry() QVariant QDateTimeEditPrivate::getZeroVariant() const { - Q_ASSERT(type == QVariant::DateTime); + Q_ASSERT(type == QMetaType::QDateTime); return QDateTime(QDATETIMEEDIT_DATE_INITIAL, QTime(), spec); } diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index 03994675ae1..8905ad4a9ca 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -195,7 +195,10 @@ protected: void paintEvent(QPaintEvent *event) override; void initStyleOption(QStyleOptionSpinBox *option) const; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = nullptr); +#endif + QDateTimeEdit(const QVariant &val, QMetaType::Type parserType, QWidget *parent = nullptr); private: Q_DECLARE_PRIVATE(QDateTimeEdit) Q_DISABLE_COPY(QDateTimeEdit) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index d54c0d0b20d..87e8af13825 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2250,17 +2250,17 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant a } const QPointF offset = contentOffset(); - switch (argument.type()) { - case QVariant::RectF: + switch (argument.userType()) { + case QMetaType::QRectF: argument = argument.toRectF().translated(-offset); break; - case QVariant::PointF: + case QMetaType::QPointF: argument = argument.toPointF() - offset; break; - case QVariant::Rect: + case QMetaType::QRect: argument = argument.toRect().translated(-offset.toPoint()); break; - case QVariant::Point: + case QMetaType::QPoint: argument = argument.toPoint() - offset; break; default: @@ -2268,14 +2268,14 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant a } const QVariant v = d->control->inputMethodQuery(query, argument); - switch (v.type()) { - case QVariant::RectF: + switch (v.userType()) { + case QMetaType::QRectF: return v.toRectF().translated(offset); - case QVariant::PointF: + case QMetaType::QPointF: return v.toPointF() + offset; - case QVariant::Rect: + case QMetaType::QRect: return v.toRect().translated(offset.toPoint()); - case QVariant::Point: + case QMetaType::QPoint: return v.toPoint() + offset.toPoint(); default: break; diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index 61ea81c8925..08428f673ed 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1081,7 +1081,7 @@ QSpinBoxPrivate::QSpinBoxPrivate() value = minimum; displayIntegerBase = 10; singleStep = QVariant((int)1); - type = QVariant::Int; + type = QMetaType::Int; } /*! @@ -1238,7 +1238,7 @@ QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() value = minimum; singleStep = QVariant(1.0); decimals = 2; - type = QVariant::Double; + type = QMetaType::Double; } /*! diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index d0ccd435b35..0ba74a20e0c 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -310,9 +310,9 @@ void QTextBrowserPrivate::setSource(const QUrl &url, QTextDocument::ResourceType if (url.isValid() && (newUrlWithoutFragment != currentUrlWithoutFragment || forceLoadOnSourceChange)) { QVariant data = q->loadResource(type, resolveUrl(url)); - if (data.type() == QVariant::String) { + if (data.userType() == QMetaType::QString) { txt = data.toString(); - } else if (data.type() == QVariant::ByteArray) { + } else if (data.userType() == QMetaType::QByteArray) { if (type == QTextDocument::HtmlResource) { #if QT_CONFIG(textcodec) QByteArray ba = data.toByteArray(); diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 10de7d0b9e3..913ca6ec164 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1502,7 +1502,7 @@ void QTextEdit::resizeEvent(QResizeEvent *e) QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); if (!doc->pageSize().isNull() - && alignmentProperty.type() == QVariant::Bool + && alignmentProperty.userType() == QMetaType::Bool && !alignmentProperty.toBool()) { d->_q_adjustScrollbars(); @@ -1547,7 +1547,7 @@ void QTextEditPrivate::relayoutDocument() width = lineWrapColumnOrWidth; else if (lineWrap == QTextEdit::NoWrap) { QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); - if (alignmentProperty.type() == QVariant::Bool && !alignmentProperty.toBool()) { + if (alignmentProperty.userType() == QMetaType::Bool && !alignmentProperty.toBool()) { width = 0; } @@ -1835,17 +1835,17 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argume } const QPointF offset(-d->horizontalOffset(), -d->verticalOffset()); - switch (argument.type()) { - case QVariant::RectF: + switch (argument.userType()) { + case QMetaType::QRectF: argument = argument.toRectF().translated(-offset); break; - case QVariant::PointF: + case QMetaType::QPointF: argument = argument.toPointF() - offset; break; - case QVariant::Rect: + case QMetaType::QRect: argument = argument.toRect().translated(-offset.toPoint()); break; - case QVariant::Point: + case QMetaType::QPoint: argument = argument.toPoint() - offset; break; default: @@ -1853,14 +1853,14 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argume } const QVariant v = d->control->inputMethodQuery(query, argument); - switch (v.type()) { - case QVariant::RectF: + switch (v.userType()) { + case QMetaType::QRectF: return v.toRectF().translated(offset); - case QVariant::PointF: + case QMetaType::QPointF: return v.toPointF() + offset; - case QVariant::Rect: + case QMetaType::QRect: return v.toRect().translated(offset.toPoint()); - case QVariant::Point: + case QMetaType::QPoint: return v.toPoint() + offset.toPoint(); default: break; From 49f143e19ca11ef48260a3aaaa4ddbe490cf81ab Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Tue, 26 Nov 2019 23:55:01 +0100 Subject: [PATCH 26/71] QSslCertificate: migrate to QRegularExpression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is part of the migration of qtbase from QRexExp to QRegularExpression. If support for regular expression is disabled, fixed string can still be used. [ChangeLog][QtCore][QSslCertificate] Add overload of fromPath that does not make use of QRegExp and deprecate the QRegExp variant. Task-number: QTBUG-72587 Change-Id: I507d8941cc7d70166da0948375dc421fe5e7d967 Reviewed-by: Mårten Nordheim --- .../code/src_network_ssl_qsslcertificate.cpp | 8 + src/network/ssl/qsslcertificate.cpp | 107 ++++++++++++- src/network/ssl/qsslcertificate.h | 20 ++- .../qsslcertificate/tst_qsslcertificate.cpp | 140 ++++++++++++++---- 4 files changed, 245 insertions(+), 30 deletions(-) diff --git a/src/network/doc/snippets/code/src_network_ssl_qsslcertificate.cpp b/src/network/doc/snippets/code/src_network_ssl_qsslcertificate.cpp index 12691da7a25..b381ae7b6e9 100644 --- a/src/network/doc/snippets/code/src_network_ssl_qsslcertificate.cpp +++ b/src/network/doc/snippets/code/src_network_ssl_qsslcertificate.cpp @@ -55,3 +55,11 @@ for (const QSslCertificate &cert : certs) { qDebug() << cert.issuerInfo(QSslCertificate::Organization); } //! [0] + +//! [1] +const auto certs = QSslCertificate::fromPath("C:/ssl/certificate.*.pem", + QSsl::Pem, QSslCertificate::Wildcard); +for (const QSslCertificate &cert : certs) { + qDebug() << cert.issuerInfo(QSslCertificate::Organization); +} +//! [1] diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 4820953468d..c179cf9c4a8 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -124,7 +124,9 @@ #if QT_CONFIG(schannel) #include "qsslsocket_schannel_p.h" #endif - +#if QT_CONFIG(regularexpression) +#include "qregularexpression.h" +#endif #include "qssl_p.h" #include "qsslcertificate.h" #include "qsslcertificate_p.h" @@ -462,7 +464,10 @@ QByteArray QSslCertificate::digest(QCryptographicHash::Algorithm algorithm) cons \since 5.0 */ +#if QT_DEPRECATED_SINCE(5,15) /*! + \obsolete + Searches all files in the \a path for certificates encoded in the specified \a format and returns them in a list. \a path must be a file or a pattern matching one or more files, as specified by \a syntax. @@ -537,6 +542,106 @@ QList QSslCertificate::fromPath(const QString &path, } return certs; } +#endif // QT_DEPRECATED_SINCE(5,15) + +/*! + \since 5.15 + + Searches all files in the \a path for certificates encoded in the + specified \a format and returns them in a list. \a path must be a file + or a pattern matching one or more files, as specified by \a syntax. + + Example: + + \snippet code/src_network_ssl_qsslcertificate.cpp 1 + + \sa fromData() +*/ +QList QSslCertificate::fromPath(const QString &path, + QSsl::EncodingFormat format, + PatternSyntax syntax) +{ + // $, (,), *, +, ., ?, [, ,], ^, {, | and }. + + // make sure to use the same path separators on Windows and Unix like systems. + QString sourcePath = QDir::fromNativeSeparators(path); + + // Find the path without the filename + QString pathPrefix = sourcePath.left(sourcePath.lastIndexOf(QLatin1Char('/'))); + + // Check if the path contains any special chars + int pos = -1; + +#if QT_CONFIG(regularexpression) + if (syntax == Wildcard) + pos = pathPrefix.indexOf(QRegularExpression(QLatin1String("[*?[]"))); + else if (syntax == RegExp) + pos = sourcePath.indexOf(QRegularExpression(QLatin1String("[\\$\\(\\)\\*\\+\\.\\?\\[\\]\\^\\{\\}\\|]"))); +#else + if (syntax == Wildcard || syntax == RegExp) + qWarning("Regular expression support is disabled in this build. Only fixed string can be searched"); + return QList(); +#endif + + if (pos != -1) { + // there was a special char in the path so cut of the part containing that char. + pathPrefix = pathPrefix.left(pos); + const int lastIndexOfSlash = pathPrefix.lastIndexOf(QLatin1Char('/')); + if (lastIndexOfSlash != -1) + pathPrefix = pathPrefix.left(lastIndexOfSlash); + else + pathPrefix.clear(); + } else { + // Check if the path is a file. + if (QFileInfo(sourcePath).isFile()) { + QFile file(sourcePath); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + return QSslCertificate::fromData(file.readAll(), format); + return QList(); + } + } + + // Special case - if the prefix ends up being nothing, use "." instead. + int startIndex = 0; + if (pathPrefix.isEmpty()) { + pathPrefix = QLatin1String("."); + startIndex = 2; + } + + // The path can be a file or directory. + QList certs; + +#if QT_CONFIG(regularexpression) + if (syntax == Wildcard) + sourcePath = QRegularExpression::wildcardToRegularExpression(sourcePath); + + QRegularExpression pattern(QRegularExpression::anchoredPattern(sourcePath)); +#endif + + QDirIterator it(pathPrefix, QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories); + while (it.hasNext()) { + QString filePath = startIndex == 0 ? it.next() : it.next().mid(startIndex); + +#if QT_CONFIG(regularexpression) + if (!pattern.match(filePath).hasMatch()) + continue; +#else + if (sourcePath != filePath) + continue; +#endif + + QFile file(filePath); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + certs += QSslCertificate::fromData(file.readAll(), format); + } + return certs; +} /*! Searches for and parses all certificates in \a device that are diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h index 69901b526c6..99937698881 100644 --- a/src/network/ssl/qsslcertificate.h +++ b/src/network/ssl/qsslcertificate.h @@ -84,6 +84,13 @@ public: EmailAddress }; + enum PatternSyntax { + RegExp, + Wildcard, + FixedString + }; + + explicit QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); explicit QSslCertificate(const QByteArray &data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem); QSslCertificate(const QSslCertificate &other); @@ -139,9 +146,20 @@ public: QByteArray toDer() const; QString toText() const; - static QList fromPath( +#if QT_DEPRECATED_SINCE(5,15) + QT_DEPRECATED_X("Use the overload not using QRegExp") static QList fromPath( const QString &path, QSsl::EncodingFormat format = QSsl::Pem, QRegExp::PatternSyntax syntax = QRegExp::FixedString); + + static QList fromPath( + const QString &path, QSsl::EncodingFormat format, + PatternSyntax syntax); +#else + static QList fromPath( + const QString &path, QSsl::EncodingFormat format = QSsl::Pem, + PatternSyntax syntax = FixedString); +#endif + static QList fromDevice( QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); static QList fromData( diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 14718ad373f..a7a81e9f0b0 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -86,6 +86,8 @@ private slots: void fromDevice(); void fromPath_data(); void fromPath(); + void fromPath_qregularexpression_data(); + void fromPath_qregularexpression(); void certInfo(); void certInfoQByteArray(); void task256066toPem(); @@ -434,7 +436,7 @@ void tst_QSslCertificate::subjectAlternativeNames() void tst_QSslCertificate::utf8SubjectNames() { QSslCertificate cert = QSslCertificate::fromPath(testDataDir + "certificates/cert-ss-san-utf8.pem", QSsl::Pem, - QRegExp::FixedString).first(); + QSslCertificate::FixedString).first(); QVERIFY(!cert.isNull()); // O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc., @@ -625,6 +627,88 @@ void tst_QSslCertificate::fromPath() numCerts); } +void tst_QSslCertificate::fromPath_qregularexpression_data() +{ + QTest::addColumn("path"); + QTest::addColumn("syntax"); + QTest::addColumn("pemencoding"); + QTest::addColumn("numCerts"); + + QTest::newRow("empty fixed pem") << QString() << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("empty fixed der") << QString() << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("empty regexp pem") << QString() << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("empty regexp der") << QString() << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("empty wildcard pem") << QString() << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("empty wildcard der") << QString() << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"certificates\" fixed pem") << (testDataDir + "certificates") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"certificates\" fixed der") << (testDataDir + "certificates") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"certificates\" regexp pem") << (testDataDir + "certificates") << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("\"certificates\" regexp der") << (testDataDir + "certificates") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"certificates\" wildcard pem") << (testDataDir + "certificates") << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("\"certificates\" wildcard der") << (testDataDir + "certificates") << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"certificates/cert.pem\" fixed pem") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::FixedString) << true << 1; + QTest::newRow("\"certificates/cert.pem\" fixed der") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"certificates/cert.pem\" regexp pem") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::RegExp) << true << 1; + QTest::newRow("\"certificates/cert.pem\" regexp der") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"certificates/cert.pem\" wildcard pem") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::Wildcard) << true << 1; + QTest::newRow("\"certificates/cert.pem\" wildcard der") << (testDataDir + "certificates/cert.pem") << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"certificates/*\" fixed pem") << (testDataDir + "certificates/*") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"certificates/*\" fixed der") << (testDataDir + "certificates/*") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"certificates/*\" regexp pem") << (testDataDir + "certificates/*") << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("\"certificates/*\" regexp der") << (testDataDir + "certificates/*") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"certificates/*\" wildcard pem") << (testDataDir + "certificates/*") << int(QSslCertificate::Wildcard) << true << 7; + QTest::newRow("\"certificates/ca*\" wildcard pem") << (testDataDir + "certificates/ca*") << int(QSslCertificate::Wildcard) << true << 1; + QTest::newRow("\"certificates/cert*\" wildcard pem") << (testDataDir + "certificates/cert*") << int(QSslCertificate::Wildcard) << true << 4; + QTest::newRow("\"certificates/cert-[sure]*\" wildcard pem") << (testDataDir + "certificates/cert-[sure]*") << int(QSslCertificate::Wildcard) << true << 3; + QTest::newRow("\"certificates/cert-[not]*\" wildcard pem") << (testDataDir + "certificates/cert-[not]*") << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("\"certificates/*\" wildcard der") << (testDataDir + "certificates/*") << int(QSslCertificate::Wildcard) << false << 2; + QTest::newRow("\"c*/c*.pem\" fixed pem") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"c*/c*.pem\" fixed der") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"c*/c*.pem\" regexp pem") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("\"c*/c*.pem\" regexp der") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"c*/c*.pem\" wildcard pem") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::Wildcard) << true << 5; + QTest::newRow("\"c*/c*.pem\" wildcard der") << (testDataDir + "c*/c*.pem") << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"d*/c*.pem\" fixed pem") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"d*/c*.pem\" fixed der") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"d*/c*.pem\" regexp pem") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("\"d*/c*.pem\" regexp der") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"d*/c*.pem\" wildcard pem") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("\"d*/c*.pem\" wildcard der") << (testDataDir + "d*/c*.pem") << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"c.*/c.*.pem\" fixed pem") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"c.*/c.*.pem\" fixed der") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"c.*/c.*.pem\" regexp pem") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::RegExp) << true << 5; + QTest::newRow("\"c.*/c.*.pem\" regexp der") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"c.*/c.*.pem\" wildcard pem") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("\"c.*/c.*.pem\" wildcard der") << (testDataDir + "c.*/c.*.pem") << int(QSslCertificate::Wildcard) << false << 0; + QTest::newRow("\"d.*/c.*.pem\" fixed pem") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("\"d.*/c.*.pem\" fixed der") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::FixedString) << false << 0; + QTest::newRow("\"d.*/c.*.pem\" regexp pem") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::RegExp) << true << 0; + QTest::newRow("\"d.*/c.*.pem\" regexp der") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::RegExp) << false << 0; + QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::Wildcard) << true << 0; + QTest::newRow("\"d.*/c.*.pem\" wildcard der") << (testDataDir + "d.*/c.*.pem") << int(QSslCertificate::Wildcard) << false << 0; +#ifdef Q_OS_LINUX + QTest::newRow("absolute path wildcard pem") << (testDataDir + "certificates/*.pem") << int(QSslCertificate::Wildcard) << true << 7; +#endif + + QTest::newRow("trailing-whitespace") << (testDataDir + "more-certificates/trailing-whitespace.pem") << int(QSslCertificate::FixedString) << true << 1; + QTest::newRow("no-ending-newline") << (testDataDir + "more-certificates/no-ending-newline.pem") << int(QSslCertificate::FixedString) << true << 1; + QTest::newRow("malformed-just-begin") << (testDataDir + "more-certificates/malformed-just-begin.pem") << int(QSslCertificate::FixedString) << true << 0; + QTest::newRow("malformed-just-begin-no-newline") << (testDataDir + "more-certificates/malformed-just-begin-no-newline.pem") << int(QSslCertificate::FixedString) << true << 0; +} + +void tst_QSslCertificate::fromPath_qregularexpression() +{ + QFETCH(QString, path); + QFETCH(int, syntax); + QFETCH(bool, pemencoding); + QFETCH(int, numCerts); + + QCOMPARE(QSslCertificate::fromPath(path, + pemencoding ? QSsl::Pem : QSsl::Der, + QSslCertificate::PatternSyntax(syntax)).size(), + numCerts); +} + void tst_QSslCertificate::certInfo() { // MD5 Fingerprint=B6:CF:57:34:DA:A9:73:21:82:F7:CF:4D:3D:85:31:88 @@ -711,7 +795,7 @@ void tst_QSslCertificate::certInfo() "55:ba:e7:fb:95:5d:91"; QSslCertificate cert = QSslCertificate::fromPath(testDataDir + "certificates/cert.pem", QSsl::Pem, - QRegExp::FixedString).first(); + QSslCertificate::FixedString).first(); QVERIFY(!cert.isNull()); QCOMPARE(cert.issuerInfo(QSslCertificate::Organization)[0], QString("CryptSoft Pty Ltd")); @@ -768,7 +852,7 @@ void tst_QSslCertificate::certInfo() void tst_QSslCertificate::certInfoQByteArray() { QSslCertificate cert = QSslCertificate::fromPath(testDataDir + "certificates/cert.pem", QSsl::Pem, - QRegExp::FixedString).first(); + QSslCertificate::FixedString).first(); QVERIFY(!cert.isNull()); // in this test, check the bytearray variants before the enum variants to see if @@ -820,7 +904,7 @@ void tst_QSslCertificate::nulInCN() QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/badguy-nul-cn.crt"); + QSslCertificate::fromPath(testDataDir + "more-certificates/badguy-nul-cn.crt", QSsl::Pem, QSslCertificate::FixedString); QCOMPARE(certList.size(), 1); const QSslCertificate &cert = certList.at(0); @@ -839,7 +923,7 @@ void tst_QSslCertificate::nulInSan() QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/badguy-nul-san.crt"); + QSslCertificate::fromPath(testDataDir + "more-certificates/badguy-nul-san.crt", QSsl::Pem, QSslCertificate::FixedString); QCOMPARE(certList.size(), 1); const QSslCertificate &cert = certList.at(0); @@ -859,7 +943,7 @@ void tst_QSslCertificate::nulInSan() void tst_QSslCertificate::largeSerialNumber() { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-serial-number.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-serial-number.pem", QSsl::Pem, QSslCertificate::FixedString); QCOMPARE(certList.size(), 1); @@ -871,7 +955,7 @@ void tst_QSslCertificate::largeSerialNumber() void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489 { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-expiration-date.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-expiration-date.pem", QSsl::Pem, QSslCertificate::FixedString); QCOMPARE(certList.size(), 1); @@ -884,7 +968,7 @@ void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489 void tst_QSslCertificate::blacklistedCertificates() { - QList blacklistedCerts = QSslCertificate::fromPath(testDataDir + "more-certificates/blacklisted*.pem", QSsl::Pem, QRegExp::Wildcard); + QList blacklistedCerts = QSslCertificate::fromPath(testDataDir + "more-certificates/blacklisted*.pem", QSsl::Pem, QSslCertificate::Wildcard); QVERIFY(blacklistedCerts.count() > 0); for (int a = 0; a < blacklistedCerts.count(); a++) { QVERIFY(blacklistedCerts.at(a).isBlacklisted()); @@ -893,15 +977,15 @@ void tst_QSslCertificate::blacklistedCertificates() void tst_QSslCertificate::selfsignedCertificates() { - QVERIFY(QSslCertificate::fromPath(testDataDir + "certificates/cert-ss.pem").first().isSelfSigned()); - QVERIFY(!QSslCertificate::fromPath(testDataDir + "certificates/cert.pem").first().isSelfSigned()); + QVERIFY(QSslCertificate::fromPath(testDataDir + "certificates/cert-ss.pem", QSsl::Pem, QSslCertificate::FixedString).first().isSelfSigned()); + QVERIFY(!QSslCertificate::fromPath(testDataDir + "certificates/cert.pem", QSsl::Pem, QSslCertificate::FixedString).first().isSelfSigned()); QVERIFY(!QSslCertificate().isSelfSigned()); } void tst_QSslCertificate::toText() { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-expiration-date.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-expiration-date.pem", QSsl::Pem, QSslCertificate::FixedString); QCOMPARE(certList.size(), 1); const QSslCertificate &cert = certList.at(0); @@ -943,7 +1027,7 @@ void tst_QSslCertificate::toText() void tst_QSslCertificate::multipleCommonNames() { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/test-cn-two-cns-cert.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/test-cn-two-cns-cert.pem", QSsl::Pem, QSslCertificate::FixedString); QVERIFY(certList.count() > 0); QStringList commonNames = certList[0].subjectInfo(QSslCertificate::CommonName); @@ -954,14 +1038,14 @@ void tst_QSslCertificate::multipleCommonNames() void tst_QSslCertificate::subjectAndIssuerAttributes() { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/test-cn-with-drink-cert.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/test-cn-with-drink-cert.pem", QSsl::Pem, QSslCertificate::FixedString); QVERIFY(certList.count() > 0); QList attributes = certList[0].subjectInfoAttributes(); QVERIFY(attributes.contains(QByteArray("favouriteDrink"))); attributes.clear(); - certList = QSslCertificate::fromPath(testDataDir + "more-certificates/natwest-banking.pem"); + certList = QSslCertificate::fromPath(testDataDir + "more-certificates/natwest-banking.pem", QSsl::Pem, QSslCertificate::FixedString); QVERIFY(certList.count() > 0); QByteArray shortName("1.3.6.1.4.1.311.60.2.1.3"); @@ -996,17 +1080,17 @@ void tst_QSslCertificate::verify() errors.clear(); // Verify a valid cert signed by a CA - QList caCerts = QSslCertificate::fromPath(testDataDir + "verify-certs/cacert.pem"); + QList caCerts = QSslCertificate::fromPath(testDataDir + "verify-certs/cacert.pem", QSsl::Pem, QSslCertificate::FixedString); QSslSocket::addDefaultCaCertificate(caCerts.first()); - toVerify = QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem"); + toVerify = QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem", QSsl::Pem, QSslCertificate::FixedString); errors = QSslCertificate::verify(toVerify); VERIFY_VERBOSE(errors.count() == 0); errors.clear(); // Test a blacklisted certificate - toVerify = QSslCertificate::fromPath(testDataDir + "verify-certs/test-addons-mozilla-org-cert.pem"); + toVerify = QSslCertificate::fromPath(testDataDir + "verify-certs/test-addons-mozilla-org-cert.pem", QSsl::Pem, QSslCertificate::FixedString); errors = QSslCertificate::verify(toVerify); bool foundBlack = false; foreach (const QSslError &error, errors) { @@ -1019,7 +1103,7 @@ void tst_QSslCertificate::verify() errors.clear(); // This one is expired and untrusted - toVerify = QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-serial-number.pem"); + toVerify = QSslCertificate::fromPath(testDataDir + "more-certificates/cert-large-serial-number.pem", QSsl::Pem, QSslCertificate::FixedString); errors = QSslCertificate::verify(toVerify); VERIFY_VERBOSE(errors.contains(QSslError(QSslError::SelfSignedCertificate, toVerify[0]))); VERIFY_VERBOSE(errors.contains(QSslError(QSslError::CertificateExpired, toVerify[0]))); @@ -1027,15 +1111,15 @@ void tst_QSslCertificate::verify() toVerify.clear(); // This one is signed by a valid cert, but the signer is not a valid CA - toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-not-ca-cert.pem").first(); - toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem").first(); + toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-not-ca-cert.pem", QSsl::Pem, QSslCertificate::FixedString).first(); + toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem", QSsl::Pem, QSslCertificate::FixedString).first(); errors = QSslCertificate::verify(toVerify); VERIFY_VERBOSE(errors.contains(QSslError(QSslError::InvalidCaCertificate, toVerify[1]))); toVerify.clear(); // This one is signed by a valid cert, and the signer is a valid CA - toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-is-ca-cert.pem").first(); - toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-ca-cert.pem").first(); + toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-is-ca-cert.pem", QSsl::Pem, QSslCertificate::FixedString).first(); + toVerify << QSslCertificate::fromPath(testDataDir + "verify-certs/test-intermediate-ca-cert.pem", QSsl::Pem, QSslCertificate::FixedString).first(); errors = QSslCertificate::verify(toVerify); VERIFY_VERBOSE(errors.count() == 0); @@ -1065,7 +1149,7 @@ QString tst_QSslCertificate::toString(const QList& errors) void tst_QSslCertificate::extensions() { QList certList = - QSslCertificate::fromPath(testDataDir + "more-certificates/natwest-banking.pem"); + QSslCertificate::fromPath(testDataDir + "more-certificates/natwest-banking.pem", QSsl::Pem, QSslCertificate::FixedString); QVERIFY(certList.count() > 0); QSslCertificate cert = certList[0]; @@ -1163,7 +1247,7 @@ void tst_QSslCertificate::extensions() void tst_QSslCertificate::extensionsCritical() { QList certList = - QSslCertificate::fromPath(testDataDir + "verify-certs/test-addons-mozilla-org-cert.pem"); + QSslCertificate::fromPath(testDataDir + "verify-certs/test-addons-mozilla-org-cert.pem", QSsl::Pem, QSslCertificate::FixedString); QVERIFY(certList.count() > 0); QSslCertificate cert = certList[0]; @@ -1284,12 +1368,12 @@ void tst_QSslCertificate::version_data() QTest::newRow("null certificate") << QSslCertificate() << QByteArray(); QList certs; - certs << QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem"); + certs << QSslCertificate::fromPath(testDataDir + "verify-certs/test-ocsp-good-cert.pem", QSsl::Pem, QSslCertificate::FixedString); QTest::newRow("v3 certificate") << certs.first() << QByteArrayLiteral("3"); certs.clear(); - certs << QSslCertificate::fromPath(testDataDir + "certificates/cert.pem"); + certs << QSslCertificate::fromPath(testDataDir + "certificates/cert.pem", QSsl::Pem, QSslCertificate::FixedString); QTest::newRow("v1 certificate") << certs.first() << QByteArrayLiteral("1"); } @@ -1326,7 +1410,7 @@ void tst_QSslCertificate::pkcs12() QVERIFY(ok); f.close(); - QList leafCert = QSslCertificate::fromPath(testDataDir + QLatin1String("pkcs12/leaf.crt")); + QList leafCert = QSslCertificate::fromPath(testDataDir + QLatin1String("pkcs12/leaf.crt"), QSsl::Pem, QSslCertificate::FixedString); QVERIFY(!leafCert.isEmpty()); QCOMPARE(cert, leafCert.first()); @@ -1341,7 +1425,7 @@ void tst_QSslCertificate::pkcs12() QVERIFY(!leafKey.isNull()); QCOMPARE(key, leafKey); - QList caCert = QSslCertificate::fromPath(testDataDir + QLatin1String("pkcs12/inter.crt")); + QList caCert = QSslCertificate::fromPath(testDataDir + QLatin1String("pkcs12/inter.crt"), QSsl::Pem, QSslCertificate::FixedString); QVERIFY(!caCert.isEmpty()); QVERIFY(!caCerts.isEmpty()); From cb3152086c61e7c51ed1c5f8c5946364e19abc4d Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 21 Jan 2020 15:33:11 +0100 Subject: [PATCH 27/71] Introduce Q_PROPERTY attribute REQUIRED This is meant to correspond to required properties in QML. Change-Id: I2645981e13f7423bc86b48370c165b3cfe2aaa62 Task-number: QTBUG-81561 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../doc/snippets/code/doc_src_properties.cpp | 1 + .../doc/src/objectmodel/properties.qdoc | 6 +++++ src/corelib/kernel/qmetaobject.cpp | 15 ++++++++++++ src/corelib/kernel/qmetaobject.h | 1 + src/corelib/kernel/qmetaobject_p.h | 3 ++- src/tools/moc/generator.cpp | 2 ++ src/tools/moc/moc.cpp | 4 ++++ src/tools/moc/moc.h | 1 + tests/auto/tools/moc/allmocs_baseline_in.json | 13 ++++++++++ tests/auto/tools/moc/tst_moc.cpp | 24 +++++++++++++++++++ 10 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/corelib/doc/snippets/code/doc_src_properties.cpp b/src/corelib/doc/snippets/code/doc_src_properties.cpp index b72c9d13e1e..a67945bbcf2 100644 --- a/src/corelib/doc/snippets/code/doc_src_properties.cpp +++ b/src/corelib/doc/snippets/code/doc_src_properties.cpp @@ -61,6 +61,7 @@ Q_PROPERTY(type name [USER bool] [CONSTANT] [FINAL]) + [REQUIRED] //! [0] diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc index 9ef08cce073..680e5598f09 100644 --- a/src/corelib/doc/src/objectmodel/properties.qdoc +++ b/src/corelib/doc/src/objectmodel/properties.qdoc @@ -144,6 +144,12 @@ optimizations in some cases, but is not enforced by moc. Care must be taken never to override a \c FINAL property. + \li The presence of the \c REQUIRED attribute indicates that the property + should be set by a user of the class. This is not enforced by moc, and is + mostly useful for classes exposed to QML. In QML, classes with REQUIRED + properties cannot be instantiated unless all REQUIRED properties have + been set. + \endlist The \c READ, \c WRITE, and \c RESET functions can be inherited. diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 347fb1eb877..37f5acc5c57 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -3572,6 +3572,21 @@ bool QMetaProperty::isFinal() const return flags & Final; } +/*! + \since 5.15 + Returns \c true if the property is required; otherwise returns \c false. + + A property is final if the \c{Q_PROPERTY()}'s \c REQUIRED attribute + is set. +*/ +bool QMetaProperty::isRequired() const +{ + if (!mobj) + return false; + int flags = mobj->d.data[handle + 2]; + return flags & Required; +} + /*! \obsolete diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index fcd92afd898..beb85becaed 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -266,6 +266,7 @@ public: bool isUser(const QObject *obj = nullptr) const; bool isConstant() const; bool isFinal() const; + bool isRequired() const; bool isFlagType() const; bool isEnumType() const; diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 56e3d6cb446..277109dac46 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -85,7 +85,8 @@ enum PropertyFlags { User = 0x00100000, ResolveUser = 0x00200000, Notify = 0x00400000, - Revisioned = 0x00800000 + Revisioned = 0x00800000, + Required = 0x01000000, }; enum MethodFlags { diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 034e8469180..8d4fb2efc6c 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -864,6 +864,8 @@ void Generator::generateProperties() flags |= Constant; if (p.final) flags |= Final; + if (p.required) + flags |= Required; fprintf(out, " %4d, ", stridx(p.name)); generateTypeInfo(p.type); diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index d7a1af0a185..b562416c314 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1238,6 +1238,9 @@ void Moc::createPropertyDef(PropertyDef &propDef) } else if(l[0] == 'F' && l == "FINAL") { propDef.final = true; continue; + } else if (l[0] == 'R' && l == "REQUIRED") { + propDef.required = true; + continue; } QByteArray v, v2; @@ -1960,6 +1963,7 @@ QJsonObject PropertyDef::toJson() const prop[QLatin1String("constant")] = constant; prop[QLatin1String("final")] = final; + prop[QLatin1String("required")] = required; if (revision > 0) prop[QLatin1String("revision")] = revision; diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 5d1ae0ad6dc..04814b85a1c 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -137,6 +137,7 @@ struct PropertyDef int revision = 0; bool constant = false; bool final = false; + bool required = false; QJsonObject toJson() const; }; diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json index 8cb397190c3..48cac07012c 100644 --- a/tests/auto/tools/moc/allmocs_baseline_in.json +++ b/tests/auto/tools/moc/allmocs_baseline_in.json @@ -275,6 +275,7 @@ "final": false, "name": "flags", "read": "flags", + "required": false, "scriptable": true, "stored": true, "type": "Flags", @@ -299,6 +300,7 @@ "final": false, "name": "flags", "read": "flags", + "required": false, "scriptable": true, "stored": true, "type": "Foo::Bar::Flags", @@ -311,6 +313,7 @@ "final": false, "name": "flagsList", "read": "flagsList", + "required": false, "scriptable": true, "stored": true, "type": "QList", @@ -1988,6 +1991,7 @@ "final": false, "name": "blah", "read": "blah", + "required": false, "scriptable": true, "stored": true, "type": "A::SomeEnum", @@ -2088,6 +2092,7 @@ "final": false, "name": "blah", "read": "blah", + "required": false, "scriptable": true, "stored": true, "type": "A::SomeEnum", @@ -2257,6 +2262,7 @@ "final": false, "name": "gadgetPoperty", "read": "gadgetPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Gadget::SomeEnum", @@ -2268,6 +2274,7 @@ "final": false, "name": "objectPoperty", "read": "objectPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Object::SomeEnum", @@ -2291,6 +2298,7 @@ "final": false, "name": "nestedGadgetPoperty", "read": "nestedGadgetPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Nested::Gadget::SomeEnum", @@ -2314,6 +2322,7 @@ "final": false, "name": "nestedObjectPoperty", "read": "nestedObjectPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Nested::Object::SomeEnum", @@ -2442,6 +2451,7 @@ "final": false, "name": "gadgetPoperty", "read": "gadgetPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Gadget::SomeEnum", @@ -2453,6 +2463,7 @@ "final": false, "name": "objectPoperty", "read": "objectPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Object::SomeEnum", @@ -2476,6 +2487,7 @@ "final": false, "name": "nestedGadgetPoperty", "read": "nestedGadgetPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Nested::Gadget::SomeEnum", @@ -2499,6 +2511,7 @@ "final": false, "name": "nestedObjectPoperty", "read": "nestedObjectPoperty", + "required": false, "scriptable": true, "stored": true, "type": "Nested::Object::SomeEnum", diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 6b202f79a6a..0f801fe902f 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -719,6 +719,7 @@ private slots: void cxx17Namespaces(); void cxxAttributes(); void mocJsonOutput(); + void requiredProperties(); signals: void sigWithUnsignedArg(unsigned foo); @@ -4025,6 +4026,29 @@ void tst_Moc::mocJsonOutput() QVERIFY2(actualOutput == expectedOutput, showPotentialDiff(actualOutput, expectedOutput).constData()); } +class RequiredTest :public QObject +{ + Q_OBJECT + + Q_PROPERTY(int required MEMBER m_required REQUIRED) + Q_PROPERTY(int notRequired MEMBER m_notRequired) + +private: + int m_required; + int m_notRequired; +}; + +void tst_Moc::requiredProperties() +{ + QMetaObject mo = RequiredTest::staticMetaObject; + QMetaProperty required = mo.property(mo.indexOfProperty("required")); + QVERIFY(required.isValid()); + QVERIFY(required.isRequired()); + QMetaProperty notRequired = mo.property(mo.indexOfProperty("notRequired")); + QVERIFY(notRequired.isValid()); + QVERIFY(!notRequired.isRequired()); +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS From 2d57dc2f33582833efff5ccc950ec863765eaedb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 23 Jan 2020 13:25:18 +0100 Subject: [PATCH 28/71] Allow benign errors when writing PNGs Otherwise we can end up not writing anything due to recoverable libpng error reports. Change-Id: I4d4db42305482babffbe2bcf25535a35b51502a9 Fixes: QTBUG-81604 Reviewed-by: Boudewijn Rempt Reviewed-by: Eirik Aavitsland --- src/gui/image/qpnghandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 4ab45337b0b..fa67d38f7a0 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -915,7 +915,10 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_i return false; } - png_set_error_fn(png_ptr, 0, 0, qt_png_warning); + png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning); +#ifdef PNG_BENIGN_ERRORS_SUPPORTED + png_set_benign_errors(png_ptr, 1); +#endif info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { From 474a5e2f3fe7d5fdcb930b0b6da896cd4d9c209c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 22 Jan 2020 12:38:53 +0100 Subject: [PATCH 29/71] Fix handling of the DEFINES_DEBUG/DEFINES_RELEASE variables Modifications of the CONFIG variable in the project file wasn't taken into account in the handling of DEFINES_DEBUG and DEFINES_RELEASE, because it was happening before the evaluation of the project file. Moved the handling code into default_post.prf where the other *_DEBUG and *_RELEASE variables are handled. In practice that means: to avoid the addition of the NDEBUG define one has to remove NDEBUG from DEFINES_RELEASE. This amends commit 1456b809. [ChangeLog][qmake] To remove the NDEBUG define that is added by default in MSVC mkspecs, write DEFINES_RELEASE -= NDEBUG in your .pro file. Fixes: QTBUG-81569 Change-Id: I2ea5628653275a4e48ad002977d34969c0663815 Reviewed-by: Alexandru Croitor --- mkspecs/features/default_post.prf | 2 ++ mkspecs/features/default_pre.prf | 6 ------ qmake/doc/src/qmake-manual.qdoc | 7 +++++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 0e41b825ec5..1d79f5c958a 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -64,11 +64,13 @@ debug { QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG + DEFINES += $$DEFINES_DEBUG } else { QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE + DEFINES += $$DEFINES_RELEASE } stack_protector_strong { diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index b2629d04c09..1c24bf071a8 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -26,10 +26,4 @@ CONFIG = \ unset(today) } -CONFIG(debug, debug|release) { - DEFINES += $$DEFINES_DEBUG -} else { - DEFINES += $$DEFINES_RELEASE -} - load(toolchain) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index cd8129a5392..3a1d79cb797 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1168,7 +1168,7 @@ \section1 DEFINES_DEBUG Specifies preprocessor defines for the debug configuration. The values of - this variable get added to \l{DEFINES} before the project is loaded. This + this variable get added to \l{DEFINES} after the project is loaded. This variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. @@ -1178,10 +1178,13 @@ \section1 DEFINES_RELEASE Specifies preprocessor defines for the release configuration. The values of - this variable get added to \l{DEFINES} before the project is loaded. This + this variable get added to \l{DEFINES} after the project is loaded. This variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \note For MSVC mkspecs, this variable contains the value \c NDEBUG by + default. + This variable was introduced in Qt 5.13.2. \target DEF_FILE From 4d8a515a230ca9864a94830fd376a1d3ecbe6886 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 15 Jan 2020 20:53:21 +0100 Subject: [PATCH 30/71] QXmlStreamReader: early return in case of malformed attributes There's no point at keep raising errors after encountering the first malformed attribute. Change-Id: Idb37e577ea96c3bd850b3caf008fe3ecd57dd32e Reviewed-by: Thiago Macieira --- src/corelib/serialization/qxmlstream.cpp | 7 +- .../qxmlstream/data/duplicatedattributes.ref | 8003 +++++++++++++++++ .../qxmlstream/data/duplicatedattributes.xml | 1002 +++ 3 files changed, 9010 insertions(+), 2 deletions(-) create mode 100644 tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.ref create mode 100644 tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.xml diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 500e0aa6beb..dfa36ea6427 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -50,6 +50,7 @@ #endif #include #include +#include #ifndef QT_BOOTSTRAPPED #include #else @@ -1582,6 +1583,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix) */ void QXmlStreamReaderPrivate::resolveTag() { + const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); }); int n = attributeStack.size(); if (namespaceProcessing) { @@ -1649,7 +1651,10 @@ void QXmlStreamReaderPrivate::resolveTag() if (attributes[j].name() == attribute.name() && attributes[j].namespaceUri() == attribute.namespaceUri() && (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName())) + { raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName())); + return; + } } } @@ -1680,8 +1685,6 @@ void QXmlStreamReaderPrivate::resolveTag() attribute.m_isDefault = true; attributes.append(attribute); } - - attributeStack.clear(); } void QXmlStreamReaderPrivate::resolvePublicNamespaces() diff --git a/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.ref b/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.ref new file mode 100644 index 00000000000..a578de8bb4e --- /dev/null +++ b/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.ref @@ -0,0 +1,8003 @@ +StartDocument( ) +Invalid( name="a" qualifiedName="a" + Attribute( name="b" qualifiedName="b" value="1" ) + + Attribute( name="b" qualifiedName="b" value="2" ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + + Attribute( ) + ) +ERROR: Attribute 'b' redefined. diff --git a/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.xml b/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.xml new file mode 100644 index 00000000000..5f8b1003e94 --- /dev/null +++ b/tests/auto/corelib/serialization/qxmlstream/data/duplicatedattributes.xml @@ -0,0 +1,1002 @@ + From e83c4e813840b8632ec44f00ee3daf2ba1b18133 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 21 Jan 2020 14:43:01 +0100 Subject: [PATCH 31/71] QXmlStreamReader: fix memory leak On some inputs a QXmlStreamReaderPrivate may allocate another QXmlStreamReaderPrivate as its entityResolver. Which, recursively, may allocate yet another one. This "chain" of QXmlStreamReaderPrivate objects was managed using raw pointers, and a leak was possible by resetting one of these pointers to nullptr without freeing the corresponding object. Change-Id: I2c6e1f023a2ed68b2b1857db25c53cce7f6bd3e7 Reviewed-by: Sona Kurazyan --- src/corelib/serialization/qxmlstream.cpp | 7 ++++--- src/corelib/serialization/qxmlstream_p.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index dfa36ea6427..7ff87885a53 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -69,6 +69,8 @@ public: \ { return QString::fromLatin1(sourceText); } \ private: #endif +#include + QT_BEGIN_NAMESPACE #include "qxmlstream_p.h" @@ -848,7 +850,7 @@ void QXmlStreamReaderPrivate::init() #endif attributeStack.clear(); attributeStack.reserve(16); - entityParser = nullptr; + entityParser.reset(); hasCheckedStartDocument = false; normalizeLiterals = false; hasSeenTag = false; @@ -881,7 +883,7 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value) if (!entityParser) - entityParser = new QXmlStreamReaderPrivate(q); + entityParser = qt_make_unique(q); else entityParser->init(); entityParser->inParseEntity = true; @@ -911,7 +913,6 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate() #endif free(sym_stack); free(state_stack); - delete entityParser; } diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index cde66a48a34..9c94e6d4346 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -981,7 +981,7 @@ public: QString resolveUndeclaredEntity(const QString &name); void parseEntity(const QString &value); - QXmlStreamReaderPrivate *entityParser; + std::unique_ptr entityParser; bool scanAfterLangleBang(); bool scanPublicOrSystem(); From ca85e1246eacfe7ba570882a674e313be3b808f8 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 20 Jan 2020 13:44:30 +0100 Subject: [PATCH 32/71] updateSystemPrivate(): fix handling of empty string as non-null QVariant QSystemLocale::query() can return an empty string for PositiveSign on Windows, apparently. In any case, we shouldn't be taking .at(0) of a QString without checking it's non-empty. Fixes: QTBUG-81530 Change-Id: I4d496a2650362f225d02998bd7b8be9fd783edb4 Reviewed-by: Friedemann Kleint --- src/corelib/text/qlocale.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index d8c4b416248..26db674a99d 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -734,23 +734,23 @@ static void updateSystemPrivate() globalLocaleData.m_script_id = res.toInt(); res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_decimal = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_group = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_zero = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::NegativeSign, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_minus = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_plus = res.toString().at(0).unicode(); } #endif // !QT_NO_SYSTEMLOCALE From 08d4caadd734e640b3c5521306ff2ea0cfe600d0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 15 Jan 2020 11:02:22 +0100 Subject: [PATCH 33/71] Prepare callers for QChar-to-QString change in some QLocale returns The assorted characters making up numbers can potentially need surrogate pairs for their encoding, so Qt6 shall make the methods returning them return QString instead of QChar. Prepare callers of these methods to cope when that happens. This follows up on commit f91af791cc3be1dfb9645ed4ebba10a7d9f74134, which announced the intent to change the return type. Task-number: QTBUG-81053 Change-Id: I99896c1d4fc2e24758c6486eaca32fd915b9a673 Reviewed-by: Thiago Macieira --- src/widgets/widgets/qspinbox.cpp | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index 61ea81c8925..ae4394dc97f 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1168,11 +1168,11 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, } else { num = locale.toInt(copy, &ok); if (!ok && (max >= 1000 || min <= -1000)) { - const QChar sep = locale.groupSeparator(); - const QChar doubleSep[2] = {sep, sep}; - if (copy.contains(sep) && !copy.contains(QString(doubleSep, 2))) { + const QString sep(locale.groupSeparator()); + const QString doubleSep = sep + sep; + if (copy.contains(sep) && !copy.contains(doubleSep)) { QString copy2 = copy; - copy2.remove(locale.groupSeparator()); + copy2.remove(sep); num = locale.toInt(copy2, &ok); } } @@ -1314,6 +1314,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, const bool plus = max >= 0; const bool minus = min <= 0; + const QString group(locale.groupSeparator()); + const uint groupUcs = (group.size() > 1 && group.at(0).isHighSurrogate() + ? QChar::surrogateToUcs4(group.at(0), group.at(1)) + : group.at(0).unicode()); switch (len) { case 0: state = max != min ? QValidator::Intermediate : QValidator::Invalid; @@ -1360,14 +1364,15 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, } } } else { - const QChar last = copy.at(len - 1); - const QChar secondLast = copy.at(len - 2); - if ((last == locale.groupSeparator() || last.isSpace()) - && (secondLast == locale.groupSeparator() || secondLast.isSpace())) { + const QChar last = copy.back(); + const bool groupEnd = copy.endsWith(group); + const QStringView head(copy.constData(), groupEnd ? len - group.size() : len - 1); + const QChar secondLast = head.back(); + if ((groupEnd || last.isSpace()) && (head.endsWith(group) || secondLast.isSpace())) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; - } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) { + } else if (last.isSpace() && (!QChar::isSpace(groupUcs) || secondLast.isSpace())) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; @@ -1381,26 +1386,31 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok; if (!ok) { - if (locale.groupSeparator().isPrint()) { - if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) { + if (QChar::isPrint(groupUcs)) { + if (max < 1000 && min > -1000 && copy.contains(group)) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; } const int len = copy.size(); - for (int i=0; i Date: Wed, 22 Jan 2020 17:35:06 +0100 Subject: [PATCH 34/71] Mac: disable application menu items during modal session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default menu items in the application menu are not part of a traversable menu object hierarchy, so we never find a menubar. Since that is only the case for those items, we can disable them during any modal session. Change-Id: Ie8d8db274176237de664c6e5ebfe5015e13800e4 Fixes: QTBUG-80273 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview_menus.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview_menus.mm b/src/plugins/platforms/cocoa/qnsview_menus.mm index a55fd97eb71..b6cd8322823 100644 --- a/src/plugins/platforms/cocoa/qnsview_menus.mm +++ b/src/plugins/platforms/cocoa/qnsview_menus.mm @@ -84,7 +84,8 @@ static bool selectorIsCutCopyPaste(SEL selector) menuParent = menuObject->menuParent(); } - if (menubar && menubar->cocoaWindow() != self.platformWindow) + // we have no menubar parent for the application menu items, e.g About and Preferences + if (!menubar || menubar->cocoaWindow() != self.platformWindow) return NO; } From d31910709c568d4f4e01a341196c3bffbeb7aae0 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 22 Jan 2020 16:43:47 +0100 Subject: [PATCH 35/71] macOS: Decide enabled state of menu items correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use automatic menu enabling, so the only property that should define whether the item in the menu is enabled or not is QCocoaMenuItem::enabled, which will then get read from validateMenuItem:, and synced to the native menu item by AppKit. Change-Id: I860d05bf4675c9bc2058d2ede44b5ac3551453b6 Fixes: QTBUG-81375 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 8c4fca0d297..90d5180fed5 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -334,7 +334,7 @@ void QCocoaMenu::setEnabled(bool enabled) bool QCocoaMenu::isEnabled() const { - return m_attachedItem ? m_attachedItem.enabled : m_enabled && m_parentEnabled; + return m_enabled && m_parentEnabled; } void QCocoaMenu::setVisible(bool visible) From 39396409656b12940ffe9b715f13e23ac4290eca Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Jan 2020 15:48:15 +0100 Subject: [PATCH 36/71] Fix some qdoc-warnings src/corelib/tools/qmap.cpp:1199: (qdoc) warning: Can't link to 'QMultiMap::unite()' src/gui/kernel/qevent.cpp:949: (qdoc) warning: Unknown command '\see' src/gui/painting/qpaintengine_raster.cpp:344: (qdoc) warning: clang found diagnostics parsing \fn Type QRasterPaintEngine::type() const error: unknown type name 'Type' src/gui/doc/src/qtgui.qdoc:45: (qdoc) warning: Can't link to 'Build with CMake' examples/widgets/doc/src/gallery.qdoc:28: (qdoc) warning: Cannot find file 'widgets/gallery/gallery.pro' or 'widgets/gallery/gallery.pyproject' src/widgets/kernel/qwidget.cpp:5950: (qdoc) warning: Can't link to 'setFilePath' src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut() Change-Id: I2395af854efebef719d4762da466f69f7c5aab9e Reviewed-by: Paul Wicking --- examples/widgets/doc/src/gallery.qdoc | 2 +- src/corelib/tools/qmap.cpp | 2 +- src/gui/doc/src/qtgui.qdoc | 2 +- src/gui/kernel/qevent.cpp | 2 +- src/gui/painting/qpaintengine_raster.cpp | 2 +- src/widgets/kernel/qshortcut.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/widgets/doc/src/gallery.qdoc b/examples/widgets/doc/src/gallery.qdoc index a262374ce63..455099ddce7 100644 --- a/examples/widgets/doc/src/gallery.qdoc +++ b/examples/widgets/doc/src/gallery.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/gallery + \example gallery \title Widgets Gallery Example \ingroup examples-widgets \brief The Widgets Gallery example shows widgets relevant for designing UIs. diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index d747a8cda40..a51e59b2b88 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -1203,7 +1203,7 @@ void QMapDataBase::freeData(QMapDataBase *d) key is common to both maps, the resulting map will contain the key multiple times. - \sa QMultiMap::unite() + \sa QMap::unite() */ /*! \typedef QMap::Iterator diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index 392b6040cb1..f8a3ce84aab 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -62,7 +62,7 @@ \include module-use.qdocinc using qt module \quotefile overview/using-qt-gui.cmake - See also the \l[QtDoc]{Build with CMake} overview. + See also the \l{Build with CMake} overview. \section2 Building with qmake diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 3362294435b..da77290c30c 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -946,7 +946,7 @@ QWheelEvent::~QWheelEvent() \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). \endlist - \see pixelDelta() + \sa pixelDelta() */ /*! diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index bc65ed56e33..10920c38fe1 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -342,7 +342,7 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : */ /*! - \fn Type QRasterPaintEngine::type() const + \fn QPaintEngine::Type QRasterPaintEngine::type() const \reimp */ diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index d469279ea5d..039699a004e 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -545,7 +545,7 @@ QShortcut::QShortcut(QWidget *parent) match the \a key sequence. Depending on the ambiguity of the event, the shortcut will call the \a member function, or the \a ambiguousMember function, if the key press was in the shortcut's - \a context. + \a shortcutContext. */ QShortcut::QShortcut(const QKeySequence &key, QWidget *parent, const char *member, const char *ambiguousMember, diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 954b00eb35b..b85bb62917e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5957,9 +5957,9 @@ void QWidget::setWindowTitle(const QString &title) \note On \macos, window icons represent the active document, and will not be displayed unless a file path has also been - set using setFilePath. + set using setWindowFilePath. - \sa windowTitle, setFilePath + \sa windowTitle, setWindowFilePath */ QIcon QWidget::windowIcon() const { From 2344e5cc3104b7d599f4d2a96bbfd8530223a08e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 12 Dec 2019 08:51:20 +0100 Subject: [PATCH 37/71] Move QOpenGLTexture and related classes from QtGui to QtOpenGL Task-number: QTBUG-74409 Change-Id: Ied825dd7cb92365505a4aa43fd67488024160341 Reviewed-by: Laszlo Agocs Reviewed-by: Qt CI Bot --- src/gui/opengl/opengl.pri | 7 ------- src/opengl/opengl.pro | 7 +++++++ src/{gui => }/opengl/qopenglpixeltransferoptions.cpp | 2 +- src/{gui => }/opengl/qopenglpixeltransferoptions.h | 6 +++--- src/{gui => }/opengl/qopengltexture.cpp | 0 src/{gui => }/opengl/qopengltexture.h | 10 +++++----- src/{gui => }/opengl/qopengltexture_p.h | 4 ++-- src/{gui => }/opengl/qopengltexturehelper.cpp | 2 +- src/{gui => }/opengl/qopengltexturehelper_p.h | 4 ++-- src/platformsupport/vkconvenience/qvkconvenience.cpp | 4 +++- src/platformsupport/vkconvenience/vkconvenience.pro | 2 ++ src/plugins/platforms/wasm/qwasmbackingstore.cpp | 2 +- src/plugins/platforms/wasm/qwasmcompositor.cpp | 2 +- src/plugins/platforms/wasm/qwasmcompositor.h | 2 +- src/plugins/platforms/wasm/wasm.pro | 1 + src/src.pro | 1 + tests/auto/gui/qopengl/tst_qopengl.cpp | 2 +- 17 files changed, 32 insertions(+), 26 deletions(-) rename src/{gui => }/opengl/qopenglpixeltransferoptions.cpp (99%) rename src/{gui => }/opengl/qopenglpixeltransferoptions.h (95%) rename src/{gui => }/opengl/qopengltexture.cpp (100%) rename src/{gui => }/opengl/qopengltexture.h (99%) rename src/{gui => }/opengl/qopengltexture_p.h (98%) rename src/{gui => }/opengl/qopengltexturehelper.cpp (99%) rename src/{gui => }/opengl/qopengltexturehelper_p.h (99%) diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index d9f0e0d6cc7..f1e20194172 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -17,10 +17,6 @@ qtConfig(opengl) { opengl/qopenglversionfunctionsfactory_p.h \ opengl/qopenglvertexarrayobject.h \ opengl/qopengltextureblitter.h \ - opengl/qopengltexture.h \ - opengl/qopengltexture_p.h \ - opengl/qopengltexturehelper_p.h \ - opengl/qopenglpixeltransferoptions.h \ opengl/qopenglextrafunctions.h \ opengl/qopenglprogrambinarycache_p.h @@ -33,9 +29,6 @@ qtConfig(opengl) { opengl/qopenglversionfunctionsfactory.cpp \ opengl/qopenglvertexarrayobject.cpp \ opengl/qopengltextureblitter.cpp \ - opengl/qopengltexture.cpp \ - opengl/qopengltexturehelper.cpp \ - opengl/qopenglpixeltransferoptions.cpp \ opengl/qopenglprogrambinarycache.cpp !qtConfig(opengles2) { diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 6c2a9698209..ba9590ec073 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -19,7 +19,11 @@ HEADERS += \ qopenglpaintdevice.h \ qopenglpaintdevice_p.h \ qopenglpaintengine_p.h \ + qopenglpixeltransferoptions.h \ qopenglshadercache_p.h \ + qopengltexture.h \ + qopengltexture_p.h \ + qopengltexturehelper_p.h \ qopengltexturecache_p.h \ qopengltextureglyphcache_p.h \ qopengltextureuploader_p.h \ @@ -33,6 +37,9 @@ SOURCES += \ qopenglgradientcache.cpp \ qopenglpaintdevice.cpp \ qopenglpaintengine.cpp \ + qopenglpixeltransferoptions.cpp \ + qopengltexture.cpp \ + qopengltexturehelper.cpp \ qopengltexturecache.cpp \ qopengltextureglyphcache.cpp \ qopengltextureuploader.cpp \ diff --git a/src/gui/opengl/qopenglpixeltransferoptions.cpp b/src/opengl/qopenglpixeltransferoptions.cpp similarity index 99% rename from src/gui/opengl/qopenglpixeltransferoptions.cpp rename to src/opengl/qopenglpixeltransferoptions.cpp index b0d953d76b1..aa1af3b092f 100644 --- a/src/gui/opengl/qopenglpixeltransferoptions.cpp +++ b/src/opengl/qopenglpixeltransferoptions.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/opengl/qopenglpixeltransferoptions.h similarity index 95% rename from src/gui/opengl/qopenglpixeltransferoptions.h rename to src/opengl/qopenglpixeltransferoptions.h index 195543ae903..252c2a2f1e4 100644 --- a/src/gui/opengl/qopenglpixeltransferoptions.h +++ b/src/opengl/qopenglpixeltransferoptions.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -40,7 +40,7 @@ #ifndef QOPENGLPIXELUPLOADOPTIONS_H #define QOPENGLPIXELUPLOADOPTIONS_H -#include +#include #if !defined(QT_NO_OPENGL) @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE class QOpenGLPixelTransferOptionsData; -class Q_GUI_EXPORT QOpenGLPixelTransferOptions +class Q_OPENGL_EXPORT QOpenGLPixelTransferOptions { public: QOpenGLPixelTransferOptions(); diff --git a/src/gui/opengl/qopengltexture.cpp b/src/opengl/qopengltexture.cpp similarity index 100% rename from src/gui/opengl/qopengltexture.cpp rename to src/opengl/qopengltexture.cpp diff --git a/src/gui/opengl/qopengltexture.h b/src/opengl/qopengltexture.h similarity index 99% rename from src/gui/opengl/qopengltexture.h rename to src/opengl/qopengltexture.h index 539b6aa7b20..8eba2724df5 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/opengl/qopengltexture.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -40,7 +40,7 @@ #ifndef QOPENGLABSTRACTTEXTURE_H #define QOPENGLABSTRACTTEXTURE_H -#include +#include #ifndef QT_NO_OPENGL @@ -54,7 +54,7 @@ class QDebug; class QOpenGLTexturePrivate; class QOpenGLPixelTransferOptions; -class Q_GUI_EXPORT QOpenGLTexture +class Q_OPENGL_EXPORT QOpenGLTexture { Q_GADGET public: @@ -641,7 +641,7 @@ public: float levelofDetailBias() const; #ifndef QT_NO_DEBUG_STREAM - friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QOpenGLTexture *t); + friend Q_OPENGL_EXPORT QDebug operator<<(QDebug dbg, const QOpenGLTexture *t); #endif private: @@ -653,7 +653,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTexture::Features) #ifndef QT_NO_DEBUG_STREAM -Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QOpenGLTexture *t); +Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLTexture *t); #endif QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengltexture_p.h b/src/opengl/qopengltexture_p.h similarity index 98% rename from src/gui/opengl/qopengltexture_p.h rename to src/opengl/qopengltexture_p.h index 9f3457ad0a0..1dc08016443 100644 --- a/src/gui/opengl/qopengltexture_p.h +++ b/src/opengl/qopengltexture_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -53,7 +53,7 @@ #ifndef QT_NO_OPENGL -#include +#include #include "private/qobject_p.h" #include "qopengltexture.h" #include "qopengl.h" diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/opengl/qopengltexturehelper.cpp similarity index 99% rename from src/gui/opengl/qopengltexturehelper.cpp rename to src/opengl/qopengltexturehelper.cpp index 6709edc4e2b..8f1473ecc9d 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/opengl/qopengltexturehelper.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/opengl/qopengltexturehelper_p.h similarity index 99% rename from src/gui/opengl/qopengltexturehelper_p.h rename to src/opengl/qopengltexturehelper_p.h index 62d0125daff..a62a47d0290 100644 --- a/src/gui/opengl/qopengltexturehelper_p.h +++ b/src/opengl/qopengltexturehelper_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtOpenGL module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -51,7 +51,7 @@ // We mean it. // -#include +#include #ifndef QT_NO_OPENGL diff --git a/src/platformsupport/vkconvenience/qvkconvenience.cpp b/src/platformsupport/vkconvenience/qvkconvenience.cpp index acde1d1bda6..59de3353339 100644 --- a/src/platformsupport/vkconvenience/qvkconvenience.cpp +++ b/src/platformsupport/vkconvenience/qvkconvenience.cpp @@ -39,7 +39,9 @@ #include "qvkconvenience_p.h" -#include +#if QT_CONFIG(opengl) +#include +#endif QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/vkconvenience/vkconvenience.pro b/src/platformsupport/vkconvenience/vkconvenience.pro index ee540024cff..f3ada5768a6 100644 --- a/src/platformsupport/vkconvenience/vkconvenience.pro +++ b/src/platformsupport/vkconvenience/vkconvenience.pro @@ -2,6 +2,8 @@ TARGET = QtVulkanSupport MODULE = vulkan_support QT = core-private gui-private +qtConfig(opengl): QT += opengl + CONFIG += static internal_module DEFINES += QT_NO_CAST_FROM_ASCII diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp index 7e8a3825124..a7423e9c47e 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp +++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp @@ -31,7 +31,7 @@ #include "qwasmwindow.h" #include "qwasmcompositor.h" -#include +#include #include #include #include diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index e9c45599716..6bf0d697707 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -31,7 +31,7 @@ #include "qwasmwindow.h" #include "qwasmstylepixmaps_p.h" -#include +#include #include #include diff --git a/src/plugins/platforms/wasm/qwasmcompositor.h b/src/plugins/platforms/wasm/qwasmcompositor.h index 98f4a79b27e..6b59d87a0a2 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.h +++ b/src/plugins/platforms/wasm/qwasmcompositor.h @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -43,6 +42,7 @@ QT_BEGIN_NAMESPACE class QWasmWindow; class QWasmScreen; class QOpenGLContext; +class QOpenGLTexture; class QOpenGLTextureBlitter; class QWasmCompositedWindow diff --git a/src/plugins/platforms/wasm/wasm.pro b/src/plugins/platforms/wasm/wasm.pro index f8c81755257..9087c484d50 100644 --- a/src/plugins/platforms/wasm/wasm.pro +++ b/src/plugins/platforms/wasm/wasm.pro @@ -50,6 +50,7 @@ wasmfonts.base = ../../../3rdparty/wasm RESOURCES += wasmfonts qtConfig(opengl) { + QT += opengl SOURCES += qwasmbackingstore.cpp HEADERS += qwasmbackingstore.h } diff --git a/src/src.pro b/src/src.pro index 0b8ae6d3084..3445ca0faba 100644 --- a/src/src.pro +++ b/src/src.pro @@ -221,6 +221,7 @@ qtConfig(gui) { SUBDIRS += src_openglextensions SUBDIRS += src_opengl src_plugins.depends += src_opengl + src_platformsupport.depends += src_opengl } src_plugins.depends += src_gui src_platformsupport src_platformheaders src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 3b39c8c4740..3a7ad6dad54 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -27,13 +27,13 @@ ****************************************************************************/ #include +#include #include #include #include #include #include #include -#include #include #include #include From 16885a6033405e1ed28ac42f9dfec7339975e85e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 Jan 2020 14:16:21 +0100 Subject: [PATCH 38/71] De-duplicate the last occurrence of calling a depend_command Use the central callExtraCompilerDependCommand in the last place where the code to call an extra compiler's depend_command was duplicated. Note that this is in the "Bad hack" section. We're making this hack less bad, but the comment still applies. Change-Id: Iaa857af20ca46b2d73053d3e264c63124c87a41b Reviewed-by: Oliver Wolff --- qmake/generators/win32/msvc_vcproj.cpp | 44 ++++++++++---------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 867b14faea9..80f444820a0 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1481,36 +1481,24 @@ void VcprojGenerator::initResourceFiles() // Bad hack, please look away ------------------------------------- QString rcc_dep_cmd = project->values("rcc.depend_command").join(' '); if(!rcc_dep_cmd.isEmpty()) { - ProStringList qrc_files = project->values("RESOURCES"); + const QStringList qrc_files = project->values("RESOURCES").toQStringList(); QStringList deps; - if(!qrc_files.isEmpty()) { - for (int i = 0; i < qrc_files.count(); ++i) { - char buff[256]; - QString dep_cmd = replaceExtraCompilerVariables( - rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell); - - dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); - if(canExecute(dep_cmd)) { - dep_cmd.prepend(QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && ")); - if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { - QString indeps; - while(!feof(proc)) { - int read_in = (int)fread(buff, 1, 255, proc); - if(!read_in) - break; - indeps += QByteArray(buff, read_in); - } - QT_PCLOSE(proc); - if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), - FileFixifyFromOutdir); - } - } - } - vcProject.ResourceFiles.addFiles(deps); + const QString rcc_dep_cd_cmd = QLatin1String("cd ") + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && "); + for (const QString &qrc_file : qrc_files) { + callExtraCompilerDependCommand("rcc", + rcc_dep_cd_cmd, + rcc_dep_cmd, + qrc_file, + QString(), + true, // dep_lines + &deps, + false, // existingDepsOnly + true // checkCommandavailability + ); } + vcProject.ResourceFiles.addFiles(deps); } // You may look again -------------------------------------------- From 41b919919eb05299cc382de0da7d25892a120dd5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 Jan 2020 14:28:39 +0100 Subject: [PATCH 39/71] Purge the dep_cd_cmd parameter from callExtraCompilerDependCommand We always pass the same value. The builtins are also using exactly this "cd command" unconditionally. This deduplicates the code at the call sites of callExtraCompilerDependCommand a bit. Change-Id: I5c412c815d50afdac55e1b45021f37f2545ce8f0 Reviewed-by: Oliver Wolff --- qmake/generators/makefile.cpp | 16 ++++++---------- qmake/generators/makefile.h | 2 +- qmake/generators/win32/msvc_objectmodel.cpp | 5 +---- qmake/generators/win32/msvc_vcproj.cpp | 4 ---- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7e471f126cb..8e46da521f6 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1851,7 +1851,6 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString & } void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler, - const QString &dep_cd_cmd, const QString &tmp_dep_cmd, const QString &inpf, const QString &tmp_out, @@ -1864,7 +1863,10 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); if (checkCommandAvailability && !canExecute(dep_cmd)) return; - dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); + dep_cmd = QLatin1String("cd ") + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ") + + fixEnvVariables(dep_cmd); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QByteArray depData; while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) @@ -1916,12 +1918,6 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) FileFixifyFromOutdir); const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); const QString tmp_dep_cmd = project->values(ProKey(*it + ".depend_command")).join(' '); - QString dep_cd_cmd; - if (!tmp_dep_cmd.isEmpty()) { - dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); - } const bool dep_lines = (config.indexOf("dep_lines") != -1); const ProStringList &vars = project->values(ProKey(*it + ".variables")); if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) @@ -2035,7 +2031,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) deps += findDependencies(inpf); inputs += Option::fixPathToTargetOS(inpf, false); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf, tmp_out, dep_lines, &deps, existingDepsOnly); } } @@ -2084,7 +2080,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3) cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf, tmp_out, dep_lines, &deps, existingDepsOnly); //use the depend system to find includes of these included files QStringList inc_deps; diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index ab970c966fd..a96b9c54da5 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -84,7 +84,7 @@ protected: void writeExtraVariables(QTextStream &t); void writeExtraTargets(QTextStream &t); QString resolveDependency(const QDir &outDir, const QString &file); - void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd, + void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &tmp_dep_cmd, const QString &inpf, const QString &tmp_out, bool dep_lines, QStringList *deps, bool existingDepsOnly, diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 2b39a4baaaa..3002ce889c9 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2351,10 +2351,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (!tmp_dep.isEmpty()) deps = tmp_dep; if (!tmp_dep_cmd.isEmpty()) { - const QString dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); - Project->callExtraCompilerDependCommand(extraCompilerName, dep_cd_cmd, tmp_dep_cmd, + Project->callExtraCompilerDependCommand(extraCompilerName, tmp_dep_cmd, inFile, out, true, // dep_lines &deps, diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 80f444820a0..e117f472e09 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1483,12 +1483,8 @@ void VcprojGenerator::initResourceFiles() if(!rcc_dep_cmd.isEmpty()) { const QStringList qrc_files = project->values("RESOURCES").toQStringList(); QStringList deps; - const QString rcc_dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); for (const QString &qrc_file : qrc_files) { callExtraCompilerDependCommand("rcc", - rcc_dep_cd_cmd, rcc_dep_cmd, qrc_file, QString(), From 236a47ff7af54f4108a2d716784b61778ef93af2 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Thu, 16 Jan 2020 10:20:39 +0200 Subject: [PATCH 40/71] Android: JNI_OnLoad return JNI_VERSION_1_6 instead of JNI_VERSION_1_4 Update instance of old code using JNI_VERSION_1_4 to make the code consistent. Change-Id: I779696738caa3b844f4adf33104b4328dba748a5 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Alex Blasche --- src/plugins/platforms/android/androidjnimain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index fd2644717ed..1c7800358fa 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -900,7 +900,7 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) uenv.venv = nullptr; m_javaVM = nullptr; - if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) { + if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) { __android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed"); return -1; } @@ -922,5 +922,5 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) if (threadSetter.thread()) threadSetter.thread()->setObjectName("QtMainLoopThread"); __android_log_print(ANDROID_LOG_INFO, "Qt", "qt started"); - return JNI_VERSION_1_4; + return JNI_VERSION_1_6; } From b5193881e54ec3f3fe496654d23584eb5f96b692 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Jan 2020 15:05:46 +0100 Subject: [PATCH 41/71] Make QMatrix4x4::projectedRotate public The function is used by QGraphicsRotation, which is in widgets. QGraphicsRotation is marked as a friend, so that it can access the private method. QtQuick needs access to the same method, so internally it declares a "fake" QGraphicsRotation class, just so that it can private access. This breaks now that QtQuick needs to do QT += opengl, which implies widgets and thus ends up including the header file that also declares QGraphicsRotation. So instead of these hacks, let's make the function public, but remain \internal in terms of docs. Change-Id: I671f68c9d7ab0aac985e0b583f63f3ee962567dc Reviewed-by: Jarek Kobus Reviewed-by: Laszlo Agocs --- src/gui/math3d/qmatrix4x4.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 1439bfac597..4ad6cceaea4 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -187,6 +187,7 @@ public: friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m); #endif + void projectedRotate(float angle, float x, float y, float z); private: float m[4][4]; // Column-major order to match OpenGL. int flagBits; // Flag bits from the enum below. @@ -206,10 +207,6 @@ private: explicit QMatrix4x4(int) { } QMatrix4x4 orthonormalInverse() const; - - void projectedRotate(float angle, float x, float y, float z); - - friend class QGraphicsRotation; }; QT_WARNING_PUSH From 089d54f06ff327f5212cb08fdbcb540066357dd5 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 19 Jan 2020 19:40:56 +0100 Subject: [PATCH 42/71] Sync behavior and documentation of QFoo::setItemDelegate() QComboBox::setItemDelegate() does delete the old delegate which is in constrast to all other setItemDelegate() functions which is quite confusing. Sync in by *not* deleting the delegate in QComboBox::setItemDelegate() and adjust the documentation to explicitly state that the ownership is *not* passed to the affected classes. [ChangeLog][QtWidgets][QComboBox] QComobBox::setItemDelegates no longer deletes the previous delegate set. Fixes: QTBUG-72483 Change-Id: I89c8e53903e7c9924a980c57b83ce40f5866e6ae Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/dialogs/qfiledialog.cpp | 3 +++ src/widgets/itemviews/qdatawidgetmapper.cpp | 3 +++ src/widgets/widgets/qcombobox.cpp | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index e24d308d659..6b82669f074 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2015,6 +2015,9 @@ QStringList QFileDialog::history() const Sets the item delegate used to render items in the views in the file dialog to the given \a delegate. + Any existing delegate will be removed, but not deleted. QFileDialog + does not take ownership of \a delegate. + \warning You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()} diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index 24039c42f6c..74100c077ef 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -383,6 +383,9 @@ QAbstractItemModel *QDataWidgetMapper::model() const data from the model into the widget and from the widget to the model, using QAbstractItemDelegate::setEditorData() and QAbstractItemDelegate::setModelData(). + Any existing delegate will be removed, but not deleted. QDataWidgetMapper + does not take ownership of \a delegate. + The delegate also decides when to apply data and when to change the editor, using QAbstractItemDelegate::commitData() and QAbstractItemDelegate::closeEditor(). diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index d786c7ff83b..785de350902 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2096,6 +2096,9 @@ QAbstractItemDelegate *QComboBox::itemDelegate() const Sets the item \a delegate for the popup list view. The combobox takes ownership of the delegate. + Any existing delegate will be removed, but not deleted. QComboBox + does not take ownership of \a delegate. + \warning You should not share the same instance of a delegate between comboboxes, widget mappers or views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the @@ -2110,7 +2113,6 @@ void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate) qWarning("QComboBox::setItemDelegate: cannot set a 0 delegate"); return; } - delete view()->itemDelegate(); view()->setItemDelegate(delegate); } From a11267c5320324cce19496313e2f7f8cdce9d8f7 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 8 Jan 2020 20:18:17 +0100 Subject: [PATCH 43/71] QTextBrowser: deprecate signal highlighted(QString) Deprecate QTextBrowser::highlighted(QString) to avoid the use of qOverloadOf<>. Task-number: QTBUG-80906 Change-Id: I757622c976f7540ecef9225026299ebb0b90d007 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qtextbrowser.cpp | 37 ++++++++++++++-------------- src/widgets/widgets/qtextbrowser.h | 3 +++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 0ba74a20e0c..78fde94fadf 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -152,6 +152,16 @@ public: QTextCursor prevFocus; int lastKeypadScrollValue; #endif + void emitHighlighted(const QUrl &url) + { + Q_Q(QTextBrowser); + emit q->highlighted(url); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + emit q->highlighted(url.toString()); +#endif + } }; Q_DECLARE_TYPEINFO(QTextBrowserPrivate::HistoryEntry, Q_MOVABLE_TYPE); @@ -256,24 +266,20 @@ void QTextBrowserPrivate::_q_activateAnchor(const QString &href) void QTextBrowserPrivate::_q_highlightLink(const QString &anchor) { - Q_Q(QTextBrowser); if (anchor.isEmpty()) { #ifndef QT_NO_CURSOR if (viewport->cursor().shape() != Qt::PointingHandCursor) oldCursor = viewport->cursor(); viewport->setCursor(oldCursor); #endif - emit q->highlighted(QUrl()); - emit q->highlighted(QString()); + emitHighlighted(QUrl()); } else { #ifndef QT_NO_CURSOR viewport->setCursor(Qt::PointingHandCursor); #endif const QUrl url = resolveUrl(anchor); - emit q->highlighted(url); - // convenience to ease connecting to QStatusBar::showMessage(const QString &) - emit q->highlighted(url.toString()); + emitHighlighted(url); } } @@ -383,8 +389,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url, QTextDocument::ResourceType } #ifdef QT_KEYPAD_NAVIGATION lastKeypadScrollValue = vbar->value(); - emit q->highlighted(QUrl()); - emit q->highlighted(QString()); + emitHighlighted(QUrl()); #endif #ifndef QT_NO_CURSOR @@ -559,8 +564,7 @@ void QTextBrowserPrivate::keypadMove(bool next) // Ensure that the new selection is highlighted. const QString href = control->anchorAtCursor(); QUrl url = resolveUrl(href); - emit q->highlighted(url); - emit q->highlighted(url.toString()); + emitHighlighted(url); } else { // Scroll vbar->setValue(scrollYOffset); @@ -575,8 +579,7 @@ void QTextBrowserPrivate::keypadMove(bool next) hbar->setValue(savedXOffset); vbar->setValue(scrollYOffset); - emit q->highlighted(QUrl()); - emit q->highlighted(QString()); + emitHighlighted(QUrl()); } } #endif @@ -619,8 +622,7 @@ void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry &entry) Q_Q(QTextBrowser); const QString href = prevFocus.charFormat().anchorHref(); QUrl url = resolveUrl(href); - emit q->highlighted(url); - emit q->highlighted(url.toString()); + emitHighlighted(url); #endif } @@ -927,6 +929,7 @@ void QTextBrowser::doSetSource(const QUrl &url, QTextDocument::ResourceType type /*! \fn void QTextBrowser::highlighted(const QString &link) \overload + \obsolete Convenience signal that allows connecting to a slot that takes just a QString, like for example QStatusBar's @@ -1127,8 +1130,7 @@ bool QTextBrowser::focusNextPrevChild(bool next) if (d->prevFocus != d->control->textCursor() && d->control->textCursor().hasSelection()) { const QString href = d->control->anchorAtCursor(); QUrl url = d->resolveUrl(href); - emit highlighted(url); - emit highlighted(url.toString()); + emitHighlighted(url); } d->prevFocus = d->control->textCursor(); #endif @@ -1136,8 +1138,7 @@ bool QTextBrowser::focusNextPrevChild(bool next) } else { #ifdef QT_KEYPAD_NAVIGATION // We assume we have no highlight now. - emit highlighted(QUrl()); - emit highlighted(QString()); + emitHighlighted(QUrl()); #endif } return QTextEdit::focusNextPrevChild(next); diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h index 33e5b3980c4..4b3ec491ee0 100644 --- a/src/widgets/widgets/qtextbrowser.h +++ b/src/widgets/widgets/qtextbrowser.h @@ -107,7 +107,10 @@ Q_SIGNALS: void historyChanged(); void sourceChanged(const QUrl &); void highlighted(const QUrl &); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_VERSION_X_5_15("Use QTextBrowser::highlighted(QUrl) instead") void highlighted(const QString &); +#endif void anchorClicked(const QUrl &); protected: From 5c3b5efd40b3ab14cc6406a0dca62dfb14b03d46 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 10 Jan 2020 22:11:12 +0100 Subject: [PATCH 44/71] QMenu: don't crash when another popup is closed when a popup is closed When closing a popup (submenu) triggers closing another popup (the menu) programatically it can happen that QApplicationPrivate::popupWidgets is destroyed. Therefore we have to check if popupWidgets is still valid after the focus change event was delivered. Fixes: QTBUG-81222 Change-Id: Ide3a6897e43f389d396a80d8b158f7c8eb04e3aa Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qapplication.cpp | 4 +- .../auto/widgets/widgets/qmenu/tst_qmenu.cpp | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 842c0ea9e6d..68f6b72d20e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3762,7 +3762,9 @@ void QApplicationPrivate::closePopup(QWidget *popup) if (QWidget *fw = aw->focusWidget()) fw->setFocus(Qt::PopupFocusReason); - if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + // can become nullptr due to setFocus() above + if (QApplicationPrivate::popupWidgets && + QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard grabForPopup(aw); } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 3dc7b05af97..d7d3a934f8b 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -114,6 +115,7 @@ private slots: void QTBUG30595_rtl_submenu(); void QTBUG20403_nested_popup_on_shortcut_trigger(); void QTBUG47515_widgetActionEnterLeave(); + void QTBUG8122_widgetActionCrashOnClose(); void QTBUG_10735_crashWithDialog(); #ifdef Q_OS_MAC @@ -1352,6 +1354,60 @@ void tst_QMenu::QTBUG47515_widgetActionEnterLeave() } } +void tst_QMenu::QTBUG8122_widgetActionCrashOnClose() +{ + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QSKIP("Window activation is not supported"); + if (QGuiApplication::platformName() == QLatin1String("cocoa")) + QSKIP("See QTBUG-63031"); +#ifdef Q_OS_WINRT + QSKIP("WinRT does not support QTest::mouseMove"); +#endif + + const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); + QRect geometry(QPoint(), availableGeometry.size() / 3); + geometry.moveCenter(availableGeometry.center()); + QPoint pointOutsideMenu = geometry.bottomRight() - QPoint(5, 5); + + QMainWindow topLevel; + topLevel.setGeometry(geometry); + + auto menuBar = topLevel.menuBar(); + auto menu = menuBar->addMenu("Menu"); + auto wAct = new QWidgetAction(menu); + auto spinBox1 = new QSpinBox(menu); + wAct->setDefaultWidget(spinBox1); + menu->addAction(wAct); + auto subMenu = menu->addMenu("Submenu"); + auto nextMenuAct = menu->addMenu(subMenu); + auto wAct2 = new QWidgetAction(menu); + auto spinBox2 = new QSpinBox(menu); + wAct2->setDefaultWidget(spinBox2); + subMenu->addAction(wAct2); + QObject::connect(spinBox2, &QSpinBox::editingFinished, menu, &QMenu::hide); + + topLevel.show(); + topLevel.setWindowTitle(QTest::currentTestFunction()); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); + QWindow *topLevelWindow = topLevel.windowHandle(); + QVERIFY(topLevelWindow); + + const QPoint menuActionPos = menuBar->mapTo(&topLevel, menuBar->actionGeometry(menu->menuAction()).center()); + QTest::mouseClick(topLevelWindow, Qt::LeftButton, Qt::KeyboardModifiers(), menuActionPos); + QVERIFY(QTest::qWaitForWindowExposed(menu)); + + QPoint w1Center = topLevel.mapFromGlobal(spinBox1->mapToGlobal(spinBox1->rect().center())); + QTest::mouseClick(topLevelWindow, Qt::LeftButton, Qt::KeyboardModifiers(), w1Center); + menu->setActiveAction(nextMenuAct); + QVERIFY(QTest::qWaitForWindowExposed(subMenu)); + + QPoint w2Center = topLevel.mapFromGlobal(spinBox2->mapToGlobal(spinBox2->rect().center())); + QTest::mouseClick(topLevelWindow, Qt::LeftButton, Qt::KeyboardModifiers(), w2Center); + QTest::mouseMove(topLevelWindow, topLevel.mapFromGlobal(pointOutsideMenu)); + QTRY_VERIFY(menu->isHidden()); +} + + class MyMenu : public QMenu { Q_OBJECT From bb42b7d8b2fe8508074bc4574679893c6cf4fbd5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 6 Jan 2020 10:26:49 +0100 Subject: [PATCH 45/71] Make sure the focus is passed on correctly when back-tabbing When the tested widget has a focus proxy, then we should check if the current focus widget is not the same as that focus proxy before setting it to be the widget that gets focus. This ensures that when back-tabbing from a widget like QDoubleSpinBox that it will not get stuck inside that widget and will back-tab to the next correct one. Fixes: QTBUG-81097 Change-Id: I3f689c7715da7f3ce8c3d2f616041528f5778a2f Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qapplication.cpp | 3 +- .../widgets/kernel/qwidget/tst_qwidget.cpp | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ef76265f8b6..ce32fd39a8d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2139,7 +2139,8 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool && !(!next && focusProxy && test->isAncestorOf(focusProxy)) && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) - && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { + && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test)) + && f != focusProxy) { w = test; if (seenWindow) focusWidgetAfterWindow = true; diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 371738ad275..b5d174f340a 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #if defined(Q_OS_OSX) #include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile. @@ -187,6 +188,7 @@ private slots: void tabOrderNoChange2(); void appFocusWidgetWithFocusProxyLater(); void appFocusWidgetWhenLosingFocusProxy(); + void explicitTabOrderWithComplexWidget(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void activation(); #endif @@ -2086,6 +2088,32 @@ void tst_QWidget::appFocusWidgetWhenLosingFocusProxy() QCOMPARE(QApplication::focusWidget(), lineEdit); } +void tst_QWidget::explicitTabOrderWithComplexWidget() +{ + // Check that handling tab/backtab with a widget comprimised of other widgets + // handles tabbing correctly + Container window; + auto lineEditOne = new QLineEdit; + window.box->addWidget(lineEditOne); + auto lineEditTwo = new QLineEdit; + window.box->addWidget(lineEditTwo); + QWidget::setTabOrder(lineEditOne, lineEditTwo); + lineEditOne->setFocus(); + window.show(); + QApplication::setActiveWindow(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QTRY_COMPARE(QApplication::focusWidget(), lineEditOne); + + window.tab(); + QTRY_COMPARE(QApplication::focusWidget(), lineEditTwo); + window.tab(); + QTRY_COMPARE(QApplication::focusWidget(), lineEditOne); + window.backTab(); + QTRY_COMPARE(QApplication::focusWidget(), lineEditTwo); + window.backTab(); + QTRY_COMPARE(QApplication::focusWidget(), lineEditOne); +} + #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void tst_QWidget::activation() { From ba1e880fbb2aacb550980bc2de35246bdcc38481 Mon Sep 17 00:00:00 2001 From: Indiana Kernick Date: Sat, 14 Dec 2019 05:31:48 +0000 Subject: [PATCH 46/71] QScrollArea: fix off-by-one error in ensureWidgetVisible If focusRect was 5 pixels past the right side of the viewport, then the scroll area would need to be scrolled by 5 pixels. The error arises because of this: focusRect.right() - d->viewport->width() == 4 focusRect.right() is still inside the rectangle but width is not. So one has to be added. Likewise for focusRect.bottom() and height. Change-Id: Ice47a7758d136b2e4bdcbe25a33a015b37f500c1 Fixes: QTBUG-80093 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qscrollarea.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index 68aa545082c..c36ec98f9a4 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -490,14 +490,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma if (focusRect.width() > visibleRect.width()) d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2); else if (focusRect.right() > visibleRect.right()) - d->hbar->setValue(focusRect.right() - d->viewport->width()); + d->hbar->setValue(focusRect.right() - d->viewport->width() + 1); else if (focusRect.left() < visibleRect.left()) d->hbar->setValue(focusRect.left()); if (focusRect.height() > visibleRect.height()) d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2); else if (focusRect.bottom() > visibleRect.bottom()) - d->vbar->setValue(focusRect.bottom() - d->viewport->height()); + d->vbar->setValue(focusRect.bottom() - d->viewport->height() + 1); else if (focusRect.top() < visibleRect.top()) d->vbar->setValue(focusRect.top()); } From f3d3c095a6bda505384ef56acab57b985d94fac5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 6 Dec 2019 16:51:41 +0100 Subject: [PATCH 47/71] Register QColorSpace as a QtGui metatype Helps pass it through QVariant, and needed for QML support. Change-Id: Id161ff9b8f81ad55a7ee7a7c4c614bdf74bca4a1 Reviewed-by: Andy Nichols --- src/corelib/kernel/qmetatype.cpp | 1 + src/corelib/kernel/qmetatype.h | 7 ++++--- src/gui/kernel/qguivariant.cpp | 1 + src/gui/painting/qcolorspace.cpp | 9 +++++++++ src/gui/painting/qcolorspace.h | 2 ++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index af9a2e0dd2d..46900be1a4b 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -252,6 +252,7 @@ struct DefinedTypesFilter { \value QPolygon QPolygon \value QPolygonF QPolygonF \value QColor QColor + \value QColorSpace QColorSpace \value QSizeF QSizeF \value QRectF QRectF \value QLine QLine diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 825f7674251..4f70eb4c6d1 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -175,6 +175,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(QVector4D, 84, QVector4D) \ F(QQuaternion, 85, QQuaternion) \ F(QPolygonF, 86, QPolygonF) \ + F(QColorSpace, 87, QColorSpace) \ #define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\ @@ -437,7 +438,7 @@ public: FirstCoreType = Bool, LastCoreType = QCborMap, FirstGuiType = QFont, - LastGuiType = QPolygonF, + LastGuiType = QColorSpace, FirstWidgetsType = QSizePolicy, LastWidgetsType = QSizePolicy, HighestInternalId = LastWidgetsType, @@ -472,12 +473,12 @@ public: QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73, QCursor = 74, QKeySequence = 75, QPen = 76, QTextLength = 77, QTextFormat = 78, QMatrix = 79, QTransform = 80, QMatrix4x4 = 81, QVector2D = 82, - QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86, + QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86, QColorSpace = 87, // Widget types QSizePolicy = 121, LastCoreType = QCborMap, - LastGuiType = QPolygonF, + LastGuiType = QColorSpace, User = 1024 }; #endif diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index 596b7e44fdb..215b2b1d743 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -41,6 +41,7 @@ #include "qbitmap.h" #include "qbrush.h" #include "qcolor.h" +#include "qcolorspace.h" #include "qcursor.h" #include "qfont.h" #include "qimage.h" diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp index 0fb0e9ee336..7ebd5f1bf48 100644 --- a/src/gui/painting/qcolorspace.cpp +++ b/src/gui/painting/qcolorspace.cpp @@ -744,6 +744,15 @@ QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace &color return d_ptr->transformationToColorSpace(colorspace.d_ptr); } +/*! + Returns the color space as a QVariant. + \since 5.15 +*/ +QColorSpace::operator QVariant() const +{ + return QVariant(QMetaType::QColorSpace, this); +} + /***************************************************************************** QColorSpace stream functions *****************************************************************************/ diff --git a/src/gui/painting/qcolorspace.h b/src/gui/painting/qcolorspace.h index e6bc62d58a6..08c9944301a 100644 --- a/src/gui/painting/qcolorspace.h +++ b/src/gui/painting/qcolorspace.h @@ -44,6 +44,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -125,6 +126,7 @@ public: QColorTransform transformationToColorSpace(const QColorSpace &colorspace) const; + operator QVariant() const; private: Q_DECLARE_PRIVATE(QColorSpace) From e9a797799ee7e81d1cd113ba56f62705ae150e5c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 2 Dec 2019 18:03:47 +0100 Subject: [PATCH 48/71] CMake: Add Qt6 forward compatible CMake API and targets Create Qt:: versionless targets for libraries and tools. So Qt::Core will link to Qt5::Core. Add additional feature properties to targets, with the same name they have in Qt6: QT_ENABLED_PUBLIC_FEATURES, QT_DISABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES, QT_DISABLED_PRIVATE_FEATURES, to be forward-compatible with Qt6. Prefix properties with INTERFACE_ for interface libraries. Create functions with no major version in their prefix, so qt_foo instead of qt5_foo. The non-versioned functions will call the versioned functions, depending on the value of QT_DEFAULT_MAJOR_VERSION, which can be set by an application developer before finding the Qt package. Set QT_DEFAULT_MAJOR_VERSION to 5 if the value has not been defined in the current scope. Application developers can set QT_NO_CREATE_VERSIONLESS_FUNCTIONS to TRUE before calling find_package(Qt5) to suppress creation of the non-versioned functions. Application developers can set QT_NO_CREATE_VERSIONLESS_TARGETS to TRUE before calling find_package(Qt5) to suppress creation of the non-versioned targets. Setting these can be useful when both find_package(Qt5) and find_package(Qt6) are in the same project. If none of these are set by the user, then the first find_package(Qt5) will create versionless targets with the major version being "5", which means the second find_package(Qt6) will not create versionless targets. Handle versionless plugin names in qt_import_plugins, so both Qt::QCocoaIntegrationPlugin and Qt5/6::QCocoaIntegrationPlugin are recognized by the function. Allow specifying multiple types in EXCLUDE_BY_TYPE in qt_import_plugins, to be consitent with the Qt 6 version. Make sure to set the QT_PLUGIN_CLASS_NAME property to compatible with Qt 6. Task-number: QTBUG-74137 Task-number: QTBUG-80477 Change-Id: Ib89d090ea6f7794d7debd64f03f29da963a17ca7 Reviewed-by: Joerg Bornemann --- mkspecs/features/create_cmake.prf | 6 +- .../data/cmake/Qt5BasicConfig.cmake.in | 31 +++++++++ .../data/cmake/Qt5PluginTarget.cmake.in | 22 +++++-- src/corelib/Qt5CoreConfigExtras.cmake.in | 24 +++++++ src/corelib/Qt5CoreMacros.cmake | 66 ++++++++++++++++++- src/dbus/Qt5DBusConfigExtras.cmake.in | 11 ++++ src/dbus/Qt5DBusMacros.cmake | 43 ++++++++++++ src/widgets/Qt5WidgetsConfigExtras.cmake.in | 11 ++++ src/widgets/Qt5WidgetsMacros.cmake | 12 ++++ 9 files changed, 219 insertions(+), 7 deletions(-) diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 346fbf2467c..63b4a73660e 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -176,7 +176,7 @@ contains(CONFIG, plugin) { list_plugin_extends = for (p, PLUGIN_EXTENDS) { m = $$cmakeModuleName($$p) - list_plugin_extends += Qt5::$$m + list_plugin_extends += Qt::$$m } CMAKE_PLUGIN_EXTENDS = $$join(list_plugin_extends, ";") } @@ -291,6 +291,10 @@ CMAKE_INTERFACE_MODULE_DEPS = $$join(aux_mod_deps, ";") CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";") CMAKE_MODULE_PLUGIN_TYPES = $$join(QT.$${MODULE}.plugin_types, ";") +# Interface libraries have to have all properties starting with "INTERFACE_". +CMAKE_FEATURE_PROPERTY_PREFIX = "" +equals(TEMPLATE, aux): CMAKE_FEATURE_PROPERTY_PREFIX = "INTERFACE_" + mac { !isEmpty(CMAKE_STATIC_TYPE) { CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 26d4c17e6cb..01dda9b0c35 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -406,6 +406,15 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED) !!ENDIF !!ENDIF + + # Add a versionless target, for compatibility with Qt6. + if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::$${CMAKE_MODULE_NAME}) + add_library(Qt::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED) + set_target_properties(Qt::$${CMAKE_MODULE_NAME} PROPERTIES + INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}\" + ) + endif() + !!IF !equals(TEMPLATE, aux) !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1) @@ -420,6 +429,20 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_ENABLED_FEATURES $$join(QT.$${MODULE}.enabled_features, ";")) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_DISABLED_FEATURES $$join(QT.$${MODULE}.disabled_features, ";")) + # Qt 6 forward compatible properties. + set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} + PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PUBLIC_FEATURES + $$join(QT.$${MODULE}.enabled_features, ";")) + set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} + PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PUBLIC_FEATURES + $$join(QT.$${MODULE}.disabled_features, ";")) + set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} + PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PRIVATE_FEATURES + $$join(QT.$${MODULE}_private.enabled_features, ";")) + set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} + PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PRIVATE_FEATURES + $$join(QT.$${MODULE}_private.disabled_features, ";")) + set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_PLUGIN_TYPES \"$${CMAKE_MODULE_PLUGIN_TYPES}\") set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE) @@ -443,6 +466,14 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}Private PROPERTY INTERFACE_LINK_LIBRARIES Qt5::$${CMAKE_MODULE_NAME} ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS} ) + + # Add a versionless target, for compatibility with Qt6. + if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::$${CMAKE_MODULE_NAME}Private) + add_library(Qt::$${CMAKE_MODULE_NAME}Private INTERFACE IMPORTED) + set_target_properties(Qt::$${CMAKE_MODULE_NAME}Private PROPERTIES + INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}Private\" + ) + endif() endif() !!IF !equals(TEMPLATE, aux) diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in index 7b70cfed096..b550a52c608 100644 --- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in +++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in @@ -75,19 +75,30 @@ endif() set(_user_specified_genex \"$\" ) +set(_user_specified_genex_versionless + \"$\" +) string(CONCAT _plugin_genex \"$<$,\" \"$,Qt5::$${CMAKE_MODULE_NAME}>,\" + # FIXME: The value of CMAKE_MODULE_NAME seems to be wrong (e.g for Svg plugin + # it should be Qt::Svg instead of Qt::Gui). + \"$,Qt::$${CMAKE_MODULE_NAME}>,\" \"$,>\" \">,\" - \"$>\" + \"$>,\" + \"$>\" \">\" \">:Qt5::$$CMAKE_PLUGIN_NAME>\" ) @@ -100,3 +111,4 @@ set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} APPEND PROPERTY INTERFACE_LINK_LI !!ENDIF set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_TYPE \"$$CMAKE_PLUGIN_TYPE\") set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_EXTENDS \"$$CMAKE_PLUGIN_EXTENDS\") +set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_CLASS_NAME \"$$CMAKE_PLUGIN_NAME\") diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 9b672327eff..4c1c3a612ba 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -1,3 +1,6 @@ +if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION) + set(QT_DEFAULT_MAJOR_VERSION 5) +endif() if (NOT TARGET Qt5::qmake) add_executable(Qt5::qmake IMPORTED) @@ -177,3 +180,24 @@ if (ANDROID_PLATFORM) endif() _qt5_Core_check_file_exists(${_Qt5CTestMacros}) + +# Create versionless tool targets. +foreach(__qt_tool qmake moc rcc) + if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool} + AND TARGET Qt5::${__qt_tool}) + add_executable(Qt::${__qt_tool} IMPORTED) + get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION) + set_target_properties(Qt::${__qt_tool} + PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\") + endif() +endforeach() + +!!IF !isEmpty(CMAKE_WINDOWS_BUILD) +# Add a versionless target for WinMain. +if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::WinMain) + add_library(Qt::WinMain INTERFACE IMPORTED) + set_target_properties(Qt::WinMain PROPERTIES + INTERFACE_LINK_LIBRARIES \"Qt5::WinMain\" + ) +endif() +!!ENDIF diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index e298cf7de76..6c214701642 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -157,6 +157,16 @@ function(qt5_generate_moc infile outfile ) qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}" "") endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_generate_moc) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_generate_moc(${ARGV}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_generate_moc(${ARGV}) + endif() + endfunction() +endif() + # qt5_wrap_cpp(outfiles inputfile ... ) @@ -184,6 +194,17 @@ function(qt5_wrap_cpp outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +# This will override the CMake upstream command, because that one is for Qt 3. +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_wrap_cpp outfiles) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_wrap_cpp("${outfiles}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_wrap_cpp("${outfiles}" ${ARGN}) + endif() + set("${outfiles}" "${${outfiles}}" PARENT_SCOPE) + endfunction() +endif() # _qt5_parse_qrc_file(infile _out_depends _rc_depends) @@ -255,6 +276,16 @@ function(qt5_add_binary_resources target ) add_custom_target(${target} ALL DEPENDS ${rcc_destination}) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_binary_resources) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_binary_resources(${ARGV}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_binary_resources(${ARGV}) + endif() + endfunction() +endif() + # qt5_add_resources(outfiles inputfile ... ) @@ -293,6 +324,18 @@ function(qt5_add_resources outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_resources outfiles) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_resources("${outfiles}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_resources("${outfiles}" ${ARGN}) + endif() + set("${outfiles}" "${${outfiles}}" PARENT_SCOPE) + endfunction() +endif() + + # qt5_add_big_resources(outfiles inputfile ... ) function(qt5_add_big_resources outfiles ) @@ -341,6 +384,18 @@ function(qt5_add_big_resources outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_big_resources outfiles) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_big_resources(${outfiles} ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_big_resources(${outfiles} ${ARGN}) + endif() + set("${outfiles}" "${${outfiles}}" PARENT_SCOPE) + endfunction() +endif() + + set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") macro(qt5_use_modules _target _link_type) @@ -413,10 +468,19 @@ function(qt5_import_plugins TARGET_NAME) elseif(_doing STREQUAL "EXCLUDE_BY_TYPE") string(REGEX REPLACE "[-/]" "_" _plugin_type "${_arg}") set_property(TARGET ${TARGET_NAME} PROPERTY "QT_PLUGINS_${_plugin_type}" -) - set(_doing "") else() message(FATAL_ERROR "Unexpected extra argument: \"${_arg}\"") endif() endif() endforeach() endfunction() + +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_import_plugins) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_import_plugins(${ARGV}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_import_plugins(${ARGV}) + endif() + endfunction() +endif() diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in index 1d947159e2e..a814678f7b5 100644 --- a/src/dbus/Qt5DBusConfigExtras.cmake.in +++ b/src/dbus/Qt5DBusConfigExtras.cmake.in @@ -31,3 +31,14 @@ endif() set(Qt5DBus_QDBUSCPP2XML_EXECUTABLE Qt5::qdbuscpp2xml) set(Qt5DBus_QDBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp) + +# Create versionless tool targets. +foreach(__qt_tool qdbuscpp2xml qdbusxml2cpp) + if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool} + AND TARGET Qt5::${__qt_tool}) + add_executable(Qt::${__qt_tool} IMPORTED) + get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION) + set_target_properties(Qt::${__qt_tool} + PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\") + endif() +endforeach() diff --git a/src/dbus/Qt5DBusMacros.cmake b/src/dbus/Qt5DBusMacros.cmake index 9b69e77dc75..1cacccdddd3 100644 --- a/src/dbus/Qt5DBusMacros.cmake +++ b/src/dbus/Qt5DBusMacros.cmake @@ -70,6 +70,17 @@ function(qt5_add_dbus_interface _sources _interface _basename) set(${_sources} ${${_sources}} PARENT_SCOPE) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_dbus_interface sources) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_dbus_interface("${sources}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_dbus_interface("${sources}" ${ARGN}) + endif() + set("${sources}" "${${sources}}" PARENT_SCOPE) + endfunction() +endif() + function(qt5_add_dbus_interfaces _sources) foreach(_current_FILE ${ARGN}) @@ -83,6 +94,17 @@ function(qt5_add_dbus_interfaces _sources) set(${_sources} ${${_sources}} PARENT_SCOPE) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_dbus_interfaces sources) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_dbus_interfaces("${sources}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_dbus_interfaces("${sources}" ${ARGN}) + endif() + set("${sources}" "${${sources}}" PARENT_SCOPE) + endfunction() +endif() + function(qt5_generate_dbus_interface _header) # _customName OPTIONS -some -options ) set(options) @@ -116,6 +138,16 @@ function(qt5_generate_dbus_interface _header) # _customName OPTIONS -some -optio ) endfunction() +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_generate_dbus_interface) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_generate_dbus_interface(${ARGV}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_generate_dbus_interface(${ARGV}) + endif() + endfunction() +endif() + function(qt5_add_dbus_adaptor _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) get_filename_component(_infile ${_xml_file} ABSOLUTE) @@ -152,3 +184,14 @@ function(qt5_add_dbus_adaptor _sources _xml_file _include _parentClass) # _optio list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") set(${_sources} ${${_sources}} PARENT_SCOPE) endfunction() + +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_add_dbus_adaptor sources) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_dbus_adaptor("${sources}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_dbus_adaptor("${sources}" ${ARGN}) + endif() + set("${sources}" "${${sources}}" PARENT_SCOPE) + endfunction() +endif() diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in index 99d87e2e46f..236d1d4159c 100644 --- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in +++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in @@ -17,3 +17,14 @@ endif() include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5Widgets_AccessibleFactory.cmake\" OPTIONAL) set(Qt5Widgets_UIC_EXECUTABLE Qt5::uic) + +# Create versionless tool targets. +foreach(__qt_tool uic) + if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool} + AND TARGET Qt5::${__qt_tool}) + add_executable(Qt::${__qt_tool} IMPORTED) + get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION) + set_target_properties(Qt::${__qt_tool} + PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\") + endif() +endforeach() diff --git a/src/widgets/Qt5WidgetsMacros.cmake b/src/widgets/Qt5WidgetsMacros.cmake index 21e73d4f0cc..35d2a2dc546 100644 --- a/src/widgets/Qt5WidgetsMacros.cmake +++ b/src/widgets/Qt5WidgetsMacros.cmake @@ -66,3 +66,15 @@ function(qt5_wrap_ui outfiles ) endforeach() set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() + +# This will override the CMake upstream command, because that one is for Qt 3. +if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) + function(qt_wrap_ui outfiles) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_wrap_ui("${outfiles}" ${ARGN}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_wrap_ui("${outfiles}" ${ARGN}) + endif() + set("${outfiles}" "${${outfiles}}" PARENT_SCOPE) + endfunction() +endif() From 114ff44f3c42e2575c60e6b5c8459acfea2dc60d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 2 Sep 2019 07:32:49 +0800 Subject: [PATCH 49/71] QLabel: Allow pixmap() and picture() to return by-value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous versions of these functions that returned by-pointer are held over from Qt 1 times. They are inconsistent with the rest of the Qt API. [ChangeLog][QtWidgets][QLabel] QLabel::pixmap() and QLabel::picture() can now return by-value instead of by-pointer. Task-number: QTBUG-48701 Change-Id: I23ce319a7b1f757e1f4dec697551bb472e92fabf Reviewed-by: André Hartmann --- src/corelib/global/qnamespace.h | 3 + src/corelib/global/qnamespace.qdoc | 10 +++ src/widgets/accessible/simplewidgets.cpp | 15 +++-- src/widgets/dialogs/qmessagebox.cpp | 6 +- src/widgets/dialogs/qwizard.cpp | 4 +- src/widgets/widgets/qlabel.cpp | 78 +++++++++++++++++++++++- src/widgets/widgets/qlabel.h | 20 +++++- 7 files changed, 117 insertions(+), 19 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 5b63daec690..8f40393a7ee 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1767,6 +1767,9 @@ public: PassThrough }; + // QTBUG-48701 + enum ReturnByValue_t { ReturnByValue }; // ### Qt 7: Remove me + #ifndef Q_QDOC // NOTE: Generally, do not add QT_Q_ENUM if a corresponding Q_Q_FLAG exists. QT_Q_ENUM(ScrollBarPolicy) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6149281904b..169c296bcdd 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3319,3 +3319,13 @@ \value RoundPreferFloor Round up for .75 and above. \value PassThrough Don't round. */ + +/*! + \enum Qt::ReturnByValue_t + \since 5.15 + + This is a dummy type, designed to help users transition from certain deprecated APIs to their replacement APIs. + + \sa QLabel::picture() + \sa QLabel::pixmap() +*/ diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 9dbbe9c6086..107fd729fe7 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -76,6 +76,9 @@ #include #include #endif +#ifndef QT_NO_PICTURE +#include +#endif #include #include #include @@ -431,10 +434,10 @@ QAccessible::Role QAccessibleDisplay::role() const #if QT_CONFIG(label) QLabel *l = qobject_cast(object()); if (l) { - if (l->pixmap()) + if (!l->pixmap(Qt::ReturnByValue).isNull()) return QAccessible::Graphic; #ifndef QT_NO_PICTURE - if (l->picture()) + if (!l->picture(Qt::ReturnByValue).isNull()) return QAccessible::Graphic; #endif #if QT_CONFIG(movie) @@ -558,10 +561,7 @@ QSize QAccessibleDisplay::imageSize() const #endif return QSize(); #if QT_CONFIG(label) - const QPixmap *pixmap = label->pixmap(); - if (!pixmap) - return QSize(); - return pixmap->size(); + return label->pixmap(Qt::ReturnByValue).size(); #endif } @@ -574,8 +574,7 @@ QPoint QAccessibleDisplay::imagePosition() const #endif return QPoint(); #if QT_CONFIG(label) - const QPixmap *pixmap = label->pixmap(); - if (!pixmap) + if (label->pixmap(Qt::ReturnByValue).isNull()) return QPoint(); return QPoint(label->mapToGlobal(label->pos())); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 854fee6e33a..4e7a4a65e39 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -305,7 +305,7 @@ void QMessageBoxPrivate::setupLayout() Q_Q(QMessageBox); delete q->layout(); QGridLayout *grid = new QGridLayout; - bool hasIcon = iconLabel->pixmap() && !iconLabel->pixmap()->isNull(); + bool hasIcon = !iconLabel->pixmap(Qt::ReturnByValue).isNull(); if (hasIcon) grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); @@ -1323,9 +1323,7 @@ void QMessageBox::setIcon(Icon icon) QPixmap QMessageBox::iconPixmap() const { Q_D(const QMessageBox); - if (d->iconLabel && d->iconLabel->pixmap()) - return *d->iconLabel->pixmap(); - return QPixmap(); + return d->iconLabel->pixmap(Qt::ReturnByValue); } void QMessageBox::setIconPixmap(const QPixmap &pixmap) diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index a4789f40b15..2f145806cfc 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -452,8 +452,8 @@ public: } QSize minimumSizeHint() const override { - if (pixmap() && !pixmap()->isNull()) - return pixmap()->size() / pixmap()->devicePixelRatio(); + if (!pixmap(Qt::ReturnByValue).isNull()) + return pixmap(Qt::ReturnByValue).size() / pixmap(Qt::ReturnByValue).devicePixelRatio(); return QFrame::minimumSizeHint(); } diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 77d117775a4..2490df58f29 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -188,8 +188,13 @@ QLabelPrivate::~QLabelPrivate() */ #ifndef QT_NO_PICTURE +#if QT_DEPRECATED_SINCE(5, 15) /*! - Returns the label's picture or nullptr if the label doesn't have a + \deprecated + + New code should use the other overload which returns QPicture by-value. + + This function returns the label's picture or \c nullptr if the label doesn't have a picture. */ @@ -198,6 +203,37 @@ const QPicture *QLabel::picture() const Q_D(const QLabel); return d->picture; } +#endif // QT_DEPRECATED_SINCE(5, 15) + +/*! + \since 5.15 + Returns the label's picture. + + Previously, Qt provided a version of \c picture() which returned the picture + by-pointer. That version is now deprecated. To maintain compatibility + with old code, you can explicitly differentiate between the by-pointer + function and the by-value function: + + \code + const QPicture *picPtr = label->picture(); + QPicture picVal = label->picture(Qt::ReturnByValue); + \endcode + + If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE + macro, then you can omit \c Qt::ReturnByValue as shown below: + + \code + QPicture picVal = label->picture(); + \endcode +*/ + +QPicture QLabel::picture(Qt::ReturnByValue_t) const +{ + Q_D(const QLabel); + if (d->picture) + return *(d->picture); + return QPicture(); +} #endif @@ -352,9 +388,27 @@ void QLabel::clear() /*! \property QLabel::pixmap - \brief the label's pixmap + \brief the label's pixmap. - If no pixmap has been set this will return nullptr. + Previously, Qt provided a version of \c pixmap() which returned the pixmap + by-pointer. That version is now deprecated. To maintain compatibility + with old code, you can explicitly differentiate between the by-pointer + function and the by-value function: + + \code + const QPixmap *pixmapPtr = label->pixmap(); + QPixmap pixmapVal = label->pixmap(Qt::ReturnByValue); + \endcode + + If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE + macro, then you can omit \c Qt::ReturnByValue as shown below: + + \code + QPixmap pixmapVal = label->pixmap(); + \endcode + + If no pixmap has been set, the deprecated getter function will return + \c nullptr. Setting the pixmap clears any previous content. The buddy shortcut, if any, is disabled. @@ -373,11 +427,29 @@ void QLabel::setPixmap(const QPixmap &pixmap) d->updateLabel(); } +#if QT_DEPRECATED_SINCE(5, 15) +/*! + \deprecated + + New code should use the other overload which returns QPixmap by-value. +*/ const QPixmap *QLabel::pixmap() const { Q_D(const QLabel); return d->pixmap; } +#endif // QT_DEPRECATED_SINCE(5, 15) + +/*! + \since 5.15 +*/ +QPixmap QLabel::pixmap(Qt::ReturnByValue_t) const +{ + Q_D(const QLabel); + if (d->pixmap) + return *(d->pixmap); + return QPixmap(); +} #ifndef QT_NO_PICTURE /*! diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h index 2f5db5a7d3e..288022a71e3 100644 --- a/src/widgets/widgets/qlabel.h +++ b/src/widgets/widgets/qlabel.h @@ -72,9 +72,25 @@ public: ~QLabel(); QString text() const; - const QPixmap *pixmap() const; + +#if QT_DEPRECATED_SINCE(5,15) + QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QPixmap by-value") + const QPixmap *pixmap() const; // ### Qt 7: Remove function + + QPixmap pixmap(Qt::ReturnByValue_t) const; +#else + QPixmap pixmap(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg +#endif // QT_DEPRECATED_SINCE(5,15) + #ifndef QT_NO_PICTURE - const QPicture *picture() const; +# if QT_DEPRECATED_SINCE(5,15) + QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QPicture by-value") + const QPicture *picture() const; // ### Qt 7: Remove function + + QPicture picture(Qt::ReturnByValue_t) const; +# else + QPicture picture(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg +# endif // QT_DEPRECATED_SINCE(5,15) #endif #if QT_CONFIG(movie) QMovie *movie() const; From e79a6253813cd67954e371805da547c48ea32d3d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 14 Sep 2019 18:47:13 +0800 Subject: [PATCH 50/71] QCursor: Allow bitmap() and mask() to return by-value The previous versions of these functions that returned by-pointer are held over from Qt 1 times. They are inconsistent with the rest of the Qt API. [ChangeLog][QtGui][QCursor] QCursor::bitmap() and QCursor::mask() can now return by-value instead of by-pointer. Task-number: QTBUG-48701 Change-Id: I3ca4f0c28d5c831727a60309facfb49c74673bb7 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcursor.cpp | 76 ++++++++++++++++++- src/gui/kernel/qcursor.h | 15 +++- .../platforms/windows/qwindowscursor.cpp | 14 ++-- 3 files changed, 95 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 339284aa30f..2018d28d92a 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -325,7 +325,7 @@ QDataStream &operator<<(QDataStream &s, const QCursor &c) if (isPixmap) s << c.pixmap(); else - s << *c.bitmap() << *c.mask(); + s << c.bitmap(Qt::ReturnByValue) << c.mask(Qt::ReturnByValue); s << c.hotSpot(); } return s; @@ -565,7 +565,12 @@ void QCursor::setShape(Qt::CursorShape shape) } } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \deprecated + + New code should use the other overload which returns QBitmap by-value. + Returns the cursor bitmap, or \nullptr if it is one of the standard cursors. */ @@ -577,6 +582,10 @@ const QBitmap *QCursor::bitmap() const } /*! + \deprecated + + New code should use the other overload which returns QBitmap by-value. + Returns the cursor bitmap mask, or \nullptr if it is one of the standard cursors. */ @@ -587,6 +596,71 @@ const QBitmap *QCursor::mask() const QCursorData::initialize(); return d->bmm; } +#endif // QT_DEPRECATED_SINCE(5, 15) + +/*! + \since 5.15 + + Returns the cursor bitmap, or a null bitmap if it is one of the + standard cursors. + + Previously, Qt provided a version of \c bitmap() which returned the bitmap + by-pointer. That version is now deprecated. To maintain compatibility + with old code, you can explicitly differentiate between the by-pointer + function and the by-value function: + + \code + const QBitmap *bmpPtr = cursor->bitmap(); + QBitmap bmpVal = cursor->bitmap(Qt::ReturnByValue); + \endcode + + If you disable the deprecated version, then you can omit \c Qt::ReturnByValue + as shown below: + + \code + QBitmap bmpVal = cursor->bitmap(); + \endcode +*/ +QBitmap QCursor::bitmap(Qt::ReturnByValue_t) const +{ + if (!QCursorData::initialized) + QCursorData::initialize(); + if (d->bm) + return *(d->bm); + return QBitmap(); +} + +/*! + \since 5.15 + + Returns the cursor bitmap mask, or a null bitmap if it is one of the + standard cursors. + + Previously, Qt provided a version of \c mask() which returned the bitmap + by-pointer. That version is now deprecated. To maintain compatibility + with old code, you can explicitly differentiate between the by-pointer + function and the by-value function: + + \code + const QBitmap *bmpPtr = cursor->mask(); + QBitmap bmpVal = cursor->mask(Qt::ReturnByValue); + \endcode + + If you disable the deprecated version, then you can omit \c Qt::ReturnByValue + as shown below: + + \code + QBitmap bmpVal = cursor->mask(); + \endcode +*/ +QBitmap QCursor::mask(Qt::ReturnByValue_t) const +{ + if (!QCursorData::initialized) + QCursorData::initialize(); + if (d->bmm) + return *(d->bmm); + return QBitmap(); +} /*! Returns the cursor pixmap. This is only valid if the cursor is a diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 7966e358408..7a11fe59eec 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -97,8 +97,19 @@ public: Qt::CursorShape shape() const; void setShape(Qt::CursorShape newShape); - const QBitmap *bitmap() const; - const QBitmap *mask() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") + const QBitmap *bitmap() const; // ### Qt 7: Remove function + + QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") + const QBitmap *mask() const; // ### Qt 7: Remove function + + QBitmap bitmap(Qt::ReturnByValue_t) const; + QBitmap mask(Qt::ReturnByValue_t) const; +#else + QBitmap bitmap(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg + QBitmap mask(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg +#endif // QT_DEPRECATED_SINCE(5, 15) QPixmap pixmap() const; QPoint hotSpot() const; diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 59457f1720f..19de3d59393 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -80,10 +80,10 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c) : bitmapCacheKey(c.pixmap().cacheKey()), maskCacheKey(0) { if (!bitmapCacheKey) { - Q_ASSERT(c.bitmap()); - Q_ASSERT(c.mask()); - bitmapCacheKey = c.bitmap()->cacheKey(); - maskCacheKey = c.mask()->cacheKey(); + Q_ASSERT(!c.bitmap(Qt::ReturnByValue).isNull()); + Q_ASSERT(!c.mask(Qt::ReturnByValue).isNull()); + bitmapCacheKey = c.bitmap(Qt::ReturnByValue).cacheKey(); + maskCacheKey = c.mask(Qt::ReturnByValue).cacheKey(); } } @@ -169,9 +169,9 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, // Create a cursor from image and mask of the format QImage::Format_Mono. static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1) { - Q_ASSERT(cursor.shape() == Qt::BitmapCursor && cursor.bitmap()); - QImage bbits = cursor.bitmap()->toImage(); - QImage mbits = cursor.mask()->toImage(); + Q_ASSERT(cursor.shape() == Qt::BitmapCursor && !cursor.bitmap(Qt::ReturnByValue).isNull()); + QImage bbits = cursor.bitmap(Qt::ReturnByValue).toImage(); + QImage mbits = cursor.mask(Qt::ReturnByValue).toImage(); scaleFactor /= bbits.devicePixelRatioF(); if (!qFuzzyCompare(scaleFactor, 1)) { const QSize scaledSize = (QSizeF(bbits.size()) * scaleFactor).toSize(); From 1278995778a3ab576231c372969336a2f6621e02 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 14 Jan 2020 10:08:22 +0100 Subject: [PATCH 51/71] Windows QPA: Better disambiguate Window class names Use a standard prefix for Window class names containing version, build and namespace which should reduce conflicts. Task-number: QTBUG-81347 Change-Id: Ia7c20af71d364e362781f791a4e51b77d605c918 Reviewed-by: Oliver Wolff --- .../platforms/windows/qwindowsclipboard.cpp | 2 +- .../platforms/windows/qwindowscontext.cpp | 26 ++++++++++++++++--- .../platforms/windows/qwindowscontext.h | 1 + .../platforms/windows/qwindowsglcontext.cpp | 2 +- .../windows/qwindowssystemtrayicon.cpp | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index ccd4e50a8b3..efcb0b6e6ed 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -190,7 +190,7 @@ void QWindowsClipboard::releaseIData() void QWindowsClipboard::registerViewer() { m_clipboardViewer = QWindowsContext::instance()-> - createDummyWindow(QStringLiteral("Qt5ClipboardView"), L"Qt5ClipboardView", + createDummyWindow(QStringLiteral("ClipboardView"), L"QtClipboardView", qClipboardViewerWndProc, WS_OVERLAPPED); // Try format listener API (Vista onwards) first. diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index d31352b8546..c85d04b8162 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -72,6 +72,7 @@ #include #include +#include #include #include #include @@ -426,7 +427,7 @@ bool QWindowsContext::initPowerNotificationHandler() if (d->m_powerNotification) return false; - d->m_powerDummyWindow = createDummyWindow(QStringLiteral("QtPowerDummyWindow"), L"QtPowerDummyWindow", qWindowsPowerWindowProc); + d->m_powerDummyWindow = createDummyWindow(QStringLiteral("PowerDummyWindow"), L"QtPowerDummyWindow", qWindowsPowerWindowProc); if (!d->m_powerDummyWindow) return false; @@ -536,6 +537,23 @@ void QWindowsContext::setKeyGrabber(QWindow *w) d->m_keyMapper.setKeyGrabber(w); } +QString QWindowsContext::classNamePrefix() +{ + static QString result; + if (result.isEmpty()) { + QTextStream str(&result); + str << "Qt" << QT_VERSION_MAJOR << QT_VERSION_MINOR << QT_VERSION_PATCH; + if (QLibraryInfo::isDebugBuild()) + str << 'd'; +#ifdef QT_NAMESPACE +# define xstr(s) str(s) +# define str(s) #s + str << xstr(QT_NAMESPACE); +#endif + } + return result; +} + // Window class registering code (from qapplication_win.cpp) QString QWindowsContext::registerWindowClass(const QWindow *w) @@ -567,8 +585,8 @@ QString QWindowsContext::registerWindowClass(const QWindow *w) break; } // Create a unique name for the flag combination - QString cname; - cname += QLatin1String("Qt5QWindow"); + QString cname = classNamePrefix(); + cname += QLatin1String("QWindow"); switch (type) { case Qt::Tool: cname += QLatin1String("Tool"); @@ -878,7 +896,7 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn, { if (!wndProc) wndProc = DefWindowProc; - QString className = registerWindowClass(classNameIn, wndProc); + QString className = registerWindowClass(classNamePrefix() + classNameIn, wndProc); return CreateWindowEx(0, reinterpret_cast(className.utf16()), windowName, style, CW_USEDEFAULT, CW_USEDEFAULT, diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 8027f093897..43ab8416ab9 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -180,6 +180,7 @@ public: int defaultDPI() const; + static QString classNamePrefix(); QString registerWindowClass(const QWindow *w); QString registerWindowClass(QString cname, WNDPROC proc, unsigned style = 0, HBRUSH brush = nullptr, diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index f2d31d5783e..f5d0a8780a9 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -802,7 +802,7 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, static inline HWND createDummyGLWindow() { return QWindowsContext::instance()-> - createDummyWindow(QStringLiteral("QtOpenGLDummyWindow"), + createDummyWindow(QStringLiteral("OpenGLDummyWindow"), L"OpenGLDummyWindow", nullptr, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); } diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp index 66c558df1ea..53562c87dd9 100644 --- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp +++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp @@ -168,7 +168,7 @@ static inline HWND createTrayIconMessageWindow() return nullptr; // Register window class in the platform plugin. const QString className = - ctx->registerWindowClass(QStringLiteral("QTrayIconMessageWindowClass"), + ctx->registerWindowClass(QWindowsContext::classNamePrefix() + QStringLiteral("TrayIconMessageWindowClass"), qWindowsTrayIconWndProc); const wchar_t windowName[] = L"QTrayIconMessageWindow"; return CreateWindowEx(0, reinterpret_cast(className.utf16()), From 12f085e538a1e3060fc5be3e21cefbb6d4c492b5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Oct 2019 16:01:47 +0200 Subject: [PATCH 52/71] Windows QPA: Add detection of dark mode Read the dark mode setting and make it accessible via native interface. Add a command line option to set the support level. Task-number: QTBUG-72028 Change-Id: I1e9fe296a6b1bda81512d003183038b866b67545 Reviewed-by: Oliver Wolff --- src/gui/kernel/qguiapplication.cpp | 15 ++++++++++++++ .../platforms/windows/qwindowscontext.cpp | 20 ++++++++++++++++++- .../platforms/windows/qwindowscontext.h | 2 ++ .../platforms/windows/qwindowsintegration.cpp | 4 ++++ .../platforms/windows/qwindowsintegration.h | 4 +++- .../windows/qwindowsnativeinterface.cpp | 12 +++++++++++ .../windows/qwindowsnativeinterface.h | 8 ++++++++ .../platforms/windows/qwindowstheme.cpp | 19 ++++++++++++++++++ src/plugins/platforms/windows/qwindowstheme.h | 2 ++ 9 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 445ad6b8354..1190bd1936b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -592,6 +592,21 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME \list \li \c {altgr}, detect the key \c {AltGr} found on some keyboards as Qt::GroupSwitchModifier (since Qt 5.12). + \li \c {darkmode=[1|2]} controls how Qt responds to the activation + of the \e{Dark Mode for applications} introduced in Windows 10 + 1903 (since Qt 5.15). + + A value of 1 causes Qt to switch the window borders to black + when \e{Dark Mode for applications} is activated and no High + Contrast Theme is in use. This is intended for applications + that implement their own theming. + + A value of 2 will in addition cause the Windows Vista style to + be deactivated and switch to the Windows style using a + simplified palette in dark mode. This is currently + experimental pending the introduction of new style that + properly adapts to dark mode. + \li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and \c none disables them. diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index c85d04b8162..d322b0e92bf 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -42,6 +42,7 @@ #include "qwindowsintegration.h" #include "qwindowswindow.h" #include "qwindowskeymapper.h" +#include "qwindowsnativeinterface.h" #include "qwindowsmousehandler.h" #include "qwindowspointerhandler.h" #include "qtwindowsglobal.h" @@ -277,8 +278,11 @@ struct QWindowsContextPrivate { bool m_asyncExpose = false; HPOWERNOTIFY m_powerNotification = nullptr; HWND m_powerDummyWindow = nullptr; + static bool m_darkMode; }; +bool QWindowsContextPrivate::m_darkMode = false; + QWindowsContextPrivate::QWindowsContextPrivate() : m_oleInitializeResult(OleInitialize(nullptr)) { @@ -293,6 +297,7 @@ QWindowsContextPrivate::QWindowsContextPrivate() m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); } + m_darkMode = QWindowsTheme::queryDarkMode(); if (FAILED(m_oleInitializeResult)) { qWarning() << "QWindowsContext: OleInitialize() failed: " << QWindowsContext::comErrorString(m_oleInitializeResult); @@ -485,6 +490,11 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA } } +bool QWindowsContext::isDarkMode() +{ + return QWindowsContextPrivate::m_darkMode; +} + QWindowsContext *QWindowsContext::instance() { return m_instance; @@ -1203,9 +1213,17 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, t->displayChanged(); QWindowsWindow::displayChanged(); return d->m_screenManager.handleDisplayChange(wParam, lParam); - case QtWindows::SettingChangedEvent: + case QtWindows::SettingChangedEvent: { QWindowsWindow::settingsChanged(); + const bool darkMode = QWindowsTheme::queryDarkMode(); + if (darkMode != QWindowsContextPrivate::m_darkMode) { + QWindowsContextPrivate::m_darkMode = darkMode; + auto nativeInterface = + static_cast(QWindowsIntegration::instance()->nativeInterface()); + emit nativeInterface->darkModeChanged(darkMode); + } return d->m_screenManager.handleScreenChanges(); + } default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 43ab8416ab9..1831ac6ec01 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -226,6 +226,8 @@ public: void setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness); static int processDpiAwareness(); + static bool isDarkMode(); + void setDetectAltGrModifier(bool a); // Returns a combination of SystemInfoFlags diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 32bd29a8429..4b4047ac0cd 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -219,6 +219,10 @@ static inline unsigned parseOptions(const QStringList ¶mList, options |= QWindowsIntegration::DontUseWMPointer; } else if (param == u"reverse") { options |= QWindowsIntegration::RtlEnabled; + } else if (param == u"darkmode=1") { + options |= QWindowsIntegration::DarkModeWindowFrames; + } else if (param == u"darkmode=2") { + options |= QWindowsIntegration::DarkModeWindowFrames | QWindowsIntegration::DarkModeStyle; } else { qWarning() << "Unknown option" << param; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index b49d21022b7..1f16d137698 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -70,7 +70,9 @@ public: NoNativeMenus = 0x200, DontUseWMPointer = 0x400, DetectAltGrModifier = 0x800, - RtlEnabled = 0x1000 + RtlEnabled = 0x1000, + DarkModeWindowFrames = 0x2000, + DarkModeStyle = 0x4000 }; explicit QWindowsIntegration(const QStringList ¶mList); diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index d1d181d66e7..1195f15a597 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -47,6 +47,7 @@ #include "qwindowsopengltester.h" #include "qwindowsintegration.h" #include "qwindowsmime.h" +#include "qwindowstheme.h" #include "qwin10helpers.h" #include @@ -316,4 +317,15 @@ QVariant QWindowsNativeInterface::gpuList() const return result; } +bool QWindowsNativeInterface::isDarkMode() const +{ + return QWindowsContext::isDarkMode(); +} + +// Dark mode support level 2 (style) +bool QWindowsNativeInterface::isDarkModeStyle() const +{ + return (QWindowsIntegration::instance()->options() & QWindowsIntegration::DarkModeStyle) != 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h index ce395dc5a42..90ba7a44c97 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.h +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h @@ -65,6 +65,8 @@ class QWindowsNativeInterface : public QPlatformNativeInterface { Q_OBJECT Q_PROPERTY(bool asyncExpose READ asyncExpose WRITE setAsyncExpose) + Q_PROPERTY(bool darkMode READ isDarkMode STORED false NOTIFY darkModeChanged) + Q_PROPERTY(bool darkModeStyle READ isDarkModeStyle STORED false) Q_PROPERTY(QVariant gpu READ gpu STORED false) Q_PROPERTY(QVariant gpuList READ gpuList STORED false) @@ -92,6 +94,9 @@ public: bool asyncExpose() const; void setAsyncExpose(bool value); + bool isDarkMode() const; + bool isDarkModeStyle() const; + QVariant gpu() const; QVariant gpuList() const; @@ -109,6 +114,9 @@ public: QFunctionPointer platformFunction(const QByteArray &function) const override; +Q_SIGNALS: + void darkModeChanged(bool); + private: static QWindowsWindowFunctions::WindowActivationBehavior m_windowActivationBehavior; }; diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 010aea20682..2f9dd0b40b6 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ #include #include #include +#include #include @@ -946,6 +948,23 @@ bool QWindowsTheme::useNativeMenus() return result; } +bool QWindowsTheme::queryDarkMode() +{ + if (QOperatingSystemVersion::current() + < QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 17763) + || queryHighContrast()) { + return false; + } + const auto setting = QWinRegistryKey(HKEY_CURRENT_USER, LR"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)") + .dwordValue(L"AppsUseLightTheme"); + return setting.second && setting.first == 0; +} + +bool QWindowsTheme::queryHighContrast() +{ + return booleanSystemParametersInfo(SPI_GETHIGHCONTRAST, false); +} + QPlatformMenuItem *QWindowsTheme::createPlatformMenuItem() const { qCDebug(lcQpaMenus) << __FUNCTION__; diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h index 7a8c321da4d..d557c0b4fdf 100644 --- a/src/plugins/platforms/windows/qwindowstheme.h +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -84,6 +84,8 @@ public: void showPlatformMenuBar() override; static bool useNativeMenus(); + static bool queryDarkMode(); + static bool queryHighContrast(); void refreshFonts(); From eb26563dd5483ab83a7a5addf8f98a4921d1edc1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 16:10:40 +0100 Subject: [PATCH 53/71] Windows QPA: Add setting of dark window borders Implement dark mode support level 1: change the window borders to dark and back, tracking the activation of dark mode. Task-number: QTBUG-72028 Change-Id: I6e8b31e7ee574f4d90438405f361cd940faee7fd Reviewed-by: Oliver Wolff --- .../platforms/windows/qwindowscontext.cpp | 5 +++ .../platforms/windows/qwindowswindow.cpp | 44 +++++++++++++++++++ .../platforms/windows/qwindowswindow.h | 3 ++ 3 files changed, 52 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index d322b0e92bf..5578259399c 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1221,6 +1221,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, auto nativeInterface = static_cast(QWindowsIntegration::instance()->nativeInterface()); emit nativeInterface->darkModeChanged(darkMode); + const auto options = QWindowsIntegration::instance()->options(); + if ((options & QWindowsIntegration::DarkModeWindowFrames) != 0) { + for (QWindowsWindow *w : d->m_windows) + w->setDarkBorder(QWindowsContextPrivate::m_darkMode); + } } return d->m_screenManager.handleScreenChanges(); } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index a7aad157499..b7536066d01 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -749,6 +749,11 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag } } +static inline bool shouldApplyDarkFrame(const QWindow *w) +{ + return w->isTopLevel() && !w->flags().testFlag(Qt::FramelessWindowHint); +} + QWindowsWindowData WindowCreationData::create(const QWindow *w, const WindowData &data, QString title) const { @@ -816,6 +821,12 @@ QWindowsWindowData return result; } + if (QWindowsContext::isDarkMode() + && (QWindowsIntegration::instance()->options() & QWindowsIntegration::DarkModeWindowFrames) != 0 + && shouldApplyDarkFrame(w)) { + QWindowsWindow::setDarkBorderToWindow(result.hwnd, true); + } + if (mirrorParentWidth != 0) { context->obtainedPos.setX(mirrorParentWidth - context->obtainedSize.width() - context->obtainedPos.x()); @@ -2892,6 +2903,39 @@ bool QWindowsWindow::isTopLevel() const return window()->isTopLevel() && !m_data.embedded; } +enum : WORD { + DwmwaUseImmersiveDarkMode = 20, + DwmwaUseImmersiveDarkModeBefore20h1 = 19 +}; + +static bool queryDarkBorder(HWND hwnd) +{ + BOOL result = FALSE; + const bool ok = + SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &result, sizeof(result))) + || SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &result, sizeof(result))); + if (!ok) + qWarning("%s: Unable to retrieve dark window border setting.", __FUNCTION__); + return result == TRUE; +} + +bool QWindowsWindow::setDarkBorderToWindow(HWND hwnd, bool d) +{ + const BOOL darkBorder = d ? TRUE : FALSE; + const bool ok = + SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &darkBorder, sizeof(darkBorder))) + || SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &darkBorder, sizeof(darkBorder))); + if (!ok) + qWarning("%s: Unable to set dark window border.", __FUNCTION__); + return ok; +} + +void QWindowsWindow::setDarkBorder(bool d) +{ + if (shouldApplyDarkFrame(window()) && queryDarkBorder(m_data.hwnd) != d) + setDarkBorderToWindow(m_data.hwnd, d); +} + QWindowsMenuBar *QWindowsWindow::menuBar() const { return m_menuBar.data(); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 1f8800272b7..7c37c6b1159 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -287,6 +287,9 @@ public: HWND handle() const override { return m_data.hwnd; } bool isTopLevel() const override; + static bool setDarkBorderToWindow(HWND hwnd, bool d); + void setDarkBorder(bool d); + QWindowsMenuBar *menuBar() const; void setMenuBar(QWindowsMenuBar *mb); From 859307d7a590873d8df5f8094e13043370fccaa7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Sep 2019 15:04:36 +0200 Subject: [PATCH 54/71] Windows QPA: Provide an experimental palette for dark mode Provide a simple palette for dark mode, implementing dark mode support level 2. Task-number: QTBUG-72028 Change-Id: I6f71870b251ccb7da30c01abb22c224e600f2b27 Reviewed-by: Oliver Wolff --- .../platforms/windows/qwindowscontext.cpp | 5 + .../platforms/windows/qwindowstheme.cpp | 112 ++++++++++++++---- src/plugins/platforms/windows/qwindowstheme.h | 2 +- .../styles/windowsvista/qwindowsxpstyle.cpp | 8 +- src/widgets/styles/qwindowsstyle.cpp | 17 +++ src/widgets/styles/qwindowsstyle_p_p.h | 1 + 6 files changed, 118 insertions(+), 27 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 5578259399c..2591966d54a 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1226,6 +1226,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, for (QWindowsWindow *w : d->m_windows) w->setDarkBorder(QWindowsContextPrivate::m_darkMode); } + if ((options & QWindowsIntegration::DarkModeStyle) != 0) { + QWindowsTheme::instance()->refresh(); + for (QWindowsWindow *w : d->m_windows) + QWindowSystemInterface::handleThemeChange(w->window()); + } } return d->m_screenManager.handleScreenChanges(); } diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 2f9dd0b40b6..325956b7ba7 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -243,6 +243,15 @@ static bool shGetFileInfoBackground(const QString &fileName, DWORD attributes, return result; } +// Dark Mode constants +enum DarkModeColors : QRgb { + darkModeBtnHighlightRgb = 0xc0c0c0, + darkModeBtnShadowRgb = 0x808080, + darkModeHighlightRgb = 0x0055ff, // deviating from 0x800080 + darkModeMenuHighlightRgb = darkModeHighlightRgb, + darkModeGrayTextRgb = 0x00ff00 +}; + // from QStyle::standardPalette static inline QPalette standardPalette() { @@ -260,23 +269,55 @@ static inline QPalette standardPalette() return palette; } -static inline QPalette systemPalette() +static void populateLightSystemBasePalette(QPalette &result) { - QPalette result = standardPalette(); result.setColor(QPalette::WindowText, getSysColor(COLOR_WINDOWTEXT)); - result.setColor(QPalette::Button, getSysColor(COLOR_BTNFACE)); - result.setColor(QPalette::Light, getSysColor(COLOR_BTNHIGHLIGHT)); + const QColor btnFace = getSysColor(COLOR_BTNFACE); + result.setColor(QPalette::Button, btnFace); + const QColor btnHighlight = getSysColor(COLOR_BTNHIGHLIGHT); + result.setColor(QPalette::Light, btnHighlight); result.setColor(QPalette::Dark, getSysColor(COLOR_BTNSHADOW)); result.setColor(QPalette::Mid, result.button().color().darker(150)); result.setColor(QPalette::Text, getSysColor(COLOR_WINDOWTEXT)); - result.setColor(QPalette::BrightText, getSysColor(COLOR_BTNHIGHLIGHT)); + result.setColor(QPalette::BrightText, btnHighlight); result.setColor(QPalette::Base, getSysColor(COLOR_WINDOW)); - result.setColor(QPalette::Window, getSysColor(COLOR_BTNFACE)); + result.setColor(QPalette::Window, btnFace); result.setColor(QPalette::ButtonText, getSysColor(COLOR_BTNTEXT)); result.setColor(QPalette::Midlight, getSysColor(COLOR_3DLIGHT)); result.setColor(QPalette::Shadow, getSysColor(COLOR_3DDKSHADOW)); result.setColor(QPalette::Highlight, getSysColor(COLOR_HIGHLIGHT)); result.setColor(QPalette::HighlightedText, getSysColor(COLOR_HIGHLIGHTTEXT)); +} + +static void populateDarkSystemBasePalette(QPalette &result) +{ + const QColor darkModeWindowText = Qt::white; + result.setColor(QPalette::WindowText, darkModeWindowText); + const QColor darkModebtnFace = Qt::black; + result.setColor(QPalette::Button, darkModebtnFace); + const QColor btnHighlight = QColor(darkModeBtnHighlightRgb); + result.setColor(QPalette::Light, btnHighlight); + result.setColor(QPalette::Dark, QColor(darkModeBtnShadowRgb)); + result.setColor(QPalette::Mid, result.button().color().darker(150)); + result.setColor(QPalette::Text, darkModeWindowText); + result.setColor(QPalette::BrightText, btnHighlight); + result.setColor(QPalette::Base, darkModebtnFace); + result.setColor(QPalette::Window, darkModebtnFace); + result.setColor(QPalette::ButtonText, darkModeWindowText); + result.setColor(QPalette::Midlight, darkModeWindowText); + result.setColor(QPalette::Shadow, darkModeWindowText); + result.setColor(QPalette::Highlight, QColor(darkModeHighlightRgb)); + result.setColor(QPalette::HighlightedText, darkModeWindowText); +} + +static QPalette systemPalette(bool light) +{ + QPalette result = standardPalette(); + if (light) + populateLightSystemBasePalette(result); + else + populateDarkSystemBasePalette(result); + result.setColor(QPalette::Link, Qt::blue); result.setColor(QPalette::LinkVisited, Qt::magenta); result.setColor(QPalette::Inactive, QPalette::Button, result.button().color()); @@ -302,19 +343,19 @@ static inline QPalette systemPalette() result.setColor(QPalette::Disabled, QPalette::Text, disabled); result.setColor(QPalette::Disabled, QPalette::ButtonText, disabled); result.setColor(QPalette::Disabled, QPalette::Highlight, - getSysColor(COLOR_HIGHLIGHT)); + light ? getSysColor(COLOR_HIGHLIGHT) : QColor(darkModeHighlightRgb)); result.setColor(QPalette::Disabled, QPalette::HighlightedText, - getSysColor(COLOR_HIGHLIGHTTEXT)); + light ? getSysColor(COLOR_HIGHLIGHTTEXT) : QColor(Qt::white)); result.setColor(QPalette::Disabled, QPalette::Base, result.window().color()); return result; } -static inline QPalette toolTipPalette(const QPalette &systemPalette) +static inline QPalette toolTipPalette(const QPalette &systemPalette, bool light) { QPalette result(systemPalette); - const QColor tipBgColor(getSysColor(COLOR_INFOBK)); - const QColor tipTextColor(getSysColor(COLOR_INFOTEXT)); + const QColor tipBgColor = light ? getSysColor(COLOR_INFOBK) : QColor(Qt::black); + const QColor tipTextColor = light ? getSysColor(COLOR_INFOTEXT) : QColor(Qt::white); result.setColor(QPalette::All, QPalette::Button, tipBgColor); result.setColor(QPalette::All, QPalette::Window, tipBgColor); @@ -339,12 +380,13 @@ static inline QPalette toolTipPalette(const QPalette &systemPalette) return result; } -static inline QPalette menuPalette(const QPalette &systemPalette) +static inline QPalette menuPalette(const QPalette &systemPalette, bool light) { QPalette result(systemPalette); - const QColor menuColor(getSysColor(COLOR_MENU)); - const QColor menuTextColor(getSysColor(COLOR_MENUTEXT)); - const QColor disabled(getSysColor(COLOR_GRAYTEXT)); + const QColor menuColor = light ? getSysColor(COLOR_MENU) : QColor(Qt::black); + const QColor menuTextColor = light ? getSysColor(COLOR_MENUTEXT) : QColor(Qt::white); + const QColor disabled = light + ? getSysColor(COLOR_GRAYTEXT) : QColor(darkModeGrayTextRgb); // we might need a special color group for the result. result.setColor(QPalette::Active, QPalette::Button, menuColor); result.setColor(QPalette::Active, QPalette::Text, menuTextColor); @@ -353,8 +395,10 @@ static inline QPalette menuPalette(const QPalette &systemPalette) result.setColor(QPalette::Disabled, QPalette::WindowText, disabled); result.setColor(QPalette::Disabled, QPalette::Text, disabled); const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false); - result.setColor(QPalette::Disabled, QPalette::Highlight, - getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)); + const QColor highlightColor = light + ? (getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)) + : QColor(darkModeMenuHighlightRgb); + result.setColor(QPalette::Disabled, QPalette::Highlight, highlightColor); result.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); result.setColor(QPalette::Disabled, QPalette::Button, result.color(QPalette::Active, QPalette::Button)); @@ -375,12 +419,12 @@ static inline QPalette menuPalette(const QPalette &systemPalette) return result; } -static inline QPalette *menuBarPalette(const QPalette &menuPalette) +static inline QPalette *menuBarPalette(const QPalette &menuPalette, bool light) { QPalette *result = nullptr; if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) { result = new QPalette(menuPalette); - const QColor menubar(getSysColor(COLOR_MENUBAR)); + const QColor menubar(light ? getSysColor(COLOR_MENUBAR) : QColor(Qt::black)); result->setColor(QPalette::Active, QPalette::Button, menubar); result->setColor(QPalette::Disabled, QPalette::Button, menubar); result->setColor(QPalette::Inactive, QPalette::Button, menubar); @@ -487,10 +531,26 @@ void QWindowsTheme::refreshPalettes() if (!QGuiApplication::desktopSettingsAware()) return; - m_palettes[SystemPalette] = new QPalette(systemPalette()); - m_palettes[ToolTipPalette] = new QPalette(toolTipPalette(*m_palettes[SystemPalette])); - m_palettes[MenuPalette] = new QPalette(menuPalette(*m_palettes[SystemPalette])); - m_palettes[MenuBarPalette] = menuBarPalette(*m_palettes[MenuPalette]); + const bool light = + !QWindowsContext::isDarkMode() + || (QWindowsIntegration::instance()->options() & QWindowsIntegration::DarkModeStyle) == 0; + m_palettes[SystemPalette] = new QPalette(systemPalette(light)); + m_palettes[ToolTipPalette] = new QPalette(toolTipPalette(*m_palettes[SystemPalette], light)); + m_palettes[MenuPalette] = new QPalette(menuPalette(*m_palettes[SystemPalette], light)); + m_palettes[MenuBarPalette] = menuBarPalette(*m_palettes[MenuPalette], light); + if (!light) { + m_palettes[ButtonPalette] = new QPalette(*m_palettes[SystemPalette]); + m_palettes[ButtonPalette]->setColor(QPalette::Button, QColor(0x666666u)); + const QColor checkBoxBlue(0x0078d7u); + const QColor white(Qt::white); + m_palettes[CheckBoxPalette] = new QPalette(*m_palettes[SystemPalette]); + m_palettes[CheckBoxPalette]->setColor(QPalette::Window, checkBoxBlue); + m_palettes[CheckBoxPalette]->setColor(QPalette::Base, checkBoxBlue); + m_palettes[CheckBoxPalette]->setColor(QPalette::Button, checkBoxBlue); + m_palettes[CheckBoxPalette]->setColor(QPalette::ButtonText, white); + m_palettes[RadioButtonPalette] = new QPalette(*m_palettes[CheckBoxPalette]); + + } } void QWindowsTheme::clearFonts() @@ -499,6 +559,12 @@ void QWindowsTheme::clearFonts() std::fill(m_fonts, m_fonts + NFonts, nullptr); } +void QWindowsTheme::refresh() +{ + refreshPalettes(); + refreshFonts(); +} + void QWindowsTheme::refreshFonts() { clearFonts(); diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h index d557c0b4fdf..af28f2878c6 100644 --- a/src/plugins/platforms/windows/qwindowstheme.h +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -88,11 +88,11 @@ public: static bool queryHighContrast(); void refreshFonts(); + void refresh(); static const char *name; private: - void refresh() { refreshPalettes(); refreshFonts(); } void clearPalettes(); void refreshPalettes(); void clearFonts(); diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 5d2e8efd682..899e7f7c177 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -225,9 +225,11 @@ static HRGN qt_hrgn_from_qregion(const QRegion ®ion) */ bool QWindowsXPStylePrivate::useXP(bool update) { - if (!update) - return use_xp; - return use_xp = IsThemeActive() && (IsAppThemed() || !QCoreApplication::instance()); + if (update) { + use_xp = IsThemeActive() && (IsAppThemed() || !QCoreApplication::instance()) + && !QWindowsStylePrivate::isDarkMode(); + } + return use_xp; } /* \internal diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 8496a2c2236..497afd17e1a 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -84,6 +84,7 @@ #include #include #include +#include #include #include @@ -127,6 +128,22 @@ qreal QWindowsStylePrivate::appDevicePixelRatio() return qApp->devicePixelRatio(); } +bool QWindowsStylePrivate::isDarkMode() +{ + bool result = false; +#ifdef Q_OS_WIN + // Windows only: Return whether dark mode style support is desired and + // dark mode is in effect. + if (auto ni = QGuiApplication::platformNativeInterface()) { + const QVariant darkModeStyleP = ni->property("darkModeStyle"); + result = darkModeStyleP.type() == QVariant::Bool + && darkModeStyleP.value() + && ni->property("darkMode").value(); + } +#endif + return result; +} + // Returns \c true if the toplevel parent of \a widget has seen the Alt-key bool QWindowsStylePrivate::hasSeenAlt(const QWidget *widget) const { diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h index 4f6ffcefc2b..a25f5c41660 100644 --- a/src/widgets/styles/qwindowsstyle_p_p.h +++ b/src/widgets/styles/qwindowsstyle_p_p.h @@ -74,6 +74,7 @@ public: static qreal devicePixelRatio(const QWidget *widget = nullptr) { return widget ? widget->devicePixelRatioF() : QWindowsStylePrivate::appDevicePixelRatio(); } static qreal nativeMetricScaleFactor(const QWidget *widget = nullptr); + static bool isDarkMode(); bool hasSeenAlt(const QWidget *widget) const; bool altDown() const { return alt_down; } From bf330a8f034a8d6198a78f87d23eafc5ef7e6ffb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 26 Dec 2019 19:35:55 +0100 Subject: [PATCH 55/71] QGestureManager: fix one (of many) inefficient loop(s) I showed QGestureManager to a colleage and I just couldn't avert my eyes... Also remove a pointless container::clear() call (the data member's dtor will do that implicitly). Change-Id: Id2b3f471d62e5ea416e875f28ecee73f8614a469 Reviewed-by: Giuseppe D'Angelo --- src/widgets/kernel/qgesturemanager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 56043910590..541519245e2 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -105,11 +105,10 @@ QGestureManager::QGestureManager(QObject *parent) QGestureManager::~QGestureManager() { qDeleteAll(m_recognizers); - foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) { - qDeleteAll(m_obsoleteGestures.value(recognizer)); - delete recognizer; + for (auto it = m_obsoleteGestures.cbegin(), end = m_obsoleteGestures.cend(); it != end; ++it) { + qDeleteAll(it.value()); + delete it.key(); } - m_obsoleteGestures.clear(); } Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) From f21a6d409ea0504c64cd72861fc16b6f3e080086 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 18 Dec 2019 15:43:24 +0100 Subject: [PATCH 56/71] QStringList: use local storage in removeDuplicates() If available, use a C++17 std::pmr::unordered_set with a monotonic buffer resource and a 256-byte stack buffer to avoid the per-element allocations of QSet. Results on my machine: RESULT : tst_QStringList::removeDuplicates():"empty": - 0.00014 msecs per iteration (total: 74, iterations: 524288) + 0.000031 msecs per iteration (total: 66, iterations: 2097152) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.00": - 0.00043 msecs per iteration (total: 57, iterations: 131072) + 0.00013 msecs per iteration (total: 69, iterations: 524288) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.50": - 0.00049 msecs per iteration (total: 65, iterations: 131072) + 0.00032 msecs per iteration (total: 85, iterations: 262144) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.66": - 0.00057 msecs per iteration (total: 75, iterations: 131072) + 0.00039 msecs per iteration (total: 52, iterations: 131072) RESULT : tst_QStringList::removeDuplicates():"short-dup-0.75": - 0.00064 msecs per iteration (total: 85, iterations: 131072) + 0.00048 msecs per iteration (total: 63, iterations: 131072) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.00": - 0.083 msecs per iteration (total: 85, iterations: 1024) + 0.039 msecs per iteration (total: 80, iterations: 2048) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.50": - 0.11 msecs per iteration (total: 58, iterations: 512) + 0.078 msecs per iteration (total: 80, iterations: 1024) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.66": - 0.13 msecs per iteration (total: 70, iterations: 512) + 0.10 msecs per iteration (total: 53, iterations: 512) RESULT : tst_QStringList::removeDuplicates():"long-dup-0.75": - 0.16 msecs per iteration (total: 86, iterations: 512) + 0.13 msecs per iteration (total: 69, iterations: 512) When interpreting the data, take into account that each iteration contains _also_ a deep copy of the QStringList d/t the detach from 'input'. The pattern is used elsewhere in Qt, so I've put the class that implements the seen set into a private header file and used in some other places I found. Change-Id: I1f71a82008a16d5a3818f91f290ade21d837805e Reviewed-by: Giuseppe D'Angelo --- src/corelib/text/qstringlist.cpp | 10 +- src/corelib/tools/qduplicatetracker_p.h | 94 +++++++++++++++++++ src/corelib/tools/tools.pri | 1 + .../fontconfig/qfontconfigdatabase.cpp | 9 +- src/widgets/itemviews/qtreewidget.cpp | 7 +- src/xml/dom/qdom.cpp | 8 +- .../corelib/text/qstringlist/main.cpp | 39 ++++++++ .../corelib/text/qstringlist/qstringlist.pro | 1 + 8 files changed, 153 insertions(+), 16 deletions(-) create mode 100644 src/corelib/tools/qduplicatetracker_p.h diff --git a/src/corelib/text/qstringlist.cpp b/src/corelib/text/qstringlist.cpp index 4bbe424ed23..4b9dcee169f 100644 --- a/src/corelib/text/qstringlist.cpp +++ b/src/corelib/text/qstringlist.cpp @@ -43,9 +43,9 @@ #if QT_CONFIG(regularexpression) # include #endif +#include #include - QT_BEGIN_NAMESPACE /*! \typedef QStringListIterator @@ -885,15 +885,13 @@ int QtPrivate::QStringList_removeDuplicates(QStringList *that) { int n = that->size(); int j = 0; - QSet seen; + + QDuplicateTracker seen; seen.reserve(n); - int setSize = 0; for (int i = 0; i < n; ++i) { const QString &s = that->at(i); - seen.insert(s); - if (setSize == seen.size()) // unchanged size => was already seen + if (seen.hasSeen(s)) continue; - ++setSize; if (j != i) that->swapItemsAt(i, j); ++j; diff --git a/src/corelib/tools/qduplicatetracker_p.h b/src/corelib/tools/qduplicatetracker_p.h new file mode 100644 index 00000000000..99068c01a33 --- /dev/null +++ b/src/corelib/tools/qduplicatetracker_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QDUPLICATETRACKER_P_H +#define QDUPLICATETRACKER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#if QT_HAS_INCLUDE() && __cplusplus > 201402L +# include +# include +#else +# include +#endif + +QT_BEGIN_NAMESPACE + +template +class QDuplicateTracker { +#ifdef __cpp_lib_memory_resource + char buffer[Prealloc * sizeof(T)]; + std::pmr::monotonic_buffer_resource res{buffer, sizeof buffer}; + std::pmr::unordered_set set{&res}; +#else + QSet set; + int setSize = 0; +#endif + Q_DISABLE_COPY_MOVE(QDuplicateTracker); +public: + QDuplicateTracker() = default; + void reserve(int n) { set.reserve(n); } + Q_REQUIRED_RESULT bool hasSeen(const T &s) + { + bool inserted; +#ifdef __cpp_lib_memory_resource + inserted = set.insert(s).second; +#else + set.insert(s); + const int n = set.size(); + inserted = qExchange(setSize, n) != n; +#endif + return !inserted; + } +}; + +QT_END_NAMESPACE + +#endif /* QDUPLICATETRACKER_P_H */ diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 40c84157cdd..e078ab44095 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -12,6 +12,7 @@ HEADERS += \ tools/qcontainerfwd.h \ tools/qcontainertools_impl.h \ tools/qcryptographichash.h \ + tools/qduplicatetracker_p.h \ tools/qfreelist_p.h \ tools/qhash.h \ tools/qhashfunctions.h \ diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 7af5490963b..af49ad6407b 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -56,6 +56,8 @@ #include +#include + #include #if FC_VERSION >= 20402 #include @@ -778,9 +780,9 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont FcPatternDestroy(pattern); if (fontSet) { - QSet duplicates; + QDuplicateTracker duplicates; duplicates.reserve(fontSet->nfont + 1); - duplicates.insert(family.toCaseFolded()); + (void)duplicates.hasSeen(family.toCaseFolded()); for (int i = 0; i < fontSet->nfont; i++) { FcChar8 *value = nullptr; if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch) @@ -788,9 +790,8 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont // capitalize(value); const QString familyName = QString::fromUtf8((const char *)value); const QString familyNameCF = familyName.toCaseFolded(); - if (!duplicates.contains(familyNameCF)) { + if (!duplicates.hasSeen(familyNameCF)) { fallbackFamilies << familyName; - duplicates.insert(familyNameCF); } } FcFontSetDestroy(fontSet); diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index ddb31523fd5..0d4c391e1c0 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -48,6 +48,8 @@ #include #include +#include + #include QT_BEGIN_NAMESPACE @@ -3175,13 +3177,12 @@ QList QTreeWidget::selectedItems() const const QModelIndexList indexes = selectionModel()->selectedIndexes(); QList items; items.reserve(indexes.count()); - QSet seen; + QDuplicateTracker seen; seen.reserve(indexes.count()); for (const auto &index : indexes) { QTreeWidgetItem *item = d->item(index); - if (item->isHidden() || seen.contains(item)) + if (item->isHidden() || seen.hasSeen(item)) continue; - seen.insert(item); items.append(item); } return items; diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index bbc877eeada..26c1a2122b2 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -60,6 +60,9 @@ #include #include #include +#include + + #include QT_BEGIN_NAMESPACE @@ -4081,10 +4084,10 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const } s << '<' << qName << nsDecl; - QSet outputtedPrefixes; /* Write out attributes. */ if (!m_attr->map.isEmpty()) { + QDuplicateTracker outputtedPrefixes; QHash::const_iterator it = m_attr->map.constBegin(); for (; it != m_attr->map.constEnd(); ++it) { s << ' '; @@ -4105,9 +4108,8 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const * arrive in those situations. */ if((!it.value()->ownerNode || it.value()->ownerNode->prefix != it.value()->prefix) && - !outputtedPrefixes.contains(it.value()->prefix)) { + !outputtedPrefixes.hasSeen(it.value()->prefix)) { s << " xmlns:" << it.value()->prefix << "=\"" << encodeText(it.value()->namespaceURI, s, true, true) << '\"'; - outputtedPrefixes.insert(it.value()->prefix); } } } diff --git a/tests/benchmarks/corelib/text/qstringlist/main.cpp b/tests/benchmarks/corelib/text/qstringlist/main.cpp index ae355a8b893..9f184d0cf58 100644 --- a/tests/benchmarks/corelib/text/qstringlist/main.cpp +++ b/tests/benchmarks/corelib/text/qstringlist/main.cpp @@ -41,6 +41,9 @@ private slots: void join() const; void join_data() const; + void removeDuplicates() const; + void removeDuplicates_data() const; + void split_qlist_qbytearray() const; void split_qlist_qbytearray_data() const { return split_data(); } @@ -116,6 +119,42 @@ void tst_QStringList::join_data() const << QString(); } +void tst_QStringList::removeDuplicates() const +{ + QFETCH(const QStringList, input); + + QBENCHMARK { + auto copy = input; + copy.removeDuplicates(); + } +} + +void tst_QStringList::removeDuplicates_data() const +{ + QTest::addColumn("input"); + + const QStringList s = {"one", "two", "three"}; + + QTest::addRow("empty") << QStringList(); + QTest::addRow("short-dup-0.00") << s; + QTest::addRow("short-dup-0.50") << (s + s); + QTest::addRow("short-dup-0.66") << (s + s + s); + QTest::addRow("short-dup-0.75") << (s + s + s + s); + + const QStringList l = []() { + QStringList result; + const int n = 1000; + result.reserve(n); + for (int i = 0; i < n; ++i) + result.push_back(QString::number(i)); + return result; + }(); + QTest::addRow("long-dup-0.00") << l; + QTest::addRow("long-dup-0.50") << (l + l); + QTest::addRow("long-dup-0.66") << (l + l + l); + QTest::addRow("long-dup-0.75") << (l + l + l + l); +} + void tst_QStringList::split_data() const { QTest::addColumn("input"); diff --git a/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro b/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro index 5803e7da0e1..2e7ae058f7c 100644 --- a/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro +++ b/tests/benchmarks/corelib/text/qstringlist/qstringlist.pro @@ -1,5 +1,6 @@ TARGET = tst_bench_qstringlist CONFIG -= debug CONFIG += release +CONFIG += benchmark QT = core testlib SOURCES += main.cpp From aec4e05e9e8ad9109d7db15dd0fea477e4574c20 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 25 Jan 2020 20:12:12 +0100 Subject: [PATCH 57/71] Doc/QtWidgets: replace some 0 with \nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is \nullptr' and 'are \nullptr' Change-Id: I5ff46185b570bdfc7d20d18a47fd9174771ad8e5 Reviewed-by: André Hartmann Reviewed-by: Sze Howe Koh --- src/widgets/dialogs/qwizard.cpp | 2 +- .../graphicsview/qgraphicsproxywidget.cpp | 4 ++-- src/widgets/graphicsview/qgraphicsview.cpp | 2 +- src/widgets/styles/qdrawutil.cpp | 20 +++++++++---------- src/widgets/styles/qproxystyle.cpp | 2 +- src/widgets/styles/qstyle.cpp | 6 +++--- src/widgets/util/qundoview.cpp | 10 +++++----- src/widgets/widgets/qabstractscrollarea.cpp | 6 +++--- src/widgets/widgets/qcombobox.cpp | 2 +- src/widgets/widgets/qdialogbuttonbox.cpp | 2 +- src/widgets/widgets/qdockwidget.cpp | 4 ++-- src/widgets/widgets/qmdiarea.cpp | 4 ++-- src/widgets/widgets/qtabwidget.cpp | 2 +- 13 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 2f145806cfc..87f6875c8c6 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2924,7 +2924,7 @@ void QWizard::setDefaultProperty(const char *className, const char *property, or when the watermark is not provided the side widget is displayed on the left side of the wizard. - Passing 0 shows no side widget. + Passing \nullptr shows no side widget. When the \a widget is not \nullptr the wizard reparents it. diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index eb8acf1f279..a9a57c57fac 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -570,8 +570,8 @@ QGraphicsProxyWidget::~QGraphicsProxyWidget() After this function returns, QGraphicsProxyWidget will keep its state synchronized with that of \a widget whenever possible. - If a widget is already embedded by this proxy when this function is - called, that widget will first be automatically unembedded. Passing 0 for + If a widget is already embedded by this proxy when this function is called, + that widget will first be automatically unembedded. Passing \nullptr for the \a widget argument will only unembed the widget, and the ownership of the currently embedded widget will be passed on to the caller. Every child widget that are embedded will also be embedded and their proxy diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index e1a829f779e..102f3e894fa 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -963,7 +963,7 @@ static inline void QRect_unite(QRect *rect, const QRect &other) /* Calling this function results in update rects being clipped to the item's bounding rect. Note that updates prior to this function call is not clipped. - The clip is removed by passing 0. + The clip is removed by passing \nullptr. */ void QGraphicsViewPrivate::setUpdateClip(QGraphicsItem *item) { diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp index d30b43a679c..66729e4dc78 100644 --- a/src/widgets/styles/qdrawutil.cpp +++ b/src/widgets/styles/qdrawutil.cpp @@ -214,7 +214,7 @@ void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, specifies the line width for each of the lines; it is not the total line width. The \a midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The rectangle's - interior is filled with the \a fill brush unless \a fill is 0. + interior is filled with the \a fill brush unless \a fill is \nullptr. The rectangle appears sunken if \a sunken is true, otherwise raised. @@ -331,7 +331,7 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, The given \a palette specifies the shading colors (\l {QPalette::light()}{light}, \l {QPalette::dark()}{dark} and \l {QPalette::mid()}{middle} colors). The panel's interior is filled - with the \a fill brush unless \a fill is 0. + with the \a fill brush unless \a fill is \nullptr. The panel appears sunken if \a sunken is true, otherwise raised. @@ -490,7 +490,7 @@ static void qDrawWinShades(QPainter *p, Draws the Windows-style button specified by the given point (\a x, \a y}, \a width and \a height using the provided \a painter with a line width of 2 pixels. The button's interior is filled with the - \a{fill} brush unless \a fill is 0. + \a{fill} brush unless \a fill is \nullptr. The given \a palette specifies the shading colors (\l {QPalette::light()}{light}, \l {QPalette::dark()}{dark} and \l @@ -528,7 +528,7 @@ void qDrawWinButton(QPainter *p, int x, int y, int w, int h, Draws the Windows-style panel specified by the given point(\a x, \a y), \a width and \a height using the provided \a painter with a line width of 2 pixels. The button's interior is filled with the - \a fill brush unless \a fill is 0. + \a fill brush unless \a fill is \nullptr. The given \a palette specifies the shading colors. The panel appears sunken if \a sunken is true, otherwise raised. @@ -567,7 +567,7 @@ void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, Draws the plain rectangle beginning at (\a x, \a y) with the given \a width and \a height, using the specified \a painter, \a lineColor and \a lineWidth. The rectangle's interior is filled with the \a - fill brush unless \a fill is 0. + fill brush unless \a fill is \nullptr. \warning This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make @@ -676,7 +676,7 @@ void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, specifies the line width for each of the lines; it is not the total line width. The \a midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The rectangle's - interior is filled with the \a fill brush unless \a fill is 0. + interior is filled with the \a fill brush unless \a fill is \nullptr. The rectangle appears sunken if \a sunken is true, otherwise raised. @@ -714,7 +714,7 @@ void qDrawShadeRect(QPainter *p, const QRect &r, The given \a palette specifies the shading colors (\l {QPalette::light()}{light}, \l {QPalette::dark()}{dark} and \l {QPalette::mid()}{middle} colors). The panel's interior is filled - with the \a fill brush unless \a fill is 0. + with the \a fill brush unless \a fill is \nullptr. The panel appears sunken if \a sunken is true, otherwise raised. @@ -746,7 +746,7 @@ void qDrawShadePanel(QPainter *p, const QRect &r, Draws the Windows-style button at the rectangle specified by \a rect using the given \a painter with a line width of 2 pixels. The button's interior - is filled with the \a{fill} brush unless \a fill is 0. + is filled with the \a{fill} brush unless \a fill is \nullptr. The given \a palette specifies the shading colors (\l {QPalette::light()}{light}, \l {QPalette::dark()}{dark} and \l @@ -774,7 +774,7 @@ void qDrawWinButton(QPainter *p, const QRect &r, Draws the Windows-style panel at the rectangle specified by \a rect using the given \a painter with a line width of 2 pixels. The button's interior - is filled with the \a fill brush unless \a fill is 0. + is filled with the \a fill brush unless \a fill is \nullptr. The given \a palette specifies the shading colors. The panel appears sunken if \a sunken is true, otherwise raised. @@ -804,7 +804,7 @@ void qDrawWinPanel(QPainter *p, const QRect &r, Draws the plain rectangle specified by \a rect using the given \a painter, \a lineColor and \a lineWidth. The rectangle's interior is filled with the - \a fill brush unless \a fill is 0. + \a fill brush unless \a fill is \nullptr. \warning This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index cfaa5a2011b..0cc235bc845 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -403,7 +403,7 @@ QIcon QProxyStyle::standardIcon(StandardPixmap standardIcon, orientation specifies whether the controls are laid out side by side or stacked vertically. The \a option parameter can be used to pass extra information about the parent widget. The \a widget parameter - is optional and can also be used if \a option is 0. + is optional and can also be used if \a option is \nullptr. The default implementation returns -1. diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index d2f5ac76f9a..72e40d657df 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -2362,14 +2362,14 @@ QPalette QStyle::standardPalette() const \fn int QStyle::layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, - const QStyleOption *option = 0, const QWidget *widget = 0) const + const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const Returns the spacing that should be used between \a control1 and \a control2 in a layout. \a orientation specifies whether the controls are laid out side by side or stacked vertically. The \a option parameter can be used to pass extra information about the parent widget. The \a widget parameter is optional and can also - be used if \a option is 0. + be used if \a option is \nullptr. This function is called by the layout system. It is used only if PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a @@ -2386,7 +2386,7 @@ QPalette QStyle::standardPalette() const controls are laid out side by side or stacked vertically. The \a option parameter can be used to pass extra information about the parent widget. The \a widget parameter is optional and can also - be used if \a option is 0. + be used if \a option is \nullptr. \a controls1 and \a controls2 are OR-combination of zero or more \l{QSizePolicy::ControlTypes}{control types}. diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 9ca83a1da25..a39276a2b8d 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -358,8 +358,8 @@ QUndoStack *QUndoView::stack() const } /*! - Sets the stack displayed by this view to \a stack. If \a stack is 0, the view - will be empty. + Sets the stack displayed by this view to \a stack. If \a stack is \nullptr, + the view will be empty. If the view was previously looking at a QUndoGroup, the group is set to \nullptr. @@ -378,10 +378,10 @@ void QUndoView::setStack(QUndoStack *stack) #if QT_CONFIG(undogroup) /*! - Sets the group displayed by this view to \a group. If \a group is 0, the view will - be empty. + Sets the group displayed by this view to \a group. If \a group is \nullptr, + the view will be empty. - The view will update itself autmiatically whenever the active stack of the group changes. + The view will update itself automatically whenever the active stack of the group changes. \sa group(), setStack() */ diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 320b3bf7ef2..257cffda62c 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -512,8 +512,8 @@ QAbstractScrollArea::~QAbstractScrollArea() Sets the viewport to be the given \a widget. The QAbstractScrollArea will take ownership of the given \a widget. - If \a widget is 0, QAbstractScrollArea will assign a new QWidget instance - for the viewport. + If \a widget is \nullptr, QAbstractScrollArea will assign a new QWidget + instance for the viewport. \sa viewport() */ @@ -720,7 +720,7 @@ QWidget *QAbstractScrollArea::cornerWidget() const You will probably also want to set at least one of the scroll bar modes to \c AlwaysOn. - Passing 0 shows no widget in the corner. + Passing \nullptr shows no widget in the corner. Any previous corner widget is hidden. diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 9826cabe50d..aa3788c404f 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2044,7 +2044,7 @@ const QValidator *QComboBox::validator() const \since 4.2 Sets the \a completer to use instead of the current completer. - If \a completer is 0, auto completion is disabled. + If \a completer is \nullptr, auto completion is disabled. By default, for an editable combo box, a QCompleter that performs case insensitive inline completion is automatically created. diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 2e12320bc39..28c4f59d0d9 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -699,7 +699,7 @@ QList QDialogButtonBox::buttons() const /*! Returns the button role for the specified \a button. This function returns - \l InvalidRole if \a button is 0 or has not been added to the button box. + \l InvalidRole if \a button is \nullptr or has not been added to the button box. \sa buttons(), addButton() */ diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 299e5da8d34..1d358c493e2 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1674,8 +1674,8 @@ QAction * QDockWidget::toggleViewAction() const \since 4.3 Sets an arbitrary \a widget as the dock widget's title bar. If \a widget - is 0, any custom title bar widget previously set on the dock widget is - removed, but not deleted, and the default title bar will be used + is \nullptr, any custom title bar widget previously set on the dock widget + is removed, but not deleted, and the default title bar will be used instead. If a title bar widget is set, QDockWidget will not use native window diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 3272ac440b9..da6eb473723 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -103,8 +103,8 @@ \fn void QMdiArea::subWindowActivated(QMdiSubWindow *window) QMdiArea emits this signal after \a window has been activated. When \a - window is 0, QMdiArea has just deactivated its last active window, and - there are no active windows on the workspace. + window is \nullptr, QMdiArea has just deactivated its last active window, + and there are no active windows on the workspace. \sa QMdiArea::activeSubWindow() */ diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index f0bfe67e3ab..a19dacda521 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -612,7 +612,7 @@ void QTabWidget::setTabVisible(int index, bool visible) Only the horizontal element of the \a corner will be used. - Passing 0 shows no widget in the corner. + Passing \nullptr shows no widget in the corner. Any previously set corner widget is hidden. From ae9056587a52d51c7b41b41f631c6cab8097a7c7 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 25 Jan 2020 21:19:47 +0100 Subject: [PATCH 58/71] Doc/QtCore: use new signal/slot signature in snippets Use the new signal/slot syntax in the snippets where possible. Also change some 0 to nullptr. Change-Id: Ie3da2721d3cec33704f73f4d39c06a767717b095 Reviewed-by: Sze Howe Koh --- .../src_corelib_kernel_qcoreapplication.cpp | 10 +++--- ...src_corelib_statemachine_qstatemachine.cpp | 2 +- .../src_corelib_thread_qfuturewatcher.cpp | 2 +- .../code/src_corelib_tools_qtimeline.cpp | 4 +-- .../snippets/qsignalmapper/buttonwidget.cpp | 14 ++++---- .../doc/snippets/qsignalmapper/buttonwidget.h | 4 +-- .../snippets/resource-system/mainwindow.cpp | 36 +++++++++---------- .../doc/snippets/statemachine/main.cpp | 13 +++---- .../doc/snippets/statemachine/main2.cpp | 15 ++++---- .../doc/snippets/statemachine/main3.cpp | 2 +- .../doc/snippets/statemachine/main5.cpp | 14 ++++---- .../doc/snippets/timers/analogclock.cpp | 2 +- src/corelib/doc/snippets/timers/timers.cpp | 6 ++-- src/corelib/doc/src/animation.qdoc | 4 +-- src/corelib/doc/src/statemachine.qdoc | 4 +-- 15 files changed, 67 insertions(+), 65 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qcoreapplication.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qcoreapplication.cpp index aae2456bf15..36b47e6f6eb 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qcoreapplication.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qcoreapplication.cpp @@ -56,7 +56,7 @@ QApplication::sendEvent(mainWindow, &event); //! [1] QPushButton *quitButton = new QPushButton("Quit"); -connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()), Qt::QueuedConnection); +connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection); //! [1] @@ -79,12 +79,12 @@ Q_COREAPP_STARTUP_FUNCTION(preRoutineMyDebugTool) //! [4] -static int *global_ptr = 0; +static int *global_ptr = nullptr; static void cleanup_ptr() { delete [] global_ptr; - global_ptr = 0; + global_ptr = nullptr; } void init_ptr() @@ -125,9 +125,9 @@ private: //! [6] static inline QString tr(const char *sourceText, - const char *comment = 0); + const char *comment = nullptr); static inline QString trUtf8(const char *sourceText, - const char *comment = 0); + const char *comment = nullptr); //! [6] diff --git a/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp b/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp index a606da1a0ce..c756116de4d 100644 --- a/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp @@ -56,7 +56,7 @@ QState *s1 = new QState(); s1->assignProperty(&button, "text", "Click me"); QFinalState *s2 = new QFinalState(); -s1->addTransition(&button, SIGNAL(clicked()), s2); +s1->addTransition(&button, &QPushButton::clicked, s2); machine.addState(s1); machine.addState(s2); diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qfuturewatcher.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qfuturewatcher.cpp index 043974b25b0..336c1e9c791 100644 --- a/src/corelib/doc/snippets/code/src_corelib_thread_qfuturewatcher.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_thread_qfuturewatcher.cpp @@ -52,7 +52,7 @@ // Instantiate the objects and connect to the finished signal. MyClass myObject; QFutureWatcher watcher; -connect(&watcher, SIGNAL(finished()), &myObject, SLOT(handleFinished())); +connect(&watcher, QFutureWatcher::finished, &myObject, &MyClass::handleFinished); // Start the computation. QFuture future = QtConcurrent::run(...); diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qtimeline.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qtimeline.cpp index 004a810fcef..80859d5ba59 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qtimeline.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qtimeline.cpp @@ -56,10 +56,10 @@ progressBar->setRange(0, 100); // Construct a 1-second timeline with a frame range of 0 - 100 QTimeLine *timeLine = new QTimeLine(1000, this); timeLine->setFrameRange(0, 100); -connect(timeLine, SIGNAL(frameChanged(int)), progressBar, SLOT(setValue(int))); +connect(timeLine, &QTimeLine::frameChanged, progressBar, &QProgressBar::setValue); // Clicking the push button will start the progress bar animation pushButton = new QPushButton(tr("Start animation"), this); -connect(pushButton, SIGNAL(clicked()), timeLine, SLOT(start())); +connect(pushButton, &QPushButton::clicked, timeLine, &QTimeLine::start); ... //! [0] diff --git a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp index e91c41b3054..84a156bb6db 100644 --- a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp +++ b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp @@ -48,11 +48,10 @@ ** ****************************************************************************/ -#include -#include - #include "buttonwidget.h" +#include + //! [0] ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent) : QWidget(parent) @@ -62,15 +61,16 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent) QGridLayout *gridLayout = new QGridLayout; for (int i = 0; i < texts.size(); ++i) { QPushButton *button = new QPushButton(texts[i]); - connect(button, SIGNAL(clicked()), signalMapper, SLOT(map())); + connect(button, &QPushButton::clicked, + signalMapper, &QSignalMapper::map); //! [0] //! [1] signalMapper->setMapping(button, texts[i]); gridLayout->addWidget(button, i / 3, i % 3); } - connect(signalMapper, SIGNAL(mapped(QString)), + connect(signalMapper, QOverload::of(&QSignalMapper::mapped), //! [1] //! [2] - this, SIGNAL(clicked(QString))); + this, &ButtonWidget::clicked); setLayout(gridLayout); } @@ -84,7 +84,7 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent) for (int i = 0; i < texts.size(); ++i) { QString text = texts[i]; QPushButton *button = new QPushButton(text); - connect(button, &QPushButton::clicked, [=] { clicked(text); }); + connect(button, &QPushButton::clicked, [this, text] { clicked(text); }); gridLayout->addWidget(button, i / 3, i % 3); } setLayout(gridLayout); diff --git a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h index f55683c2d5c..b9d59f8dd84 100644 --- a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h +++ b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h @@ -51,7 +51,7 @@ #ifndef BUTTONWIDGET_H #define BUTTONWIDGET_H -#include +#include class QSignalMapper; class QString; @@ -63,7 +63,7 @@ class ButtonWidget : public QWidget Q_OBJECT public: - ButtonWidget(const QStringList &texts, QWidget *parent = 0); + ButtonWidget(const QStringList &texts, QWidget *parent = nullptr); signals: void clicked(const QString &text); diff --git a/src/corelib/doc/snippets/resource-system/mainwindow.cpp b/src/corelib/doc/snippets/resource-system/mainwindow.cpp index 86e93aaa624..6dc525304c5 100644 --- a/src/corelib/doc/snippets/resource-system/mainwindow.cpp +++ b/src/corelib/doc/snippets/resource-system/mainwindow.cpp @@ -68,10 +68,10 @@ MainWindow::MainWindow() readSettings(); - connect(textEdit->document(), SIGNAL(contentsChanged()), - this, SLOT(documentWasModified())); + connect(textEdit->document(), &QTextEdit::contentsChanged, + this, &QAction::documentWasModified); - setCurrentFile(""); + setCurrentFile(QString()); setUnifiedTitleAndToolBarOnMac(true); } //! [2] @@ -95,7 +95,7 @@ void MainWindow::newFile() { if (maybeSave()) { textEdit->clear(); - setCurrentFile(""); + setCurrentFile(QString()); } } //! [6] @@ -162,31 +162,31 @@ void MainWindow::createActions() newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); - connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); + connect(newAct, &QAction::triggered, this, &MainWindow::newFile); //! [19] openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); - connect(openAct, SIGNAL(triggered()), this, SLOT(open())); + connect(openAct, &QAction::triggered, this, &MainWindow::open); //! [18] //! [19] saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); - connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); + connect(saveAct, &QAction::triggered, this, &MainWindow::save); saveAsAct = new QAction(tr("Save &As..."), this); saveAsAct->setShortcuts(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); - connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); + connect(saveAsAct, &QAction::triggered, this, &MainWindow::saveAs); //! [20] exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); //! [20] exitAct->setStatusTip(tr("Exit the application")); - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + connect(exitAct, &QAction::triggered, this, &MainWindow::close); //! [21] cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); @@ -194,38 +194,38 @@ void MainWindow::createActions() cutAct->setShortcuts(QKeySequence::Cut); cutAct->setStatusTip(tr("Cut the current selection's contents to the " "clipboard")); - connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut())); + connect(cutAct, &QAction::triggered, textEdit, &QTextEdit::cut); copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this); copyAct->setShortcuts(QKeySequence::Copy); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); - connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy())); + connect(copyAct, &QAction::triggered, textEdit, &QTextEdit::copy); pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this); pasteAct->setShortcuts(QKeySequence::Paste); pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " "selection")); - connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste())); + connect(pasteAct, &QAction::triggered, textEdit, &QTextEdit::paste); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); + connect(aboutAct, &QAction::triggered, this, &MainWindow::about); //! [22] aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); - connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt); //! [22] //! [23] cutAct->setEnabled(false); //! [23] //! [24] copyAct->setEnabled(false); - connect(textEdit, SIGNAL(copyAvailable(bool)), - cutAct, SLOT(setEnabled(bool))); - connect(textEdit, SIGNAL(copyAvailable(bool)), - copyAct, SLOT(setEnabled(bool))); + connect(textEdit, &QTextEdit::copyAvailable, + cutAct, &QAction::setEnabled); + connect(textEdit, &QTextEdit::copyAvailable, + copyAct, &QAction::setEnabled); } //! [24] diff --git a/src/corelib/doc/snippets/statemachine/main.cpp b/src/corelib/doc/snippets/statemachine/main.cpp index 8cd8b69e128..c399f4f1992 100644 --- a/src/corelib/doc/snippets/statemachine/main.cpp +++ b/src/corelib/doc/snippets/statemachine/main.cpp @@ -48,13 +48,14 @@ ** ****************************************************************************/ -#include +#include int main(int argv, char **args) { QApplication app(argv, args); QLabel *label = new QLabel; + QPushButton *button = new QPushButton; //![0] QStateMachine machine; @@ -70,14 +71,14 @@ int main(int argv, char **args) //![4] //![5] - QObject::connect(s3, SIGNAL(entered()), button, SLOT(showMaximized())); - QObject::connect(s3, SIGNAL(exited()), button, SLOT(showMinimized())); + QObject::connect(s3, &QState::entered, button, &QPushButton:showMaximized); + QObject::connect(s3, &QState::exited, button, &QPushButton::showMinimized); //![5] //![1] - s1->addTransition(button, SIGNAL(clicked()), s2); - s2->addTransition(button, SIGNAL(clicked()), s3); - s3->addTransition(button, SIGNAL(clicked()), s1); + s1->addTransition(button, &QPushButton::clicked, s2); + s2->addTransition(button, &QPushButton::clicked, s3); + s3->addTransition(button, &QPushButton::clicked, s1); //![1] //![2] diff --git a/src/corelib/doc/snippets/statemachine/main2.cpp b/src/corelib/doc/snippets/statemachine/main2.cpp index 96eb912b143..dedd2d29bf4 100644 --- a/src/corelib/doc/snippets/statemachine/main2.cpp +++ b/src/corelib/doc/snippets/statemachine/main2.cpp @@ -48,11 +48,11 @@ ** ****************************************************************************/ -#include +#include int main(int argv, char **args) { - QApplication app(argv, args); + QApplication app(argv, args); QStateMachine machine; @@ -66,16 +66,17 @@ int main(int argv, char **args) //![0] //![2] - s12->addTransition(quitButton, SIGNAL(clicked()), s12); + s12->addTransition(quitButton, &QPushButton::clicked, s12); //![2] //![1] QFinalState *s2 = new QFinalState(); - s1->addTransition(quitButton, SIGNAL(clicked()), s2); + s1->addTransition(quitButton, &QPushButton::clicked, s2); machine.addState(s2); machine.setInitialState(s1); - QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); + QObject::connect(&machine, &QStateMachine::finished, + QCoreApplication::instance(), &QCoreApplication::quit); //![1] QButton *interruptButton = new QPushButton("Interrupt Button"); @@ -90,11 +91,11 @@ int main(int argv, char **args) mbox->addButton(QMessageBox::Ok); mbox->setText("Interrupted!"); mbox->setIcon(QMessageBox::Information); - QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec())); + QObject::connect(s3, &QState::entered, mbox, &QMessageBox::exec); s3->addTransition(s1h); machine.addState(s3); - s1->addTransition(interruptButton, SIGNAL(clicked()), s3); + s1->addTransition(interruptButton, &QPushButton::clicked, s3); //![3] return app.exec(); diff --git a/src/corelib/doc/snippets/statemachine/main3.cpp b/src/corelib/doc/snippets/statemachine/main3.cpp index bc9a0e29c4b..b665565aef3 100644 --- a/src/corelib/doc/snippets/statemachine/main3.cpp +++ b/src/corelib/doc/snippets/statemachine/main3.cpp @@ -62,7 +62,7 @@ int main(int argv, char **args) //![0] //![1] - s1->addTransition(s1, SIGNAL(finished()), s2); + s1->addTransition(s1, &QState::finished, s2); //![1] return app.exec(); diff --git a/src/corelib/doc/snippets/statemachine/main5.cpp b/src/corelib/doc/snippets/statemachine/main5.cpp index 38bb2cb475f..d701f51e2b6 100644 --- a/src/corelib/doc/snippets/statemachine/main5.cpp +++ b/src/corelib/doc/snippets/statemachine/main5.cpp @@ -98,7 +98,7 @@ int main(int argv, char **args) s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - s1->addTransition(button, SIGNAL(clicked()), s2); + s1->addTransition(button, &QPushButton::clicked, s2); //![3] } @@ -111,7 +111,7 @@ int main(int argv, char **args) s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); - QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2); + QSignalTransition *transition = s1->addTransition(button, &QPushButton::clicked, s2); transition->addAnimation(new QPropertyAnimation(button, "geometry")); //![4] @@ -130,9 +130,9 @@ int main(int argv, char **args) QState *s2 = new QState(); s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); - connect(s2, SIGNAL(entered()), messageBox, SLOT(exec())); + connect(s2, &QState::entered, messageBox, SLOT(exec())); - s1->addTransition(button, SIGNAL(clicked()), s2); + s1->addTransition(button, &QPushButton::clicked, s2); //![5] } @@ -151,10 +151,10 @@ int main(int argv, char **args) s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); QState *s3 = new QState(); - connect(s3, SIGNAL(entered()), messageBox, SLOT(exec())); + connect(s3, &QState::entered, messageBox, SLOT(exec())); - s1->addTransition(button, SIGNAL(clicked()), s2); - s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); + s1->addTransition(button, &QPushButton::clicked, s2); + s2->addTransition(s2, &QState::propertiesAssigned, s3); //![6] } diff --git a/src/corelib/doc/snippets/timers/analogclock.cpp b/src/corelib/doc/snippets/timers/analogclock.cpp index 4e1957a450a..3edfce32357 100644 --- a/src/corelib/doc/snippets/timers/analogclock.cpp +++ b/src/corelib/doc/snippets/timers/analogclock.cpp @@ -61,7 +61,7 @@ AnalogClock::AnalogClock(QWidget *parent) //! [3] //! [4] QTimer *timer = new QTimer(this); //! [4] //! [5] - connect(timer, SIGNAL(timeout()), this, SLOT(update())); + connect(timer, &QTimer::timeout, this, QOverload<>::of(&AnalogClock::update)); //! [5] //! [6] timer->start(1000); //! [6] diff --git a/src/corelib/doc/snippets/timers/timers.cpp b/src/corelib/doc/snippets/timers/timers.cpp index 5f95899af21..eb0c82c625d 100644 --- a/src/corelib/doc/snippets/timers/timers.cpp +++ b/src/corelib/doc/snippets/timers/timers.cpp @@ -61,13 +61,13 @@ Foo::Foo() //! [0] QTimer *timer = new QTimer(this); //! [0] //! [1] - connect(timer, SIGNAL(timeout()), this, SLOT(updateCaption())); + connect(timer, &QTimer::timeout, this, &Foo::updateCaption); //! [1] //! [2] timer->start(1000); //! [2] //! [3] - QTimer::singleShot(200, this, SLOT(updateCaption())); + QTimer::singleShot(200, this, &Foo::updateCaption); //! [3] { @@ -75,7 +75,7 @@ Foo::Foo() //! [4] QTimer *timer = new QTimer(this); //! [4] //! [5] - connect(timer, SIGNAL(timeout()), this, SLOT(processOneThing())); + connect(timer, &QTimer::timeout, this, &Foo::processOneThing); //! [5] //! [6] timer->start(); //! [6] diff --git a/src/corelib/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc index 0c1b2aed171..9cbe50d4a98 100644 --- a/src/corelib/doc/src/animation.qdoc +++ b/src/corelib/doc/src/animation.qdoc @@ -356,11 +356,11 @@ state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30)); QSignalTransition *transition1 = state1->addTransition(button, - SIGNAL(clicked()), state2); + &QPushButton::clicked, state2); transition1->addAnimation(new QPropertyAnimation(button, "geometry")); QSignalTransition *transition2 = state2->addTransition(button, - SIGNAL(clicked()), state1); + &QPushButton::clicked, state1); transition2->addAnimation(new QPropertyAnimation(button, "geometry")); machine->start(); diff --git a/src/corelib/doc/src/statemachine.qdoc b/src/corelib/doc/src/statemachine.qdoc index 43c8497ef2b..881a0785c6c 100644 --- a/src/corelib/doc/src/statemachine.qdoc +++ b/src/corelib/doc/src/statemachine.qdoc @@ -323,12 +323,12 @@ QState *s1 = new QState(&machine); QPushButton button; - QSignalTransition *trans = new QSignalTransition(&button, SIGNAL(clicked())); + QSignalTransition *trans = new QSignalTransition(&button, &QPushButton::clicked); s1->addTransition(trans); QMessageBox msgBox; msgBox.setText("The button was clicked; carry on."); - QObject::connect(trans, SIGNAL(triggered()), &msgBox, SLOT(exec())); + QObject::connect(trans, QSignalTransition::triggered, &msgBox, &QMessageBox::exec); machine.setInitialState(s1); \endcode From 2e377f29481475e938ab5a1e5857a1d3a88fa397 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 25 Jan 2020 20:16:02 +0100 Subject: [PATCH 59/71] Doc/QtBase: replace some 0 with \nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is \nullptr' and 'are \nullptr' Change-Id: Ida9af2971924377efe2f49f435d79e109de2bdf4 Reviewed-by: André Hartmann Reviewed-by: Sze Howe Koh --- src/corelib/global/qglobal.cpp | 4 ++-- src/corelib/io/qbuffer.cpp | 2 +- src/corelib/io/qiodevice.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 2 +- src/corelib/serialization/qtextstream.cpp | 2 +- src/network/access/qftp.cpp | 2 +- src/network/socket/qudpsocket.cpp | 2 +- src/opengl/qglframebufferobject.cpp | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index da69628d2b7..0f7ba8580ed 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -702,7 +702,7 @@ Q_STATIC_ASSERT((std::is_same::value)); 64-bit integer literals in a platform-independent way. The Q_CHECK_PTR() macro prints a warning containing the source code's file name and line number, saying that the program ran out of - memory, if the pointer is 0. The qPrintable() and qUtf8Printable() + memory, if the pointer is \nullptr. The qPrintable() and qUtf8Printable() macros represent an easy way of printing text. The QT_POINTER_SIZE macro expands to the size of a pointer in bytes. @@ -3263,7 +3263,7 @@ QByteArray QSysInfo::bootUniqueId() \macro void Q_CHECK_PTR(void *pointer) \relates - If \a pointer is 0, prints a message containing the source + If \a pointer is \nullptr, prints a message containing the source code's file name and line number, saying that the program ran out of memory and aborts program execution. It throws \c std::bad_alloc instead if exceptions are enabled. diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index 8e980733de1..595fcd27248 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -227,7 +227,7 @@ QBuffer::~QBuffer() \snippet buffer/buffer.cpp 4 - If \a byteArray is 0, the buffer creates its own internal + If \a byteArray is \nullptr, the buffer creates its own internal QByteArray to work on. This byte array is initially empty. \sa buffer(), setData(), open() diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index b89cab5e3cb..f7a86c25cd2 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1829,7 +1829,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize) /*! \fn bool QIODevice::getChar(char *c) Reads one character from the device and stores it in \a c. If \a c - is 0, the character is discarded. Returns \c true on success; + is \nullptr, the character is discarded. Returns \c true on success; otherwise returns \c false. \sa read(), putChar(), ungetChar() diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 46900be1a4b..a2b7fec5cd3 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -457,7 +457,7 @@ struct DefinedTypesFilter { \deprecated Constructs a value of the given type which is a copy of \a copy. - The default value for \a copy is 0. + The default value for \a copy is \nullptr. Deprecated, use the static function QMetaType::create(int type, const void *copy) instead. diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index 4d92b1e0dad..b8137e0abd4 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -1681,7 +1681,7 @@ QString QTextStream::readLine(qint64 maxlen) \since 5.5 Reads one line of text from the stream into \a line. - If \a line is 0, the read line is not stored. + If \a line is \nullptr, the read line is not stored. The maximum allowed line length is set to \a maxlen. If the stream contains lines longer than this, then the lines will be diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 62ae1adbd91..66dd3f9371f 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1820,7 +1820,7 @@ int QFtp::cd(const QString &dir) \internal Downloads the file \a file from the server. - If \a dev is 0, then the readyRead() signal is emitted when there + If \a dev is \nullptr, then the readyRead() signal is emitted when there is data available to read. You can then read the data with the read() or readAll() functions. diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index 0e3d5165353..9694dfa5078 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -479,7 +479,7 @@ QNetworkDatagram QUdpSocket::receiveDatagram(qint64 maxSize) /*! Receives a datagram no larger than \a maxSize bytes and stores it in \a data. The sender's host address and port is stored in - *\a address and *\a port (unless the pointers are 0). + *\a address and *\a port (unless the pointers are \nullptr). Returns the size of the datagram on success; otherwise returns -1. diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index d0f82a85fa0..362b3ef189c 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1395,7 +1395,7 @@ bool QGLFramebufferObject::hasOpenGLFramebufferBlit() Blits from the \a sourceRect rectangle in the \a source framebuffer object to the \a targetRect rectangle in the \a target framebuffer object. - If \a source or \a target is 0, the default framebuffer will be used + If \a source or \a target is \nullptr, the default framebuffer will be used instead of a framebuffer object as source or target respectively. The \a buffers parameter should be a mask consisting of any combination of From ea4b837fa169c21afb79488b669d30bca2fcb94f Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 25 Jan 2020 20:15:19 +0100 Subject: [PATCH 60/71] Doc/QtGui: replace some 0 with \nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is \nullptr' and 'are \nullptr' Change-Id: Ic18d0c8bcf64159b4c8fae8c9499839954a98884 Reviewed-by: André Hartmann Reviewed-by: Sze Howe Koh --- src/gui/accessible/qaccessible.cpp | 2 +- src/gui/image/qimage.cpp | 4 ++-- src/gui/image/qpixmap.cpp | 4 ++-- src/gui/kernel/qevent.cpp | 2 +- src/gui/kernel/qopenglcontext.cpp | 2 +- src/gui/text/qfontmetrics.cpp | 4 ++-- src/gui/text/qtextlayout.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 7922d6fb06c..a789e65284d 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -2029,7 +2029,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface() \fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const Returns a selection. The size of the selection is returned in \a startOffset and \a endOffset. - If there is no selection both \a startOffset and \a endOffset are 0. + If there is no selection both \a startOffset and \a endOffset are \nullptr. The accessibility APIs support multiple selections. For most widgets though, only one selection is supported with \a selectionIndex equal to 0. diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 62d2d0e948b..23facb85176 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4058,7 +4058,7 @@ void QImage::setText(const QString &key, const QString &value) \obsolete Returns the text recorded for the given \a key in the given \a - language, or in a default language if \a language is 0. + language, or in a default language if \a language is \nullptr. Use text() instead. @@ -4085,7 +4085,7 @@ void QImage::setText(const QString &key, const QString &value) Sets the image text to the given \a text and associate it with the given \a key. The text is recorded in the specified \a language, - or in a default language if \a language is 0. + or in a default language if \a language is \nullptr. Use setText() instead. diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index e914d7697f1..adadba20571 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -813,8 +813,8 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings. - If \a format is 0, an image format will be chosen from \a fileName's - suffix. + If \a format is \nullptr, an image format will be chosen from + \a fileName's suffix. \sa {QPixmap#Reading and Writing Image Files}{Reading and Writing Image Files} diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index da77290c30c..04970a942b1 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3366,7 +3366,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent() \a action is the action that is changed, added, or removed. If \a type is ActionAdded, the action is to be inserted before the - action \a before. If \a before is 0, the action is appended. + action \a before. If \a before is \nullptr, the action is appended. */ QActionEvent::QActionEvent(int type, QAction *action, QAction *before) : QEvent(static_cast(type)), act(action), bef(before) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 124b39f2a9c..ac5e279a796 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -941,7 +941,7 @@ GLuint QOpenGLContext::defaultFramebufferObject() const The latter may happen if the surface is not exposed, or the graphics hardware is not available due to e.g. the application being suspended. - If \a surface is 0 this is equivalent to calling doneCurrent(). + If \a surface is \nullptr this is equivalent to calling doneCurrent(). Avoid calling this function from a different thread than the one the QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index de9cae0c917..73fcc4bc788 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -161,7 +161,7 @@ QFontMetrics::QFontMetrics(const QFont &font) Constructs a font metrics object for \a font and \a paintdevice. The font metrics will be compatible with the paintdevice passed. - If the \a paintdevice is 0, the metrics will be screen-compatible, + If the \a paintdevice is \nullptr, the metrics will be screen-compatible, ie. the metrics you get if you use the font for drawing text on a \l{QWidget}{widgets} or \l{QPixmap}{pixmaps}, not on a QPicture or QPrinter. @@ -1154,7 +1154,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font) Constructs a font metrics object for \a font and \a paintdevice. The font metrics will be compatible with the paintdevice passed. - If the \a paintdevice is 0, the metrics will be screen-compatible, + If the \a paintdevice is \nullptr, the metrics will be screen-compatible, ie. the metrics you get if you use the font for drawing text on a \l{QWidget}{widgets} or \l{QPixmap}{pixmaps}, not on a QPicture or QPrinter. diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index fc256d72f37..02c42eaf03b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -350,7 +350,7 @@ QTextLayout::QTextLayout(const QString& text) \a font. All the metric and layout calculations will be done in terms of - the paint device, \a paintdevice. If \a paintdevice is 0 the + the paint device, \a paintdevice. If \a paintdevice is \nullptr the calculations will be done in screen metrics. */ From a4363030bf4efd8ed4d6cd99323a14231189e0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 24 Jan 2020 12:21:46 +0100 Subject: [PATCH 61/71] QMultiMap: Add unite documentation I missed copying over the documentation from QMap::unite when deprecating it. Amends 4ec6748c6a30f74e6d8fbb90fc118b306d1fa690 Change-Id: I118382c4645bdc679a378e02a462d104b9af9aad Reviewed-by: Paul Wicking --- src/corelib/tools/qmap.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index a51e59b2b88..e2b7705b557 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -1203,7 +1203,7 @@ void QMapDataBase::freeData(QMapDataBase *d) key is common to both maps, the resulting map will contain the key multiple times. - \sa QMap::unite() + \sa QMultiMap::unite() */ /*! \typedef QMap::Iterator @@ -2128,4 +2128,11 @@ void QMapDataBase::freeData(QMapDataBase *d) once in the returned list. */ +/*! \fn template QMultiMap &QMultiMap::unite(const QMultiMap &other) + + Inserts all the items in the \a other map into this map. If a + key is common to both maps, the resulting map will contain the + key multiple times. +*/ + QT_END_NAMESPACE From 1ed802e3b8a7f236bd277719090f461a87eae78e Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Wed, 22 Jan 2020 16:07:05 +0100 Subject: [PATCH 62/71] Doc: Update the stylesheet reference for widgets and richtext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the Qt-specific properites to the list. Fixes: QTBUG-37938 Change-Id: I178de6cd5e17cd282a20ccee9ce8355f540c38a1 Reviewed-by: Tor Arne Vestbø Reviewed-by: Paul Wicking Reviewed-by: Richard Moe Gustavsen Reviewed-by: Simon Hausmann --- src/gui/doc/src/richtext.qdoc | 43 ++++++++++++++++++- .../src/widgets-and-layouts/stylesheet.qdoc | 12 ++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index d3197f159c5..31a2ebf05bb 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -1275,10 +1275,51 @@ following: \list \li fixed line height in pixels, points, or centimeters. - \li a percent of the current font size. + \li a percentage of the current font size. \endlist \endtable + \section1 Qt-specific CSS properties + + Besides the standard CSS properties listed earlier, the following + Qt-specific properties can also be used to style a text block: + + \table + \header \li Property + \li Values + \li Description + \row + \li \c -qt-block-indent + \li \c + \li Indents the text block by the specified no. spaces. + \row + \li \c -qt-list-indent + \li \c + \li Indents the list items by the specified no. of spaces. + \row + \li \c -qt-list-number-prefix + \li \c + \li Prefixes the given string to list number in an HTML ordered list. + \row + \li \c -qt-list-number-suffix + \li + \li Suffixes the given string to list number in an HTML ordered list. + \row + \li \c -qt-paragraph-type + \li \c empty + \li Hides the text block. + \row + \li \c -qt-table-type + \li \c{root | frame} + \li \c root renders the text blocks inline without borders and + indentation, whereas \c frame renders them on a new line + with a frame around. + \row + \li \c -qt-user-state + \li \c + \li Adds it as user data for the text block. + \endtable + \section1 Supported CSS Selectors All CSS 2.1 selector classes are supported except pseudo-class selectors such diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index c8f374a1b19..efe30308f0b 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2526,6 +2526,18 @@ See also \l{#height-prop}{height}. + \row + \li \b -qt-background-role + \li \l{#paletterole}{PaletteRole} + \li The \c{background-color} for the subcontrol or widget based on the + chosen role. + + \row + \li \b -qt-style-features + \li \c list + \li The list of CSS properties that you want to apply Qt-specific styles on. + + \note The \c list can only include properties that are not pixmap-based. \endtable \target list of icons From 582311d1224cb196d8149bdfd8f178d5239c6b28 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 27 Jan 2020 17:11:51 +0800 Subject: [PATCH 63/71] Doc: Replace some usages of 0/zero/null with \nullptr Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb Reviewed-by: Paul Wicking --- examples/sql/doc/src/drilldown.qdoc | 2 +- src/corelib/kernel/qabstracteventdispatcher.cpp | 2 +- src/corelib/kernel/qmetaobject.cpp | 4 ++-- src/corelib/thread/qmutex.cpp | 2 +- src/gui/image/qimage.cpp | 6 +++--- src/gui/rhi/qrhi.cpp | 4 ++-- src/widgets/styles/qproxystyle.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/sql/doc/src/drilldown.qdoc b/examples/sql/doc/src/drilldown.qdoc index 7a8aa2037a4..8beb515a839 100644 --- a/examples/sql/doc/src/drilldown.qdoc +++ b/examples/sql/doc/src/drilldown.qdoc @@ -425,7 +425,7 @@ The \c findWindow() function simply searches through the list of existing windows, returning a pointer to the window that matches - the given item ID, or 0 if the window doesn't exists. + the given item ID, or \nullptr if the window doesn't exists. Finally, let's take a quick look at our custom \c ImageItem class: diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 7215b3f2bd1..685a0c595ae 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -160,7 +160,7 @@ QAbstractEventDispatcher::~QAbstractEventDispatcher() /*! Returns a pointer to the event dispatcher object for the specified - \a thread. If \a thread is zero, the current thread is used. If no + \a thread. If \a thread is \nullptr, the current thread is used. If no event dispatcher exists for the specified thread, this function returns \nullptr. diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 37f5acc5c57..1661520b783 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -599,7 +599,7 @@ static bool methodMatch(const QMetaObject *m, int handle, * \internal * helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within * the baseObject -* \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything. +* \a MethodType might be MethodSignal or MethodSlot, or \nullptr to match everything. */ template static inline int indexOfMethodRelative(const QMetaObject **baseObject, @@ -731,7 +731,7 @@ int QMetaObject::indexOfSignal(const char *signal) const \internal Same as QMetaObject::indexOfSignal, but the result is the local offset to the base object. - \a baseObject will be adjusted to the enclosing QMetaObject, or 0 if the signal is not found + \a baseObject will be adjusted to the enclosing QMetaObject, or \nullptr if the signal is not found */ int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject, const QByteArray &name, int argc, diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index f3883278e37..0508932d68c 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -487,7 +487,7 @@ QRecursiveMutex::~QRecursiveMutex() \fn QMutexLocker::QMutexLocker(QMutex *mutex) Constructs a QMutexLocker and locks \a mutex. The mutex will be - unlocked when the QMutexLocker is destroyed. If \a mutex is zero, + unlocked when the QMutexLocker is destroyed. If \a mutex is \nullptr, QMutexLocker does nothing. \sa QMutex::lock() diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 23facb85176..1166eb5023d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3683,8 +3683,8 @@ QImage QImage::fromData(const uchar *data, int size, const char *format) /*! Saves the image to the file with the given \a fileName, using the given image file \a format and \a quality factor. If \a format is - 0, QImage will attempt to guess the format by looking at \a fileName's - suffix. + \nullptr, QImage will attempt to guess the format by looking at + \a fileName's suffix. The \a quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed @@ -4099,7 +4099,7 @@ void QImage::setText(const QString &key, const QString &value) \l{http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.Anc-text} {the PNG specification}. \a s can be any text. \a lang should specify the language code (see - \l{http://www.rfc-editor.org/rfc/rfc1766.txt}{RFC 1766}) or 0. + \l{http://www.rfc-editor.org/rfc/rfc1766.txt}{RFC 1766}) or \nullptr. \endomit */ diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index d2c8ae104e0..a9c6835687c 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -2361,7 +2361,7 @@ QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const /*! \return a pointer to a backend-specific QRhiNativeHandles subclass, such as - QRhiVulkanRenderPassNativeHandles. The returned value is null when exposing + QRhiVulkanRenderPassNativeHandles. The returned value is \nullptr when exposing the underlying native resources is not supported by the backend. \sa QRhiVulkanRenderPassNativeHandles @@ -4933,7 +4933,7 @@ void QRhiCommandBuffer::dispatch(int x, int y, int z) /*! \return a pointer to a backend-specific QRhiNativeHandles subclass, such as - QRhiVulkanCommandBufferNativeHandles. The returned value is null when + QRhiVulkanCommandBufferNativeHandles. The returned value is \nullptr when exposing the underlying native resources is not supported by, or not applicable to, the backend. diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 0cc235bc845..ecad637957c 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -162,7 +162,7 @@ QStyle *QProxyStyle::baseStyle() const Ownership of \a style is transferred to QProxyStyle. - If style is zero, a desktop-dependant style will be + If style is \nullptr, a desktop-dependent style will be assigned automatically. */ void QProxyStyle::setBaseStyle(QStyle *style) From e44de91a2cab6e3c4632523e644fadaa93b89364 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 26 Jan 2020 16:39:05 +0800 Subject: [PATCH 64/71] Doc: Clarify usage of Qt::ReturnByValue in QCursor Change-Id: I6ce2c658dc0e72beb9e7a2497c6dbdbc71d96bc5 Reviewed-by: Paul Wicking --- src/corelib/global/qnamespace.qdoc | 2 ++ src/gui/kernel/qcursor.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 169c296bcdd..29b58783d5e 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3326,6 +3326,8 @@ This is a dummy type, designed to help users transition from certain deprecated APIs to their replacement APIs. + \sa QCursor::bitmap() + \sa QCursor::mask() \sa QLabel::picture() \sa QLabel::pixmap() */ diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 2018d28d92a..7f6fdafbd0e 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -614,8 +614,8 @@ const QBitmap *QCursor::mask() const QBitmap bmpVal = cursor->bitmap(Qt::ReturnByValue); \endcode - If you disable the deprecated version, then you can omit \c Qt::ReturnByValue - as shown below: + If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE + macro, then you can omit \c Qt::ReturnByValue as shown below: \code QBitmap bmpVal = cursor->bitmap(); @@ -646,8 +646,8 @@ QBitmap QCursor::bitmap(Qt::ReturnByValue_t) const QBitmap bmpVal = cursor->mask(Qt::ReturnByValue); \endcode - If you disable the deprecated version, then you can omit \c Qt::ReturnByValue - as shown below: + If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE + macro, then you can omit \c Qt::ReturnByValue as shown below: \code QBitmap bmpVal = cursor->mask(); From be8c257da9a264994243c120231965ff0008ef09 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 27 Jan 2020 13:19:00 +0100 Subject: [PATCH 65/71] QThread::setPriority() Warn about invalid parameter on all platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InheritPriority may not be set, but the warning only occurs on Windows. Move the warning to the public class. Change-Id: I51d401300f840e4c1396c2c30182e49ed45d60d2 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Christian Tismer Reviewed-by: David Faure Reviewed-by: Mårten Nordheim --- src/corelib/thread/qthread.cpp | 6 +++++- src/corelib/thread/qthread_win.cpp | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index d3bb372b007..d18056063f0 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -614,7 +614,7 @@ void QThread::run() priority. The \a priority argument can be any value in the \c - QThread::Priority enum except for \c InheritPriorty. + QThread::Priority enum except for \c InheritPriority. The effect of the \a priority parameter is dependent on the operating system's scheduling policy. In particular, the \a priority @@ -626,6 +626,10 @@ void QThread::run() */ void QThread::setPriority(Priority priority) { + if (priority == QThread::InheritPriority) { + qWarning("QThread::setPriority: Argument cannot be InheritPriority"); + return; + } Q_D(QThread); QMutexLocker locker(&d->mutex); if (!d->running) { diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 3df7080caf9..bc70e3178a2 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -715,9 +715,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority) prio = THREAD_PRIORITY_TIME_CRITICAL; break; - case QThread::InheritPriority: default: - qWarning("QThread::setPriority: Argument cannot be InheritPriority"); return; } From 4bb897a3841f0f79150787e29fe122e1410bc119 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 10 Jan 2020 10:08:37 +0100 Subject: [PATCH 66/71] Deprecate all methods that use QMatrix Don't use QMatrix in implementation classes anymore. Task-number: QTBUG-46653 Fixes: QTBUG-81627 Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b Reviewed-by: Leena Miettinen Reviewed-by: Laszlo Agocs Reviewed-by: Lars Knoll --- examples/widgets/graphicsview/chip/view.cpp | 4 +- .../graphicsview/diagramscene/mainwindow.cpp | 4 +- examples/widgets/painting/affine/xform.cpp | 4 +- .../widgets/painting/deform/pathdeform.cpp | 2 +- .../painting/pathstroke/pathstroke.cpp | 4 +- .../code/src_gui_painting_qpainter.cpp | 4 +- src/gui/image/qimage.cpp | 12 +++++ src/gui/image/qimage.h | 4 ++ src/gui/image/qpixmap.cpp | 12 ++++- src/gui/image/qpixmap.h | 4 ++ src/gui/kernel/qguivariant.cpp | 1 - src/gui/math3d/qmatrix4x4.cpp | 10 +++++ src/gui/math3d/qmatrix4x4.h | 6 ++- src/gui/painting/qbrush.cpp | 10 +++++ src/gui/painting/qbrush.h | 9 +++- src/gui/painting/qmatrix.cpp | 3 +- src/gui/painting/qpaintengine.cpp | 2 +- src/gui/painting/qpaintengine.h | 4 +- src/gui/painting/qpainter.cpp | 8 ++-- src/gui/painting/qpainter.h | 1 - src/gui/painting/qpainter_p.h | 1 - src/gui/painting/qpainterpath.cpp | 16 ++++++- src/gui/painting/qpainterpath.h | 6 +++ src/gui/painting/qpdf_p.h | 1 - src/gui/painting/qpolygon.cpp | 18 ++++---- src/gui/painting/qregion.cpp | 3 +- src/gui/painting/qtransform.cpp | 6 +++ src/gui/painting/qtransform.h | 4 ++ .../styles/windowsvista/qwindowsxpstyle.cpp | 2 +- src/printsupport/kernel/qprintengine_pdf_p.h | 1 - .../widgets/qprintpreviewwidget.cpp | 2 +- src/widgets/doc/snippets/javastyle.cpp | 4 +- src/widgets/graphicsview/qgraphicsscene.cpp | 1 - src/widgets/graphicsview/qgraphicsscene.h | 1 - src/widgets/graphicsview/qgraphicsview.cpp | 16 +++++++ src/widgets/graphicsview/qgraphicsview.h | 8 ++-- src/widgets/styles/qcommonstyle.cpp | 2 +- src/widgets/styles/qwindowsstyle.cpp | 2 +- src/widgets/widgets/qwidgettextcontrol.cpp | 40 ++++++++--------- src/widgets/widgets/qwidgettextcontrol_p.h | 2 +- .../qdatastream/tst_qdatastream.cpp | 6 +++ tests/auto/gui/image/qimage/tst_qimage.cpp | 6 +-- tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 1 - .../kernel/qguimetatype/tst_qguimetatype.cpp | 5 +++ .../qguivariant/test/tst_qguivariant.cpp | 5 +++ .../gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 5 +++ .../gui/painting/qpainter/tst_qpainter.cpp | 21 +++++++-- .../auto/gui/painting/qpathclipper/paths.cpp | 4 -- .../qpathclipper/tst_qpathclipper.cpp | 6 +-- .../painting/qtransform/tst_qtransform.cpp | 19 ++++---- .../gui/painting/qwmatrix/tst_qwmatrix.cpp | 6 +++ .../qgraphicsitem/tst_qgraphicsitem.cpp | 10 +++++ .../tst_qgraphicsitemanimation.cpp | 1 - .../qgraphicsview/tst_qgraphicsview.cpp | 44 +++++++++---------- .../qgraphicsview/benchapps/chipTest/view.cpp | 2 +- 55 files changed, 269 insertions(+), 116 deletions(-) diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 21998dc2dfd..86da5b138ff 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -234,11 +234,11 @@ void View::setupMatrix() { qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50)); - QMatrix matrix; + QTransform matrix; matrix.scale(scale, scale); matrix.rotate(rotateSlider->value()); - graphicsView->setMatrix(matrix); + graphicsView->setTransform(matrix); setResetButtonEnabled(); } diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp index 3327d4d5df6..04ff42e3ebe 100644 --- a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp +++ b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp @@ -231,8 +231,8 @@ void MainWindow::fontSizeChanged(const QString &) void MainWindow::sceneScaleChanged(const QString &scale) { double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0; - QMatrix oldMatrix = view->matrix(); - view->resetMatrix(); + QTransform oldMatrix = view->transform(); + view->resetTransform(); view->translate(oldMatrix.dx(), oldMatrix.dy()); view->scale(newScale, newScale); } diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index 50acf0f814c..4e7cb91ce1d 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -223,7 +223,7 @@ void XFormView::setRotation(qreal r) m_rotation = r; QPointF center(pts->points().at(0)); - QMatrix m; + QTransform m; m.translate(center.x(), center.y()); m.rotate(m_rotation - old_rot); m.translate(-center.x(), -center.y()); @@ -236,7 +236,7 @@ void XFormView::timerEvent(QTimerEvent *e) { if (e->timerId() == timer.timerId()) { QPointF center(pts->points().at(0)); - QMatrix m; + QTransform m; m.translate(center.x(), center.y()); m.rotate(0.2); m.translate(-center.x(), -center.y()); diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp index d5c8746247c..961d5e5e993 100644 --- a/examples/widgets/painting/deform/pathdeform.cpp +++ b/examples/widgets/painting/deform/pathdeform.cpp @@ -374,7 +374,7 @@ void PathDeformRenderer::setText(const QString &text) } for (int i=0; ibegin(myWidget); // impossible - only one painter at a time //! [4] void QPainter::rotate(qreal angle) { - QMatrix matrix; + QTransform matrix; matrix.rotate(angle); - setWorldMatrix(matrix, true); + setWorldTransform(matrix, true); } //! [4] diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1166eb5023d..267faa7753e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2881,7 +2881,13 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const } +#if QT_DEPRECATED_SINCE(5, 15) + /*! + \obsolete + + Use trueMatrix(const QTransform &matrix, int w, int h) instead. + \fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height) Returns the actual matrix used for transforming an image with the @@ -2903,6 +2909,10 @@ QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h) } /*! + \obsolete + + Use transformed(const QTransform &matrix, Qt::TransformationMode mode) instead. + Returns a copy of the image that is transformed using the given transformation \a matrix and transformation \a mode. @@ -2927,6 +2937,8 @@ QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) c return transformed(QTransform(matrix), mode); } +#endif // QT_DEPRECATED_SINCE(5, 15) + /*! Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 115071c16e3..7b2abfaf85c 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -282,8 +282,12 @@ public: Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transformed(const QTransform &matrix, Qt::TransformationMode mode)") QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + QT_DEPRECATED_X("trueMatrix(const QTransform &, int w, int h)") static QMatrix trueMatrix(const QMatrix &, int w, int h); +#endif // QT_DEPRECATED_SINCE(5, 15) QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; static QTransform trueMatrix(const QTransform &, int w, int h); #if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index adadba20571..269f236ecd2 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -438,7 +438,7 @@ QImage QPixmap::toImage() const } /*! - \fn QMatrix QPixmap::trueMatrix(const QTransform &matrix, int width, int height) + \fn QTransform QPixmap::trueMatrix(const QTransform &matrix, int width, int height) Returns the actual matrix used for transforming a pixmap with the given \a width, \a height and \a matrix. @@ -458,8 +458,12 @@ QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h) return QImage::trueMatrix(m, w, h); } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use trueMatrix(const QTransform &m, int w, int h) instead. This convenience function loads the matrix \a m into a QTransform and calls the overloaded function with the @@ -469,6 +473,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h) { return trueMatrix(QTransform(m), w, h).toAffine(); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! @@ -1233,8 +1238,12 @@ QPixmap QPixmap::transformed(const QTransform &transform, return data->transformed(transform, mode); } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use transformed(const QTransform &transform, Qt::TransformationMode mode)() instead. This convenience function loads the \a matrix into a QTransform and calls the overloaded function. @@ -1243,6 +1252,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) { return transformed(QTransform(matrix), mode); } +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 8a06ebe6039..e47a9fe59ee 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -129,8 +129,12 @@ public: Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transformed(const QTransform &, Qt::TransformationMode mode)") QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const; + QT_DEPRECATED_X("Use trueMatrix(const QTransform &m, int w, int h)") static QMatrix trueMatrix(const QMatrix &m, int w, int h); +#endif // QT_DEPRECATED_SINCE(5, 15) QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const; static QTransform trueMatrix(const QTransform &m, int w, int h); diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index 215b2b1d743..c9c45ba8155 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -47,7 +47,6 @@ #include "qimage.h" #include "qkeysequence.h" #include "qtransform.h" -#include "qmatrix.h" #include "qpalette.h" #include "qpen.h" #include "qpixmap.h" diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 6666eb037f3..cdaed788e99 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -187,7 +187,10 @@ QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows) flagBits = General; } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete + Constructs a 4x4 matrix from a conventional Qt 2D affine transformation \a matrix. @@ -218,6 +221,7 @@ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) m[3][3] = 1.0f; flagBits = Translation | Scale | Rotation2D; } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Constructs a 4x4 matrix from the conventional Qt 2D @@ -1659,7 +1663,12 @@ void QMatrix4x4::copyDataTo(float *values) const values[row * 4 + col] = float(m[col][row]); } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete + + Use toTransform() instead. + Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix. It is assumed that this matrix only contains 2D affine transformation elements. @@ -1672,6 +1681,7 @@ QMatrix QMatrix4x4::toAffine() const m[1][0], m[1][1], m[3][0], m[3][1]); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the conventional Qt 2D transformation matrix that diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 1439bfac597..6a726a197c5 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -72,7 +72,9 @@ public: QMatrix4x4(const float *values, int cols, int rows); QMatrix4x4(const QTransform& transform); +#if QT_DEPRECATED_SINCE(5, 15) QMatrix4x4(const QMatrix& matrix); +#endif // QT_DEPRECATED_SINCE(5, 15) inline const float& operator()(int row, int column) const; inline float& operator()(int row, int column); @@ -156,7 +158,9 @@ public: void copyDataTo(float *values) const; - QMatrix toAffine() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use toTransform()") QMatrix toAffine() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform toTransform() const; QTransform toTransform(float distanceToPlane) const; diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index e84916e063a..28cc20bfc58 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -893,8 +893,12 @@ bool QBrush::isOpaque() const } +#if QT_DEPRECATED_SINCE(5, 15) /*! \since 4.2 + \obsolete + + Use setTransform() instead. Sets \a matrix as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with @@ -906,6 +910,7 @@ void QBrush::setMatrix(const QMatrix &matrix) { setTransform(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! \since 4.3 @@ -923,14 +928,19 @@ void QBrush::setTransform(const QTransform &matrix) } +#if QT_DEPRECATED_SINCE(5, 15) /*! \fn void QBrush::matrix() const \since 4.2 + \obsolete + + Use transform() instead. Returns the current transformation matrix for the brush. \sa setMatrix() */ +#endif // QT_DEPRECATED_SINCE(5, 15) /*! \fn bool QBrush::operator!=(const QBrush &brush) const diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 1d7199782f4..3a01248c57d 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -89,8 +89,10 @@ public: inline Qt::BrushStyle style() const; void setStyle(Qt::BrushStyle); - inline const QMatrix &matrix() const; - void setMatrix(const QMatrix &mat); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") inline const QMatrix &matrix() const; + QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &mat); +#endif // QT_DEPRECATED_SINCE(5, 15) inline QTransform transform() const; void setTransform(const QTransform &); @@ -157,7 +159,10 @@ struct QBrushData inline Qt::BrushStyle QBrush::style() const { return d->style; } inline const QColor &QBrush::color() const { return d->color; } +#if QT_DEPRECATED_SINCE(5, 15) +QT_DEPRECATED_X("Use transform()") inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } +#endif // QT_DEPRECATED_SINCE(5, 15) inline QTransform QBrush::transform() const { return d->transform; } inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; } diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 890b0079de0..7ebd2dbd09c 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -45,6 +45,7 @@ #include "qregion.h" #include "qpainterpath.h" #include "qpainterpath_p.h" +#include "qtransform.h" #include "qvariant.h" #include @@ -680,7 +681,7 @@ QRegion QMatrix::map(const QRegion &r) const } QPainterPath p = map(qt_regionToPath(r)); - return p.toFillPolygon().toPolygon(); + return p.toFillPolygon(QTransform()).toPolygon(); } /*! diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 1785fcd12dc..315bf0daf21 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -508,7 +508,7 @@ void QPaintEngine::drawEllipse(const QRectF &rect) if (hasFeature(PainterPaths)) { drawPath(path); } else { - QPolygonF polygon = path.toFillPolygon(); + QPolygonF polygon = path.toFillPolygon(QTransform()); drawPolygon(polygon.data(), polygon.size(), ConvexMode); } } diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 9fb67e253ea..e90020dbbf9 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -273,7 +273,9 @@ public: QBrush backgroundBrush() const; Qt::BGMode backgroundMode() const; QFont font() const; - QMatrix matrix() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") QMatrix matrix() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform transform() const; Qt::ClipOperation clipOperation() const; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b0553a1ff9b..390147463d5 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2555,19 +2555,19 @@ QRegion QPainter::clipRegion() const case QPainterClipInfo::PathClip: { QTransform matrix = (info.matrix * d->invMatrix); if (lastWasNothing) { - region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); lastWasNothing = false; continue; } if (info.operation == Qt::IntersectClip) { - region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region &= QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); } else if (info.operation == Qt::NoClip) { lastWasNothing = true; region = QRegion(); } else { - region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); } break; @@ -8089,6 +8089,8 @@ QFont QPaintEngineState::font() const \since 4.2 \obsolete + Use transform() instead. + Returns the matrix in the current paint engine state. diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 3394da63c72..77c6504d2ef 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -72,7 +72,6 @@ class QPen; class QPolygon; class QTextItem; class QTextEngine; -class QMatrix; class QTransform; class QStaticText; class QGlyphRun; diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 285bd90502a..dafd6e33be2 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -59,7 +59,6 @@ #include "QtGui/qfont.h" #include "QtGui/qpen.h" #include "QtGui/qregion.h" -#include "QtGui/qmatrix.h" #include "QtGui/qpainter.h" #include "QtGui/qpainterpath.h" #include "QtGui/qpaintengine.h" diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 17d8b863ab8..ab60afd9cdf 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1660,13 +1660,18 @@ QList QPainterPath::toSubpathPolygons(const QTransform &matrix) const return flatCurves; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toSubpathPolygons(const QTransform &matrix) instead. */ QList QPainterPath::toSubpathPolygons(const QMatrix &matrix) const { return toSubpathPolygons(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Converts the path into a list of polygons using the @@ -1787,13 +1792,18 @@ QList QPainterPath::toFillPolygons(const QTransform &matrix) const return polys; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toFillPolygons(const QTransform &matrix) instead. */ QList QPainterPath::toFillPolygons(const QMatrix &matrix) const { return toFillPolygons(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) //same as qt_polygon_isect_line in qpolygon.cpp static void qt_painterpath_isect_line(const QPointF &p1, @@ -2904,14 +2914,18 @@ QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const return polygon; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toFillPolygon(const QTransform &matrix) instead. */ QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const { return toFillPolygon(QTransform(matrix)); } - +#endif // QT_DEPRECATED_SINCE(5, 15) //derivative of the equation static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index ed5be667b72..26b92dc6fae 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -175,9 +175,15 @@ public: bool isEmpty() const; Q_REQUIRED_RESULT QPainterPath toReversed() const; + +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use toSubpathPolygons(const QTransform &)") QList toSubpathPolygons(const QMatrix &matrix = QMatrix()) const; + QT_DEPRECATED_X("Use toFillPolygons(const QTransform &") QList toFillPolygons(const QMatrix &matrix = QMatrix()) const; + QT_DEPRECATED_X("Use toFillPolygon(const QTransform &)") QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const; +#endif // QT_DEPRECATED_SINCE(5, 15) QList toSubpathPolygons(const QTransform &matrix) const; QList toFillPolygons(const QTransform &matrix) const; QPolygonF toFillPolygon(const QTransform &matrix) const; diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 57d70db442d..4ff540e67b1 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -55,7 +55,6 @@ #ifndef QT_NO_PDF -#include "QtGui/qmatrix.h" #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "private/qstroker_p.h" diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 20337477b73..4fe819cae0d 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -40,9 +40,9 @@ #include "qpolygon.h" #include "qrect.h" #include "qdatastream.h" -#include "qmatrix.h" #include "qdebug.h" #include "qpainterpath.h" +#include "qtransform.h" #include "qvariant.h" #include "qpainterpath_p.h" #include "qbezier_p.h" @@ -111,7 +111,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP from a specified index (resizing the polygon if necessary). QPolygon provides the boundingRect() and translate() functions for - geometry functions. Use the QMatrix::map() function for more + geometry functions. Use the QTransform::map() function for more general transformations of QPolygons. The QPolygon class is \l {Implicit Data Sharing}{implicitly @@ -495,7 +495,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a) In addition to the functions provided by QVector, QPolygonF provides the boundingRect() and translate() functions for geometry - operations. Use the QMatrix::map() function for more general + operations. Use the QTransform::map() function for more general transformations of QPolygonFs. QPolygonF also provides the isClosed() function to determine @@ -899,7 +899,7 @@ QPolygon QPolygon::united(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.united(clip).toFillPolygon().toPolygon(); + return subject.united(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -918,7 +918,7 @@ QPolygon QPolygon::intersected(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.intersected(clip).toFillPolygon().toPolygon(); + return subject.intersected(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -936,7 +936,7 @@ QPolygon QPolygon::subtracted(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.subtracted(clip).toFillPolygon().toPolygon(); + return subject.subtracted(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -975,7 +975,7 @@ QPolygonF QPolygonF::united(const QPolygonF &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.united(clip).toFillPolygon(); + return subject.united(clip).toFillPolygon(QTransform()); } /*! @@ -994,7 +994,7 @@ QPolygonF QPolygonF::intersected(const QPolygonF &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.intersected(clip).toFillPolygon(); + return subject.intersected(clip).toFillPolygon(QTransform()); } /*! @@ -1011,7 +1011,7 @@ QPolygonF QPolygonF::subtracted(const QPolygonF &r) const { QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.subtracted(clip).toFillPolygon(); + return subject.subtracted(clip).toFillPolygon(QTransform()); } /*! diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 44ee038194b..bac042c7848 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -46,6 +46,7 @@ #include "qvarlengtharray.h" #include "qimage.h" #include "qbitmap.h" +#include "qtransform.h" #include @@ -3916,7 +3917,7 @@ QRegion::QRegion(const QRect &r, RegionType t) } else if (t == Ellipse) { QPainterPath path; path.addEllipse(r.x(), r.y(), r.width(), r.height()); - QPolygon a = path.toSubpathPolygons().at(0).toPolygon(); + QPolygon a = path.toSubpathPolygons(QTransform()).at(0).toPolygon(); d->qt_rgn = PolygonRegion(a.constData(), a.size(), EvenOddRule); } } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 279a817ff1e..9d8bb0c3e29 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -311,8 +311,10 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21, { } +#if QT_DEPRECATED_SINCE(5, 15) /*! \fn QTransform::QTransform(const QMatrix &matrix) + \obsolete Constructs a matrix that is a copy of the given \a matrix. Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0, @@ -328,6 +330,7 @@ QTransform::QTransform(const QMatrix &mtx) #endif { } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the adjoint of this matrix. @@ -2082,7 +2085,9 @@ void QTransform::map(int x, int y, int *tx, int *ty) const *ty = qRound(fy); } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete Returns the QTransform as an affine matrix. \warning If a perspective transformation has been specified, @@ -2092,6 +2097,7 @@ const QMatrix &QTransform::toAffine() const { return affine; } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the transformation type of this matrix. diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index b2a634dd2a8..485caa51403 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -73,7 +73,9 @@ public: qreal h31, qreal h32, qreal h33 = 1.0); QTransform(qreal h11, qreal h12, qreal h21, qreal h22, qreal dx, qreal dy); +#if QT_DEPRECATED_SINCE(5, 15) explicit QTransform(const QMatrix &mtx); +#endif // QT_DEPRECATED_SINCE(5, 15) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! @@ -158,7 +160,9 @@ public: void map(int x, int y, int *tx, int *ty) const; void map(qreal x, qreal y, qreal *tx, qreal *ty) const; +#if QT_DEPRECATED_SINCE(5, 15) const QMatrix &toAffine() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform &operator*=(qreal div); QTransform &operator/=(qreal div); diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 899e7f7c177..9ae8bd6c905 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -1025,7 +1025,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa imgCopy = cachedPixmap.toImage(); if (themeData.rotate) { - QMatrix rotMatrix; + QTransform rotMatrix; rotMatrix.rotate(themeData.rotate); imgCopy = imgCopy.transformed(rotMatrix); } diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h index e7ae21f2607..c8d8f8e8664 100644 --- a/src/printsupport/kernel/qprintengine_pdf_p.h +++ b/src/printsupport/kernel/qprintengine_pdf_p.h @@ -55,7 +55,6 @@ #ifndef QT_NO_PRINTER #include "QtCore/qmap.h" -#include "QtGui/qmatrix.h" #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "QtGui/qpaintengine.h" diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp index 92370be2bdf..16b84e328d0 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.cpp +++ b/src/printsupport/widgets/qprintpreviewwidget.cpp @@ -264,7 +264,7 @@ void QPrintPreviewWidgetPrivate::_q_fit(bool doFitting) } else { graphicsView->fitInView(target, Qt::KeepAspectRatio); if (zoomMode == QPrintPreviewWidget::FitInView) { - int step = qRound(graphicsView->matrix().mapRect(target).height()); + const int step = qRound(graphicsView->transform().mapRect(target).height()); graphicsView->verticalScrollBar()->setSingleStep(step); graphicsView->verticalScrollBar()->setPageStep(step); } diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp index 3d1b1e00309..ca6866376b3 100644 --- a/src/widgets/doc/snippets/javastyle.cpp +++ b/src/widgets/doc/snippets/javastyle.cpp @@ -380,10 +380,10 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option, QRect rect = bar->rect; if (bar->orientation == Qt::Vertical) { rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); - QMatrix m; + QTransform m; m.translate(rect.height()-1, 0); m.rotate(90.0); - painter->setMatrix(m); + painter->setTransform(m); } painter->setPen(bar->palette.color(QPalette::Mid)); diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 1cb24f74b6c..bbcceb1ce6c 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -231,7 +231,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index d36a8715335..3ba9bddc32a 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -47,7 +47,6 @@ #include #include #include -#include #include QT_REQUIRE_CONFIG(graphicsview); diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 102f3e894fa..686b41960ae 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1795,7 +1795,13 @@ void QGraphicsView::setSceneRect(const QRectF &rect) d->recalculateContentSize(); } +#if QT_DEPRECATED_SINCE(5, 15) + /*! + \obsolete + + Use transform() instead. + Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned. @@ -1808,6 +1814,10 @@ QMatrix QGraphicsView::matrix() const } /*! + \obsolete + + Use setTransform() instead. + Sets the view's current transformation matrix to \a matrix. If \a combine is true, then \a matrix is combined with the current matrix; @@ -1839,6 +1849,10 @@ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) } /*! + \obsolete + + Use resetTransform() instead. + Resets the view transformation matrix to the identity matrix. \sa resetTransform() @@ -1848,6 +1862,8 @@ void QGraphicsView::resetMatrix() resetTransform(); } +#endif // QT_DEPRECATED_SINCE(5, 15) + /*! Rotates the current view transformation \a angle degrees clockwise. diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 1389796c3f8..e98ec52d8f4 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -165,9 +165,11 @@ public: void setSceneRect(const QRectF &rect); inline void setSceneRect(qreal x, qreal y, qreal w, qreal h); - QMatrix matrix() const; - void setMatrix(const QMatrix &matrix, bool combine = false); - void resetMatrix(); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") QMatrix matrix() const; + QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false); + QT_DEPRECATED_X("Use resetTransform()") void resetMatrix(); +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform transform() const; QTransform viewportTransform() const; bool isTransformed() const; diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index c241f7a936b..1e5830d2161 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1556,7 +1556,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, qint64 maximum = qint64(pb->maximum); qint64 progress = qint64(pb->progress); - QMatrix m; + QTransform m; if (vertical) { rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 497afd17e1a..105eba370a1 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1692,7 +1692,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai const bool vertical = pb->orientation == Qt::Vertical; const bool inverted = pb->invertedAppearance; - QMatrix m; + QTransform m; if (vertical) { rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height m.rotate(90); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index bb28db7fac3..edd48854502 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -992,12 +992,12 @@ void QWidgetTextControl::selectAll() void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) { - QMatrix m; - m.translate(coordinateOffset.x(), coordinateOffset.y()); - processEvent(e, m, contextWidget); + QTransform t; + t.translate(coordinateOffset.x(), coordinateOffset.y()); + processEvent(e, t, contextWidget); } -void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) +void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget) { Q_D(QWidgetTextControl); if (d->interactionFlags == Qt::NoTextInteraction) { @@ -1038,22 +1038,22 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::MouseButtonPress: { QMouseEvent *ev = static_cast(e); - d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseMove: { QMouseEvent *ev = static_cast(e); - d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseButtonRelease: { QMouseEvent *ev = static_cast(e); - d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::MouseButtonDblClick: { QMouseEvent *ev = static_cast(e); - d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->globalPos()); break; } case QEvent::InputMethod: @@ -1062,7 +1062,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: { QContextMenuEvent *ev = static_cast(e); - d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + d->contextMenuEvent(ev->globalPos(), transform.map(ev->pos()), contextWidget); break; } #endif // QT_NO_CONTEXTMENU case QEvent::FocusIn: @@ -1077,7 +1077,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #ifndef QT_NO_TOOLTIP case QEvent::ToolTip: { QHelpEvent *ev = static_cast(e); - d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + d->showToolTip(ev->globalPos(), transform.map(ev->pos()), contextWidget); break; } #endif // QT_NO_TOOLTIP @@ -1094,13 +1094,13 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::DragMove: { QDragMoveEvent *ev = static_cast(e); - if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos()))) ev->acceptProposedAction(); break; } case QEvent::Drop: { QDropEvent *ev = static_cast(e); - if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source())) ev->acceptProposedAction(); break; } @@ -1109,32 +1109,32 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget #if QT_CONFIG(graphicsview) case QEvent::GraphicsSceneMousePress: { QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseMove: { QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseRelease: { QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneMouseDoubleClick: { QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(), ev->screenPos()); break; } case QEvent::GraphicsSceneContextMenu: { QGraphicsSceneContextMenuEvent *ev = static_cast(e); - d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget); + d->contextMenuEvent(ev->screenPos(), transform.map(ev->pos()), contextWidget); break; } case QEvent::GraphicsSceneHoverMove: { QGraphicsSceneHoverEvent *ev = static_cast(e); - d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton, + d->mouseMoveEvent(ev, Qt::NoButton, transform.map(ev->pos()), ev->modifiers(),Qt::NoButton, ev->screenPos()); break; } @@ -1148,12 +1148,12 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget break; case QEvent::GraphicsSceneDragMove: { QGraphicsSceneDragDropEvent *ev = static_cast(e); - if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos()))) ev->acceptProposedAction(); break; } case QEvent::GraphicsSceneDrop: { QGraphicsSceneDragDropEvent *ev = static_cast(e); - if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source())) ev->accept(); break; } #endif // QT_CONFIG(graphicsview) diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index 1f06aa0b971..c445ecaf806 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -252,7 +252,7 @@ public: QPalette palette() const; void setPalette(const QPalette &pal); - virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget = nullptr); + virtual void processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget = nullptr); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = nullptr); // control methods diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index 8197c386c5c..7873c94b6d3 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -3296,7 +3296,10 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(col, color); stream >> rGrad; QCOMPARE(rGrad.style(), radialBrush.style()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QCOMPARE(rGrad.matrix(), radialBrush.matrix()); +QT_WARNING_POP QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type()); QCOMPARE(rGrad.gradient()->stops(), radialBrush.gradient()->stops()); QCOMPARE(rGrad.gradient()->spread(), radialBrush.gradient()->spread()); @@ -3305,7 +3308,10 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius()); stream >> cGrad; QCOMPARE(cGrad.style(), conicalBrush.style()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QCOMPARE(cGrad.matrix(), conicalBrush.matrix()); +QT_WARNING_POP QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type()); QCOMPARE(cGrad.gradient()->stops(), conicalBrush.gradient()->stops()); QCOMPARE(cGrad.gradient()->spread(), conicalBrush.gradient()->spread()); diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index bc964e0d5c7..71aaa23da46 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -1204,7 +1204,7 @@ void tst_QImage::rotate() // original.save("rotated90_original.png", "png"); // Initialize the matrix manually (do not use rotate) to avoid rounding errors - QMatrix matRotate90; + QTransform matRotate90; matRotate90.rotate(degrees); QImage dest = original; // And rotate it 4 times, then the image should be identical to the original @@ -1218,7 +1218,7 @@ void tst_QImage::rotate() // dest.save("rotated90_result.png","png"); QCOMPARE(original, dest); - // Test with QMatrix::rotate 90 also, since we trust that now + // Test with QTransform::rotate 90 also, since we trust that now matRotate90.rotate(degrees); dest = original; // And rotate it 4 times, then the image should be identical to the original diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index ba5df809f2a..1d77f70919d 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #ifndef QT_NO_WIDGETS #include #include diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index 3ce65a67858..81f0183728e 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -193,9 +193,14 @@ template<> struct TestValueFactory { template<> struct TestValueFactory { static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); } }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED template<> struct TestValueFactory { static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); } }; +QT_WARNING_POP +#endif template<> struct TestValueFactory { static QTransform *create() { return new QTransform(10, 20, 30, 40, 50, 60); } }; diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 0b9fc3c9aec..8b301c145af 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -402,6 +402,9 @@ void tst_QGuiVariant::toString() QCOMPARE( str, result ); } +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED void tst_QGuiVariant::matrix() { QVariant variant; @@ -414,6 +417,8 @@ void tst_QGuiVariant::matrix() QVERIFY(mmatrix); QMetaType::destroy(QVariant::Matrix, mmatrix); } +QT_WARNING_POP +#endif void tst_QGuiVariant::matrix4x4() { diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index e19f76d8307..3c4f2f2e753 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -3061,6 +3061,9 @@ void tst_QMatrixNxN::columnsAndRows() QVERIFY(m1.row(3) == QVector4D(4, 8, 12, 16)); } +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // Test converting QMatrix objects into QMatrix4x4 and then // checking that transformations in the original perform the // equivalent transformations in the new matrix. @@ -3107,6 +3110,8 @@ void tst_QMatrixNxN::convertQMatrix() QVERIFY(qFuzzyCompare(float(m5.dx()), float(m7.dx()))); QVERIFY(qFuzzyCompare(float(m5.dy()), float(m7.dy()))); } +QT_WARNING_POP +#endif // Test converting QTransform objects into QMatrix4x4 and then // checking that transformations in the original perform the diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index e05de64be5e..9eb62ceab22 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -1704,8 +1704,11 @@ void tst_QPainter::combinedMatrix() QTransform ct = p.combinedTransform(); #if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QMatrix cm = p.combinedMatrix(); QCOMPARE(cm, ct.toAffine()); +QT_WARNING_POP #endif QPointF pt = QPointF(0, 0) * ct.toAffine(); @@ -2245,7 +2248,7 @@ void tst_QPainter::clippedPolygon() { QFETCH(QSize, imageSize); QFETCH(QPainterPath, path); - QPolygonF polygon = path.toFillPolygon(); + QPolygonF polygon = path.toFillPolygon(QTransform()); QFETCH(QRect, clipRect); QPainterPath clipPath; clipPath.addRect(clipRect); @@ -3066,7 +3069,7 @@ void tst_QPainter::fpe_steepSlopes_data() const qreal dsin = 0.000014946676875461832484392500630665523431162000633776187896728515625; const qreal dcos = 0.9999999998882984630910186751862056553363800048828125; - const QTransform transform = QTransform(QMatrix(dcos, dsin, -dsin, dcos, 64, 64)); + const QTransform transform = QTransform(dcos, dsin, -dsin, dcos, 64, 64); const QLineF line(2, 2, 2, 6); QTest::newRow("task 207147 aa") << transform << line << true; @@ -4064,7 +4067,7 @@ void tst_QPainter::drawPolygon() path.moveTo(2, 34); path.lineTo(34, 2); - QPolygonF poly = stroker.createStroke(path).toFillPolygon(); + QPolygonF poly = stroker.createStroke(path).toFillPolygon(QTransform()); img.fill(0xffffffff); QPainter p(&img); @@ -4133,7 +4136,10 @@ void tst_QPainter::inactivePainter() p.setClipping(true); #if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED p.combinedMatrix(); +QT_WARNING_POP #endif p.combinedTransform(); @@ -4142,7 +4148,10 @@ void tst_QPainter::inactivePainter() p.device(); #if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED p.deviceMatrix(); +QT_WARNING_POP #endif p.deviceTransform(); @@ -4168,7 +4177,10 @@ void tst_QPainter::inactivePainter() p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false); #if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED p.resetMatrix(); +QT_WARNING_POP #endif p.resetTransform(); p.rotate(1); @@ -4186,8 +4198,11 @@ void tst_QPainter::inactivePainter() p.setWindow(QRect(10, 10, 620, 460)); #if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED p.worldMatrix(); p.setWorldMatrix(QMatrix().translate(43, 21), true); +QT_WARNING_POP #endif p.setWorldMatrixEnabled(true); diff --git a/tests/auto/gui/painting/qpathclipper/paths.cpp b/tests/auto/gui/painting/qpathclipper/paths.cpp index 1328befd1b4..a8149583942 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.cpp +++ b/tests/auto/gui/painting/qpathclipper/paths.cpp @@ -713,9 +713,5 @@ QPainterPath Paths::bezierQuadrant() path.closeSubpath(); } - QMatrix m(2, 0, - 0, 2, - 0, 0); - return path; } diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp index 93035af7d37..01853d841a4 100644 --- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp @@ -152,9 +152,9 @@ void tst_QPathClipper::initTestCase() for (int i = 0; i < paths.size(); ++i) { QRectF bounds = paths[i].boundingRect(); - QMatrix m(1, 0, - 0, 1, - -bounds.center().x(), -bounds.center().y()); + QTransform m(1, 0, + 0, 1, + -bounds.center().x(), -bounds.center().y()); paths[i] = m.map(paths[i]); } diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp index f9366c9227e..78638a75187 100644 --- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -331,17 +331,13 @@ void tst_QTransform::mapToPolygon() void tst_QTransform::qhash() { - QMatrix m1; - m1.shear(3.0, 2.0); - m1.rotate(44); + QTransform t1; + t1.shear(3.0, 2.0); + t1.rotate(44); - QMatrix m2 = m1; - - QTransform t1(m1); - QTransform t2(m2); + QTransform t2 = t1; // not really much to test here, so just the bare minimum: - QCOMPARE(qHash(m1), qHash(m2)); QCOMPARE(qHash(t1), qHash(t2)); } @@ -376,6 +372,9 @@ void tst_QTransform::scale() QVERIFY( QTransform::fromScale( 1, 1 ) == QTransform()); } +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED void tst_QTransform::matrix() { QMatrix mat1; @@ -414,7 +413,7 @@ void tst_QTransform::matrix() QRect rect(43, 70, 200, 200); QPoint pt(43, 66); - QCOMPARE(tranInv.map(pt), matInv.map(pt)); + QCOMPARE(tranInv.mapRect(rect), matInv.mapRect(rect)); QCOMPARE(tranInv.map(pt), matInv.map(pt)); QPainterPath path; @@ -431,6 +430,8 @@ void tst_QTransform::testOffset() const QMatrix &aff = trans.toAffine(); QCOMPARE((void*)(&aff), (void*)(&trans)); } +QT_WARNING_POP +#endif void tst_QTransform::types() { diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp index da88a868f3a..281639c27ab 100644 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp @@ -32,6 +32,9 @@ #include #include +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class tst_QWMatrix : public QObject { @@ -324,5 +327,8 @@ void tst_QWMatrix::mapPolygon() } } +QT_WARNING_POP +#endif + QTEST_APPLESS_MAIN(tst_QWMatrix) #include "tst_qwmatrix.moc" diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 262e1772a04..5b11cd5d110 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8014,11 +8014,21 @@ public: //Doesn't use the extended style option so the exposed rect is the boundingRect if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) { QCOMPARE(option->exposedRect, boundingRect()); +#if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QCOMPARE(option->matrix, QMatrix()); +QT_WARNING_POP +#endif } else { QVERIFY(option->exposedRect != QRect()); QVERIFY(option->exposedRect != boundingRect()); +#if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QCOMPARE(option->matrix, sceneTransform().toAffine()); +QT_WARNING_POP +#endif } } QGraphicsRectItem::paint(painter, option, widget); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp index ed79904ed8e..0d8e5b4d542 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp @@ -31,7 +31,6 @@ #include #include -#include class tst_QGraphicsItemAnimation : public QObject { diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index ea89e2422b2..acf6ce1c68b 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -67,7 +67,7 @@ using namespace QTestPrivate; Q_DECLARE_METATYPE(ExpectedValueDescription) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) -Q_DECLARE_METATYPE(QMatrix) +Q_DECLARE_METATYPE(QTransform) Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(Qt::ScrollBarPolicy) Q_DECLARE_METATYPE(ScrollBarCount) @@ -291,7 +291,7 @@ void tst_QGraphicsView::construction() QCOMPARE(view.sceneRect(), QRectF()); QVERIFY(view.viewport()); QCOMPARE(view.viewport()->metaObject()->className(), "QWidget"); - QCOMPARE(view.matrix(), QMatrix()); + QCOMPARE(view.transform(), QTransform()); QVERIFY(view.items().isEmpty()); QVERIFY(view.items(QPoint()).isEmpty()); QVERIFY(view.items(QRect()).isEmpty()); @@ -1208,37 +1208,37 @@ void tst_QGraphicsView::matrix() void tst_QGraphicsView::matrix_convenience() { QGraphicsView view; - QCOMPARE(view.matrix(), QMatrix()); + QCOMPARE(view.transform(), QTransform()); // Check the convenience functions view.rotate(90); - QCOMPARE(view.matrix(), QMatrix().rotate(90)); + QCOMPARE(view.transform(), QTransform().rotate(90)); view.scale(2, 2); - QCOMPARE(view.matrix(), QMatrix().scale(2, 2) * QMatrix().rotate(90)); + QCOMPARE(view.transform(), QTransform().scale(2, 2) * QTransform().rotate(90)); view.shear(1.2, 1.2); - QCOMPARE(view.matrix(), QMatrix().shear(1.2, 1.2) * QMatrix().scale(2, 2) * QMatrix().rotate(90)); + QCOMPARE(view.transform(), QTransform().shear(1.2, 1.2) * QTransform().scale(2, 2) * QTransform().rotate(90)); view.translate(1, 1); - QCOMPARE(view.matrix(), QMatrix().translate(1, 1) * QMatrix().shear(1.2, 1.2) * QMatrix().scale(2, 2) * QMatrix().rotate(90)); + QCOMPARE(view.transform(), QTransform().translate(1, 1) * QTransform().shear(1.2, 1.2) * QTransform().scale(2, 2) * QTransform().rotate(90)); } void tst_QGraphicsView::matrix_combine() { // Check matrix combining QGraphicsView view; - QCOMPARE(view.matrix(), QMatrix()); - view.setMatrix(QMatrix().rotate(90), true); - view.setMatrix(QMatrix().rotate(90), true); - view.setMatrix(QMatrix().rotate(90), true); - view.setMatrix(QMatrix().rotate(90), true); - QCOMPARE(view.matrix(), QMatrix()); + QCOMPARE(view.transform(), QTransform()); + view.setTransform(QTransform().rotate(90), true); + view.setTransform(QTransform().rotate(90), true); + view.setTransform(QTransform().rotate(90), true); + view.setTransform(QTransform().rotate(90), true); + QCOMPARE(view.transform(), QTransform()); - view.resetMatrix(); - QCOMPARE(view.matrix(), QMatrix()); - view.setMatrix(QMatrix().rotate(90), false); - view.setMatrix(QMatrix().rotate(90), false); - view.setMatrix(QMatrix().rotate(90), false); - view.setMatrix(QMatrix().rotate(90), false); - QCOMPARE(view.matrix(), QMatrix().rotate(90)); + view.resetTransform(); + QCOMPARE(view.transform(), QTransform()); + view.setTransform(QTransform().rotate(90), false); + view.setTransform(QTransform().rotate(90), false); + view.setTransform(QTransform().rotate(90), false); + view.setTransform(QTransform().rotate(90), false); + QCOMPARE(view.transform(), QTransform().rotate(90)); } void tst_QGraphicsView::centerOnPoint() @@ -2125,8 +2125,8 @@ void tst_QGraphicsView::mapFromScenePath() QPainterPath path2; path2.addPolygon(polygon2); - QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon(); - QPolygonF path2Poly = path2.toFillPolygon(); + QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon(QTransform()); + QPolygonF path2Poly = path2.toFillPolygon(QTransform()); for (int i = 0; i < pathPoly.size(); ++i) { QVERIFY(qAbs(pathPoly[i].x() - path2Poly[i].x()) < 3); diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp index 6e0ac445a69..60e8dd0032c 100644 --- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp +++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp @@ -187,7 +187,7 @@ void View::setupMatrix() { qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50)); - QMatrix matrix; + QTransform matrix; matrix.scale(scale, scale); matrix.rotate(rotateSlider->value()); From fb7c9dfc060a09b4b1fa6d474f106bb6c1d2d4df Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 25 Jan 2020 20:43:13 +0100 Subject: [PATCH 67/71] QButtonGroup: deprecate overloaded signals Deprecate the overloaded signals buttonClicked/buttonPressed/buttonReleased/buttonToggled taking an int to avoid to need to use QOverload<> when connecting the signal. The id of a button in a button group can be easily fetched with QButtonGroup::id(). Task-number: QTBUG-80906 Change-Id: Idaaab54bbcb25cba543fc99f305b9f4743ee3ed8 Reviewed-by: Sze Howe Koh Reviewed-by: Richard Moe Gustavsen --- examples/widgets/animation/easing/window.cpp | 7 ++++--- examples/widgets/animation/easing/window.h | 2 +- .../graphicsview/diagramscene/mainwindow.cpp | 13 ++++++------ .../graphicsview/diagramscene/mainwindow.h | 4 ++-- src/widgets/widgets/qabstractbutton.cpp | 20 +++++++++++++++++++ src/widgets/widgets/qbuttongroup.cpp | 4 ++++ src/widgets/widgets/qbuttongroup.h | 12 ++++++++--- 7 files changed, 47 insertions(+), 15 deletions(-) diff --git a/examples/widgets/animation/easing/window.cpp b/examples/widgets/animation/easing/window.cpp index d1d63483618..378af07535c 100644 --- a/examples/widgets/animation/easing/window.cpp +++ b/examples/widgets/animation/easing/window.cpp @@ -67,7 +67,7 @@ Window::Window(QWidget *parent) connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged, this, &Window::curveChanged); - connect(m_ui.buttonGroup, QOverload::of(&QButtonGroup::buttonClicked), + connect(m_ui.buttonGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &Window::pathChanged); connect(m_ui.periodSpinBox, QOverload::of(&QDoubleSpinBox::valueChanged), this, &Window::periodChanged); @@ -180,9 +180,10 @@ void Window::curveChanged(int row) m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack); } -void Window::pathChanged(int index) +void Window::pathChanged(QAbstractButton *button) { - m_anim->setPathType((Animation::PathType)index); + const int index = m_ui.buttonGroup->id(button); + m_anim->setPathType(Animation::PathType(index)); } void Window::periodChanged(double value) diff --git a/examples/widgets/animation/easing/window.h b/examples/widgets/animation/easing/window.h index 541377a981d..0c49dd6e8a5 100644 --- a/examples/widgets/animation/easing/window.h +++ b/examples/widgets/animation/easing/window.h @@ -69,7 +69,7 @@ public: Window(QWidget *parent = nullptr); private slots: void curveChanged(int row); - void pathChanged(int index); + void pathChanged(QAbstractButton *button); void periodChanged(double); void amplitudeChanged(double); void overshootChanged(double); diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp index 04ff42e3ebe..58b959dd10e 100644 --- a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp +++ b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp @@ -113,13 +113,14 @@ void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button) //! [1] //! [2] -void MainWindow::buttonGroupClicked(int id) +void MainWindow::buttonGroupClicked(QAbstractButton *button) { const QList buttons = buttonGroup->buttons(); - for (QAbstractButton *button : buttons) { - if (buttonGroup->button(id) != button) + for (QAbstractButton *myButton : buttons) { + if (myButton != button) button->setChecked(false); } + const int id = buttonGroup->id(button); if (id == InsertTextButton) { scene->setMode(DiagramScene::InsertText); } else { @@ -154,7 +155,7 @@ void MainWindow::deleteItem() //! [3] //! [4] -void MainWindow::pointerGroupClicked(int) +void MainWindow::pointerGroupClicked() { scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId())); } @@ -334,7 +335,7 @@ void MainWindow::createToolBox() { buttonGroup = new QButtonGroup(this); buttonGroup->setExclusive(false); - connect(buttonGroup, QOverload::of(&QButtonGroup::buttonClicked), + connect(buttonGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &MainWindow::buttonGroupClicked); QGridLayout *layout = new QGridLayout; layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0); @@ -528,7 +529,7 @@ void MainWindow::createToolbars() pointerTypeGroup = new QButtonGroup(this); pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem)); pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine)); - connect(pointerTypeGroup, QOverload::of(&QButtonGroup::buttonClicked), + connect(pointerTypeGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &MainWindow::pointerGroupClicked); sceneScaleCombo = new QComboBox; diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.h b/examples/widgets/graphicsview/diagramscene/mainwindow.h index e04224fbc7b..9fcd1884ca5 100644 --- a/examples/widgets/graphicsview/diagramscene/mainwindow.h +++ b/examples/widgets/graphicsview/diagramscene/mainwindow.h @@ -82,9 +82,9 @@ public: private slots: void backgroundButtonGroupClicked(QAbstractButton *button); - void buttonGroupClicked(int id); + void buttonGroupClicked(QAbstractButton *button); void deleteItem(); - void pointerGroupClicked(int id); + void pointerGroupClicked(); void bringToFront(); void sendToBack(); void itemInserted(DiagramItem *item); diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 022f41738cf..7961d0a21bc 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -415,8 +415,13 @@ void QAbstractButtonPrivate::emitClicked() emit q->clicked(checked); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonClicked(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonClicked(q); } #endif @@ -429,8 +434,13 @@ void QAbstractButtonPrivate::emitPressed() emit q->pressed(); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonPressed(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonPressed(q); } #endif @@ -443,8 +453,13 @@ void QAbstractButtonPrivate::emitReleased() emit q->released(); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonReleased(group->id(q)); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonReleased(q); } #endif @@ -457,8 +472,13 @@ void QAbstractButtonPrivate::emitToggled(bool checked) emit q->toggled(checked); #if QT_CONFIG(buttongroup) if (guard && group) { +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED emit group->buttonToggled(group->id(q), checked); if (guard && group) +QT_WARNING_POP +#endif emit group->buttonToggled(q, checked); } #endif diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp index c3fd37d8e9b..9162029cdbc 100644 --- a/src/widgets/widgets/qbuttongroup.cpp +++ b/src/widgets/widgets/qbuttongroup.cpp @@ -164,6 +164,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonClicked(int id) + \obsolete This signal is emitted when a button with the given \a id is clicked. @@ -183,6 +184,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonPressed(int id) \since 4.2 + \obsolete This signal is emitted when a button with the given \a id is pressed down. @@ -202,6 +204,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonReleased(int id) \since 4.2 + \obsolete This signal is emitted when a button with the given \a id is released. @@ -222,6 +225,7 @@ void QButtonGroup::setExclusive(bool exclusive) /*! \fn void QButtonGroup::buttonToggled(int id, bool checked) \since 5.2 + \obsolete This signal is emitted when a button with the given \a id is toggled. \a checked is true if the button is checked, or false if the button is unchecked. diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h index fec94ccb3e9..2989dcb4ba1 100644 --- a/src/widgets/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -78,13 +78,19 @@ public: Q_SIGNALS: void buttonClicked(QAbstractButton *); - void buttonClicked(int); void buttonPressed(QAbstractButton *); - void buttonPressed(int); void buttonReleased(QAbstractButton *); - void buttonReleased(int); void buttonToggled(QAbstractButton *, bool); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonClicked(QAbstractButton *) instead") + void buttonClicked(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonPressed(QAbstractButton *) instead") + void buttonPressed(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonReleased(QAbstractButton *) instead") + void buttonReleased(int); + QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonToggled(QAbstractButton *, bool) instead") void buttonToggled(int, bool); +#endif private: Q_DISABLE_COPY(QButtonGroup) From b0c804f345a383d2813f4709632baa43a4275646 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 29 Dec 2019 13:24:34 +0100 Subject: [PATCH 68/71] QComboBox: unify behavior of setModel() and modelReset When a new model is set, a valid index is selected. When a model is reset, this is not the case which is slightly inconsistent. Fix it by using the same logic to find a valid index when the model is reset Fixes: QTBUG-80998 Change-Id: I6c167511e199a6664343cf1dc3bcd27c65389bfd Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qcombobox.cpp | 37 +++++++++++-------- src/widgets/widgets/qcombobox_p.h | 1 + .../widgets/qcombobox/tst_qcombobox.cpp | 11 ++---- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index aa3788c404f..95c2bea3fe5 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -293,8 +293,7 @@ void QComboBoxPrivate::_q_modelReset() lineEdit->setText(QString()); updateLineEditGeometry(); } - if (currentIndex.row() != indexBeforeChange) - _q_emitCurrentIndexChanged(currentIndex); + trySetValidIndex(); modelChanged(); q->update(); } @@ -304,6 +303,25 @@ void QComboBoxPrivate::_q_modelDestroyed() model = QAbstractItemModelPrivate::staticEmptyModel(); } +void QComboBoxPrivate::trySetValidIndex() +{ + Q_Q(QComboBox); + bool currentReset = false; + + const int rowCount = q->count(); + for (int pos = 0; pos < rowCount; ++pos) { + const QModelIndex idx(model->index(pos, modelColumn, root)); + if (idx.flags() & Qt::ItemIsEnabled) { + setCurrentIndex(idx); + currentReset = true; + break; + } + } + + if (!currentReset) + setCurrentIndex(QModelIndex()); +} + QRect QComboBoxPrivate::popupGeometry(int screen) const { return QStylePrivate::useFullScreenForPopup() @@ -2200,20 +2218,7 @@ void QComboBox::setModel(QAbstractItemModel *model) setRootModelIndex(QModelIndex()); - bool currentReset = false; - - const int rowCount = count(); - for (int pos=0; pos < rowCount; pos++) { - if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled) { - setCurrentIndex(pos); - currentReset = true; - break; - } - } - - if (!currentReset) - setCurrentIndex(-1); - + d->trySetValidIndex(); d->modelChanged(); } diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 7a3fcf6e0fd..3e78e756a6a 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -371,6 +371,7 @@ public: void _q_rowsRemoved(const QModelIndex &parent, int start, int end); void updateArrow(QStyle::StateFlag state); bool updateHoverControl(const QPoint &pos); + void trySetValidIndex(); QRect popupGeometry(int screen = -1) const; QStyle::SubControl newHoverControl(const QPoint &pos); int computeWidthHint() const; diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index ea1b330152e..3878e7ccb20 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2756,10 +2756,7 @@ void tst_QComboBox::resetModel() class StringListModel : public QStringListModel { public: - StringListModel(const QStringList &list) : QStringListModel(list) - { - } - + using QStringListModel::QStringListModel; void reset() { QStringListModel::beginResetModel(); @@ -2767,8 +2764,8 @@ void tst_QComboBox::resetModel() } }; QComboBox cb; - StringListModel model( QStringList() << "1" << "2"); - QSignalSpy spy(&cb, SIGNAL(currentIndexChanged(int))); + StringListModel model({"1", "2"}); + QSignalSpy spy(&cb, QOverload::of(&QComboBox::currentIndexChanged)); QCOMPARE(spy.count(), 0); QCOMPARE(cb.currentIndex(), -1); //no selection @@ -2779,7 +2776,7 @@ void tst_QComboBox::resetModel() model.reset(); QCOMPARE(spy.count(), 2); - QCOMPARE(cb.currentIndex(), -1); //no selection + QCOMPARE(cb.currentIndex(), 0); //first item selected } From fcd3a20059d0c629d972ba2577694394b438a100 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 27 Jan 2020 08:56:10 +0100 Subject: [PATCH 69/71] macOS build: Fix 'direct access in function...' warning For every executable that uses a static Qt library (e.g. rcc using libQt5Bootstrap.a) we got a warning: 'direct access in function...to global weak symbol'. This was because we've built all libraries with -fvisibility=hidden -fvisibility-inlines-hidden but not the executables linking against them. On macOS however, all translation units must have the same visibility setting. We're now setting the same visibilty for libs and executables on darwin. Fixes: QTBUG-81297 Change-Id: I2668e9385caa7f0ce78bf3727b4e5322bc4a294f Reviewed-by: Alexandru Croitor --- mkspecs/features/qt_common.prf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index c24f2c60621..02460a2e0c2 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -23,7 +23,6 @@ qtConfig(c11): CONFIG += c11 qtConfig(stack-protector-strong): CONFIG += stack_protector_strong contains(TEMPLATE, .*lib) { # module and plugins - if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions qtConfig(separate_debug_info): CONFIG += separate_debug_info @@ -58,6 +57,9 @@ contains(TEMPLATE, .*lib) { QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace } } +contains(TEMPLATE, .*lib)|darwin { + if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols +} # The remainder of this file must not apply to host tools/libraries, # as the host compiler's version and capabilities are not checked. From 07a576cc6171fd78d7fb3a0332349c2fa6127460 Mon Sep 17 00:00:00 2001 From: Vitaly Fanaskov Date: Mon, 27 Jan 2020 16:45:16 +0100 Subject: [PATCH 70/71] QProcess: remove deprecated signature of finished signal Task-number: QTBUG-80906 Change-Id: Ic9852bc5031d357d23ff6c13a65d020a4b6ea3d6 Reviewed-by: Joerg Bornemann --- src/corelib/io/qprocess.cpp | 16 --- src/corelib/io/qprocess.h | 6 +- .../auto/corelib/io/qprocess/tst_qprocess.cpp | 108 +++--------------- 3 files changed, 19 insertions(+), 111 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index aedcae2cdca..5d5b0b2a29f 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -810,16 +810,6 @@ void QProcessPrivate::Channel::clear() \a newState argument is the state QProcess changed to. */ -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \fn void QProcess::finished(int exitCode) - \obsolete - \overload - - Use finished(int exitCode, QProcess::ExitStatus status) instead. -*/ -#endif - /*! \fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus) @@ -1175,12 +1165,6 @@ bool QProcessPrivate::_q_processDied() //emit q->standardOutputClosed(); //emit q->standardErrorClosed(); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - emit q->finished(exitCode); -QT_WARNING_POP -#endif emit q->finished(exitCode, exitStatus); } #if defined QPROCESS_DEBUG diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 585508adf18..0a2187750f6 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -273,11 +273,7 @@ public Q_SLOTS: Q_SIGNALS: void started(QPrivateSignal); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QProcess::finished(int, QProcess::ExitStatus) instead") - void finished(int exitCode); // ### Qt 6: merge the two signals with a default value -#endif - void finished(int exitCode, QProcess::ExitStatus exitStatus); + void finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit); #if QT_DEPRECATED_SINCE(5, 6) QT_DEPRECATED_X("Use QProcess::errorOccurred(QProcess::ProcessError) instead") void error(QProcess::ProcessError error); diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e799369c8a8..269a59ae41e 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -42,8 +42,6 @@ #include #include -typedef void (QProcess::*QProcessFinishedSignal1)(int); -typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus); typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError); class tst_QProcess : public QObject @@ -152,7 +150,6 @@ private slots: void failToStartEmptyArgs(); #if QT_DEPRECATED_SINCE(5, 13) - void crashTest2_deprecated(); void restartProcessDeadlock_deprecated(); void waitForReadyReadInAReadyReadSlot_deprecated(); void finishProcessBeforeReadingDone_deprecated(); @@ -350,7 +347,7 @@ void tst_QProcess::crashTest() qRegisterMetaType("QProcess::ExitStatus"); QSignalSpy spy(process.data(), &QProcess::errorOccurred); - QSignalSpy spy2(process.data(), static_cast(&QProcess::finished)); + QSignalSpy spy2(process.data(), &QProcess::finished); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); @@ -393,13 +390,12 @@ void tst_QProcess::crashTest2() qRegisterMetaType("QProcess::ExitStatus"); QSignalSpy spy(&process, static_cast(&QProcess::errorOccurred)); - QSignalSpy spy2(&process, static_cast(&QProcess::finished)); + QSignalSpy spy2(&process, &QProcess::finished); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); - QObject::connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + QObject::connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) @@ -724,15 +720,14 @@ void tst_QProcess::restartProcessDeadlock() // process in the finished() connected slot causes a deadlock // because of the way QProcessManager uses its locks. QProcess process; - connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::restartProcess); + connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess); process.start("testProcessEcho/testProcessEcho"); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); - QObject::disconnect(&process, static_cast(&QProcess::finished), nullptr, nullptr); + QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); @@ -931,8 +926,7 @@ public: SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false) { - connect(this, static_cast(&QProcess::finished), - this, &SoftExitProcess::finishedSlot); + connect(this, &QProcess::finished, this, &SoftExitProcess::finishedSlot); switch (n) { case 0: @@ -1177,8 +1171,7 @@ protected: exitCode = 90210; QProcess process; - connect(&process, static_cast(&QProcess::finished), - this, &TestThread::catchExitCode, Qt::DirectConnection); + connect(&process, &QProcess::finished, this, &TestThread::catchExitCode, Qt::DirectConnection); process.start("testProcessEcho/testProcessEcho"); @@ -1251,8 +1244,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() { QProcess process; connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot); - connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); bytesAvailable = 0; process.start("testProcessEcho/testProcessEcho"); @@ -1490,7 +1482,7 @@ void tst_QProcess::failToStart() QProcess process; QSignalSpy stateSpy(&process, &QProcess::stateChanged); QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(stateSpy.isValid()); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1499,10 +1491,6 @@ void tst_QProcess::failToStart() QSignalSpy errorSpy2(&process, static_cast(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif // OS X and HP-UX have a really low default process limit (~100), so spawning // to many processes here will cause test failures later on. @@ -1548,9 +1536,6 @@ void tst_QProcess::failToStart() #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), j * attempts + i + 1); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); -#endif int it = j * attempts + i + 1; @@ -1569,7 +1554,7 @@ void tst_QProcess::failToStartWithWait() QProcess process; QEventLoop loop; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1577,10 +1562,6 @@ void tst_QProcess::failToStartWithWait() QSignalSpy errorSpy2(&process, static_cast(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif for (int i = 0; i < 50; ++i) { process.start("/blurp", QStringList() << "-v" << "-debug"); @@ -1592,10 +1573,6 @@ void tst_QProcess::failToStartWithWait() #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), i + 1); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); -#endif - } } @@ -1607,7 +1584,7 @@ void tst_QProcess::failToStartWithEventLoop() QProcess process; QEventLoop loop; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1615,10 +1592,6 @@ void tst_QProcess::failToStartWithEventLoop() QSignalSpy errorSpy2(&process, static_cast(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif // The error signal may be emitted before start() returns connect(&process, &QProcess::errorOccurred, &loop, &QEventLoop::quit, Qt::QueuedConnection); @@ -1634,9 +1607,6 @@ void tst_QProcess::failToStartWithEventLoop() QCOMPARE(finishedSpy.count(), 0); #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), i + 1); -#endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); #endif } } @@ -1912,7 +1882,7 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QProcess process; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1920,10 +1890,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QSignalSpy errorSpy2(&process, static_cast(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy1(&process, static_cast(&QProcess::finished)); - QVERIFY(finishedSpy1.isValid()); -#endif QVERIFY(!process.waitForReadyRead()); // used to crash process.start("doesntexist"); @@ -1935,9 +1901,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QCOMPARE(errorSpy2.count(), 1); QCOMPARE(errorSpy2.at(0).at(0).toInt(), 0); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy1.count(), 0); -#endif } void tst_QProcess::setStandardInputFile() @@ -2390,7 +2353,7 @@ void tst_QProcess::onlyOneStartedSignal() QProcess process; QSignalSpy spyStarted(&process, &QProcess::started); - QSignalSpy spyFinished(&process, static_cast(&QProcess::finished)); + QSignalSpy spyFinished(&process, &QProcess::finished); QVERIFY(spyStarted.isValid()); QVERIFY(spyFinished.isValid()); @@ -2433,8 +2396,7 @@ void tst_QProcess::finishProcessBeforeReadingDone() QProcess process; BlockOnReadStdOut blocker(&process); QEventLoop loop; - connect(&process, static_cast(&QProcess::finished), - &loop, &QEventLoop::quit); + connect(&process, &QProcess::finished, &loop, &QEventLoop::quit); process.start("testProcessOutput/testProcessOutput"); QVERIFY(process.waitForStarted()); loop.exec(); @@ -2581,52 +2543,20 @@ void tst_QProcess::processEventsInAReadyReadSlot() #if QT_DEPRECATED_SINCE(5, 13) -void tst_QProcess::crashTest2_deprecated() -{ - QProcess process; - process.start("testProcessCrash/testProcessCrash"); - QVERIFY(process.waitForStarted(5000)); - - qRegisterMetaType("QProcess::ProcessError"); - qRegisterMetaType("QProcess::ExitStatus"); - - QSignalSpy spy(&process, static_cast(&QProcess::errorOccurred)); - QSignalSpy spy2(&process, static_cast(&QProcess::finished)); - - QVERIFY(spy.isValid()); - QVERIFY(spy2.isValid()); - - QObject::connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); - - QTestEventLoop::instance().enterLoop(30); - if (QTestEventLoop::instance().timeout()) - QFAIL("Failed to detect crash : operation timed out"); - - QCOMPARE(spy.count(), 1); - QCOMPARE(*static_cast(spy.at(0).at(0).constData()), QProcess::Crashed); - - QCOMPARE(spy2.count(), 1); - QCOMPARE(*static_cast(spy2.at(0).at(1).constData()), QProcess::CrashExit); - - QCOMPARE(process.exitStatus(), QProcess::CrashExit); -} - void tst_QProcess::restartProcessDeadlock_deprecated() { // The purpose of this test is to detect whether restarting a // process in the finished() connected slot causes a deadlock // because of the way QProcessManager uses its locks. QProcess process; - connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::restartProcess); + connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess); process.start("testProcessEcho/testProcessEcho"); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); - QObject::disconnect(&process, static_cast(&QProcess::finished), nullptr, nullptr); + QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); @@ -2638,8 +2568,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot_deprecated() { QProcess process; connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot); - connect(&process, static_cast(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); bytesAvailable = 0; process.start("testProcessEcho/testProcessEcho"); @@ -2665,8 +2594,7 @@ void tst_QProcess::finishProcessBeforeReadingDone_deprecated() QProcess process; BlockOnReadStdOut blocker(&process); QEventLoop loop; - connect(&process, static_cast(&QProcess::finished), - &loop, &QEventLoop::quit); + connect(&process, &QProcess::finished, &loop, &QEventLoop::quit); process.start("testProcessOutput/testProcessOutput"); QVERIFY(process.waitForStarted()); loop.exec(); From 1bd60749d140d14d152b59eccbda4790c517c54e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 28 Jan 2020 12:34:18 +0100 Subject: [PATCH 71/71] QOpenGLContext: use extraFunctions instead of versioned functions Task-number: QTBUG-74409 Change-Id: I548cd4b683cbf67c9716d424b48fdc8b3f6a8c09 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index fbaff74561c..6915433aed6 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -372,20 +372,8 @@ int QOpenGLContextPrivate::maxTextureSize() GLint next = 64; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - QOpenGLFunctions_1_0 *gl1funcs = nullptr; - QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; - - if (q->format().profile() == QSurfaceFormat::CoreProfile) - gl3funcs = q->versionFunctions(); - else - gl1funcs = q->versionFunctions(); - - Q_ASSERT(gl1funcs || gl3funcs); - - if (gl1funcs) - gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); - else - gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); + QOpenGLExtraFunctions *extraFuncs = q->extraFunctions(); + extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); if (size == 0) { return max_texture_size; @@ -397,11 +385,7 @@ int QOpenGLContextPrivate::maxTextureSize() if (next > max_texture_size) break; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - if (gl1funcs) - gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); - else - gl3funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); - + extraFuncs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); } while (next > size); max_texture_size = size;