summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-02 15:57:44 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-02 15:57:44 +0100
commitd3e6e732c70ebc2340d6376d727b3c623be23810 (patch)
tree18d469f02ac36edd04b87a9bfa4886ceef0490f0 /src
parentfdfd63053ae6b10af06553be3c1b15de274bebf7 (diff)
parentba8d3430029d8c4342e9a47c110ee8c9879818f4 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/freetype/freetype.pro3
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java10
-rw-r--r--src/corelib/global/qlibraryinfo.cpp2
-rw-r--r--src/corelib/io/io.pri6
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qprocess_wince.cpp3
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp258
-rw-r--r--src/corelib/json/qjsonobject.cpp14
-rw-r--r--src/corelib/json/qjsonobject.h4
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm148
-rw-r--r--src/corelib/kernel/qcore_mac_p.h5
-rw-r--r--src/corelib/kernel/qmetatype.cpp5
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp4
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp26
-rw-r--r--src/corelib/statemachine/qfinalstate.h4
-rw-r--r--src/corelib/statemachine/qfinalstate_p.h68
-rw-r--r--src/corelib/statemachine/qstate.cpp3
-rw-r--r--src/corelib/statemachine/qstate_p.h7
-rw-r--r--src/corelib/statemachine/statemachine.pri1
-rw-r--r--src/corelib/thread/qfutureinterface.cpp3
-rw-r--r--src/corelib/thread/qfutureinterface_p.h10
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp37
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h2
-rw-r--r--src/corelib/tools/qstringbuilder.h6
-rw-r--r--src/dbus/qdbusintegrator.cpp2
-rw-r--r--src/gui/accessible/qaccessible.cpp9
-rw-r--r--src/gui/kernel/qguiapplication.cpp19
-rw-r--r--src/gui/kernel/qkeysequence.cpp17
-rw-r--r--src/gui/kernel/qkeysequence_p.h4
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp6
-rw-r--r--src/gui/text/qfont.cpp7
-rw-r--r--src/gui/text/qfontdatabase.cpp66
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy_libproxy.cpp11
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu.cpp4
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp58
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp14
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp14
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp6
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp9
-rw-r--r--src/plugins/platforms/android/androidjnimain.h1
-rw-r--r--src/plugins/platforms/android/qandroidplatformforeignwindow.cpp7
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm137
-rw-r--r--src/plugins/platforms/haiku/qhaikuclipboard.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp43
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp28
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp5
-rw-r--r--src/plugins/printsupport/cocoa/main.cpp2
-rw-r--r--src/testlib/qtestkeyboard.h4
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp2
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp2
-rw-r--r--src/tools/uic/uic.cpp14
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp34
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp2
-rw-r--r--src/widgets/doc/snippets/macmainwindow.mm53
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/widgets/kernel/qaction.cpp27
-rw-r--r--src/widgets/kernel/qaction.h4
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc5
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp11
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp20
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp8
-rw-r--r--src/widgets/widgets/qmenu.cpp4
-rw-r--r--src/widgets/widgets/qmenu_mac.mm8
-rw-r--r--src/widgets/widgets/qscrollbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp12
75 files changed, 768 insertions, 590 deletions
diff --git a/src/3rdparty/freetype/freetype.pro b/src/3rdparty/freetype/freetype.pro
index e9436febc6..04aa3b8e18 100644
--- a/src/3rdparty/freetype/freetype.pro
+++ b/src/3rdparty/freetype/freetype.pro
@@ -3,7 +3,8 @@ TARGET = qtfreetype
CONFIG += \
static \
hide_symbols \
- exceptions_off rtti_off warn_off
+ exceptions_off rtti_off warn_off \
+ installed
load(qt_helper_lib)
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 3729555d52..d9be4c7d9f 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -226,6 +226,16 @@ public class QtNative
}
}
+ private static void setViewVisibility(final View view, final boolean visible)
+ {
+ runAction(new Runnable() {
+ @Override
+ public void run() {
+ view.setVisibility(visible ? View.VISIBLE : View.GONE);
+ }
+ });
+ }
+
public static boolean startApplication(String params,
String environment,
String mainLibrary,
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index ce838622bc..7d558cbf81 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -653,7 +653,7 @@ extern "C" void qt_core_boilerplate();
void qt_core_boilerplate()
{
printf("This is the QtCore library version " QT_BUILD_STR "\n"
- "Copyright (C) 2015 The Qt Company Ltd.\n"
+ "Copyright (C) 2016 The Qt Company Ltd.\n"
"Contact: http://www.qt.io/licensing/\n"
"\n"
"Installation prefix: %s\n"
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 218fb5b078..1ae0485840 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -107,8 +107,6 @@ win32 {
!winrt {
SOURCES += io/qsettings_win.cpp
- HEADERS += io/qwindowspipewriter_p.h
- SOURCES += io/qwindowspipewriter.cpp
SOURCES += io/qstandardpaths_win.cpp
wince* {
@@ -117,11 +115,13 @@ win32 {
} else {
HEADERS += \
io/qwinoverlappedionotifier_p.h \
- io/qwindowspipereader_p.h
+ io/qwindowspipereader_p.h \
+ io/qwindowspipewriter_p.h
SOURCES += \
io/qprocess_win.cpp \
io/qwinoverlappedionotifier.cpp \
io/qwindowspipereader.cpp \
+ io/qwindowspipewriter.cpp \
io/qstorageinfo_win.cpp
LIBS += -lmpr
}
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 6ddabc2351..ccacb6ed20 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -753,7 +753,7 @@ QFile::copy(const QString &newName)
qWarning("QFile::copy: Empty or null file name");
return false;
}
- if (QFile(newName).exists()) {
+ if (QFile::exists(newName)) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old); See also rename().
diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp
index aef043fcaa..c859a740d5 100644
--- a/src/corelib/io/qprocess_wince.cpp
+++ b/src/corelib/io/qprocess_wince.cpp
@@ -39,7 +39,6 @@
#include "qprocess.h"
#include "qprocess_p.h"
-#include "qwindowspipewriter_p.h"
#include <qdir.h>
#include <qfileinfo.h>
@@ -162,7 +161,7 @@ void QProcessPrivate::startProcess()
}
// give the process a chance to start ...
- Sleep(SLEEPMIN * 2);
+ Sleep(20);
_q_startupNotification();
}
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 3961d56b63..9e3cb9ab4d 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -47,9 +47,7 @@
#include <qcoreapplication.h>
#endif
-#if !defined(Q_OS_WINCE)
const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } };
-#endif
#include <qt_windows.h>
#include <shlobj.h>
@@ -70,113 +68,152 @@ const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x6
QT_BEGIN_NAMESPACE
-#if !defined(Q_OS_WINCE)
-typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
-#endif
-
static QString convertCharArray(const wchar_t *path)
{
return QDir::fromNativeSeparators(QString::fromWCharArray(path));
}
-static inline int clsidForAppDataLocation(QStandardPaths::StandardLocation type)
+static inline bool isGenericConfigLocation(QStandardPaths::StandardLocation type)
{
-#ifndef Q_OS_WINCE
- return type == QStandardPaths::AppDataLocation ?
- CSIDL_APPDATA : // "Roaming" path
- CSIDL_LOCAL_APPDATA; // Local path
-#else
- Q_UNUSED(type)
- return CSIDL_APPDATA;
-#endif
+ return type == QStandardPaths::GenericConfigLocation || type == QStandardPaths::GenericDataLocation;
}
-QString QStandardPaths::writableLocation(StandardLocation type)
+static inline bool isConfigLocation(QStandardPaths::StandardLocation type)
{
- QString result;
+ return type == QStandardPaths::ConfigLocation || type == QStandardPaths::AppConfigLocation
+ || type == QStandardPaths::AppDataLocation || type == QStandardPaths::AppLocalDataLocation
+ || isGenericConfigLocation(type);
+}
-#if !defined(Q_OS_WINCE)
- static GetKnownFolderPath SHGetKnownFolderPath = (GetKnownFolderPath)QSystemLibrary::resolve(QLatin1String("shell32"), "SHGetKnownFolderPath");
+static void appendOrganizationAndApp(QString &path) // Courtesy qstandardpaths_unix.cpp
+{
+#ifndef QT_BOOTSTRAPPED
+ const QString &org = QCoreApplication::organizationName();
+ if (!org.isEmpty())
+ path += QLatin1Char('/') + org;
+ const QString &appName = QCoreApplication::applicationName();
+ if (!appName.isEmpty())
+ path += QLatin1Char('/') + appName;
+#else // !QT_BOOTSTRAPPED
+ Q_UNUSED(path)
#endif
+}
- wchar_t path[MAX_PATH];
-
- switch (type) {
- case ConfigLocation: // same as AppLocalDataLocation, on Windows
- case GenericConfigLocation: // same as GenericDataLocation on Windows
- case AppConfigLocation:
- case AppDataLocation:
- case AppLocalDataLocation:
- case GenericDataLocation:
- if (SHGetSpecialFolderPath(0, path, clsidForAppDataLocation(type), FALSE))
- result = convertCharArray(path);
- if (isTestModeEnabled())
- result += QLatin1String("/qttest");
+static inline QString displayName(QStandardPaths::StandardLocation type)
+{
#ifndef QT_BOOTSTRAPPED
- if (type != GenericDataLocation && type != GenericConfigLocation) {
- if (!QCoreApplication::organizationName().isEmpty())
- result += QLatin1Char('/') + QCoreApplication::organizationName();
- if (!QCoreApplication::applicationName().isEmpty())
- result += QLatin1Char('/') + QCoreApplication::applicationName();
- }
+ return QStandardPaths::displayName(type);
+#else
+ return QString::number(type);
#endif
- break;
+}
- case DesktopLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_DESKTOPDIRECTORY, FALSE))
- result = convertCharArray(path);
- break;
+static inline void appendTestMode(QString &path)
+{
+ if (QStandardPaths::isTestModeEnabled())
+ path += QLatin1String("/qttest");
+}
- case DownloadLocation:
-#if !defined(Q_OS_WINCE)
- if (SHGetKnownFolderPath) {
- LPWSTR path;
- if (SHGetKnownFolderPath(qCLSID_FOLDERID_Downloads, 0, 0, &path) == S_OK) {
- result = convertCharArray(path);
- CoTaskMemFree(path);
- }
- break;
+// Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath()
+static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
+{
+ static const int clsids[] = {
+ CSIDL_DESKTOPDIRECTORY, // DesktopLocation
+ CSIDL_PERSONAL, // DocumentsLocation
+ CSIDL_FONTS, // FontsLocation
+ CSIDL_PROGRAMS, // ApplicationsLocation
+ CSIDL_MYMUSIC, // MusicLocation
+ CSIDL_MYVIDEO, // MoviesLocation
+ CSIDL_MYPICTURES, // PicturesLocation
+ -1, -1, // TempLocation/HomeLocation
+ CSIDL_LOCAL_APPDATA, // AppLocalDataLocation ("Local" path), AppLocalDataLocation = DataLocation
+ -1, // CacheLocation
+ CSIDL_LOCAL_APPDATA, // GenericDataLocation ("Local" path)
+ -1, // RuntimeLocation
+ CSIDL_LOCAL_APPDATA, // ConfigLocation ("Local" path)
+ -1, -1, // DownloadLocation/GenericCacheLocation
+ CSIDL_LOCAL_APPDATA, // GenericConfigLocation ("Local" path)
+ CSIDL_APPDATA, // AppDataLocation ("Roaming" path)
+ CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path)
+ };
+
+ Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1));
+ return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1;
+};
+
+// Convenience for SHGetSpecialFolderPath().
+static QString sHGetSpecialFolderPath(int clsid, QStandardPaths::StandardLocation type, bool warn = false)
+{
+ QString result;
+ wchar_t path[MAX_PATH];
+ if (Q_LIKELY(clsid >= 0 && SHGetSpecialFolderPath(0, path, clsid, FALSE))) {
+ result = convertCharArray(path);
+ } else {
+ if (warn) {
+ qErrnoWarning("SHGetSpecialFolderPath() failed for standard location \"%s\", clsid=0x%x.",
+ qPrintable(displayName(type)), clsid);
}
-#endif
- // fall through
- case DocumentsLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE))
- result = convertCharArray(path);
- break;
-
- case FontsLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_FONTS, FALSE))
- result = convertCharArray(path);
- break;
-
- case ApplicationsLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_PROGRAMS, FALSE))
- result = convertCharArray(path);
- break;
-
- case MusicLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_MYMUSIC, FALSE))
- result = convertCharArray(path);
- break;
+ }
+ return result;
+}
- case MoviesLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_MYVIDEO, FALSE))
- result = convertCharArray(path);
- break;
+// Convenience for SHGetKnownFolderPath().
+static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardLocation type, bool warn = false)
+{
+ QString result;
+#ifndef Q_OS_WINCE
+ typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
+
+ static const GetKnownFolderPath sHGetKnownFolderPath = // Vista onwards.
+ reinterpret_cast<GetKnownFolderPath>(QSystemLibrary::resolve(QLatin1String("shell32"), "SHGetKnownFolderPath"));
+
+ LPWSTR path;
+ if (Q_LIKELY(sHGetKnownFolderPath && SUCCEEDED(sHGetKnownFolderPath(clsid, 0, 0, &path)))) {
+ result = convertCharArray(path);
+ CoTaskMemFree(path);
+ } else {
+ if (warn) {
+ qErrnoWarning("SHGetKnownFolderPath() failed for standard location \"%s\".",
+ qPrintable(displayName(type)));
+ }
+ }
+#else // !Q_OS_WINCE
+ Q_UNUSED(clsid)
+ Q_UNUSED(type)
+ Q_UNUSED(warn)
+#endif
+ return result;
+}
- case PicturesLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_MYPICTURES, FALSE))
- result = convertCharArray(path);
+QString QStandardPaths::writableLocation(StandardLocation type)
+{
+ QString result;
+ switch (type) {
+ case DownloadLocation:
+ result = sHGetKnownFolderPath(qCLSID_FOLDERID_Downloads, type);
+ if (result.isEmpty())
+ result = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
break;
case CacheLocation:
// Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache
// location for everyone. Most applications seem to be using a
// cache directory located in their AppData directory
- return writableLocation(AppLocalDataLocation) + QLatin1String("/cache");
+ result = sHGetSpecialFolderPath(writableSpecialFolderClsid(AppLocalDataLocation), type, /* warn */ true);
+ if (!result.isEmpty()) {
+ appendTestMode(result);
+ appendOrganizationAndApp(result);
+ result += QLatin1String("/cache");
+ }
+ break;
case GenericCacheLocation:
- return writableLocation(GenericDataLocation) + QLatin1String("/cache");
+ result = sHGetSpecialFolderPath(writableSpecialFolderClsid(GenericDataLocation), type, /* warn */ true);
+ if (!result.isEmpty()) {
+ appendTestMode(result);
+ result += QLatin1String("/cache");
+ }
+ break;
case RuntimeLocation:
case HomeLocation:
@@ -186,6 +223,15 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case TempLocation:
result = QDir::tempPath();
break;
+
+ default:
+ result = sHGetSpecialFolderPath(writableSpecialFolderClsid(type), type, /* warn */ isConfigLocation(type));
+ if (!result.isEmpty() && isConfigLocation(type)) {
+ appendTestMode(result);
+ if (!isGenericConfigLocation(type))
+ appendOrganizationAndApp(result);
+ }
+ break;
}
return result;
}
@@ -193,44 +239,26 @@ QString QStandardPaths::writableLocation(StandardLocation type)
QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
+ const QString localDir = writableLocation(type);
+ if (!localDir.isEmpty())
+ dirs.append(localDir);
// type-specific handling goes here
-
#ifndef Q_OS_WINCE
- {
- wchar_t path[MAX_PATH];
- switch (type) {
- case ConfigLocation: // same as AppLocalDataLocation, on Windows (oversight, but too late to fix it)
- case GenericConfigLocation: // same as GenericDataLocation, on Windows
- case AppConfigLocation: // same as AppLocalDataLocation, that one on purpose
- case AppDataLocation:
- case AppLocalDataLocation:
- case GenericDataLocation:
- if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) {
- QString result = convertCharArray(path);
- if (type != GenericDataLocation && type != GenericConfigLocation) {
-#ifndef QT_BOOTSTRAPPED
- if (!QCoreApplication::organizationName().isEmpty())
- result += QLatin1Char('/') + QCoreApplication::organizationName();
- if (!QCoreApplication::applicationName().isEmpty())
- result += QLatin1Char('/') + QCoreApplication::applicationName();
-#endif
- }
- dirs.append(result);
-#ifndef QT_BOOTSTRAPPED
- dirs.append(QCoreApplication::applicationDirPath());
- dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data"));
-#endif
- }
- break;
- default:
- break;
+ if (isConfigLocation(type)) {
+ QString programData = sHGetSpecialFolderPath(CSIDL_COMMON_APPDATA, type);
+ if (!programData.isEmpty()) {
+ if (!isGenericConfigLocation(type))
+ appendOrganizationAndApp(programData);
+ dirs.append(programData);
}
- }
-#endif
+# ifndef QT_BOOTSTRAPPED
+ dirs.append(QCoreApplication::applicationDirPath());
+ dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data"));
+# endif // !QT_BOOTSTRAPPED
+ } // isConfigLocation()
+#endif // !Q_OS_WINCE
- const QString localDir = writableLocation(type);
- dirs.prepend(localDir);
return dirs;
}
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp
index 3b9a2113fd..a3ce13a99f 100644
--- a/src/corelib/json/qjsonobject.cpp
+++ b/src/corelib/json/qjsonobject.cpp
@@ -685,8 +685,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const
/*! \typedef QJsonObject::iterator::iterator_category
- A synonym for \e {std::bidirectional_iterator_tag} indicating
- this iterator is a bidirectional iterator.
+ A synonym for \e {std::random_access_iterator_tag} indicating
+ this iterator is a random-access iterator.
+
+ \note In Qt versions before 5.6, this was set by mistake to
+ \e {std::bidirectional_iterator_tag}.
*/
/*! \typedef QJsonObject::iterator::reference
@@ -892,8 +895,11 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const
/*! \typedef QJsonObject::const_iterator::iterator_category
- A synonym for \e {std::bidirectional_iterator_tag} indicating
- this iterator is a bidirectional iterator.
+ A synonym for \e {std::random_access_iterator_tag} indicating
+ this iterator is a random-access iterator.
+
+ \note In Qt versions before 5.6, this was set by mistake to
+ \e {std::bidirectional_iterator_tag}.
*/
/*! \typedef QJsonObject::const_iterator::reference
diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h
index bc4c8f46e3..5617eee04f 100644
--- a/src/corelib/json/qjsonobject.h
+++ b/src/corelib/json/qjsonobject.h
@@ -106,7 +106,7 @@ public:
int i;
public:
- typedef std::bidirectional_iterator_tag iterator_category;
+ typedef std::random_access_iterator_tag iterator_category;
typedef int difference_type;
typedef QJsonValue value_type;
typedef QJsonValueRef reference;
@@ -149,7 +149,7 @@ public:
int i;
public:
- typedef std::bidirectional_iterator_tag iterator_category;
+ typedef std::random_access_iterator_tag iterator_category;
typedef int difference_type;
typedef QJsonValue value_type;
typedef QJsonValue reference;
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index 9dc8656c50..4d5b0f156c 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -40,6 +40,11 @@
#include <private/qcore_mac_p.h>
+#ifdef Q_OS_OSX
+#include <AppKit/NSText.h>
+#include <Carbon/Carbon.h>
+#endif
+
#include <qdebug.h>
#ifdef Q_OS_IOS
@@ -154,5 +159,148 @@ QMacAutoReleasePool::~QMacAutoReleasePool()
// -------------------------------------------------------------------------
+#ifdef Q_OS_OSX
+
+// Use this method to keep all the information in the TextSegment. As long as it is ordered
+// we are in OK shape, and we can influence that ourselves.
+struct KeyPair
+{
+ QChar cocoaKey;
+ Qt::Key qtKey;
+};
+
+bool operator==(const KeyPair &entry, QChar qchar)
+{
+ return entry.cocoaKey == qchar;
+}
+
+bool operator<(const KeyPair &entry, QChar qchar)
+{
+ return entry.cocoaKey < qchar;
+}
+
+bool operator<(QChar qchar, const KeyPair &entry)
+{
+ return qchar < entry.cocoaKey;
+}
+
+bool operator<(const Qt::Key &key, const KeyPair &entry)
+{
+ return key < entry.qtKey;
+}
+
+bool operator<(const KeyPair &entry, const Qt::Key &key)
+{
+ return entry.qtKey < key;
+}
+
+struct qtKey2CocoaKeySortLessThan
+{
+ typedef bool result_type;
+ Q_DECL_CONSTEXPR result_type operator()(const KeyPair &entry1, const KeyPair &entry2) const Q_DECL_NOTHROW
+ {
+ return entry1.qtKey < entry2.qtKey;
+ }
+};
+
+static const int NumEntries = 59;
+static const KeyPair entries[NumEntries] = {
+ { NSEnterCharacter, Qt::Key_Enter },
+ { NSBackspaceCharacter, Qt::Key_Backspace },
+ { NSTabCharacter, Qt::Key_Tab },
+ { NSNewlineCharacter, Qt::Key_Return },
+ { NSCarriageReturnCharacter, Qt::Key_Return },
+ { NSBackTabCharacter, Qt::Key_Backtab },
+ { kEscapeCharCode, Qt::Key_Escape },
+ // Cocoa sends us delete when pressing backspace!
+ // (NB when we reverse this list in qtKey2CocoaKey, there
+ // will be two indices of Qt::Key_Backspace. But is seems to work
+ // ok for menu shortcuts (which uses that function):
+ { NSDeleteCharacter, Qt::Key_Backspace },
+ { NSUpArrowFunctionKey, Qt::Key_Up },
+ { NSDownArrowFunctionKey, Qt::Key_Down },
+ { NSLeftArrowFunctionKey, Qt::Key_Left },
+ { NSRightArrowFunctionKey, Qt::Key_Right },
+ { NSF1FunctionKey, Qt::Key_F1 },
+ { NSF2FunctionKey, Qt::Key_F2 },
+ { NSF3FunctionKey, Qt::Key_F3 },
+ { NSF4FunctionKey, Qt::Key_F4 },
+ { NSF5FunctionKey, Qt::Key_F5 },
+ { NSF6FunctionKey, Qt::Key_F6 },
+ { NSF7FunctionKey, Qt::Key_F7 },
+ { NSF8FunctionKey, Qt::Key_F8 },
+ { NSF9FunctionKey, Qt::Key_F9 },
+ { NSF10FunctionKey, Qt::Key_F10 },
+ { NSF11FunctionKey, Qt::Key_F11 },
+ { NSF12FunctionKey, Qt::Key_F12 },
+ { NSF13FunctionKey, Qt::Key_F13 },
+ { NSF14FunctionKey, Qt::Key_F14 },
+ { NSF15FunctionKey, Qt::Key_F15 },
+ { NSF16FunctionKey, Qt::Key_F16 },
+ { NSF17FunctionKey, Qt::Key_F17 },
+ { NSF18FunctionKey, Qt::Key_F18 },
+ { NSF19FunctionKey, Qt::Key_F19 },
+ { NSF20FunctionKey, Qt::Key_F20 },
+ { NSF21FunctionKey, Qt::Key_F21 },
+ { NSF22FunctionKey, Qt::Key_F22 },
+ { NSF23FunctionKey, Qt::Key_F23 },
+ { NSF24FunctionKey, Qt::Key_F24 },
+ { NSF25FunctionKey, Qt::Key_F25 },
+ { NSF26FunctionKey, Qt::Key_F26 },
+ { NSF27FunctionKey, Qt::Key_F27 },
+ { NSF28FunctionKey, Qt::Key_F28 },
+ { NSF29FunctionKey, Qt::Key_F29 },
+ { NSF30FunctionKey, Qt::Key_F30 },
+ { NSF31FunctionKey, Qt::Key_F31 },
+ { NSF32FunctionKey, Qt::Key_F32 },
+ { NSF33FunctionKey, Qt::Key_F33 },
+ { NSF34FunctionKey, Qt::Key_F34 },
+ { NSF35FunctionKey, Qt::Key_F35 },
+ { NSInsertFunctionKey, Qt::Key_Insert },
+ { NSDeleteFunctionKey, Qt::Key_Delete },
+ { NSHomeFunctionKey, Qt::Key_Home },
+ { NSEndFunctionKey, Qt::Key_End },
+ { NSPageUpFunctionKey, Qt::Key_PageUp },
+ { NSPageDownFunctionKey, Qt::Key_PageDown },
+ { NSPrintScreenFunctionKey, Qt::Key_Print },
+ { NSScrollLockFunctionKey, Qt::Key_ScrollLock },
+ { NSPauseFunctionKey, Qt::Key_Pause },
+ { NSSysReqFunctionKey, Qt::Key_SysReq },
+ { NSMenuFunctionKey, Qt::Key_Menu },
+ { NSHelpFunctionKey, Qt::Key_Help },
+};
+static const KeyPair * const end = entries + NumEntries;
+
+QChar qt_mac_qtKey2CocoaKey(Qt::Key key)
+{
+ // The first time this function is called, create a reverse
+ // lookup table sorted on Qt Key rather than Cocoa key:
+ static QVector<KeyPair> rev_entries(NumEntries);
+ static bool mustInit = true;
+ if (mustInit){
+ mustInit = false;
+ for (int i=0; i<NumEntries; ++i)
+ rev_entries[i] = entries[i];
+ std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan());
+ }
+ const QVector<KeyPair>::iterator i
+ = std::lower_bound(rev_entries.begin(), rev_entries.end(), key);
+ if ((i == rev_entries.end()) || (key < *i))
+ return QChar();
+ return i->cocoaKey;
+}
+
+Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
+{
+ const KeyPair *i = std::lower_bound(entries, end, keyCode);
+ if ((i == end) || (keyCode < *i))
+ return Qt::Key(keyCode.toUpper().unicode());
+ return i->qtKey;
+}
+
+#endif // Q_OS_OSX
+
+// -------------------------------------------------------------------------
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 5403014611..b94aac1093 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -143,6 +143,11 @@ typedef struct {
QAppleOperatingSystemVersion qt_apple_os_version();
+#ifdef Q_OS_OSX
+Q_CORE_EXPORT QChar qt_mac_qtKey2CocoaKey(Qt::Key key);
+Q_CORE_EXPORT Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode);
+#endif
+
QT_END_NAMESPACE
#endif // QCORE_MAC_P_H
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 96f9203d4a..3ac1f28638 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1704,8 +1704,9 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
void *QMetaType::create(int type, const void *copy)
{
QMetaType info(type);
- int size = info.sizeOf();
- return info.construct(operator new(size), copy);
+ if (int size = info.sizeOf())
+ return info.construct(operator new(size), copy);
+ return 0;
}
/*!
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index ee0c34a7a8..787db8a8a6 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
static const char boilerplate_supported_but_time_limited[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2015 The Qt Company Ltd.\n"
+ "Copyright (C) 2016 The Qt Company Ltd.\n"
"This trial version may only be used for evaluation purposes\n"
"and will shut down after 120 minutes.\n"
"Registered to:\n"
@@ -63,7 +63,7 @@ static const char boilerplate_supported_but_time_limited[] =
static const char boilerplate_supported[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2015 The Qt Company Ltd.\n"
+ "Copyright (C) 2016 The Qt Company Ltd.\n"
"This trial version may only be used for evaluation purposes\n"
"Registered to:\n"
" Licensee: %2\n\n"
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index 61eca2c74d..efcb364794 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -37,12 +37,10 @@
**
****************************************************************************/
-#include "qfinalstate.h"
+#include "qfinalstate_p.h"
#ifndef QT_NO_STATEMACHINE
-#include "qabstractstate_p.h"
-
QT_BEGIN_NAMESPACE
/*!
@@ -82,19 +80,16 @@ QT_BEGIN_NAMESPACE
\sa QState::finished()
*/
-class QFinalStatePrivate : public QAbstractStatePrivate
-{
- Q_DECLARE_PUBLIC(QFinalState)
-
-public:
- QFinalStatePrivate();
-};
-
QFinalStatePrivate::QFinalStatePrivate()
: QAbstractStatePrivate(FinalState)
{
}
+QFinalStatePrivate::~QFinalStatePrivate()
+{
+ // to prevent vtables being generated in every file that includes the private header
+}
+
/*!
Constructs a new QFinalState object with the given \a parent state.
*/
@@ -104,6 +99,15 @@ QFinalState::QFinalState(QState *parent)
}
/*!
+ \internal
+ */
+QFinalState::QFinalState(QFinalStatePrivate &dd, QState *parent)
+ : QAbstractState(dd, parent)
+{
+}
+
+
+/*!
Destroys this final state.
*/
QFinalState::~QFinalState()
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index f9b32ef128..9b6b193231 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -44,7 +44,6 @@
QT_BEGIN_NAMESPACE
-
#ifndef QT_NO_STATEMACHINE
class QFinalStatePrivate;
@@ -61,6 +60,9 @@ protected:
bool event(QEvent *e) Q_DECL_OVERRIDE;
+protected:
+ explicit QFinalState(QFinalStatePrivate &dd, QState *parent);
+
private:
Q_DISABLE_COPY(QFinalState)
Q_DECLARE_PRIVATE(QFinalState)
diff --git a/src/corelib/statemachine/qfinalstate_p.h b/src/corelib/statemachine/qfinalstate_p.h
new file mode 100644
index 0000000000..74640289f1
--- /dev/null
+++ b/src/corelib/statemachine/qfinalstate_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFINALSTATE_P_H
+#define QFINALSTATE_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 "qfinalstate.h"
+#include "private/qabstractstate_p.h"
+
+#ifndef QT_NO_STATEMACHINE
+
+QT_BEGIN_NAMESPACE
+
+class Q_CORE_EXPORT QFinalStatePrivate : public QAbstractStatePrivate
+{
+ Q_DECLARE_PUBLIC(QFinalState)
+
+public:
+ QFinalStatePrivate();
+ ~QFinalStatePrivate();
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STATEMACHINE
+
+#endif // QFINALSTATE_P_H
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index bcfff1e462..cae6474c32 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -37,11 +37,10 @@
**
****************************************************************************/
-#include "qstate.h"
+#include "qstate_p.h"
#ifndef QT_NO_STATEMACHINE
-#include "qstate_p.h"
#include "qhistorystate.h"
#include "qhistorystate_p.h"
#include "qabstracttransition.h"
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 438de427f5..913657e53b 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include "qstate.h"
#include "private/qabstractstate_p.h"
#include <QtCore/qlist.h>
@@ -58,6 +59,8 @@
#include <QtCore/qpointer.h>
#include <QtCore/qvariant.h>
+#ifndef QT_NO_STATEMACHINE
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PROPERTIES
@@ -89,7 +92,7 @@ class QAbstractTransition;
class QHistoryState;
class QState;
-class Q_AUTOTEST_EXPORT QStatePrivate : public QAbstractStatePrivate
+class Q_CORE_EXPORT QStatePrivate : public QAbstractStatePrivate
{
Q_DECLARE_PUBLIC(QState)
public:
@@ -121,4 +124,6 @@ public:
QT_END_NAMESPACE
+#endif // QT_NO_STATEMACHINE
+
#endif
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index 910cf5e9b3..c5396a2ef8 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -6,6 +6,7 @@ HEADERS += $$PWD/qstatemachine.h \
$$PWD/qstate.h \
$$PWD/qstate_p.h \
$$PWD/qfinalstate.h \
+ $$PWD/qfinalstate_p.h \
$$PWD/qhistorystate.h \
$$PWD/qhistorystate_p.h \
$$PWD/qabstracttransition.h \
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index 3146a6d6fa..6690f28556 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -199,16 +199,19 @@ void QFutureInterfaceBase::waitForResume()
int QFutureInterfaceBase::progressValue() const
{
+ const QMutexLocker lock(&d->m_mutex);
return d->m_progressValue;
}
int QFutureInterfaceBase::progressMinimum() const
{
+ const QMutexLocker lock(&d->m_mutex);
return d->m_progressMinimum;
}
int QFutureInterfaceBase::progressMaximum() const
{
+ const QMutexLocker lock(&d->m_mutex);
return d->m_progressMaximum;
}
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index 92e2cdc7af..f5f0e7047f 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -152,18 +152,20 @@ public:
QAtomicInt m_refCountT;
};
+ // T: accessed from executing thread
+ // Q: accessed from the waiting/querying thread
RefCount refCount;
mutable QMutex m_mutex;
QWaitCondition waitCondition;
QList<QFutureCallOutInterface *> outputConnections;
- int m_progressValue;
- int m_progressMinimum;
- int m_progressMaximum;
+ int m_progressValue; // TQ
+ int m_progressMinimum; // TQ
+ int m_progressMaximum; // TQ
QFutureInterfaceBase::State state;
QElapsedTimer progressTime;
QWaitCondition pausedWaitCondition;
QtPrivate::ResultStoreBase m_results;
- bool manualProgress;
+ bool manualProgress; // only accessed from executing thread
int m_expectedResultCount;
QtPrivate::ExceptionStore m_exceptionStore;
QString m_progressText;
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index ace663ae30..853903619f 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -131,14 +131,13 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
}
const SectionNode &node = sectionNodes.at(index);
- int year, month, day, hour, minute, second, msec;
- year = v.date().year();
- month = v.date().month();
- day = v.date().day();
- hour = v.time().hour();
- minute = v.time().minute();
- second = v.time().second();
- msec = v.time().msec();
+ int year = v.date().year();
+ int month = v.date().month();
+ int day = v.date().day();
+ int hour = v.time().hour();
+ int minute = v.time().minute();
+ int second = v.time().second();
+ int msec = v.time().msec();
switch (node.type) {
case Hour24Section: case Hour12Section: hour = newVal; break;
@@ -676,15 +675,7 @@ QString QDateTimeParser::sectionText(const QString &text, int sectionIndex, int
QString QDateTimeParser::sectionText(int sectionIndex) const
{
const SectionNode &sn = sectionNode(sectionIndex);
- switch (sn.type) {
- case NoSectionIndex:
- case FirstSectionIndex:
- case LastSectionIndex:
- return QString();
- default: break;
- }
-
- return displayText().mid(sn.pos, sectionSize(sectionIndex));
+ return sectionText(displayText(), sectionIndex, sn.pos);
}
@@ -1012,8 +1003,10 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
const QDate date(year, month, day);
const int diff = dayofweek - date.dayOfWeek();
- if (diff != 0 && state == Acceptable && isSet & (DayOfWeekSectionShort|DayOfWeekSectionLong)) {
- conflicts = isSet & DaySection;
+ if (diff != 0 && state == Acceptable
+ && isSet & (DayOfWeekSectionShort | DayOfWeekSectionLong)) {
+ if (isSet & DaySection)
+ conflicts = true;
const SectionNode &sn = sectionNode(currentSectionIndex);
if (sn.type & (DayOfWeekSectionShort|DayOfWeekSectionLong) || currentSectionIndex == -1) {
// dayofweek should be preferred
@@ -1377,9 +1370,9 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex
*/
-int QDateTimeParser::findAmPm(QString &str, int index, int *used) const
+int QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const
{
- const SectionNode &s = sectionNode(index);
+ const SectionNode &s = sectionNode(sectionIndex);
if (s.type != AmPmSection) {
qWarning("QDateTimeParser::findAmPm Internal error");
return -1;
@@ -1390,7 +1383,7 @@ int QDateTimeParser::findAmPm(QString &str, int index, int *used) const
return PossibleBoth;
}
const QLatin1Char space(' ');
- int size = sectionMaxSize(index);
+ int size = sectionMaxSize(sectionIndex);
enum {
amindex = 0,
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index 2c1c14f05a..64e73346f2 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -93,7 +93,7 @@ public:
first.pos = -1;
first.count = -1;
first.zeroesAdded = 0;
- last.type = FirstSection;
+ last.type = LastSection;
last.pos = -1;
last.count = -1;
last.zeroesAdded = 0;
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 524c9a14ae..faf9eb4b4d 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -242,9 +242,9 @@ template <> struct QConcatenable<QLatin1String> : private QAbstractConcatenable
}
static inline void appendTo(const QLatin1String a, char *&out)
{
- if (a.data()) {
- for (const char *s = a.data(); *s; )
- *out++ = *s++;
+ if (const char *data = a.data()) {
+ memcpy(out, data, a.size());
+ out += a.size();
}
}
};
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 3cd5c4d8e4..b6fb9ae7cf 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -812,7 +812,6 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu
if (!object)
return false;
-#ifndef QT_NO_PROPERTIES
Q_ASSERT_X(QThread::currentThread() == object->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");
@@ -871,7 +870,6 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu
deliverCall(object, flags, msg, cacheIt->metaTypes, cacheIt->slotIdx);
return true;
}
-#endif // QT_NO_PROPERTIES
return false;
}
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 739f2a1c61..4758d1b5d4 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1765,15 +1765,8 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
return QAccessible::accessibleInterface(m_uniqueId);
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
- if (!iface || !iface->isValid()) {
- static bool hasWarned = false;
- if (!iface && !hasWarned) {
- qWarning() << "Problem creating accessible interface for: " << m_object << endl
- << "Make sure to deploy Qt with accessibility plugins.";
- hasWarned = true;
- }
+ if (!iface || !iface->isValid())
return 0;
- }
if (m_child >= 0) {
QAccessibleInterface *child = iface->child(m_child);
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 58e2586024..f98b4236fe 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -960,15 +960,10 @@ QList<QScreen *> QGuiApplication::screens()
/*!
\property QGuiApplication::primaryScreen
- \brief the primary (or default) screen of the application, or null if there is none.
+ \brief the primary (or default) screen of the application.
This will be the screen where QWindows are initially shown, unless otherwise specified.
- On some platforms, it may be null when there are actually no screens connected.
- It is not possible to start a new QGuiApplication while there are no screens.
- Applications which were running at the time the primary screen was removed
- will stop rendering graphics until one or more screens are restored.
-
The primaryScreenChanged signal was introduced in Qt 5.6.
\sa screens()
@@ -1095,7 +1090,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
QString fatalMessage
- = QStringLiteral("This application failed to start because it could not find or load the Qt platform plugin \"%1\".\n\n").arg(name);
+ = QStringLiteral("This application failed to start because it could not find or load the Qt platform plugin \"%1\"\nin \"%2\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
if (!keys.isEmpty()) {
fatalMessage += QStringLiteral("Available platform plugins are: %1.\n\n").arg(
keys.join(QStringLiteral(", ")));
@@ -1999,6 +1994,16 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::focusWindow();
}
+#if !defined(Q_OS_OSX)
+ // FIXME: Include OS X in this code path by passing the key event through
+ // QPlatformInputContext::filterEvent().
+ if (e->keyType == QEvent::KeyPress && window) {
+ if (QWindowSystemInterface::handleShortcutEvent(window, e->timestamp, e->key, e->modifiers,
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount))
+ return;
+ }
+#endif
+
QKeyEvent ev(e->keyType, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
e->unicode, e->repeat, e->repeatCount);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9fe7267607..38cc9506ee 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -146,6 +146,23 @@ static int qtkeyForMacSymbol(const QChar ch)
#else
static bool qt_sequence_no_mnemonics = false;
#endif
+
+/*!
+ \fn void qt_set_sequence_auto_mnemonic(bool b)
+ \relates QKeySequence
+
+ Specifies whether mnemonics for menu items, labels, etc., should
+ be honored or not. On Windows and X11, this feature is
+ on by default; on OS X, it is off. When this feature is off
+ (that is, when \a b is false), QKeySequence::mnemonic() always
+ returns an empty string.
+
+ \note This function is not declared in any of Qt's header files.
+ To use it in your application, declare the function prototype
+ before calling it.
+
+ \sa QShortcut
+*/
void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; }
/*!
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index abe91df2ee..492546616b 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SHORTCUT
-struct Q_AUTOTEST_EXPORT QKeyBinding
+struct QKeyBinding
{
QKeySequence::StandardKey standardKey;
uchar priority;
@@ -66,7 +66,7 @@ struct Q_AUTOTEST_EXPORT QKeyBinding
uint platform;
};
-class Q_AUTOTEST_EXPORT QKeySequencePrivate
+class QKeySequencePrivate
{
public:
enum { MaxKeyCount = 4 }; // also used in QKeySequenceEdit
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 7055b7947a..d17c9c08a8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -255,8 +255,10 @@ bool QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Q
bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
+#if defined(Q_OS_OSX)
if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, k, mods, 0, 0, 0, text, autorep, count))
return true;
+#endif
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
@@ -281,10 +283,14 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
const QString& text, bool autorep,
ushort count, bool tryShortcutOverride)
{
+#if defined(Q_OS_OSX)
if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw,
timestamp, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count)) {
return true;
}
+#else
+ Q_UNUSED(tryShortcutOverride)
+#endif
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 16e88dad5f..089104665f 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2815,6 +2815,10 @@ QFontEngine *QFontCache::findEngine(const Key &key)
EngineCache::Iterator it = engineCache.find(key),
end = engineCache.end();
if (it == end) return 0;
+
+ Q_ASSERT(it.value().data != Q_NULLPTR);
+ Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi));
+
// found... update the hitcount and timestamp
updateHitCountAndTimeStamp(it.value());
@@ -2835,6 +2839,9 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value)
void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti)
{
+ Q_ASSERT(engine != Q_NULLPTR);
+ Q_ASSERT(key.multi == (engine->type() == QFontEngine::Multi));
+
#ifdef QFONTCACHE_DEBUG
FC_DEBUG("QFontCache: inserting new engine %p, refcount %d", engine, engine->ref.load());
if (!insertMulti && engineCache.contains(key)) {
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 6c63f5c7ee..b680bb4717 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -927,23 +927,28 @@ QFontEngine *loadSingleEngine(int script,
QFontDef def = request;
def.pixelSize = pixelSize;
+ QFontCache *fontCache = QFontCache::instance();
+
QFontCache::Key key(def,script);
- QFontEngine *engine = QFontCache::instance()->findEngine(key);
+ QFontEngine *engine = fontCache->findEngine(key);
if (!engine) {
- if (script != QChar::Script_Common) {
+ const bool cacheForCommonScript = script != QChar::Script_Common
+ && (family->writingSystems[QFontDatabase::Latin] & QtFontFamily::Supported) != 0;
+
+ if (Q_LIKELY(cacheForCommonScript)) {
// fast path: check if engine was loaded for another script
key.script = QChar::Script_Common;
- engine = QFontCache::instance()->findEngine(key);
+ engine = fontCache->findEngine(key);
key.script = script;
if (engine) {
- Q_ASSERT(engine->type() != QFontEngine::Multi);
// Also check for OpenType tables when using complex scripts
if (Q_UNLIKELY(!engine->supportsScript(QChar::Script(script)))) {
qWarning(" OpenType support missing for script %d", script);
return 0;
}
- QFontCache::instance()->insertEngine(key, engine);
+ fontCache->insertEngine(key, engine);
+
return engine;
}
}
@@ -951,13 +956,13 @@ QFontEngine *loadSingleEngine(int script,
// If the font data's native stretch matches the requested stretch we need to set stretch to 100
// to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate
// the new stretch factor. This only done if not matched by styleName.
- bool styleNameMatch = !request.styleName.isEmpty() && request.styleName == style->styleName;
- if (!styleNameMatch && style->key.stretch != 0 && request.stretch != 0)
+ if (style->key.stretch != 0 && request.stretch != 0
+ && (request.styleName.isEmpty() || request.styleName != style->styleName)) {
def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
+ }
engine = pfdb->fontEngine(def, size->handle);
if (engine) {
- Q_ASSERT(engine->type() != QFontEngine::Multi);
// Also check for OpenType tables when using complex scripts
if (!engine->supportsScript(QChar::Script(script))) {
qWarning(" OpenType support missing for script %d", script);
@@ -966,13 +971,13 @@ QFontEngine *loadSingleEngine(int script,
return 0;
}
- QFontCache::instance()->insertEngine(key, engine);
+ fontCache->insertEngine(key, engine);
- if (!engine->symbol && script != QChar::Script_Common && (family->writingSystems[QFontDatabase::Latin] & QtFontFamily::Supported) != 0) {
+ if (Q_LIKELY(cacheForCommonScript && !engine->symbol)) {
// cache engine for Common script as well
key.script = QChar::Script_Common;
- if (!QFontCache::instance()->findEngine(key))
- QFontCache::instance()->insertEngine(key, engine);
+ if (!fontCache->findEngine(key))
+ fontCache->insertEngine(key, engine);
}
}
}
@@ -985,7 +990,7 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
QtFontStyle *style, QtFontSize *size)
{
QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);
- Q_ASSERT(!engine || engine->type() != QFontEngine::Multi);
+
if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
@@ -2641,12 +2646,14 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
}
#endif
+ QFontCache *fontCache = QFontCache::instance();
+
// Until we specifically asked not to, try looking for Multi font engine
// first, the last '1' indicates that we want Multi font engine instead
// of single ones
bool multi = !(request.styleStrategy & QFont::NoFontMerging);
QFontCache::Key key(request, script, multi ? 1 : 0);
- engine = QFontCache::instance()->findEngine(key);
+ engine = fontCache->findEngine(key);
if (engine) {
FM_DEBUG("Cache hit level 1");
return engine;
@@ -2687,7 +2694,7 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
QFontDef def = request;
def.family = fallbacks.at(i);
QFontCache::Key key(def, script, multi ? 1 : 0);
- engine = QFontCache::instance()->findEngine(key);
+ engine = fontCache->findEngine(key);
if (!engine) {
QtFontDesc desc;
do {
@@ -2731,13 +2738,21 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
if (req.stretch == 0)
req.stretch = 100;
+ // respect the fallback families that might be passed through the request
+ const QStringList fallBackFamilies = familyList(req);
+
if (!d->engineData) {
+ QFontCache *fontCache = QFontCache::instance();
// look for the requested font in the engine data cache
- d->engineData = QFontCache::instance()->findEngineData(req);
+ // note: fallBackFamilies are not respected in the EngineData cache key;
+ // join them with the primary selection family to avoid cache misses
+ req.family = fallBackFamilies.join(QLatin1Char(','));
+
+ d->engineData = fontCache->findEngineData(req);
if (!d->engineData) {
// create a new one
d->engineData = new QFontEngineData;
- QFontCache::instance()->insertEngineData(req, d->engineData);
+ fontCache->insertEngineData(req, d->engineData);
}
d->engineData->ref.ref();
}
@@ -2746,25 +2761,18 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
if (d->engineData->engines[script])
return;
- // Until we specifically asked not to, try looking for Multi font engine
- // first, the last '1' indicates that we want Multi font engine instead
- // of single ones
- bool multi = !(req.styleStrategy & QFont::NoFontMerging);
- QFontCache::Key key(req, script, multi ? 1 : 0);
+ QFontEngine *fe = Q_NULLPTR;
- QFontEngine *fe = QFontCache::instance()->findEngine(key);
+ req.fallBackFamilies = fallBackFamilies;
+ if (!req.fallBackFamilies.isEmpty())
+ req.family = req.fallBackFamilies.takeFirst();
// list of families to try
QStringList family_list;
if (!req.family.isEmpty()) {
- QStringList familiesForRequest = familyList(req);
-
// Add primary selection
- family_list << familiesForRequest.takeFirst();
-
- // Fallbacks requested in font request
- req.fallBackFamilies = familiesForRequest;
+ family_list << req.family;
// add the default family
QString defaultFamily = QGuiApplication::font().family();
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 26914b63d2..8924a7c4ae 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -2296,7 +2296,7 @@ QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script
}
if (!engine) {
engine = QGuiApplicationPrivate::instance()->platformIntegration()->fontDatabase()->fontEngineMulti(fe, QChar::Script(script));
- QFontCache::instance()->insertEngine(key, engine, /* insertMulti */ !faceIsLocal);
+ fc->insertEngine(key, engine, /* insertMulti */ !faceIsLocal);
}
Q_ASSERT(engine);
return engine;
diff --git a/src/network/kernel/qnetworkproxy_libproxy.cpp b/src/network/kernel/qnetworkproxy_libproxy.cpp
index eb310615f3..e89df79226 100644
--- a/src/network/kernel/qnetworkproxy_libproxy.cpp
+++ b/src/network/kernel/qnetworkproxy_libproxy.cpp
@@ -127,14 +127,15 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
bool haveDirectConnection = false;
foreach (const QUrl& url, rawProxies) {
QNetworkProxy::ProxyType type;
- if (url.scheme() == QStringLiteral("http")) {
+ const QString scheme = url.scheme();
+ if (scheme == QLatin1String("http")) {
type = QNetworkProxy::HttpProxy;
- } else if (url.scheme() == QStringLiteral("socks")
- || url.scheme() == QStringLiteral("socks5")) {
+ } else if (scheme == QLatin1String("socks")
+ || scheme == QLatin1String("socks5")) {
type = QNetworkProxy::Socks5Proxy;
- } else if (url.scheme() == QStringLiteral("ftp")) {
+ } else if (scheme == QLatin1String("ftp")) {
type = QNetworkProxy::FtpCachingProxy;
- } else if (url.scheme() == QStringLiteral("direct")) {
+ } else if (scheme == QLatin1String("direct")) {
type = QNetworkProxy::NoProxy;
haveDirectConnection = true;
} else {
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
index 661e77cee3..c813d8255b 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
@@ -55,7 +55,7 @@ QDBusPlatformMenuItem::QDBusPlatformMenuItem(quintptr tag)
: m_tag(tag ? tag : reinterpret_cast<quintptr>(this)) // QMenu will overwrite this later
, m_subMenu(Q_NULLPTR)
, m_role(NoRole)
- , m_isEnabled(false)
+ , m_isEnabled(true)
, m_isVisible(true)
, m_isSeparator(false)
, m_isCheckable(false)
@@ -152,7 +152,7 @@ QList<const QDBusPlatformMenuItem *> QDBusPlatformMenuItem::byIds(const QList<in
QDBusPlatformMenu::QDBusPlatformMenu(quintptr tag)
: m_tag(tag ? tag : reinterpret_cast<quintptr>(this))
- , m_isEnabled(false)
+ , m_isEnabled(true)
, m_isVisible(true)
, m_isSeparator(false)
, m_dbusID(nextDBusID++)
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index 97ff761a22..d982c5afff 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -1967,71 +1967,71 @@ namespace
// https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes"
// specifically for "weight", "invalid", "language" and value range for colors
- if (ia2Name == QStringLiteral("background-color")) {
+ if (ia2Name == QLatin1String("background-color")) {
name = QStringLiteral("bg-color");
value = atspiColor(value);
- } else if (ia2Name == QStringLiteral("font-family")) {
+ } else if (ia2Name == QLatin1String("font-family")) {
name = QStringLiteral("family-name");
- } else if (ia2Name == QStringLiteral("color")) {
+ } else if (ia2Name == QLatin1String("color")) {
name = QStringLiteral("fg-color");
value = atspiColor(value);
- } else if (ia2Name == QStringLiteral("text-align")) {
+ } else if (ia2Name == QLatin1String("text-align")) {
name = QStringLiteral("justification");
- if (value == QStringLiteral("justify")) {
+ if (value == QLatin1String("justify")) {
value = QStringLiteral("fill");
} else {
- if (value != QStringLiteral("left") &&
- value != QStringLiteral("right") &&
- value != QStringLiteral("center")
+ if (value != QLatin1String("left") &&
+ value != QLatin1String("right") &&
+ value != QLatin1String("center")
) {
value = QString();
qAtspiDebug() << "Unknown text-align attribute value \"" << value << "\" cannot be translated to AT-SPI.";
}
}
- } else if (ia2Name == QStringLiteral("font-size")) {
+ } else if (ia2Name == QLatin1String("font-size")) {
name = QStringLiteral("size");
value = atspiSize(value);
- } else if (ia2Name == QStringLiteral("font-style")) {
+ } else if (ia2Name == QLatin1String("font-style")) {
name = QStringLiteral("style");
- if (value != QStringLiteral("normal") &&
- value != QStringLiteral("italic") &&
- value != QStringLiteral("oblique")
+ if (value != QLatin1String("normal") &&
+ value != QLatin1String("italic") &&
+ value != QLatin1String("oblique")
) {
value = QString();
qAtspiDebug() << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI.";
}
- } else if (ia2Name == QStringLiteral("text-underline-type")) {
+ } else if (ia2Name == QLatin1String("text-underline-type")) {
name = QStringLiteral("underline");
- if (value != QStringLiteral("none") &&
- value != QStringLiteral("single") &&
- value != QStringLiteral("double")
+ if (value != QLatin1String("none") &&
+ value != QLatin1String("single") &&
+ value != QLatin1String("double")
) {
value = QString();
qAtspiDebug() << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI.";
}
- } else if (ia2Name == QStringLiteral("font-weight")) {
+ } else if (ia2Name == QLatin1String("font-weight")) {
name = QStringLiteral("weight");
- if (value == QStringLiteral("normal"))
+ if (value == QLatin1String("normal"))
// Orca seems to accept all IAccessible2 values except for "normal"
// (on which it produces traceback and fails to read any following text attributes),
// but that is the default value, so omit it anyway
value = QString();
- } else if (ia2Name == QStringLiteral("text-position")) {
+ } else if (ia2Name == QLatin1String("text-position")) {
name = QStringLiteral("vertical-align");
- if (value != QStringLiteral("baseline") &&
- value != QStringLiteral("super") &&
- value != QStringLiteral("sub")
+ if (value != QLatin1String("baseline") &&
+ value != QLatin1String("super") &&
+ value != QLatin1String("sub")
) {
value = QString();
qAtspiDebug() << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI.";
}
- } else if (ia2Name == QStringLiteral("writing-mode")) {
+ } else if (ia2Name == QLatin1String("writing-mode")) {
name = QStringLiteral("direction");
- if (value == QStringLiteral("lr"))
+ if (value == QLatin1String("lr"))
value = QStringLiteral("ltr");
- else if (value == QStringLiteral("rl"))
+ else if (value == QLatin1String("rl"))
value = QStringLiteral("rtl");
- else if (value == QStringLiteral("tb")) {
+ else if (value == QLatin1String("tb")) {
// IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet))
value = QStringLiteral("rtl");
qAtspiDebug() << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
@@ -2039,9 +2039,9 @@ namespace
value = QString();
qAtspiDebug() << "Unknown writing-mode attribute value \"" << value << "\" cannot be translated to AT-SPI.";
}
- } else if (ia2Name == QStringLiteral("language")) {
+ } else if (ia2Name == QLatin1String("language")) {
// OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now
- } else if (ia2Name == QStringLiteral("invalid")) {
+ } else if (ia2Name == QLatin1String("invalid")) {
// OK - ATK docs are vague but suggest they support the same range of values as IAccessible2
} else {
// attribute we know nothing about
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index ab9560f93e..b0bc8a265e 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -1036,17 +1036,17 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const
QString bearer = i.value()->bearer();
- if (bearer == QStringLiteral("gsm")) {
+ if (bearer == QLatin1String("gsm")) {
return QNetworkConfiguration::Bearer2G;
- } else if (bearer == QStringLiteral("edge")) {
+ } else if (bearer == QLatin1String("edge")) {
return QNetworkConfiguration::Bearer2G;
- } else if (bearer == QStringLiteral("umts")) {
+ } else if (bearer == QLatin1String("umts")) {
return QNetworkConfiguration::BearerWCDMA;
- } else if (bearer == QStringLiteral("hspa")
- || bearer == QStringLiteral("hsdpa")
- || bearer == QStringLiteral("hsupa")) {
+ } else if (bearer == QLatin1String("hspa")
+ || bearer == QLatin1String("hsdpa")
+ || bearer == QLatin1String("hsupa")) {
return QNetworkConfiguration::BearerHSPA;
- } else if (bearer == QStringLiteral("lte")) {
+ } else if (bearer == QLatin1String("lte")) {
return QNetworkConfiguration::BearerLTE;
}
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index e72ed10e99..8eebf86d67 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -220,7 +220,7 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
i.next();
propertyMap.insert(i.key(),i.value());
- if (i.key() == QStringLiteral("State")) {
+ if (i.key() == QLatin1String("State")) {
quint32 state = i.value().toUInt();
if (state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
@@ -229,7 +229,7 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
Q_EMIT propertiesChanged(map);
Q_EMIT stateChanged(state);
}
- } else if (i.key() == QStringLiteral("ActiveConnections")) {
+ } else if (i.key() == QLatin1String("ActiveConnections")) {
Q_EMIT propertiesChanged(map);
}
}
@@ -424,7 +424,7 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
QMapIterator<QString, QVariant> i(map);
while (i.hasNext()) {
i.next();
- if (i.key() == QStringLiteral("AvailableConnections")) { //Device
+ if (i.key() == QLatin1String("AvailableConnections")) { //Device
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
QDBusObjectPath path;
QStringList paths;
@@ -520,9 +520,8 @@ void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant>
while (i.hasNext()) {
i.next();
propertyMap.insert(i.key(),i.value());
- if (i.key() == QStringLiteral("Carrier")) {
+ if (i.key() == QLatin1String("Carrier"))
Q_EMIT carrierChanged(i.value().toBool());
- }
}
Q_EMIT propertiesChanged(map);
}
@@ -699,9 +698,8 @@ void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVarian
while (i.hasNext()) {
i.next();
propertyMap.insert(i.key(),i.value());
- if (i.key() == QStringLiteral("ActiveAccessPoint")) { //DeviceWireless
+ if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless
Q_EMIT propertiesChanged(map);
- }
}
}
@@ -1057,7 +1055,7 @@ void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
while (i.hasNext()) {
i.next();
propertyMap.insert(i.key(),i.value());
- if (i.key() == QStringLiteral("State")) {
+ if (i.key() == QLatin1String("State")) {
quint32 state = i.value().toUInt();
if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|| state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 81d605933a..52d14e5324 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -279,7 +279,7 @@ QString TableGenerator::findComposeFile()
// check if user’s home directory has a file named .XCompose
if (cleanState()) {
QString path = qgetenv("HOME") + QStringLiteral("/.XCompose");
- if (QFile(path).exists())
+ if (QFile::exists(path))
return path;
}
@@ -292,7 +292,7 @@ QString TableGenerator::findComposeFile()
m_state = UnsupportedLocale;
else {
QString path = QDir(systemComposeDir()).filePath(table);
- if (QFile(path).exists())
+ if (QFile::exists(path))
return path;
}
}
@@ -314,7 +314,7 @@ bool TableGenerator::findSystemComposeDir()
bool found = false;
for (int i = 0; i < m_possibleLocations.size(); ++i) {
QString path = m_possibleLocations.at(i);
- if (QFile(path + QLatin1String("/compose.dir")).exists()) {
+ if (QFile::exists(path + QLatin1String("/compose.dir"))) {
m_systemComposeDir = path;
found = true;
break;
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index e59632a9ec..1eae295724 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -362,6 +362,15 @@ namespace QtAndroid
return surfaceId;
}
+ void setViewVisibility(jobject view, bool visible)
+ {
+ QJNIObjectPrivate::callStaticMethod<void>(m_applicationClass,
+ "setViewVisibility",
+ "(Landroid/view/View;Z)V",
+ view,
+ visible);
+ }
+
void setSurfaceGeometry(int surfaceId, const QRect &geometry)
{
if (surfaceId == -1)
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 2fed5af61b..e3c18b2e7a 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -68,6 +68,7 @@ namespace QtAndroid
int createSurface(AndroidSurfaceClient * client, const QRect &geometry, bool onTop, int imageDepth);
int insertNativeView(jobject view, const QRect &geometry);
+ void setViewVisibility(jobject view, bool visible);
void setSurfaceGeometry(int surfaceId, const QRect &geometry);
void destroySurface(int surfaceId);
void bringChildToFront(int surfaceId);
diff --git a/src/plugins/platforms/android/qandroidplatformforeignwindow.cpp b/src/plugins/platforms/android/qandroidplatformforeignwindow.cpp
index 89d4b08307..8c1f0ea8d2 100644
--- a/src/plugins/platforms/android/qandroidplatformforeignwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformforeignwindow.cpp
@@ -51,10 +51,14 @@ QAndroidPlatformForeignWindow::QAndroidPlatformForeignWindow(QWindow *window)
{
const WId wId = window->property("_q_foreignWinId").value<WId>();
m_view = reinterpret_cast<jobject>(wId);
+ if (m_view.isValid())
+ QtAndroid::setViewVisibility(m_view.object(), false);
}
QAndroidPlatformForeignWindow::~QAndroidPlatformForeignWindow()
{
+ if (m_view.isValid())
+ QtAndroid::setViewVisibility(m_view.object(), false);
if (m_surfaceId != -1)
QtAndroid::destroySurface(m_surfaceId);
}
@@ -90,8 +94,9 @@ void QAndroidPlatformForeignWindow::setVisible(bool visible)
if (!m_view.isValid())
return;
- QAndroidPlatformWindow::setVisible(visible);
+ QtAndroid::setViewVisibility(m_view.object(), visible);
+ QAndroidPlatformWindow::setVisible(visible);
if (!visible && m_surfaceId != -1) {
QtAndroid::destroySurface(m_surfaceId);
m_surfaceId = -1;
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index 1c318e09bf..872b97566f 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -126,7 +126,9 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
QPoint hotSpot = m_drag->hotSpot();
QPixmap pm = dragPixmap(m_drag, hotSpot);
+ QSize pmDeviceIndependentSize = pm.size() / pm.devicePixelRatio();
NSImage *nsimage = qt_mac_create_nsimage(pm);
+ [nsimage setSize : qt_mac_toNSSize(pmDeviceIndependentSize)];
QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacInternalPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
@@ -136,7 +138,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSWindow *theWindow = [m_lastEvent window];
Q_ASSERT(theWindow != nil);
event_location.x -= hotSpot.x();
- CGFloat flippedY = pm.height() - hotSpot.y();
+ CGFloat flippedY = pmDeviceIndependentSize.height() - hotSpot.y();
event_location.y -= flippedY;
NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0);
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 09973680c2..766561a264 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -90,9 +90,6 @@ HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region);
OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
-QChar qt_mac_qtKey2CocoaKey(Qt::Key key);
-Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode);
-
NSDragOperation qt_mac_mapDropAction(Qt::DropAction action);
NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions);
Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions);
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index b176549ca8..25fc9f0d5e 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -384,143 +384,6 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
return qtBrush;
}
-// Use this method to keep all the information in the TextSegment. As long as it is ordered
-// we are in OK shape, and we can influence that ourselves.
-struct KeyPair
-{
- QChar cocoaKey;
- Qt::Key qtKey;
-};
-
-bool operator==(const KeyPair &entry, QChar qchar)
-{
- return entry.cocoaKey == qchar;
-}
-
-bool operator<(const KeyPair &entry, QChar qchar)
-{
- return entry.cocoaKey < qchar;
-}
-
-bool operator<(QChar qchar, const KeyPair &entry)
-{
- return qchar < entry.cocoaKey;
-}
-
-bool operator<(const Qt::Key &key, const KeyPair &entry)
-{
- return key < entry.qtKey;
-}
-
-bool operator<(const KeyPair &entry, const Qt::Key &key)
-{
- return entry.qtKey < key;
-}
-
-struct qtKey2CocoaKeySortLessThan
-{
- typedef bool result_type;
- Q_DECL_CONSTEXPR result_type operator()(const KeyPair &entry1, const KeyPair &entry2) const Q_DECL_NOTHROW
- {
- return entry1.qtKey < entry2.qtKey;
- }
-};
-
-static const int NumEntries = 59;
-static const KeyPair entries[NumEntries] = {
- { NSEnterCharacter, Qt::Key_Enter },
- { NSBackspaceCharacter, Qt::Key_Backspace },
- { NSTabCharacter, Qt::Key_Tab },
- { NSNewlineCharacter, Qt::Key_Return },
- { NSCarriageReturnCharacter, Qt::Key_Return },
- { NSBackTabCharacter, Qt::Key_Backtab },
- { kEscapeCharCode, Qt::Key_Escape },
- // Cocoa sends us delete when pressing backspace!
- // (NB when we reverse this list in qtKey2CocoaKey, there
- // will be two indices of Qt::Key_Backspace. But is seems to work
- // ok for menu shortcuts (which uses that function):
- { NSDeleteCharacter, Qt::Key_Backspace },
- { NSUpArrowFunctionKey, Qt::Key_Up },
- { NSDownArrowFunctionKey, Qt::Key_Down },
- { NSLeftArrowFunctionKey, Qt::Key_Left },
- { NSRightArrowFunctionKey, Qt::Key_Right },
- { NSF1FunctionKey, Qt::Key_F1 },
- { NSF2FunctionKey, Qt::Key_F2 },
- { NSF3FunctionKey, Qt::Key_F3 },
- { NSF4FunctionKey, Qt::Key_F4 },
- { NSF5FunctionKey, Qt::Key_F5 },
- { NSF6FunctionKey, Qt::Key_F6 },
- { NSF7FunctionKey, Qt::Key_F7 },
- { NSF8FunctionKey, Qt::Key_F8 },
- { NSF9FunctionKey, Qt::Key_F9 },
- { NSF10FunctionKey, Qt::Key_F10 },
- { NSF11FunctionKey, Qt::Key_F11 },
- { NSF12FunctionKey, Qt::Key_F12 },
- { NSF13FunctionKey, Qt::Key_F13 },
- { NSF14FunctionKey, Qt::Key_F14 },
- { NSF15FunctionKey, Qt::Key_F15 },
- { NSF16FunctionKey, Qt::Key_F16 },
- { NSF17FunctionKey, Qt::Key_F17 },
- { NSF18FunctionKey, Qt::Key_F18 },
- { NSF19FunctionKey, Qt::Key_F19 },
- { NSF20FunctionKey, Qt::Key_F20 },
- { NSF21FunctionKey, Qt::Key_F21 },
- { NSF22FunctionKey, Qt::Key_F22 },
- { NSF23FunctionKey, Qt::Key_F23 },
- { NSF24FunctionKey, Qt::Key_F24 },
- { NSF25FunctionKey, Qt::Key_F25 },
- { NSF26FunctionKey, Qt::Key_F26 },
- { NSF27FunctionKey, Qt::Key_F27 },
- { NSF28FunctionKey, Qt::Key_F28 },
- { NSF29FunctionKey, Qt::Key_F29 },
- { NSF30FunctionKey, Qt::Key_F30 },
- { NSF31FunctionKey, Qt::Key_F31 },
- { NSF32FunctionKey, Qt::Key_F32 },
- { NSF33FunctionKey, Qt::Key_F33 },
- { NSF34FunctionKey, Qt::Key_F34 },
- { NSF35FunctionKey, Qt::Key_F35 },
- { NSInsertFunctionKey, Qt::Key_Insert },
- { NSDeleteFunctionKey, Qt::Key_Delete },
- { NSHomeFunctionKey, Qt::Key_Home },
- { NSEndFunctionKey, Qt::Key_End },
- { NSPageUpFunctionKey, Qt::Key_PageUp },
- { NSPageDownFunctionKey, Qt::Key_PageDown },
- { NSPrintScreenFunctionKey, Qt::Key_Print },
- { NSScrollLockFunctionKey, Qt::Key_ScrollLock },
- { NSPauseFunctionKey, Qt::Key_Pause },
- { NSSysReqFunctionKey, Qt::Key_SysReq },
- { NSMenuFunctionKey, Qt::Key_Menu },
- { NSHelpFunctionKey, Qt::Key_Help },
-};
-static const KeyPair * const end = entries + NumEntries;
-
-QChar qt_mac_qtKey2CocoaKey(Qt::Key key)
-{
- // The first time this function is called, create a reverse
- // lookup table sorted on Qt Key rather than Cocoa key:
- static QVector<KeyPair> rev_entries(NumEntries);
- static bool mustInit = true;
- if (mustInit){
- mustInit = false;
- for (int i=0; i<NumEntries; ++i)
- rev_entries[i] = entries[i];
- std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan());
- }
- const QVector<KeyPair>::iterator i
- = std::lower_bound(rev_entries.begin(), rev_entries.end(), key);
- if ((i == rev_entries.end()) || (key < *i))
- return QChar();
- return i->cocoaKey;
-}
-
-Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
-{
- const KeyPair *i = std::lower_bound(entries, end, keyCode);
- if ((i == end) || (keyCode < *i))
- return Qt::Key(keyCode.toUpper().unicode());
- return i->qtKey;
-}
-
struct dndenum_mapper
{
NSDragOperation mac_code;
diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.cpp b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
index a838a05e2d..0194a0415a 100644
--- a/src/plugins/platforms/haiku/qhaikuclipboard.cpp
+++ b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
@@ -92,9 +92,9 @@ QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode)
const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
if (dataLen && (status == B_OK)) {
const QString format = QString::fromLatin1(name);
- if (format == QStringLiteral("text/plain")) {
+ if (format == QLatin1String("text/plain")) {
m_systemMimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
- } else if (format == QStringLiteral("text/html")) {
+ } else if (format == QLatin1String("text/html")) {
m_systemMimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
} else {
m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen));
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index bde9a77e77..2c6e6b9771 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -286,30 +286,33 @@ void QWindowsOleDropSource::createCursors()
const bool hasPixmap = !pixmap.isNull();
// Find screen for drag. Could be obtained from QDrag::source(), but that might be a QWidget.
-
- qreal scaleFactor = 1;
- QPlatformCursor *platformCursor = Q_NULLPTR;
- if (const QPlatformScreen *platformScreen = QWindowsContext::instance()->screenManager().screenAtDp(QWindowsCursor::mousePosition())) {
- scaleFactor = QHighDpiScaling::factor(platformScreen);
- platformCursor = platformScreen->cursor();
+ const QPlatformScreen *platformScreen = QWindowsContext::instance()->screenManager().screenAtDp(QWindowsCursor::mousePosition());
+ if (!platformScreen) {
+ if (const QScreen *primaryScreen = QGuiApplication::primaryScreen())
+ platformScreen = primaryScreen->handle();
+ }
+ Q_ASSERT(platformScreen);
+ QPlatformCursor *platformCursor = platformScreen->cursor();
+
+ qreal pixmapScaleFactor = 1;
+ qreal hotSpotScaleFactor = 1;
+ if (m_mode != TouchDrag) { // Touch drag: pixmap is shown in a separate QWindow, which will be scaled.)
+ hotSpotScaleFactor = QHighDpiScaling::factor(platformScreen);
+ pixmapScaleFactor = hotSpotScaleFactor / pixmap.devicePixelRatio();
}
- if (!platformCursor && QGuiApplication::primaryScreen())
- platformCursor = QGuiApplication::primaryScreen()->handle()->cursor();
-
- const bool scalePixmap = hasPixmap
- && m_mode != TouchDrag // Touch drag: pixmap is shown in a separate QWindow, which will be scaled.
- && (scaleFactor != 1 && scaleFactor != qRound(pixmap.devicePixelRatio()));
- const QPixmap scaledPixmap = scalePixmap
- ? pixmap.scaled((QSizeF(pixmap.size()) * scaleFactor).toSize(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation)
- : pixmap;
+ QPixmap scaledPixmap = qFuzzyCompare(pixmapScaleFactor, 1.0)
+ ? pixmap
+ : pixmap.scaled((QSizeF(pixmap.size()) * pixmapScaleFactor).toSize(),
+ Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ scaledPixmap.setDevicePixelRatio(1);
+
Qt::DropAction actions[] = { Qt::MoveAction, Qt::CopyAction, Qt::LinkAction, Qt::IgnoreAction };
int actionCount = int(sizeof(actions) / sizeof(actions[0]));
if (!hasPixmap)
--actionCount; // No Qt::IgnoreAction unless pixmap
- const QPoint hotSpot = scalePixmap
- ? (QPointF(drag->hotSpot()) * scaleFactor).toPoint()
- : drag->hotSpot();
+ const QPoint hotSpot = qFuzzyCompare(hotSpotScaleFactor, 1.0)
+ ? drag->hotSpot()
+ : (QPointF(drag->hotSpot()) * hotSpotScaleFactor).toPoint();
for (int cnum = 0; cnum < actionCount; ++cnum) {
const Qt::DropAction action = actions[cnum];
QPixmap cursorPixmap = drag->dragCursor(action);
@@ -462,7 +465,7 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
if (!m_touchDragWindow)
m_touchDragWindow = new QWindowsDragCursorWindow;
m_touchDragWindow->setPixmap(e.pixmap);
- m_touchDragWindow->setFramePosition(QWindowsCursor::mousePosition() - e.hotSpot);
+ m_touchDragWindow->setFramePosition(QCursor::pos() - e.hotSpot);
if (!m_touchDragWindow->isVisible())
m_touchDragWindow->show();
break;
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index bfb76dfee7..2d5eb4b4b9 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1620,7 +1620,7 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
if (fam.isEmpty())
fam = QStringLiteral("MS Sans Serif");
- if ((fam == QStringLiteral("MS Sans Serif"))
+ if (fam == QLatin1String("MS Sans Serif")
&& (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) {
fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 3411381d4e..ed7fa441b2 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -238,17 +238,10 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa
}
} else {
#endif
- wchar_t first = tm.tmFirstChar;
- wchar_t last = tm.tmLastChar;
-
QStringIterator it(str, str + numChars);
while (it.hasNext()) {
const uint uc = it.next();
- if (
-#ifdef Q_DEAD_CODE_FROM_QT4_WINCE
- tm.tmFirstChar > 60000 ||
-#endif
- uc >= first && uc <= last)
+ if (uc >= tm.tmFirstChar && uc <= tm.tmLastChar)
glyphs->glyphs[glyph_pos] = uc;
else
glyphs->glyphs[glyph_pos] = 0;
@@ -358,11 +351,9 @@ glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const
glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000);
} else if (ttf) {
glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
-#else
- if (tm.tmFirstChar > 60000) {
- glyph = ucs4;
+ } else
#endif
- } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) {
+ if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) {
glyph = ucs4;
} else {
glyph = 0;
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index a16397f169..61c867cf07 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1151,7 +1151,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *
{
Q_UNUSED(preferredType);
QVariant result;
- if (mimeType != QStringLiteral("application/x-qt-image"))
+ if (mimeType != QLatin1String("application/x-qt-image"))
return result;
//Try to convert from a format which has more data
//DIBV5, use only if its is not synthesized
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 246ebcb238..e83d44bbfe 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -230,6 +230,30 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel)
return qrectFromRECT(rect);
}
+// Return the visibility of the Window (except full screen since it is not a window state).
+static QWindow::Visibility windowVisibility_sys(HWND hwnd)
+{
+ if (!IsWindowVisible(hwnd))
+ return QWindow::Hidden;
+#ifndef Q_OS_WINCE
+ WINDOWPLACEMENT windowPlacement;
+ windowPlacement.length = sizeof(WINDOWPLACEMENT);
+ if (GetWindowPlacement(hwnd, &windowPlacement)) {
+ switch (windowPlacement.showCmd) {
+ case SW_SHOWMINIMIZED:
+ case SW_MINIMIZE:
+ case SW_FORCEMINIMIZE:
+ return QWindow::Minimized;
+ case SW_SHOWMAXIMIZED:
+ return QWindow::Maximized;
+ default:
+ break;
+ }
+ }
+#endif // !Q_OS_WINCE
+ return QWindow::Windowed;
+}
+
static inline QSize clientSize(HWND hwnd)
{
RECT rect = { 0, 0, 0, 0 };
@@ -1867,6 +1891,10 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
swpf |= SWP_NOSIZE | SWP_NOMOVE;
const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
setFlag(SynchronousGeometryChangeEvent);
+ // After maximized/fullscreen; the window can be in a maximized state. Clear
+ // it before applying the normal geometry.
+ if (windowVisibility_sys(m_data.hwnd) == QWindow::Maximized)
+ ShowWindow(m_data.hwnd, SW_SHOWNOACTIVATE);
SetWindowPos(m_data.hwnd, 0, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(),
m_savedFrameGeometry.width(), m_savedFrameGeometry.height(), swpf);
if (!wasSync)
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index 997aa0d86c..4c4d553b2d 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -1169,7 +1169,7 @@ HRESULT QWinRTScreen::onVisibilityChanged(ICoreWindow *, IVisibilityChangedEvent
Q_D(QWinRTScreen);
boolean visible;
HRESULT hr = args ? args->get_Visible(&visible) : d->coreWindow->get_Visible(&visible);
- RETURN_OK_IF_FAILED("Failed to get visbile.");
+ RETURN_OK_IF_FAILED("Failed to get visibility.");
QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden);
if (visible)
handleExpose();
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 20a5232235..4d29cdc316 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -645,7 +645,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));
if (!glIntegrationName.isEmpty()) {
qCDebug(QT_XCB_GLINTEGRATION) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
- if (glIntegrationName != QStringLiteral("none")) {
+ if (glIntegrationName != QLatin1String("none")) {
glIntegrationNames.removeAll(glIntegrationName);
glIntegrationNames.prepend(glIntegrationName);
} else {
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index e69fa2d1df..848cd85b03 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2265,12 +2265,13 @@ void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, con
static bool ignoreLeaveEvent(const xcb_leave_notify_event_t *event)
{
return event->detail == XCB_NOTIFY_DETAIL_VIRTUAL
- || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL;
+ || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL
+ || event->mode == XCB_NOTIFY_MODE_GRAB;
}
static bool ignoreEnterEvent(const xcb_enter_notify_event_t *event)
{
- return ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB)
+ return (event->mode != XCB_NOTIFY_MODE_NORMAL
|| event->detail == XCB_NOTIFY_DETAIL_VIRTUAL
|| event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL);
}
diff --git a/src/plugins/printsupport/cocoa/main.cpp b/src/plugins/printsupport/cocoa/main.cpp
index 5f8d15b999..b6830c88d4 100644
--- a/src/plugins/printsupport/cocoa/main.cpp
+++ b/src/plugins/printsupport/cocoa/main.cpp
@@ -55,7 +55,7 @@ public:
QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key)
{
- if (key.compare(key, QStringLiteral("cocoaprintersupport"), Qt::CaseInsensitive) != 0)
+ if (key.compare(key, QLatin1String("cocoaprintersupport"), Qt::CaseInsensitive) != 0)
return 0;
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
if (!app)
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 325e1f69e8..1119b04293 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -75,11 +75,7 @@ namespace QTest
QEvent::Type type;
type = press ? QEvent::KeyPress : QEvent::KeyRelease;
qt_handleKeyEvent(window, type, code, modifier, text, repeat, delay);
-#ifdef QT_MAC_USE_COCOA
- QTest::qWait(20);
-#else
qApp->processEvents();
-#endif
}
static void sendKeyEvent(KeyAction action, QWindow *window, Qt::Key code,
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 2aa8efe7b4..1b06845c46 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -62,7 +62,7 @@ static const char docTypeHeader[] =
#define PROGRAMNAME "qdbuscpp2xml"
#define PROGRAMVERSION "0.2"
-#define PROGRAMCOPYRIGHT "Copyright (C) 2015 The Qt Company Ltd."
+#define PROGRAMCOPYRIGHT "Copyright (C) 2016 The Qt Company Ltd."
static QString outputFile;
static int flags;
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 95c0f7c46e..ae5178fffc 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -43,7 +43,7 @@
#define PROGRAMNAME "qdbusxml2cpp"
#define PROGRAMVERSION "0.8"
-#define PROGRAMCOPYRIGHT "Copyright (C) 2015 The Qt Company Ltd."
+#define PROGRAMCOPYRIGHT "Copyright (C) 2016 The Qt Company Ltd."
#define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply"
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 555a1f39ff..97a63d49c6 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -117,13 +117,13 @@ void Uic::writeCopyrightHeader(DomUI *ui)
if (comment.size())
out << "/*\n" << comment << "\n*/\n\n";
- out << "/********************************************************************************\n";
- out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
- out << "**\n";
- out << "** Created by: Qt User Interface Compiler version " << QLatin1String(QT_VERSION_STR) << "\n";
- out << "**\n";
- out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n";
- out << "********************************************************************************/\n\n";
+ out << "/********************************************************************************\n";
+ out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n";
+ out << "**\n";
+ out << "** Created by: Qt User Interface Compiler version " << QLatin1String(QT_VERSION_STR) << "\n";
+ out << "**\n";
+ out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n";
+ out << "********************************************************************************/\n\n";
}
// Check the version with a stream reader at the <ui> element.
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 7b59f96f30..288922d740 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3407,27 +3407,27 @@ void QFileDialogPrivate::_q_deleteCurrent()
if (!index.isValid())
continue;
- QString fileName = index.data(QFileSystemModel::FileNameRole).toString();
- QString filePath = index.data(QFileSystemModel::FilePathRole).toString();
- bool isDir = model->isDir(index);
+ QString fileName = index.data(QFileSystemModel::FileNameRole).toString();
+ QString filePath = index.data(QFileSystemModel::FilePathRole).toString();
+ bool isDir = model->isDir(index);
- QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
+ QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
#ifndef QT_NO_MESSAGEBOX
- Q_Q(QFileDialog);
- if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
- QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?")
- .arg(fileName),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No))
- return;
- else if (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
- QFileDialog::tr("Are you sure you want to delete '%1'?")
- .arg(fileName),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
- return;
+ Q_Q(QFileDialog);
+ if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
+ QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?")
+ .arg(fileName),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No))
+ return;
+ else if (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
+ QFileDialog::tr("Are you sure you want to delete '%1'?")
+ .arg(fileName),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
+ return;
#else
- if (!(p & QFile::WriteUser))
- return;
+ if (!(p & QFile::WriteUser))
+ return;
#endif // QT_NO_MESSAGEBOX
// the event loop has run, we can NOT reuse index because the model might have removed it.
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index cd5643660d..207b6e3919 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1903,7 +1903,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
"<p>Qt is The Qt Company Ltd product developed as an open source "
"project. See <a href=\"http://%3/\">%3</a> for more information.</p>"
- ).arg(QStringLiteral("2015"),
+ ).arg(QStringLiteral("2016"),
QStringLiteral("qt.io/licensing"),
QStringLiteral("qt.io"));
QMessageBox *msgBox = new QMessageBox(parent);
diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm
index cfa7271bbd..f74f8453c7 100644
--- a/src/widgets/doc/snippets/macmainwindow.mm
+++ b/src/widgets/doc/snippets/macmainwindow.mm
@@ -45,8 +45,6 @@
#include <Carbon/Carbon.h>
-#ifdef QT_MAC_USE_COCOA
-
//![0]
SearchWidget::SearchWidget(QWidget *parent)
: QMacCocoaViewContainer(0, parent)
@@ -82,57 +80,6 @@ QSize SearchWidget::sizeHint() const
return QSize(150, 40);
}
-#else
-
-// The SearchWidget class wraps a native HISearchField.
-SearchWidget::SearchWidget(QWidget *parent)
- :QWidget(parent)
-{
-
- // Create a native search field and pass its window id to QWidget::create.
- searchFieldText = CFStringCreateWithCString(0, "search", 0);
- HISearchFieldCreate(NULL/*bounds*/, kHISearchFieldAttributesSearchIcon | kHISearchFieldAttributesCancel,
- NULL/*menu ref*/, searchFieldText, &searchField);
- create(reinterpret_cast<WId>(searchField));
-
- // Use a Qt menu for the search field menu.
- QMenu *searchMenu = createMenu(this);
- MenuRef menuRef = searchMenu->macMenu(0);
- HISearchFieldSetSearchMenu(searchField, menuRef);
- setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-}
-
-SearchWidget::~SearchWidget()
-{
- CFRelease(searchField);
- CFRelease(searchFieldText);
-}
-
-// Get the size hint from the search field.
-QSize SearchWidget::sizeHint() const
-{
- EventRef event;
- HIRect optimalBounds;
- CreateEvent(0, kEventClassControl,
- kEventControlGetOptimalBounds,
- GetCurrentEventTime(),
- kEventAttributeUserEvent, &event);
-
- SendEventToEventTargetWithOptions(event,
- HIObjectGetEventTarget(HIObjectRef(winId())),
- kEventTargetDontPropagate);
-
- GetEventParameter(event,
- kEventParamControlOptimalBounds, typeHIRect,
- 0, sizeof(HIRect), 0, &optimalBounds);
-
- ReleaseEvent(event);
- return QSize(optimalBounds.size.width + 100, // make it a bit wider.
- optimalBounds.size.height);
-}
-
-#endif
-
QMenu *createMenu(QWidget *parent)
{
QMenu *searchMenu = new QMenu(parent);
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index ef70a39a2c..e1b835e727 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -1181,8 +1181,8 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity()
if (!proxy) {
q->setInputMethodHints(focusItem->inputMethodHints());
} else if (QWidget *widget = proxy->widget()) {
- if (QWidget *fw = widget->focusWidget())
- widget = fw;
+ if (QWidget *fw = widget->focusWidget())
+ widget = fw;
q->setInputMethodHints(widget->inputMethodHints());
} else {
q->setInputMethodHints(0);
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index dbec689efa..72d6fffefd 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -45,10 +45,10 @@
#include "qapplication.h"
#include "qevent.h"
#include "qlist.h"
-#include "qdebug.h"
#include <private/qshortcutmap_p.h>
#include <private/qapplication_p.h>
#include <private/qmenu_p.h>
+#include <private/qdebug_p.h>
#define QAPP_CHECK(functionName) \
if (Q_UNLIKELY(!qApp)) { \
@@ -1302,6 +1302,31 @@ bool QAction::isIconVisibleInMenu() const
return d->iconVisibleInMenu;
}
+#ifndef QT_NO_DEBUG_STREAM
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "QAction(" << static_cast<const void *>(action);
+ if (action) {
+ d << " text=" << action->text();
+ if (!action->toolTip().isEmpty())
+ d << " toolTip=" << action->toolTip();
+ if (action->isCheckable())
+ d << " checked=" << action->isChecked();
+ if (!action->shortcut().isEmpty())
+ d << " shortcut=" << action->shortcut();
+ d << " menuRole=";
+ QtDebugUtils::formatQEnum(d, action->menuRole());
+ d << " visible=" << action->isVisible();
+ } else {
+ d << '0';
+ }
+ d << ')';
+ return d;
+}
+#endif // QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
#include "moc_qaction.cpp"
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 6caf37c80f..abfa2cdd42 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -209,6 +209,10 @@ private:
#endif
};
+#ifndef QT_NO_DEBUG_STREAM
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QAction *);
+#endif
+
QT_BEGIN_INCLUDE_NAMESPACE
#include <QtWidgets/qactiongroup.h>
QT_END_INCLUDE_NAMESPACE
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index d1a6ecabd6..abdbd35f5b 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -238,11 +238,6 @@
\property QDesktopWidget::screenCount
\brief the number of screens currently available on the system.
- Note that on some platforms, screenCount will be zero if there are actually
- no screens connected. Applications which were running at the time the
- screenCount went to zero will stop rendering graphics until one or more
- screens are restored.
-
\since 4.6
*/
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 55f733045e..77efaf1632 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -335,7 +335,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
shown and the character will be underlined. On Windows, shortcuts
are normally not displayed until the user presses the \uicontrol Alt
key, but this is a setting the user can change. On Mac, shortcuts
- are disabled by default. Call qt_set_sequence_auto_mnemonic() to
+ are disabled by default. Call \l qt_set_sequence_auto_mnemonic() to
enable them. However, because mnemonic shortcuts do not fit in
with Aqua's guidelines, Qt will not show the shortcut character
underlined.
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index dab49f2f11..462a41ce5d 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -90,6 +90,11 @@ public:
if (usesNativeWidgets || window->parent() == 0)
return;
Q_Q(QWindowContainer);
+ if (q->internalWinId()) {
+ // Allow use native widgets if the window container is already a native widget
+ usesNativeWidgets = true;
+ return;
+ }
QWidget *p = q->parentWidget();
while (p) {
if (
@@ -153,8 +158,10 @@ public:
as a child of a QAbstractScrollArea or QMdiArea, it will
create a \l {Native Widgets vs Alien Widgets} {native window} for
every widget in its parent chain to allow for proper stacking and
- clipping in this use case. Applications with many native child
- windows may suffer from performance issues.
+ clipping in this use case. Creating a native window for the window
+ container also allows for proper stacking and clipping. This must
+ be done before showing the window container. Applications with
+ many native child windows may suffer from performance issues.
The window container has a number of known limitations:
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 2467040f29..3136118cdd 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -404,7 +404,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
{
XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme);
static int decoration_size = 0;
- if (d->initTreeViewTheming() && theme.isValid() && !decoration_size) {
+ if (!decoration_size && d->initTreeViewTheming() && theme.isValid()) {
XPThemeData themeSize = theme;
themeSize.partId = TVP_HOTGLYPH;
themeSize.stateId = GLPS_OPENED;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 2c32acf701..46507e3e3c 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1317,8 +1317,8 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
if (!lineEdit)
emit q->currentTextChanged(text);
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleValueChangeEvent event(q, text);
- QAccessible::updateAccessibility(&event);
+ QAccessibleValueChangeEvent event(q, text);
+ QAccessible::updateAccessibility(&event);
#endif
}
@@ -2838,8 +2838,8 @@ void QComboBox::clear()
Q_D(QComboBox);
d->model->removeRows(0, d->model->rowCount(d->root), d->root);
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleValueChangeEvent event(this, QString());
- QAccessible::updateAccessibility(&event);
+ QAccessibleValueChangeEvent event(this, QString());
+ QAccessible::updateAccessibility(&event);
#endif
}
@@ -2852,8 +2852,8 @@ void QComboBox::clearEditText()
if (d->lineEdit)
d->lineEdit->clear();
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleValueChangeEvent event(this, QString());
- QAccessible::updateAccessibility(&event);
+ QAccessibleValueChangeEvent event(this, QString());
+ QAccessible::updateAccessibility(&event);
#endif
}
@@ -2866,8 +2866,8 @@ void QComboBox::setEditText(const QString &text)
if (d->lineEdit)
d->lineEdit->setText(text);
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleValueChangeEvent event(this, text);
- QAccessible::updateAccessibility(&event);
+ QAccessibleValueChangeEvent event(this, text);
+ QAccessible::updateAccessibility(&event);
#endif
}
@@ -3012,8 +3012,8 @@ bool QComboBox::event(QEvent *event)
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d->updateHoverControl(he->pos());
+ if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
+ d->updateHoverControl(he->pos());
break;
case QEvent::ShortcutOverride:
if (d->lineEdit)
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 030472f757..69be43a51e 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1950,12 +1950,8 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
qt_mac_set_drawer_preferred_edge(widget, toDockWidgetArea(dockPos));
} else
#endif
- if (!testing) {
- QRect r(x, y, w, h);
- r = QDockAreaLayout::constrainedRect(r, widget);
- widget->move(r.topLeft());
- widget->resize(r.size());
- }
+ if (!testing)
+ widget->setGeometry(QDockAreaLayout::constrainedRect(QRect(x, y, w, h), widget));
if (!testing) {
widget->setVisible(flags & StateFlagVisible);
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 02215c4129..ae20159473 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -590,7 +590,9 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
if (reason != SelectedFromKeyboard) {
if (QMenu *menu = qobject_cast<QMenu*>(causedPopup.widget)) {
if (causedPopup.action && menu->d_func()->activeMenu == q)
- menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
+ // Reselect parent menu action only if mouse is over a menu and parent menu action is not already selected (QTBUG-47987)
+ if (hasReceievedEnter && menu->d_func()->currentAction != causedPopup.action)
+ menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false);
}
}
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index 3cc572cb37..c24779d61f 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -104,15 +104,13 @@ void QMenu::setAsDockMenu()
/*! \fn void qt_mac_set_dock_menu(QMenu *menu)
- \since 5.2
+ \relates QMenu
\deprecated
- Set this menu to be the dock menu available by option-clicking
+ Sets this \a menu to be the dock menu available by option-clicking
on the application dock icon. Available on OS X only.
- Deprecated; use QMenu:setAsDockMenu() instead.
-
- \sa QMenu:setAsDockMenu()
+ Deprecated; use \l QMenu::setAsDockMenu() instead.
*/
void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* item)
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 89f8ba46cf..7399601c2e 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -485,8 +485,8 @@ bool QScrollBar::event(QEvent *event)
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d_func()->updateHoverControl(he->pos());
+ if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
+ d_func()->updateHoverControl(he->pos());
break;
case QEvent::StyleChange:
d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this));
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index d5bbe14b25..664aec9a53 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -126,7 +126,7 @@ bool QToolButtonPrivate::hasMenu() const
One classic use of a tool button is to select tools; for example,
the "pen" tool in a drawing program. This would be implemented
- by using a QToolButton as a toggle button (see setToggleButton()).
+ by using a QToolButton as a toggle button (see setCheckable()).
QToolButton supports auto-raising. In auto-raise mode, the button
draws a 3D frame only when the mouse points at it. The feature is
@@ -153,8 +153,8 @@ bool QToolButtonPrivate::hasMenu() const
menu set. The default mode is DelayedPopupMode which is sometimes
used with the "Back" button in a web browser. After pressing and
holding the button down for a while, a menu pops up showing a list
- of possible pages to jump to. The default delay is 600 ms; you can
- adjust it with setPopupDelay().
+ of possible pages to jump to. The timeout is style dependent,
+ see QStyle::SH_ToolButton_PopupDelay.
\table 100%
\row \li \inlineimage assistant-toolbar.png Qt Assistant's toolbar with tool buttons
@@ -826,7 +826,7 @@ void QToolButtonPrivate::_q_menuTriggered(QAction *action)
a menu set or contains a list of actions.
\value DelayedPopup After pressing and holding the tool button
- down for a certain amount of time (the timeout is style dependant,
+ down for a certain amount of time (the timeout is style dependent,
see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A
typical application example is the "back" button in some web
browsers's tool bars. If the user clicks it, the browser simply
@@ -967,8 +967,8 @@ bool QToolButton::event(QEvent *event)
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d_func()->updateHoverControl(he->pos());
+ if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
+ d_func()->updateHoverControl(he->pos());
break;
default:
break;