diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-18 10:43:17 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-18 10:46:22 +0200 |
commit | 18934bcb0c388eb4723043cb5001702fecaf90bc (patch) | |
tree | 59f4f1e5de00fa49e49bace1a38f1bce52e48457 /src | |
parent | bc5454d2c41873349ea32c42aca8fc794cba442e (diff) | |
parent | d1210281e41008ce2e3510aa5cfb3ebea1c57734 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/corelib/global/qglobal.cpp
Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 20 | ||||
-rw-r--r-- | src/corelib/io/qfileselector.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qstringbuilder.cpp | 28 | ||||
-rw-r--r-- | src/gui/math3d/qmatrix4x4.h | 3 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 2 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 10 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu_p.h | 14 |
10 files changed, 72 insertions, 32 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 1f93d3cbec..c37503f3db 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2628,12 +2628,14 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns - "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems, - "watchos" for watchOS systems, and "darwin" in case the system could not - be determined. + \b{\macos note}: this function returns "osx" for all \macos systems, + regardless of Apple naming convention. The returned string will be updated + for Qt 6. Note that this function erroneously returned "macos" for \macos + 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0. - \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12. + \b{Darwin, iOS, tvOS, and watchOS note}: this function returns "ios" for + iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and + "darwin" in case the system could not be determined. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. @@ -2666,10 +2668,12 @@ QString QSysInfo::productType() #elif defined(Q_OS_WATCHOS) return QStringLiteral("watchos"); #elif defined(Q_OS_MACOS) - const auto version = QOperatingSystemVersion::current(); - if (version.majorVersion() == 10 && version.minorVersion() < 12) - return QStringLiteral("osx"); + // ### Qt6: remove fallback +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) return QStringLiteral("macos"); +# else + return QStringLiteral("osx"); +# endif #elif defined(Q_OS_DARWIN) return QStringLiteral("darwin"); diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index cb4f5c4b07..9db67f2f9b 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -363,6 +363,7 @@ void QFileSelectorPrivate::updateSelectors() QStringList QFileSelectorPrivate::platformSelectors() { // similar, but not identical to QSysInfo::osType + // ### Qt6: remove macOS fallbacks to "mac" and the future compatibility QStringList ret; #if defined(Q_OS_WIN) ret << QStringLiteral("windows"); @@ -380,12 +381,11 @@ QStringList QFileSelectorPrivate::platformSelectors() # endif # endif QString productName = QSysInfo::productType(); -# ifdef Q_OS_MACOS - if (productName != QLatin1String("osx")) - ret << QStringLiteral("osx"); // compatibility -# endif if (productName != QLatin1String("unknown")) - ret << productName; // "opensuse", "fedora", "macos", "ios", "android" + ret << productName; // "opensuse", "fedora", "osx", "ios", "android" +# if defined(Q_OS_MACOS) + ret << QStringLiteral("macos"); // future compatibility +# endif #endif return ret; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index bde4bf553e..697e0062dd 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ +#include "qglobal.h" + #if !defined(QWS) && defined(Q_OS_MAC) # include "private/qcore_mac_p.h" # include <CoreFoundation/CoreFoundation.h> #endif -#include "qglobal.h" - #include "qplatformdefs.h" #include "qdatastream.h" diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 0d42c8a212..15573c5588 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -260,6 +260,7 @@ namespace QtSharedPointer { internalSafetyCheckRemove(self); deleter(self); } + static void noDeleter(ExternalRefCountData *) { } static inline ExternalRefCountData *create(T **ptr, DestroyerFn destroy) { @@ -433,11 +434,13 @@ public: # else typename Private::DestroyerFn destroy = &Private::deleter; # endif + typename Private::DestroyerFn noDestroy = &Private::noDeleter; QSharedPointer result(Qt::Uninitialized); - result.d = Private::create(&result.value, destroy); + result.d = Private::create(&result.value, noDestroy); // now initialize the data new (result.data()) T(std::forward<Args>(arguments)...); + result.d->destroyer = destroy; result.d->setQObjectShared(result.value, true); # ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(result.d, result.value); diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index de12de19cb..70152a9202 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \reentrant \since 4.6 - \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks. + \brief The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks. \ingroup tools \ingroup shared @@ -58,22 +58,34 @@ QT_BEGIN_NAMESPACE To build a QString by multiple concatenations, QString::operator+() - is typically used. This causes \e{n - 1} reallocations when building - a string from \e{n} chunks. + is typically used. This causes \e{n - 1} allocations when building + a string from \e{n} chunks. The same is true for QByteArray. QStringBuilder uses expression templates to collect the individual chunks, compute the total size, allocate the required amount of - memory for the final QString object, and copy the chunks into the + memory for the final string object, and copy the chunks into the allocated memory. The QStringBuilder class is not to be used explicitly in user code. Instances of the class are created as return values of the - operator%() function, acting on objects of type QString, - QLatin1String, QStringRef, QChar, QCharRef, - QLatin1Char, and \c char. + operator%() function, acting on objects of the following types: + + For building QStrings: + + \li QString, QStringRef, + \li QChar, QCharRef, QLatin1Char, + \li QLatin1String, + \li QByteArray, \c char, \c{const char[]}. + + The types in the last list point are only available when + QT_NO_CAST_FROM_ASCII is not defined. + + For building QByteArrays: + + \li QByteArray, \c char, \c{const char[]}. Concatenating strings with operator%() generally yields better - performance then using \c QString::operator+() on the same chunks + performance than using \c QString::operator+() on the same chunks if there are three or more of them, and performs equally well in other cases. diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index aca685920e..4db96d07c0 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -423,8 +423,9 @@ inline QMatrix4x4& QMatrix4x4::operator-=(const QMatrix4x4& other) return *this; } -inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& other) +inline QMatrix4x4& QMatrix4x4::operator*=(const QMatrix4x4& o) { + const QMatrix4x4 other = o; // prevent aliasing when &o == this ### Qt 6: take o by value flagBits |= other.flagBits; if (flagBits < Rotation2D) { diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 8834afc80e..fcda17605f 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -292,7 +292,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) /*! Constructs a QSyntaxHighlighter with the given \a parent. - If the parent is a QTextEdit, it installs the syntaxhighlighter on the + If the parent is a QTextEdit, it installs the syntax highlighter on the parents document. The specified QTextEdit also becomes the owner of the QSyntaxHighlighter. */ diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index a997bf0ba1..969a9c17e0 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -901,7 +901,13 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef bool forcedAntialiasSetting = !antialias; const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); - bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")); + bool useXftConf = false; + + if (services) { + const QList<QByteArray> desktopEnv = services->desktopEnvironment().split(':'); + useXftConf = desktopEnv.contains("GNOME") || desktopEnv.contains("UNITY"); + } + if (useXftConf && !forcedAntialiasSetting) { void *antialiasResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 995a08e310..cf3fc9a9f6 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -667,6 +667,7 @@ void QMenuSloppyState::reset() m_enabled = false; m_first_mouse = true; m_init_guard = false; + m_use_reset_action = true; m_uni_dir_discarded_count = 0; m_time.stop(); m_reset_action = Q_NULLPTR; @@ -719,6 +720,7 @@ void QMenuSloppyState::setSubMenuPopup(const QRect &actionRect, QAction *resetAc { m_enabled = true; m_init_guard = true; + m_use_reset_action = true; m_time.stop(); m_action_rect = actionRect; m_sub_menu = subMenu; @@ -779,10 +781,12 @@ void QMenuSloppyState::timeout() if (m_sub_menu) menu_priv->hideMenu(m_sub_menu); - if (reallyHasMouse) - menu_priv->setCurrentAction(m_reset_action,0); - else + if (reallyHasMouse) { + if (m_use_reset_action) + menu_priv->setCurrentAction(m_reset_action, 0); + } else { menu_priv->setCurrentAction(Q_NULLPTR, 0); + } } //return the top causedPopup.widget that is not a QMenu diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index a160a2c7d4..2f04fac3c0 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -95,6 +95,7 @@ public: , m_select_other_actions(false) , m_first_mouse(true) , m_init_guard(false) + , m_use_reset_action(true) , m_uni_dir_discarded_count(0) , m_uni_dir_fail_at_count(0) , m_timeout(0) @@ -182,9 +183,17 @@ public: QSetValueOnDestroy<bool> setFirstMouse(m_first_mouse, false); QSetValueOnDestroy<QPointF> setPreviousPoint(m_previous_point, mousePos); - if (resetAction && resetAction->isSeparator()) + if (resetAction && resetAction->isSeparator()) { m_reset_action = Q_NULLPTR; - else { + m_use_reset_action = true; + } else if (m_reset_action != resetAction) { + if (m_use_reset_action && resetAction) { + const QList<QAction *> actions = m_menu->actions(); + const int resetIdx = actions.indexOf(resetAction); + const int originIdx = actions.indexOf(m_origin_action); + if (resetIdx > -1 && originIdx > -1 && qAbs(resetIdx - originIdx) > 1) + m_use_reset_action = false; + } m_reset_action = resetAction; } @@ -249,6 +258,7 @@ private: bool m_init_guard; bool m_discard_state_when_entering_parent; bool m_dont_start_time_on_leave; + bool m_use_reset_action; short m_uni_dir_discarded_count; short m_uni_dir_fail_at_count; short m_timeout; |