From 73d1476fb1397948a4d806bd921fce372bd8d63b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Dec 2019 17:54:48 +0100 Subject: 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 --- src/platformsupport/accessibility/qaccessiblebridgeutils.cpp | 2 +- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 2 +- src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp b/src/platformsupport/accessibility/qaccessiblebridgeutils.cpp index f280e65c29..a15b93e31e 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 0f34e1a4ca..012edc82e4 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 70d5616075..36d9e4e065 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(); -- cgit v1.2.3 From 2344e5cc3104b7d599f4d2a96bbfd8530223a08e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 12 Dec 2019 08:51:20 +0100 Subject: 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/platformsupport/vkconvenience/qvkconvenience.cpp | 4 +++- src/platformsupport/vkconvenience/vkconvenience.pro | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/vkconvenience/qvkconvenience.cpp b/src/platformsupport/vkconvenience/qvkconvenience.cpp index acde1d1bda..59de335333 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 ee540024cf..f3ada5768a 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 -- cgit v1.2.3 From f21a6d409ea0504c64cd72861fc16b6f3e080086 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 18 Dec 2019 15:43:24 +0100 Subject: 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 --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 7af5490963..af49ad6407 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); -- cgit v1.2.3