summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-20 08:44:28 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-20 09:00:44 +0100
commitae2695535a2f1abbd4c6596a22dd33319b9388dd (patch)
tree91df41df365a13ea71b1361d909535e5b7a7360a /src
parent8066ae49433ed7604e710eef7b15d15de171608e (diff)
parentc1a2f97a3b3a8c058b1760b57e5c83bf7815b84a (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/forkfd/forkfd.c28
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp1
-rw-r--r--src/corelib/configure.json20
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h2
-rw-r--r--src/corelib/global/qfloat16.h6
-rw-r--r--src/corelib/global/qglobal.cpp9
-rw-r--r--src/corelib/io/forkfd_qt.cpp1
-rw-r--r--src/corelib/io/io.pri18
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp29
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp20
-rw-r--r--src/corelib/io/qprocess.cpp9
-rw-r--r--src/corelib/io/qprocess.h8
-rw-r--r--src/corelib/io/qprocess_p.h9
-rw-r--r--src/corelib/io/qprocess_unix.cpp6
-rw-r--r--src/corelib/io/qprocess_win.cpp6
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h4
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp12
-rw-r--r--src/corelib/kernel/qcoreapplication.h4
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h7
-rw-r--r--src/corelib/kernel/qtimer.h2
-rw-r--r--src/corelib/plugin/plugin.pri53
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp2
-rw-r--r--src/corelib/plugin/qelfparser_p.h4
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h6
-rw-r--r--src/corelib/plugin/qlibrary.cpp4
-rw-r--r--src/corelib/plugin/qlibrary.h6
-rw-r--r--src/corelib/plugin/qlibrary_p.h7
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp4
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp4
-rw-r--r--src/corelib/plugin/qmachparser.cpp2
-rw-r--r--src/corelib/plugin/qmachparser_p.h4
-rw-r--r--src/corelib/plugin/qpluginloader.cpp4
-rw-r--r--src/corelib/plugin/qpluginloader.h7
-rw-r--r--src/corelib/thread/qfutureinterface.h28
-rw-r--r--src/corelib/thread/qresultstore.cpp6
-rw-r--r--src/corelib/thread/qresultstore.h64
-rw-r--r--src/corelib/tools/qdatetime.cpp7
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp41
-rw-r--r--src/corelib/tools/qharfbuzz.cpp4
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qlocale.cpp6
-rw-r--r--src/corelib/tools/qlocale_icu.cpp1
-rw-r--r--src/corelib/tools/qrect.h6
-rw-r--r--src/corelib/tools/qstring.cpp24
-rw-r--r--src/corelib/tools/qstring.h10
-rw-r--r--src/corelib/tools/qvector.h8
-rw-r--r--src/corelib/xml/qxmlutils_p.h2
-rw-r--r--src/dbus/qdbus_symbols.cpp12
-rw-r--r--src/dbus/qdbusintegrator.cpp2
-rw-r--r--src/gui/configure.json17
-rw-r--r--src/gui/image/qpixmapcache.cpp7
-rw-r--r--src/gui/image/qxpmhandler.cpp3
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/kernel/qplatformintegrationfactory.cpp8
-rw-r--r--src/gui/kernel/qplatformthemefactory.cpp6
-rw-r--r--src/gui/math3d/qmatrix4x4.h5
-rw-r--r--src/gui/math3d/qquaternion.h15
-rw-r--r--src/gui/math3d/qvector2d.h4
-rw-r--r--src/gui/math3d/qvector3d.h4
-rw-r--r--src/gui/math3d/qvector4d.h4
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp1
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qrgba64.h14
-rw-r--r--src/gui/painting/qtransform.h6
-rw-r--r--src/gui/text/qdistancefield.cpp4
-rw-r--r--src/network/kernel/qauthenticator.cpp3
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp6
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp4
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp137
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp5
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp13
-rw-r--r--src/opengl/qgl.cpp1
-rw-r--r--src/opengl/qglframebufferobject.cpp1
-rw-r--r--src/platformsupport/eglconvenience/eglconvenience.pro2
-rw-r--r--src/platformsupport/glxconvenience/glxconvenience.pro1
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience.cpp4
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices.cpp6
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp4
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm7
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm85
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro2
-rw-r--r--src/plugins/platforms/vnc/vnc.pro10
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp59
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp6
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp24
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h13
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp12
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h6
-rw-r--r--src/testlib/qbenchmark.cpp1
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qtestcase.cpp1
-rw-r--r--src/tools/moc/generator.cpp17
-rw-r--r--src/tools/rcc/main.cpp27
-rw-r--r--src/tools/rcc/rcc.cpp29
-rw-r--r--src/tools/rcc/rcc.h5
-rw-r--r--src/tools/uic/main.cpp4
-rw-r--r--src/widgets/accessible/complexwidgets.cpp1
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp1
-rw-r--r--src/widgets/accessible/simplewidgets.cpp7
-rw-r--r--src/widgets/accessible/simplewidgets_p.h2
-rw-r--r--src/widgets/configure.json14
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.cpp10
-rw-r--r--src/widgets/itemviews/qtableview.h4
-rw-r--r--src/widgets/itemviews/qtableview_p.h2
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp2
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp14
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/styles/qfusionstyle.cpp15
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm22
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp10
-rw-r--r--src/widgets/widgets/qabstractbutton.h2
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp1
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp5
-rw-r--r--src/widgets/widgets/qlabel.cpp6
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp4
-rw-r--r--src/widgets/widgets/qmenu.cpp60
-rw-r--r--src/widgets/widgets/qmenu_p.h1
-rw-r--r--src/widgets/widgets/qtoolbutton.h9
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp11
-rw-r--r--src/widgets/widgets/widgets.pri12
140 files changed, 812 insertions, 614 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index e57d9aa1e0..8113fdb9e7 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -281,7 +281,7 @@ static void notifyAndFreeInfo(Header *header, ProcessInfo *entry,
freeInfo(header, entry);
}
-static void sigchld_handler(int signum)
+static void sigchld_handler(int signum, siginfo_t *handler_info, void *handler_context)
{
/*
* This is a signal handler, so we need to be careful about which functions
@@ -289,7 +289,20 @@ static void sigchld_handler(int signum)
* specification at:
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
*
+ * The handler_info and handler_context parameters may not be valid, if
+ * we're a chained handler from another handler that did not use
+ * SA_SIGINFO. Therefore, we must obtain the siginfo ourselves directly by
+ * calling waitid.
+ *
+ * But we pass them anyway. Let's call the chained handler first, while
+ * those two arguments have a chance of being correct.
*/
+ if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL) {
+ if (old_sigaction.sa_flags & SA_SIGINFO)
+ old_sigaction.sa_sigaction(signum, handler_info, handler_context);
+ else
+ old_sigaction.sa_handler(signum);
+ }
if (ffd_atomic_load(&forkfd_status, FFD_ATOMIC_RELAXED) == 1) {
/* is this one of our children? */
@@ -317,9 +330,8 @@ search_next_child:
waitid(P_ALL, 0, &info, WNOHANG | WNOWAIT | WEXITED);
if (info.si_pid == 0) {
/* there are no further un-waited-for children, so we can just exit.
- * But before, transfer control to the chained SIGCHLD handler.
*/
- goto chain_handler;
+ return;
}
for (i = 0; i < (int)sizeofarray(children.entries); ++i) {
@@ -407,12 +419,6 @@ search_arrays:
array = ffd_atomic_load(&array->header.nextArray, FFD_ATOMIC_ACQUIRE);
}
}
-
-#ifdef HAVE_WAITID
-chain_handler:
-#endif
- if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL)
- old_sigaction.sa_handler(signum);
}
static void ignore_sigpipe()
@@ -457,8 +463,8 @@ static void forkfd_initialize()
struct sigaction action;
memset(&action, 0, sizeof action);
sigemptyset(&action.sa_mask);
- action.sa_flags = SA_NOCLDSTOP;
- action.sa_handler = sigchld_handler;
+ action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+ action.sa_sigaction = sigchld_handler;
/* ### RACE CONDITION
* The sigaction function does a memcpy from an internal buffer
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index e4fb359f2c..d6362b6fbc 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -43,7 +43,6 @@ QT_REQUIRE_CONFIG(iconv);
#include "qiconvcodec_p.h"
#include "qtextcodec_p.h"
-#include <qlibrary.h>
#include <qdebug.h>
#include <qthreadstorage.h>
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 4fbc51a09c..c6c5c93ddb 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -56,6 +56,9 @@
},
{ "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && features.shared" },
{ "libs": "-licui18n -licuuc -licudata", "condition": "!config.win32" }
+ ],
+ "use": [
+ { "lib": "libdl", "condition": "features.dlopen" }
]
},
"journald": {
@@ -74,10 +77,10 @@
]
},
"libdl": {
- "label": "dlopen() in libdl",
- "export": "",
+ "label": "dlopen()",
"test": "unix/dlopen",
"sources": [
+ "",
"-ldl"
]
},
@@ -131,11 +134,6 @@
"type": "compile",
"test": "unix/cloexec"
},
- "dlopen": {
- "label": "dlopen() in libc",
- "type": "compile",
- "test": "unix/dlopen"
- },
"eventfd": {
"label": "eventfd",
"type": "compile",
@@ -211,12 +209,8 @@
},
"dlopen": {
"label": "dlopen()",
- "condition": "tests.dlopen || libs.libdl"
- },
- "libdl": {
- "label": "dlopen() in libdl",
- "condition": "!tests.dlopen && libs.libdl",
- "output": [ { "type": "privateConfig", "negative": true } ]
+ "condition": "config.unix && libs.libdl",
+ "output": [ "privateFeature" ]
},
"doubleconversion": {
"label": "DoubleConversion",
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 1c806e0774..bda8ad7916 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -71,9 +71,9 @@
#define QT_FEATURE_iconv -1
#define QT_FEATURE_icu -1
#define QT_FEATURE_journald -1
-#define QT_NO_LIBRARY
#define QT_FEATURE_library -1
#define QT_NO_QOBJECT
+#define QT_FEATURE_process -1
#define QT_NO_SYSTEMLOCALE
#define QT_FEATURE_slog2 -1
#define QT_FEATURE_syslog -1
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 8fd2f212af..651057f8e2 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -196,6 +196,10 @@ QF16_MAKE_ARITH_OP_INT(*)
QF16_MAKE_ARITH_OP_INT(/)
#undef QF16_MAKE_ARITH_OP_INT
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
+
inline bool operator>(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) > static_cast<float>(b); }
inline bool operator<(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) < static_cast<float>(b); }
inline bool operator>=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) >= static_cast<float>(b); }
@@ -230,6 +234,8 @@ QF16_MAKE_BOOL_OP_INT(==)
QF16_MAKE_BOOL_OP_INT(!=)
#undef QF16_MAKE_BOOL_OP_INT
+QT_WARNING_POP
+
/*!
\internal
*/
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 7ca22e4a93..6dba733fb4 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -958,7 +958,8 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
\snippet code/src_corelib_global_qglobal.cpp 53
- \sa qConstOverload(), qNonConstOverload()
+ \sa qConstOverload(), qNonConstOverload(), {Differences between String-Based
+ and Functor-Based Connections}
*/
/*! \fn auto qConstOverload(T memberFunctionPointer)
@@ -969,7 +970,8 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
\snippet code/src_corelib_global_qglobal.cpp 54
- \sa qOverload, qNonConstOverload
+ \sa qOverload, qNonConstOverload, {Differences between String-Based
+ and Functor-Based Connections}
*/
/*! \fn auto qNonConstOverload(T memberFunctionPointer)
@@ -980,7 +982,8 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
\snippet code/src_corelib_global_qglobal.cpp 54
- \sa qOverload, qNonConstOverload
+ \sa qOverload, qNonConstOverload, {Differences between String-Based
+ and Functor-Based Connections}
*/
/*!
diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp
index 141efeb08c..dce0ebb4da 100644
--- a/src/corelib/io/forkfd_qt.cpp
+++ b/src/corelib/io/forkfd_qt.cpp
@@ -39,7 +39,6 @@
// these might be defined via precompiled headers
#include <QtCore/qatomic.h>
-#include "qprocess_p.h"
#define FORKFD_NO_SPAWNFD
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 78416cdf5e..b0cac59f42 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -22,8 +22,6 @@ HEADERS += \
io/qlockfile.h \
io/qlockfile_p.h \
io/qnoncontiguousbytedevice_p.h \
- io/qprocess.h \
- io/qprocess_p.h \
io/qtextstream.h \
io/qtextstream_p.h \
io/qtemporarydir.h \
@@ -72,7 +70,6 @@ SOURCES += \
io/qiodevice.cpp \
io/qlockfile.cpp \
io/qnoncontiguousbytedevice.cpp \
- io/qprocess.cpp \
io/qstorageinfo.cpp \
io/qtextstream.cpp \
io/qtemporarydir.cpp \
@@ -96,6 +93,19 @@ SOURCES += \
io/qloggingcategory.cpp \
io/qloggingregistry.cpp
+qtConfig(processenvironment) {
+ SOURCES += \
+ io/qprocess.cpp
+ HEADERS += \
+ io/qprocess.h \
+ io/qprocess_p.h
+
+ win32:!winrt: \
+ SOURCES += io/qprocess_win.cpp
+ else: unix: \
+ SOURCES += io/qprocess_unix.cpp
+}
+
win32 {
SOURCES += io/qfsfileengine_win.cpp
SOURCES += io/qlockfile_win.cpp
@@ -112,7 +122,6 @@ win32 {
io/qwinoverlappedionotifier_p.h
SOURCES += \
- io/qprocess_win.cpp \
io/qsettings_win.cpp \
io/qstandardpaths_win.cpp \
io/qstorageinfo_win.cpp \
@@ -132,7 +141,6 @@ win32 {
io/qfsfileengine_unix.cpp \
io/qfilesystemengine_unix.cpp \
io/qlockfile_unix.cpp \
- io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
!integrity:!uikit {
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 48c72bb9ec..d95a6de777 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -151,14 +151,15 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
#if defined(Q_OS_WINRT)
-// As none of the functions we try to resolve do exist on WinRT
-// we use QT_NO_LIBRARY to shorten everything up a little bit.
-# ifndef QT_NO_LIBRARY
-# define QT_NO_LIBRARY 1
-# endif
+// As none of the functions we try to resolve do exist on WinRT we
+// avoid library loading on WinRT in general to shorten everything
+// up a little bit.
+# define QT_FEATURE_fslibs -1
+#else
+# define QT_FEATURE_fslibs QT_FEATURE_library
#endif // Q_OS_WINRT
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
QT_BEGIN_INCLUDE_NAMESPACE
typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*);
static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0;
@@ -255,7 +256,7 @@ struct LibResolver
Q_GLOBAL_STATIC(LibResolver, resolveLibs)
} // anonymous namespace
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(fslibs)
QT_BEGIN_INCLUDE_NAMESPACE
typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD);
@@ -327,7 +328,7 @@ static QString readSymLink(const QFileSystemEntry &link)
free(rdb);
CloseHandle(handle);
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
resolveLibs();
QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
if (matchVolName.indexIn(result) == 0) {
@@ -337,7 +338,7 @@ static QString readSymLink(const QFileSystemEntry &link)
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
}
-#endif // !Q_OS_WINRT
+#endif // QT_CONFIG(fslibs)
}
#else
Q_UNUSED(link);
@@ -347,7 +348,7 @@ static QString readSymLink(const QFileSystemEntry &link)
static QString readLink(const QFileSystemEntry &link)
{
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
QString ret;
bool neededCoInit = false;
@@ -386,7 +387,7 @@ static QString readLink(const QFileSystemEntry &link)
#else
Q_UNUSED(link);
return QString();
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(fslibs)
}
static bool uncShareExists(const QString &server)
@@ -619,7 +620,7 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own)
{
QString name;
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
extern int qt_ntfs_permission_lookup;
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
resolveLibs();
@@ -669,7 +670,7 @@ QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEng
bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
{
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
resolveLibs();
if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) {
@@ -1133,7 +1134,7 @@ QString QFileSystemEngine::rootPath()
QString QFileSystemEngine::homePath()
{
QString ret;
-#if !defined(QT_NO_LIBRARY)
+#if QT_CONFIG(fslibs)
resolveLibs();
if (ptrGetUserProfileDirectoryW) {
HANDLE hnd = ::GetCurrentProcess();
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 2ebc98e0de..4a477b8429 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -108,6 +108,20 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
{
Q_Q(QFSFileEngine);
+ // Check if the file name is valid:
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions
+ const QString fileName = fileEntry.fileName();
+ for (QString::const_iterator it = fileName.constBegin(), end = fileName.constEnd();
+ it != end; ++it) {
+ const QChar c = *it;
+ if (c == QLatin1Char('<') || c == QLatin1Char('>') || c == QLatin1Char(':') ||
+ c == QLatin1Char('\"') || c == QLatin1Char('/') || c == QLatin1Char('\\') ||
+ c == QLatin1Char('|') || c == QLatin1Char('?') || c == QLatin1Char('*')) {
+ q->setError(QFile::OpenError, QStringLiteral("Invalid file name"));
+ return false;
+ }
+ }
+
// All files are opened in share mode (both read and write).
DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
@@ -589,7 +603,7 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
bool QFSFileEngine::link(const QString &newName)
{
#if !defined(Q_OS_WINRT)
-# if !defined(QT_NO_LIBRARY)
+# if QT_CONFIG(library)
bool ret = false;
QString linkName = newName;
@@ -630,10 +644,10 @@ bool QFSFileEngine::link(const QString &newName)
CoUninitialize();
return ret;
-# else // QT_NO_LIBRARY
+# else // QT_CONFIG(library)
Q_UNUSED(newName);
return false;
-# endif // QT_NO_LIBRARY
+# endif // QT_CONFIG(library)
#else // !Q_OS_WINRT
Q_UNUSED(newName);
Q_UNIMPLEMENTED();
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index c27484acbe..c0ec35ff32 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -99,8 +99,6 @@ QT_END_NAMESPACE
#include <private/qcore_unix_p.h>
#endif
-#if QT_CONFIG(processenvironment)
-
QT_BEGIN_NAMESPACE
/*!
@@ -430,8 +428,6 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e)
d->insert(*e.d);
}
-#endif // QT_CONFIG(processenvironment)
-
#if QT_CONFIG(process)
void QProcessPrivate::Channel::clear()
@@ -2605,9 +2601,8 @@ QString QProcess::nullDevice()
\sa QProcess::pid()
*/
+#endif // QT_CONFIG(process)
+
QT_END_NAMESPACE
#include "moc_qprocess.cpp"
-
-#endif // QT_NO_PROCESS
-
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index 37e71aef5d..19157bdd02 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -46,12 +46,12 @@
#include <functional>
+QT_REQUIRE_CONFIG(processenvironment);
+
QT_BEGIN_NAMESPACE
class QProcessPrivate;
-#if QT_CONFIG(processenvironment)
-
#if !defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
typedef qint64 Q_PID;
#else
@@ -105,8 +105,6 @@ private:
Q_DECLARE_SHARED(QProcessEnvironment)
-#endif // QT_CONFIG(processenvironment)
-
#if QT_CONFIG(process)
class Q_CORE_EXPORT QProcess : public QIODevice
@@ -302,7 +300,7 @@ private:
friend class QProcessManager;
};
-#endif // QT_NO_PROCESS
+#endif // QT_CONFIG(process)
QT_END_NAMESPACE
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 92b747f6ba..6e0630eb66 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -57,6 +57,9 @@
#include "QtCore/qhash.h"
#include "QtCore/qshareddata.h"
#include "private/qiodevice_p.h"
+
+QT_REQUIRE_CONFIG(processenvironment);
+
#ifdef Q_OS_UNIX
#include <QtCore/private/qorderedmutexlocker_p.h>
#endif
@@ -78,8 +81,6 @@ class QWindowsPipeWriter;
class QWinEventNotifier;
class QTimer;
-#if QT_CONFIG(processenvironment)
-
#ifdef Q_OS_WIN
class QProcEnvKey : public QString
{
@@ -233,8 +234,6 @@ template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>
d = x;
}
-#endif // QT_CONFIG(processenvironment)
-
#if QT_CONFIG(process)
class QProcessPrivate : public QIODevicePrivate
@@ -390,7 +389,7 @@ public:
void setErrorAndEmit(QProcess::ProcessError error, const QString &description = QString());
};
-#endif // QT_NO_PROCESS
+#endif // QT_CONFIG(process)
QT_END_NAMESPACE
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index deca5c50ff..795229419c 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -119,7 +119,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
-#if QT_CONFIG(processenvironment) && !defined(Q_OS_DARWIN)
+#if !defined(Q_OS_DARWIN)
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
@@ -138,7 +138,7 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment()
return env;
}
-#endif // QT_CONFIG(processenvironment) && !defined(Q_OS_DARWIN)
+#endif // !defined(Q_OS_DARWIN)
#if QT_CONFIG(process)
@@ -1040,6 +1040,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
return success;
}
-#endif // QT_NO_PROCESS
+#endif // QT_CONFIG(process)
QT_END_NAMESPACE
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index aa69e9e1db..329d1842f0 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -62,8 +62,6 @@
QT_BEGIN_NAMESPACE
-#if QT_CONFIG(processenvironment)
-
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
QProcessEnvironment env;
@@ -86,8 +84,6 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment()
return env;
}
-#endif // QT_CONFIG(processenvironment)
-
#if QT_CONFIG(process)
static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
@@ -895,6 +891,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
return success;
}
-#endif // QT_NO_PROCESS
+#endif // QT_CONFIG(process)
QT_END_NAMESPACE
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 5a0d04855f..c43e986f34 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -156,4 +156,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_PROCESS
+#endif // QWINDOWSPIPEWRITER_P_H
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 3faa8e1441..0c87dd5659 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3071,7 +3071,7 @@ void QAbstractItemModel::endRemoveColumns()
When reimplementing a subclass, this method simplifies moving
entities in your model. This method is responsible for moving
persistent indexes in the model, which you would otherwise be
- required to do yourself. Using beginMoveRows and endMoveRows
+ required to do yourself. Using beginMoveColumns and endMoveColumns
is an alternative to emitting layoutAboutToBeChanged and
layoutChanged directly along with changePersistentIndex.
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 63b45d7f89..c8771bfee5 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -302,7 +302,7 @@ static inline int qt_safe_close(int fd)
#define QT_CLOSE qt_safe_close
// - VxWorks & iOS/tvOS/watchOS don't have processes
-#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
+#if QT_CONFIG(process)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
@@ -331,7 +331,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
EINTR_LOOP(ret, ::waitpid(pid, status, options));
return ret;
}
-#endif // Q_OS_VXWORKS
+#endif // QT_CONFIG(process)
#if !defined(_POSIX_MONOTONIC_CLOCK)
# define _POSIX_MONOTONIC_CLOCK -1
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 0ac49c5019..e4b1562b8b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -376,7 +376,7 @@ struct QCoreApplicationData {
bool applicationNameSet; // true if setApplicationName was called
bool applicationVersionSet; // true if setApplicationVersion was called
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QScopedPointer<QStringList> app_libpaths;
QScopedPointer<QStringList> manual_libpaths;
#endif
@@ -569,7 +569,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QStringList *app_libpaths = coreappdata()->app_libpaths.data();
if (!app_libpaths)
coreappdata()->app_libpaths.reset(app_libpaths = new QStringList);
@@ -773,7 +773,7 @@ void QCoreApplicationPrivate::init()
QLoggingRegistry::instance()->init();
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Reset the lib paths, so that they will be recomputed, taking the availability of argv[0]
// into account. If necessary, recompute right away and replay the manual changes on top of the
// new lib paths.
@@ -872,7 +872,7 @@ QCoreApplication::~QCoreApplication()
QCoreApplicationPrivate::eventDispatcher = 0;
#endif
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
coreappdata()->app_libpaths.reset();
coreappdata()->manual_libpaths.reset();
#endif
@@ -2479,7 +2479,7 @@ QString QCoreApplication::applicationVersion()
return coreappdata() ? coreappdata()->applicationVersion : QString();
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive))
@@ -2691,7 +2691,7 @@ void QCoreApplication::removeLibraryPath(const QString &path)
QFactoryLoader::refreshAll();
}
-#endif //QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
#ifndef QT_NO_QOBJECT
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index a22e1c4f9e..5e10136dc5 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -141,12 +141,12 @@ public:
static QString applicationFilePath();
static qint64 applicationPid();
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
static void setLibraryPaths(const QStringList &);
static QStringList libraryPaths();
static void addLibraryPath(const QString &);
static void removeLibraryPath(const QString &);
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
#ifndef QT_NO_TRANSLATION
static bool installTranslator(QTranslator * messageFile);
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index fe7cf7bbb1..24ad9d140c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2653,7 +2653,8 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM
call qRegisterMetaType() to register the data type before you
establish the connection.
- \sa disconnect(), sender(), qRegisterMetaType(), Q_DECLARE_METATYPE()
+ \sa disconnect(), sender(), qRegisterMetaType(), Q_DECLARE_METATYPE(),
+ {Differences between String-Based and Functor-Based Connections}
*/
QMetaObject::Connection QObject::connect(const QObject *sender, const char *signal,
const QObject *receiver, const char *method,
@@ -4655,6 +4656,8 @@ void qDeleteInEventHandler(QObject *o)
make sure to declare the argument type with Q_DECLARE_METATYPE
Overloaded functions can be resolved with help of \l qOverload.
+
+ \sa {Differences between String-Based and Functor-Based Connections}
*/
/*!
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index bd08ca1763..3f5f2e78bb 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -90,14 +90,9 @@ namespace QtPrivate {
explicit ApplyReturnValue(void *data_) : data(data_) {}
};
template<typename T, typename U>
- void operator,(const T &value, const ApplyReturnValue<U> &container) {
- if (container.data)
- *reinterpret_cast<U*>(container.data) = value;
- }
- template<typename T, typename U>
void operator,(T &&value, const ApplyReturnValue<U> &container) {
if (container.data)
- *reinterpret_cast<U*>(container.data) = value;
+ *reinterpret_cast<U *>(container.data) = std::forward<T>(value);
}
template<typename T>
void operator,(T, const ApplyReturnValue<void> &) {}
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index d3b1fd6a18..6e61ca10cb 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -168,7 +168,7 @@ public:
Q_ALWAYS_INLINE
void setInterval(std::chrono::milliseconds value)
{
- setInterval(value.count());
+ setInterval(int(value.count()));
}
Q_ALWAYS_INLINE
diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri
index 473480eb55..a0e0d76044 100644
--- a/src/corelib/plugin/plugin.pri
+++ b/src/corelib/plugin/plugin.pri
@@ -1,38 +1,37 @@
# Qt core library plugin module
HEADERS += \
- plugin/qfactoryinterface.h \
- plugin/qpluginloader.h \
- plugin/qlibrary.h \
- plugin/qlibrary_p.h \
- plugin/qplugin.h \
- plugin/quuid.h \
- plugin/qfactoryloader_p.h \
- plugin/qsystemlibrary_p.h \
- plugin/qelfparser_p.h \
- plugin/qmachparser_p.h
+ plugin/qfactoryinterface.h \
+ plugin/qpluginloader.h \
+ plugin/qplugin.h \
+ plugin/quuid.h \
+ plugin/qfactoryloader_p.h
SOURCES += \
- plugin/qfactoryinterface.cpp \
- plugin/qpluginloader.cpp \
- plugin/qfactoryloader.cpp \
- plugin/quuid.cpp \
- plugin/qlibrary.cpp \
- plugin/qelfparser_p.cpp \
- plugin/qmachparser.cpp
+ plugin/qfactoryinterface.cpp \
+ plugin/qpluginloader.cpp \
+ plugin/qfactoryloader.cpp \
+ plugin/quuid.cpp
win32 {
- SOURCES += \
- plugin/qlibrary_win.cpp \
- plugin/qsystemlibrary.cpp
+ HEADERS += plugin/qsystemlibrary_p.h
+ SOURCES += plugin/qsystemlibrary.cpp
}
-unix {
- SOURCES += plugin/qlibrary_unix.cpp
-}
+qtConfig(library) {
+ HEADERS += \
+ plugin/qlibrary.h \
+ plugin/qlibrary_p.h \
+ plugin/qelfparser_p.h \
+ plugin/qmachparser_p.h
-integrity {
- SOURCES += plugin/qlibrary_unix.cpp
-}
+ SOURCES += \
+ plugin/qlibrary.cpp \
+ plugin/qelfparser_p.cpp \
+ plugin/qmachparser.cpp
+
+ unix: SOURCES += plugin/qlibrary_unix.cpp
+ else: SOURCES += plugin/qlibrary_win.cpp
-!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
+ qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
+}
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index 0a219d1251..7a42b0d023 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -39,7 +39,6 @@
#include "qelfparser_p.h"
-#ifndef QT_NO_LIBRARY
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
#include "qlibrary_p.h"
@@ -237,4 +236,3 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index bcda19e8b5..3e73c5d149 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -54,7 +54,8 @@
#include <qendian.h>
#include <private/qglobal_p.h>
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
QT_BEGIN_NAMESPACE
@@ -101,6 +102,5 @@ public:
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
#endif // QELFPARSER_P_H
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 51be6b3655..b731e13acc 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -62,7 +62,7 @@ class QFactoryLoaderPrivate : public QObjectPrivate
public:
QFactoryLoaderPrivate(){}
QByteArray iid;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
~QFactoryLoaderPrivate();
mutable QMutex mutex;
QList<QLibraryPrivate*> libraryList;
@@ -73,7 +73,7 @@ public:
#endif
};
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders)
@@ -232,7 +232,7 @@ void QFactoryLoader::refreshAll()
}
}
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QFactoryLoader::QFactoryLoader(const char *iid,
const QString &suffix,
@@ -242,7 +242,7 @@ QFactoryLoader::QFactoryLoader(const char *iid,
moveToThread(QCoreApplicationPrivate::mainThread());
Q_D(QFactoryLoader);
d->iid = iid;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
d->cs = cs;
d->suffix = suffix;
@@ -259,7 +259,7 @@ QList<QJsonObject> QFactoryLoader::metaData() const
{
Q_D(const QFactoryLoader);
QList<QJsonObject> metaData;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QMutexLocker locker(&d->mutex);
for (int i = 0; i < d->libraryList.size(); ++i)
metaData.append(d->libraryList.at(i)->metaData);
@@ -281,7 +281,7 @@ QObject *QFactoryLoader::instance(int index) const
if (index < 0)
return 0;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QMutexLocker lock(&d->mutex);
if (index < d->libraryList.size()) {
QLibraryPrivate *library = d->libraryList.at(index);
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 70a934c976..7be18942ae 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -60,7 +60,9 @@
#include "QtCore/qjsondocument.h"
#include "QtCore/qmap.h"
#include "QtCore/qendian.h"
+#if QT_CONFIG(library)
#include "private/qlibrary_p.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -84,7 +86,7 @@ public:
const QString &suffix = QString(),
Qt::CaseSensitivity = Qt::CaseSensitive);
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
~QFactoryLoader();
void update();
@@ -93,7 +95,7 @@ public:
#if defined(Q_OS_UNIX) && !defined (Q_OS_MAC)
QLibraryPrivate *library(const QString &key) const;
#endif // Q_OS_UNIX && !Q_OS_MAC
-#endif // !QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QMultiMap<int, QString> keyMap() const;
int indexOf(const QString &needle) const;
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index a4a654cd88..6421e7c5d8 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -40,8 +40,6 @@
#include "qplatformdefs.h"
#include "qlibrary.h"
-#ifndef QT_NO_LIBRARY
-
#include "qfactoryloader_p.h"
#include "qlibrary_p.h"
#include <qstringlist.h>
@@ -1131,5 +1129,3 @@ bool qt_debug_component()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index 2b91fa4007..89be52aac3 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -42,9 +42,9 @@
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(library);
-#ifndef QT_NO_LIBRARY
+QT_BEGIN_NAMESPACE
class QLibraryPrivate;
@@ -99,8 +99,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints)
-#endif //QT_NO_LIBRARY
-
QT_END_NAMESPACE
#endif //QLIBRARY_H
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index 7147ff6ca2..3f650501c8 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -62,10 +62,9 @@
# include "QtCore/qt_windows.h"
#endif
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+QT_BEGIN_NAMESPACE
bool qt_debug_component();
@@ -130,8 +129,6 @@ private:
friend class QLibraryStore;
};
-#endif // QT_NO_LIBRARY
-
QT_END_NAMESPACE
#endif // QLIBRARY_P_H
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 3553763bcd..3c4fbaf348 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -44,8 +44,6 @@
#include <qcoreapplication.h>
#include <private/qfilesystementry_p.h>
-#ifndef QT_NO_LIBRARY
-
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
#endif
@@ -308,5 +306,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 48aa0cdbb6..a4d3f67c27 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -44,8 +44,6 @@
#include "qfileinfo.h"
#include <private/qfilesystementry_p.h>
-#ifndef QT_NO_LIBRARY
-
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -174,5 +172,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
return QFunctionPointer(address);
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/corelib/plugin/qmachparser.cpp b/src/corelib/plugin/qmachparser.cpp
index a599fbcb23..f506a6a6b1 100644
--- a/src/corelib/plugin/qmachparser.cpp
+++ b/src/corelib/plugin/qmachparser.cpp
@@ -39,7 +39,7 @@
#include "qmachparser_p.h"
-#if defined(Q_OF_MACH_O) && !defined(QT_NO_LIBRARY)
+#if defined(Q_OF_MACH_O)
#include <qendian.h>
#include "qlibrary_p.h"
diff --git a/src/corelib/plugin/qmachparser_p.h b/src/corelib/plugin/qmachparser_p.h
index ff7eaadb70..3884c92797 100644
--- a/src/corelib/plugin/qmachparser_p.h
+++ b/src/corelib/plugin/qmachparser_p.h
@@ -54,7 +54,8 @@
#include <qendian.h>
#include <private/qglobal_p.h>
-#ifndef QT_NO_LIBRARY
+QT_REQUIRE_CONFIG(library);
+
#if defined(Q_OF_MACH_O)
QT_BEGIN_NAMESPACE
@@ -72,6 +73,5 @@ public:
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
-#endif // QT_NO_LIBRARY
#endif // QMACHPARSER_P_H
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 6723877ad5..dbd3bee556 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
/*!
\class QPluginLoader
@@ -417,7 +417,7 @@ QLibrary::LoadHints QPluginLoader::loadHints() const
return d ? d->loadHints() : QLibrary::LoadHints();
}
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
typedef QVector<QStaticPlugin> StaticPluginList;
Q_GLOBAL_STATIC(StaticPluginList, staticPluginList)
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index 5dca59c271..80b10f76bf 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -40,12 +40,15 @@
#ifndef QPLUGINLOADER_H
#define QPLUGINLOADER_H
+#include <QtCore/qglobal.h>
+#if QT_CONFIG(library)
#include <QtCore/qlibrary.h>
+#endif
#include <QtCore/qplugin.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
class QLibraryPrivate;
class QJsonObject;
@@ -93,7 +96,7 @@ public:
static QVector<QStaticPlugin> staticPlugins();
};
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 559d26e231..7b12f51e3e 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -159,7 +159,7 @@ public:
~QFutureInterface()
{
if (!derefT())
- resultStore().clear();
+ resultStoreBase().template clear<T>();
}
static QFutureInterface canceledResult()
@@ -169,7 +169,7 @@ public:
{
other.refT();
if (!derefT())
- resultStore().clear();
+ resultStoreBase().template clear<T>();
QFutureInterfaceBase::operator=(other);
return *this;
}
@@ -184,11 +184,6 @@ public:
inline const T &resultReference(int index) const;
inline const T *resultPointer(int index) const;
inline QList<T> results();
-private:
- QtPrivate::ResultStore<T> &resultStore()
- { return static_cast<QtPrivate::ResultStore<T> &>(resultStoreBase()); }
- const QtPrivate::ResultStore<T> &resultStore() const
- { return static_cast<const QtPrivate::ResultStore<T> &>(resultStoreBase()); }
};
template <typename T>
@@ -199,15 +194,14 @@ inline void QFutureInterface<T>::reportResult(const T *result, int index)
return;
}
- QtPrivate::ResultStore<T> &store = resultStore();
-
+ QtPrivate::ResultStoreBase &store = resultStoreBase();
if (store.filterMode()) {
const int resultCountBefore = store.count();
- store.addResult(index, result);
+ store.addResult<T>(index, result);
this->reportResultsReady(resultCountBefore, resultCountBefore + store.count());
} else {
- const int insertIndex = store.addResult(index, result);
+ const int insertIndex = store.addResult<T>(index, result);
this->reportResultsReady(insertIndex, insertIndex + 1);
}
}
@@ -226,7 +220,7 @@ inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int b
return;
}
- QtPrivate::ResultStore<T> &store = resultStore();
+ auto &store = resultStoreBase();
if (store.filterMode()) {
const int resultCountBefore = store.count();
@@ -250,14 +244,14 @@ template <typename T>
inline const T &QFutureInterface<T>::resultReference(int index) const
{
QMutexLocker lock(mutex());
- return resultStore().resultAt(index).value();
+ return resultStoreBase().resultAt(index).template value<T>();
}
template <typename T>
inline const T *QFutureInterface<T>::resultPointer(int index) const
{
QMutexLocker lock(mutex());
- return resultStore().resultAt(index).pointer();
+ return resultStoreBase().resultAt(index).template pointer<T>();
}
template <typename T>
@@ -272,9 +266,9 @@ inline QList<T> QFutureInterface<T>::results()
QList<T> res;
QMutexLocker lock(mutex());
- QtPrivate::ResultIterator<T> it = resultStore().begin();
- while (it != resultStore().end()) {
- res.append(it.value());
+ QtPrivate::ResultIteratorBase it = resultStoreBase().begin();
+ while (it != resultStoreBase().end()) {
+ res.append(it.value<T>());
++it;
}
diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp
index aa7ec02d6e..9a6fcec678 100644
--- a/src/corelib/thread/qresultstore.cpp
+++ b/src/corelib/thread/qresultstore.cpp
@@ -98,6 +98,12 @@ bool ResultIteratorBase::canIncrementVectorIndex() const
ResultStoreBase::ResultStoreBase()
: insertIndex(0), resultCount(0), m_filterMode(false), filteredResults(0) { }
+ResultStoreBase::~ResultStoreBase()
+{
+ // QFutureInterface's dtor must delete the contents of m_results.
+ Q_ASSERT(m_results.isEmpty());
+}
+
void ResultStoreBase::setFilterMode(bool enable)
{
m_filterMode = enable;
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h
index fa6907dde2..6c814ef854 100644
--- a/src/corelib/thread/qresultstore.h
+++ b/src/corelib/thread/qresultstore.h
@@ -93,20 +93,14 @@ public:
protected:
QMap<int, ResultItem>::const_iterator mapIterator;
int m_vectorIndex;
-};
-
-template <typename T>
-class ResultIterator : public ResultIteratorBase
-{
public:
- ResultIterator(const ResultIteratorBase &base)
- : ResultIteratorBase(base) { }
-
+ template <typename T>
const T &value() const
{
- return *pointer();
+ return *pointer<T>();
}
+ template <typename T>
const T *pointer() const
{
if (mapIterator.value().isVector())
@@ -130,7 +124,7 @@ public:
ResultIteratorBase resultAt(int index) const;
bool contains(int index) const;
int count() const;
- virtual ~ResultStoreBase() { }
+ virtual ~ResultStoreBase();
protected:
int insertResultItem(int index, ResultItem &resultItem);
@@ -147,64 +141,44 @@ protected:
QMap<int, ResultItem> pendingResults;
int filteredResults;
-};
-
-template <typename T>
-class ResultStore : public ResultStoreBase
-{
public:
- ResultStore() { }
-
- ResultStore(const ResultStoreBase &base)
- : ResultStoreBase(base) { }
-
- int addResult(int index, const T *result)
+ template <typename T>
+ int addResult(int index, const T *result)
{
if (result == 0)
- return ResultStoreBase::addResult(index, result);
+ return addResult(index, static_cast<void *>(nullptr));
else
- return ResultStoreBase::addResult(index, new T(*result));
+ return addResult(index, static_cast<void *>(new T(*result)));
}
+ template <typename T>
int addResults(int index, const QVector<T> *results)
{
- return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), results->count());
+ return addResults(index, new QVector<T>(*results), results->count(), results->count());
}
+ template <typename T>
int addResults(int index, const QVector<T> *results, int totalCount)
{
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
- return ResultStoreBase::addResults(index, 0, 0, totalCount);
+ return addResults(index, 0, 0, totalCount);
else
- return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount);
+ return addResults(index, new QVector<T>(*results), results->count(), totalCount);
}
int addCanceledResult(int index)
{
- return addResult(index, 0);
+ return addResult(index, static_cast<void *>(nullptr));
}
+ template <typename T>
int addCanceledResults(int index, int _count)
{
QVector<T> empty;
return addResults(index, &empty, _count);
}
- ResultIterator<T> begin() const
- {
- return static_cast<ResultIterator<T> >(ResultStoreBase::begin());
- }
-
- ResultIterator<T> end() const
- {
- return static_cast<ResultIterator<T> >(ResultStoreBase::end());
- }
-
- ResultIterator<T> resultAt(int index) const
- {
- return static_cast<ResultIterator<T> >(ResultStoreBase::resultAt(index));
- }
-
+ template <typename T>
void clear()
{
QMap<int, ResultItem>::const_iterator mapIterator = m_results.constBegin();
@@ -218,12 +192,6 @@ public:
resultCount = 0;
m_results.clear();
}
-
- ~ResultStore()
- {
- clear();
- }
-
};
} // namespace QtPrivate
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 01ed3cea5b..a4a7aabacb 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1971,7 +1971,7 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
case Qt::ISODateWithMs:
case Qt::TextDate:
default:
- return fromIsoTimeString(&string, format, 0);
+ return fromIsoTimeString(QStringRef(&string), format, 0);
}
}
@@ -2853,6 +2853,9 @@ inline bool QDateTime::Data::isShort() const
{
bool b = quintptr(d) & QDateTimePrivate::ShortData;
+ // sanity check:
+ Q_ASSERT(b || (d->m_status & QDateTimePrivate::ShortData) == 0);
+
// even if CanBeSmall = false, we have short data for a default-constructed
// QDateTime object. But it's unlikely.
if (CanBeSmall)
@@ -3678,7 +3681,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
d.data.status = status;
} else {
d.detach();
- d->m_status = status;
+ d->m_status = status & ~QDateTimePrivate::ShortData;
d->m_msecs = msecs;
}
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index d66416207b..c8aa4fbc89 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -49,7 +49,7 @@
//#define QDATETIMEPARSER_DEBUG
#if defined (QDATETIMEPARSER_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
-# define QDTPDEBUG qDebug() << QString("%1:%2").arg(__FILE__).arg(__LINE__)
+# define QDTPDEBUG qDebug()
# define QDTPDEBUGN qDebug
#else
# define QDTPDEBUG if (false) qDebug()
@@ -1325,39 +1325,16 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex
}
const QLocale l = locale();
for (int day=startDay; day<=7; ++day) {
- const QString str2 = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat);
-
- if (str1.startsWith(str2.toLower())) {
- if (used)
- *used = str2.size();
- if (usedDay) {
- *usedDay = str2;
- }
- return day;
- }
- if (context == FromString)
- continue;
+ const QString dayName = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat);
+ const QString str2 = dayName.toLower();
const int limit = qMin(str1.size(), str2.size());
- bool found = true;
- for (int i=0; i<limit; ++i) {
- if (str1.at(i) != str2.at(i) && !str1.at(i).isSpace()) {
- if (i > bestCount) {
- bestCount = i;
- bestMatch = day;
- }
- found = false;
- break;
- }
-
- }
- if (found) {
- if (used)
- *used = limit;
- if (usedDay)
- *usedDay = str2;
-
- return day;
+ int i = 0;
+ while (i < limit && str1.at(i) == str2.at(i))
+ ++i;
+ if (i > bestCount) {
+ bestCount = i;
+ bestMatch = day;
}
}
if (usedDay && bestMatch != -1) {
diff --git a/src/corelib/tools/qharfbuzz.cpp b/src/corelib/tools/qharfbuzz.cpp
index fdd861690d..a3e266ccd2 100644
--- a/src/corelib/tools/qharfbuzz.cpp
+++ b/src/corelib/tools/qharfbuzz.cpp
@@ -40,7 +40,9 @@
#include "qharfbuzz_p.h"
#include "qunicodetables_p.h"
+#if QT_CONFIG(library)
#include "qlibrary.h"
+#endif
QT_USE_NAMESPACE
@@ -70,7 +72,7 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch)
void (*HB_Library_Resolve(const char *library, int version, const char *symbol))()
{
-#ifdef QT_NO_LIBRARY
+#if !QT_CONFIG(library)
Q_UNUSED(library);
Q_UNUSED(version);
Q_UNUSED(symbol);
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index f861c1e71c..e2706de9ee 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -895,7 +895,7 @@ Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t)
*n++ = *i;
}
- int removedCount = e - n;
+ int removedCount = int(e - n);
d->end -= removedCount;
return removedCount;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ae4befcb9c..59952bd107 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -972,7 +972,7 @@ QLocale::NumberOptions QLocale::numberOptions() const
*/
QString QLocale::quoteString(const QString &str, QuotationStyle style) const
{
- return quoteString(&str, style);
+ return quoteString(QStringRef(&str), style);
}
/*!
@@ -2117,8 +2117,8 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language,
&& (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) {
if ((script == QLocale::AnyScript || data->m_script_id == uint(script))
&& (country == QLocale::AnyCountry || data->m_country_id == uint(country))) {
- QLocale locale(*QLocalePrivate::create(data));
- result.append(locale);
+ result.append(QLocale(*(data->m_language_id == C ? c_private()
+ : QLocalePrivate::create(data))));
}
++data;
}
diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
index 0066e95d88..afe0aae583 100644
--- a/src/corelib/tools/qlocale_icu.cpp
+++ b/src/corelib/tools/qlocale_icu.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qglobal.h"
-#include "qlibrary.h"
#include "qdebug.h"
#include "qlocale_p.h"
#include "qmutex.h"
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index f973cf3494..4030cccbd5 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -662,12 +662,18 @@ Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) Q_DECL_NOTHROW
{
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
+
Q_DECL_CONSTEXPR inline bool QRectF::isNull() const Q_DECL_NOTHROW
{ return w == 0. && h == 0.; }
Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const Q_DECL_NOTHROW
{ return w <= 0. || h <= 0.; }
+QT_WARNING_POP
+
Q_DECL_CONSTEXPR inline bool QRectF::isValid() const Q_DECL_NOTHROW
{ return w > 0. && h > 0.; }
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 6bd2aad8da..68f5605598 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -775,7 +775,9 @@ inline char qToLower(char ch)
}
+#if QT_DEPRECATED_SINCE(5, 9)
const QString::Null QString::null = { };
+#endif
/*!
\macro QT_RESTRICTED_CAST_FROM_ASCII
@@ -9794,9 +9796,7 @@ QStringRef QStringRef::left(int n) const
*/
QStringRef QString::leftRef(int n) const
{
- if (uint(n) >= uint(d->size))
- n = d->size;
- return QStringRef(this, 0, n);
+ return QStringRef(this).left(n);
}
/*!
@@ -9833,9 +9833,7 @@ QStringRef QStringRef::right(int n) const
*/
QStringRef QString::rightRef(int n) const
{
- if (uint(n) >= uint(d->size))
- n = d->size;
- return QStringRef(this, d->size - n, n);
+ return QStringRef(this).right(n);
}
/*!
@@ -9894,19 +9892,7 @@ QStringRef QStringRef::mid(int pos, int n) const
*/
QStringRef QString::midRef(int position, int n) const
{
- using namespace QtPrivate;
- switch (QContainerImplHelper::mid(d->size, &position, &n)) {
- case QContainerImplHelper::Null:
- return QStringRef();
- case QContainerImplHelper::Empty:
- return QStringRef(this, 0, 0);
- case QContainerImplHelper::Full:
- return QStringRef(this, 0, d->size);
- case QContainerImplHelper::Subset:
- return QStringRef(this, position, n);
- }
- Q_UNREACHABLE();
- return QStringRef();
+ return QStringRef(this).mid(position, n);
}
/*!
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index d4a4f23c93..258034031c 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -795,10 +795,13 @@ public:
NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED;
#endif
// compatibility
+#if QT_DEPRECATED_SINCE(5, 9)
struct Null { };
+ QT_DEPRECATED_X("use QString()")
static const Null null;
inline QString(const Null &): d(Data::sharedNull()) {}
inline QString &operator=(const Null &) { *this = QString(); return *this; }
+#endif
inline bool isNull() const { return d == Data::sharedNull(); }
@@ -1159,13 +1162,18 @@ inline bool QString::contains(QLatin1String s, Qt::CaseSensitivity cs) const
inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const
{ return indexOf(c, 0, cs) != -1; }
-
+#if QT_DEPRECATED_SINCE(5, 9)
inline bool operator==(QString::Null, QString::Null) { return true; }
+QT_DEPRECATED_X("use QString::isNull()")
inline bool operator==(QString::Null, const QString &s) { return s.isNull(); }
+QT_DEPRECATED_X("use QString::isNull()")
inline bool operator==(const QString &s, QString::Null) { return s.isNull(); }
inline bool operator!=(QString::Null, QString::Null) { return false; }
+QT_DEPRECATED_X("use !QString::isNull()")
inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
+QT_DEPRECATED_X("use !QString::isNull()")
inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
+#endif
inline bool operator==(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index c69d27bbf9..ab5a2944bf 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -692,7 +692,7 @@ typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, c
{
Q_ASSERT_X(isValidIterator(before), "QVector::insert", "The specified iterator argument 'before' is invalid");
- int offset = std::distance(d->begin(), before);
+ const auto offset = std::distance(d->begin(), before);
if (n != 0) {
const T copy(t);
if (!isDetached() || d->size + n > int(d->alloc))
@@ -728,7 +728,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
Q_ASSERT_X(isValidIterator(abegin), "QVector::erase", "The specified iterator argument 'abegin' is invalid");
Q_ASSERT_X(isValidIterator(aend), "QVector::erase", "The specified iterator argument 'aend' is invalid");
- const int itemsToErase = aend - abegin;
+ const auto itemsToErase = aend - abegin;
if (!itemsToErase)
return abegin;
@@ -737,7 +737,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
Q_ASSERT(aend <= d->end());
Q_ASSERT(abegin <= aend);
- const int itemsUntouched = abegin - d->begin();
+ const auto itemsUntouched = abegin - d->begin();
// FIXME we could do a proper realloc, which copy constructs only needed data.
// FIXME we are about to delete data - maybe it is good time to shrink?
@@ -766,7 +766,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
memmove(static_cast<void *>(abegin), static_cast<void *>(aend),
(d->size - itemsToErase - itemsUntouched) * sizeof(T));
}
- d->size -= itemsToErase;
+ d->size -= int(itemsToErase);
}
return d->begin() + itemsUntouched;
}
diff --git a/src/corelib/xml/qxmlutils_p.h b/src/corelib/xml/qxmlutils_p.h
index d8d25e0efe..6db347b3ee 100644
--- a/src/corelib/xml/qxmlutils_p.h
+++ b/src/corelib/xml/qxmlutils_p.h
@@ -73,7 +73,7 @@ public:
static bool isNameChar(const QChar c);
static bool isLetter(const QChar c);
static bool isNCName(const QStringRef &ncName);
- static inline bool isNCName(const QString &ncName) { return isNCName(&ncName); }
+ static inline bool isNCName(const QString &ncName) { return isNCName(QStringRef(&ncName)); }
static bool isPublicID(const QString &candidate);
private:
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp
index f91a8d2176..1e93a46c0c 100644
--- a/src/dbus/qdbus_symbols.cpp
+++ b/src/dbus/qdbus_symbols.cpp
@@ -39,7 +39,7 @@
****************************************************************************/
#include <QtCore/qglobal.h>
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(library)
#include <QtCore/qlibrary.h>
#endif
#include <QtCore/qmutex.h>
@@ -54,7 +54,7 @@ void (*qdbus_resolve_me(const char *name))();
#if !defined QT_LINKED_LIBDBUS
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
static QLibrary *qdbus_libdbus = 0;
void qdbus_unloadLibDBus()
@@ -71,7 +71,7 @@ void qdbus_unloadLibDBus()
bool qdbus_loadLibDBus()
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
#ifdef QT_BUILD_INTERNAL
// this is to simulate a library load failure for our autotest suite.
if (!qEnvironmentVariableIsEmpty("QT_SIMULATE_DBUS_LIBFAIL"))
@@ -126,7 +126,7 @@ bool qdbus_loadLibDBus()
#endif
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
void (*qdbus_resolve_conditionally(const char *name))()
{
if (qdbus_loadLibDBus())
@@ -137,7 +137,7 @@ void (*qdbus_resolve_conditionally(const char *name))()
void (*qdbus_resolve_me(const char *name))()
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (Q_UNLIKELY(!qdbus_loadLibDBus()))
qFatal("Cannot find libdbus-1 in your system to resolve symbol '%s'.", name);
@@ -161,7 +161,7 @@ static void qdbus_unloadLibDBus()
#endif // !QT_LINKED_LIBDBUS
-#if defined(QT_LINKED_LIBDBUS) || !defined(QT_NO_LIBRARY)
+#if defined(QT_LINKED_LIBDBUS) || QT_CONFIG(library)
Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus)
#endif
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index c63fb05e74..20186ef9f0 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1772,7 +1772,7 @@ static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnecti
# if DBUS_VERSION-0 >= 0x010400
can_send_type = dbus_connection_can_send_type;
# endif
-#elif !defined(QT_NO_LIBRARY)
+#elif QT_CONFIG(library)
// run-time check if the next functions are available
can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
#endif
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 6e1af4521d..5163045343 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -46,8 +46,7 @@
"xkb-config-root": "string",
"xkbcommon": { "type": "enum", "values": [ "no", "qt", "system" ] },
"xkbcommon-evdev": "boolean",
- "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] },
- "xrender": "boolean"
+ "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] }
}
},
@@ -304,13 +303,6 @@
"sources": [
{ "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" }
]
- },
- "xrender": {
- "label": "XRender",
- "test": "x11/xrender",
- "sources": [
- "-lXrender"
- ]
}
},
@@ -812,11 +804,6 @@
"condition": "tests.xlib",
"output": [ "privateFeature" ]
},
- "xrender": {
- "label": "Xrender",
- "condition": "libs.xrender",
- "output": [ "privateFeature", "feature" ]
- },
"texthtmlparser": {
"label": "HtmlParser",
"purpose": "Provides a parser for HTML.",
@@ -1153,7 +1140,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "X11",
"condition": "features.xcb",
"entries": [
- "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xrender", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system"
+ "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system"
]
},
{
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 73448943e1..625e145647 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -341,7 +341,6 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
} else {
//Insertion failed we released the new allocated key
cacheKeys.remove(key);
- releaseKey(cacheKey);
}
return success;
}
@@ -355,9 +354,6 @@ QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
theid = startTimer(flush_time);
t = false;
}
- } else {
- //Insertion failed we released the key and return an invalid one
- releaseKey(cacheKey);
}
return cacheKey;
}
@@ -377,9 +373,6 @@ bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int
t = false;
}
const_cast<QPixmapCache::Key&>(key) = cacheKey;
- } else {
- //Insertion failed we released the key
- releaseKey(cacheKey);
}
return success;
}
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 1f1f6b388f..ce7f7b8a0f 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -852,6 +852,9 @@ static bool read_xpm_header(
#endif
return false; // < 4 numbers parsed
+ if (*w <= 0 || *w > 32767 || *h <= 0 || *h > 32767 || *ncols <= 0 || *ncols > (64 * 64 * 64 * 64) || *cpp <= 0 || *cpp > 15)
+ return false; // failed sanity check
+
return true;
}
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c057fccade..b665750181 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -99,7 +99,7 @@
#include <QtGui/QClipboard>
#endif
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
#include <QtCore/QLibrary>
#endif
@@ -670,7 +670,7 @@ void QGuiApplication::setApplicationDisplayName(const QString &name)
disconnect(qGuiApp, &QGuiApplication::applicationNameChanged,
qGuiApp, &QGuiApplication::applicationDisplayNameChanged);
- if (QGuiApplicationPrivate::displayName != applicationName())
+ if (*QGuiApplicationPrivate::displayName != applicationName())
emit qGuiApp->applicationDisplayNameChanged();
}
} else if (name != *QGuiApplicationPrivate::displayName) {
@@ -1449,7 +1449,7 @@ void QGuiApplicationPrivate::init()
session_manager = new QSessionManager(q, session_id, session_key);
#endif
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (qEnvironmentVariableIntValue("QT_LOAD_TESTABILITY") > 0)
loadTestability = true;
@@ -1469,7 +1469,7 @@ void QGuiApplicationPrivate::init()
}
#else
Q_UNUSED(loadTestability);
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp
index 1e04a673eb..3fcf9014a7 100644
--- a/src/gui/kernel/qplatformintegrationfactory.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory.cpp
@@ -51,14 +51,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // !QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, int &argc, char **argv, const QString &platformPluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
@@ -81,7 +81,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor
QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
{
QStringList list;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
list = directLoader()->keyMap().values();
diff --git a/src/gui/kernel/qplatformthemefactory.cpp b/src/gui/kernel/qplatformthemefactory.cpp
index 223d7344e3..447d385abe 100644
--- a/src/gui/kernel/qplatformthemefactory.cpp
+++ b/src/gui/kernel/qplatformthemefactory.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QPlatformThemeFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
@@ -60,7 +60,7 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
{
QStringList paramList = key.split(QLatin1Char(':'));
const QString platform = paramList.takeFirst().toLower();
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
@@ -83,7 +83,7 @@ QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
{
QStringList list;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
list += directLoader()->keyMap().values();
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index e143884f9d..aca685920e 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -212,6 +212,9 @@ private:
friend class QGraphicsRotation;
};
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECLARE_TYPEINFO(QMatrix4x4, Q_MOVABLE_TYPE);
inline QMatrix4x4::QMatrix4x4
@@ -1093,6 +1096,8 @@ inline void QMatrix4x4::viewport(const QRectF &rect)
viewport(rect.x(), rect.y(), rect.width(), rect.height());
}
+QT_WARNING_POP
+
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m);
#endif
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 808e0ee6d7..eff427117f 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -168,7 +168,9 @@ inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
inline QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
-
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
inline bool QQuaternion::isNull() const
{
return wp == 0.0f && xp == 0.0f && yp == 0.0f && zp == 0.0f;
@@ -179,6 +181,12 @@ inline bool QQuaternion::isIdentity() const
return wp == 1.0f && xp == 0.0f && yp == 0.0f && zp == 0.0f;
}
+inline bool operator==(const QQuaternion &q1, const QQuaternion &q2)
+{
+ return q1.wp == q2.wp && q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp;
+}
+QT_WARNING_POP
+
inline float QQuaternion::x() const { return xp; }
inline float QQuaternion::y() const { return yp; }
inline float QQuaternion::z() const { return zp; }
@@ -277,11 +285,6 @@ inline QQuaternion &QQuaternion::operator/=(float divisor)
return *this;
}
-inline bool operator==(const QQuaternion &q1, const QQuaternion &q2)
-{
- return q1.wp == q2.wp && q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp;
-}
-
inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2)
{
return !operator==(q1, q2);
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index d2724c9498..bdb56c9c1f 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -204,6 +204,9 @@ inline QVector2D &QVector2D::operator/=(const QVector2D &vector)
return *this;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECL_CONSTEXPR inline bool operator==(const QVector2D &v1, const QVector2D &v2)
{
return v1.xp == v2.xp && v1.yp == v2.yp;
@@ -213,6 +216,7 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QVector2D &v1, const QVector2D &v2
{
return v1.xp != v2.xp || v1.yp != v2.yp;
}
+QT_WARNING_POP
Q_DECL_CONSTEXPR inline const QVector2D operator+(const QVector2D &v1, const QVector2D &v2)
{
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index c1d881a735..a728fd76bf 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -229,6 +229,9 @@ inline QVector3D &QVector3D::operator/=(const QVector3D &vector)
return *this;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECL_CONSTEXPR inline bool operator==(const QVector3D &v1, const QVector3D &v2)
{
return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp;
@@ -238,6 +241,7 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QVector3D &v1, const QVector3D &v2
{
return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp;
}
+QT_WARNING_POP
Q_DECL_CONSTEXPR inline const QVector3D operator+(const QVector3D &v1, const QVector3D &v2)
{
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 9387e8d187..f63b2f141b 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -229,6 +229,9 @@ inline QVector4D &QVector4D::operator/=(const QVector4D &vector)
return *this;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECL_CONSTEXPR inline bool operator==(const QVector4D &v1, const QVector4D &v2)
{
return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.wp == v2.wp;
@@ -238,6 +241,7 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QVector4D &v1, const QVector4D &v2
{
return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.wp != v2.wp;
}
+QT_WARNING_POP
Q_DECL_CONSTEXPR inline const QVector4D operator+(const QVector4D &v1, const QVector4D &v2)
{
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index cedbe19191..98ff49ea31 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -47,7 +47,6 @@
#include <private/qfont_p.h>
#include <qwindow.h>
-#include <qlibrary.h>
#include <qimage.h>
#include <QtCore/qbytearray.h>
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 083e68fcdb..b186182c34 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5968,7 +5968,7 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
\snippet code/src_gui_painting_qpainter.cpp 17
\endtable
- The \a boundingRect (if not null) is set to the what the bounding rectangle
+ The \a boundingRect (if not null) is set to what the bounding rectangle
should be in order to enclose the whole text. For example, in the following
image, the dotted line represents \a boundingRect as calculated by the
function, and the dashed line represents \a rectangle:
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index a3ae0c9b14..2c8f8fa8c4 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -64,26 +64,14 @@ class QRgba64 {
#endif
};
- // No constructors are allowed in C++98, since this needs to be usable in a union.
- // We however require one for constexprs in C++11/C++14
-#ifdef Q_COMPILER_CONSTEXPR
explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { }
-#endif
public:
-#ifdef Q_COMPILER_CONSTEXPR
- Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64() : rgba(0) { }
-#endif
+ QRgba64() = default;
Q_DECL_CONSTEXPR static
QRgba64 fromRgba64(quint64 c)
{
-#ifdef Q_COMPILER_CONSTEXPR
return QRgba64(c);
-#else
- QRgba64 rgba64;
- rgba64.rgba = c;
- return rgba64;
-#endif
}
Q_DECL_CONSTEXPR static
QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 2aea19eca0..5ca1d46982 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -291,6 +291,10 @@ inline qreal QTransform::dy() const
return affine._dy;
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
+
inline QTransform &QTransform::operator*=(qreal num)
{
if (num == 1.)
@@ -348,6 +352,8 @@ inline QTransform &QTransform::operator-=(qreal num)
return *this;
}
+QT_WARNING_POP
+
inline bool qFuzzyCompare(const QTransform& t1, const QTransform& t2)
{
return qFuzzyCompare(t1.m11(), t2.m11())
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 0a2ea8fdb2..746200fd9c 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -436,8 +436,8 @@ static void drawPolygons(qint32 *bits, int width, int height, const QPoint *vert
const quint32 *indices, int indexCount, qint32 value)
{
Q_ASSERT(indexCount != 0);
- Q_ASSERT(height <= 128);
- QVarLengthArray<quint16, 16> scans[128];
+ typedef QVarLengthArray<quint16, 16> ScanLine;
+ QVarLengthArray<ScanLine, 128> scans(height);
int first = 0;
for (int i = 1; i < indexCount; ++i) {
quint32 idx1 = indices[i - 1];
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 107addae58..099d9586d2 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -1445,7 +1445,8 @@ static PSecurityFunctionTable pSecurityFunctionTable = NULL;
static bool q_NTLM_SSPI_library_load()
{
- QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&pSecurityFunctionTable));
+ static QBasicMutex mutex;
+ QMutexLocker l(&mutex);
// Initialize security interface
if (pSecurityFunctionTable == NULL) {
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 41038dc8da..1da00813ce 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -39,7 +39,9 @@
#include "qdnslookup_p.h"
+#if QT_CONFIG(library)
#include <qlibrary.h>
+#endif
#include <qscopedpointer.h>
#include <qurl.h>
#include <private/qnativesocketengine_p.h>
@@ -58,7 +60,7 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
#if defined(Q_OS_OPENBSD)
typedef struct __res_state* res_state;
@@ -382,6 +384,6 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
return;
}
-#endif /* ifndef QT_NO_LIBRARY */
+#endif /* QT_CONFIG(library) */
QT_END_NAMESPACE
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 7af8db73e0..cf08a15f96 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -45,7 +45,9 @@
#include "private/qnativesocketengine_p.h"
#include "qiodevice.h"
#include <qbytearray.h>
+#if QT_CONFIG(library)
#include <qlibrary.h>
+#endif
#include <qbasicatomic.h>
#include <qurl.h>
#include <qfile.h>
@@ -93,7 +95,7 @@ static res_state_ptr local_res = 0;
static bool resolveLibraryInternal()
{
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_QNX)
+#if QT_CONFIG(library) && !defined(Q_OS_QNX)
QLibrary lib;
#ifdef LIBRESOLV_SO
lib.setFileName(QStringLiteral(LIBRESOLV_SO));
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 07de954cef..44171ca911 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -575,6 +575,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
{
QSslCipher ciph;
switch (cipher) {
+ // Sorted as in CipherSuite.h (and groupped by their RFC)
case SSL_RSA_WITH_NULL_MD5:
ciph.d->name = QLatin1String("NULL-MD5");
ciph.d->protocol = QSsl::SslV3;
@@ -592,38 +593,21 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
ciph.d->protocol = QSsl::SslV3;
break;
- case TLS_RSA_WITH_3DES_EDE_CBC_SHA:
- ciph.d->name = QLatin1String("DES-CBC3-SHA");
- break;
+ // TLS addenda using AES, per RFC 3268
case TLS_RSA_WITH_AES_128_CBC_SHA:
ciph.d->name = QLatin1String("AES128-SHA");
break;
- case TLS_RSA_WITH_AES_128_CBC_SHA256:
- ciph.d->name = QLatin1String("AES128-SHA256");
- break;
- case TLS_RSA_WITH_AES_256_CBC_SHA:
- ciph.d->name = QLatin1String("AES256-SHA");
- break;
- case TLS_RSA_WITH_AES_256_CBC_SHA256:
- ciph.d->name = QLatin1String("AES256-SHA256");
- break;
-
- case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:
- ciph.d->name = QLatin1String("DHE-RSA-DES-CBC3-SHA");
- break;
case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:
ciph.d->name = QLatin1String("DHE-RSA-AES128-SHA");
break;
- case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:
- ciph.d->name = QLatin1String("DHE-RSA-AES128-SHA256");
+ case TLS_RSA_WITH_AES_256_CBC_SHA:
+ ciph.d->name = QLatin1String("AES256-SHA");
break;
case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
ciph.d->name = QLatin1String("DHE-RSA-AES256-SHA");
break;
- case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:
- ciph.d->name = QLatin1String("DHE-RSA-AES256-SHA256");
- break;
+ // ECDSA addenda, RFC 4492
case TLS_ECDH_ECDSA_WITH_NULL_SHA:
ciph.d->name = QLatin1String("ECDH-ECDSA-NULL-SHA");
break;
@@ -636,21 +620,29 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA:
ciph.d->name = QLatin1String("ECDH-ECDSA-AES128-SHA");
break;
- case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256:
- ciph.d->name = QLatin1String("ECDH-ECDSA-AES128-SHA256");
- break;
case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA:
ciph.d->name = QLatin1String("ECDH-ECDSA-AES256-SHA");
break;
- case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384:
- ciph.d->name = QLatin1String("ECDH-ECDSA-AES256-SHA384");
+ case TLS_ECDHE_ECDSA_WITH_NULL_SHA:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-NULL-SHA");
+ break;
+ case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-RC4-SHA");
+ break;
+ case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-DES-CBC3-SHA");
+ break;
+ case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-AES128-SHA");
+ break;
+ case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-AES256-SHA");
break;
-
case TLS_ECDH_RSA_WITH_NULL_SHA:
ciph.d->name = QLatin1String("ECDH-RSA-NULL-SHA");
break;
case TLS_ECDH_RSA_WITH_RC4_128_SHA:
- ciph.d->name = QLatin1String("ECDH-RSA-AES256-SHA");
+ ciph.d->name = QLatin1String("ECDH-RSA-RC4-SHA");
break;
case TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA:
ciph.d->name = QLatin1String("ECDH-RSA-DES-CBC3-SHA");
@@ -658,62 +650,91 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA:
ciph.d->name = QLatin1String("ECDH-RSA-AES128-SHA");
break;
- case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256:
- ciph.d->name = QLatin1String("ECDH-RSA-AES128-SHA256");
- break;
case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA:
ciph.d->name = QLatin1String("ECDH-RSA-AES256-SHA");
break;
- case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384:
- ciph.d->name = QLatin1String("ECDH-RSA-AES256-SHA384");
+ case TLS_ECDHE_RSA_WITH_NULL_SHA:
+ ciph.d->name = QLatin1String("ECDHE-RSA-NULL-SHA");
+ break;
+ case TLS_ECDHE_RSA_WITH_RC4_128_SHA:
+ ciph.d->name = QLatin1String("ECDHE-RSA-RC4-SHA");
+ break;
+ case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-RSA-DES-CBC3-SHA");
+ break;
+ case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-RSA-AES128-SHA");
+ break;
+ case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
+ ciph.d->name = QLatin1String("ECDHE-RSA-AES256-SHA");
break;
- case TLS_ECDHE_ECDSA_WITH_NULL_SHA:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-NULL-SHA");
+ // TLS 1.2 addenda, RFC 5246
+ case TLS_RSA_WITH_3DES_EDE_CBC_SHA:
+ ciph.d->name = QLatin1String("DES-CBC3-SHA");
break;
- case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-RC4-SHA");
+ case TLS_RSA_WITH_AES_128_CBC_SHA256:
+ ciph.d->name = QLatin1String("AES128-SHA256");
break;
- case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-DES-CBC3-SHA");
+ case TLS_RSA_WITH_AES_256_CBC_SHA256:
+ ciph.d->name = QLatin1String("AES256-SHA256");
break;
- case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-AES128-SHA");
+ case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:
+ ciph.d->name = QLatin1String("DHE-RSA-DES-CBC3-SHA");
break;
- case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-AES128-SHA256");
+ case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:
+ ciph.d->name = QLatin1String("DHE-RSA-AES128-SHA256");
break;
- case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-AES256-SHA");
+ case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:
+ ciph.d->name = QLatin1String("DHE-RSA-AES256-SHA256");
break;
- case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
- ciph.d->name = QLatin1String("ECDHE-ECDSA-AES256-SHA384");
+
+ // Addendum from RFC 4279, TLS PSK
+ // all missing atm.
+
+ // RFC 4785 - Pre-Shared Key (PSK) Ciphersuites with NULL Encryption
+ // all missing atm.
+
+ // Addenda from rfc 5288 AES Galois Counter Mode (CGM) Cipher Suites for TLS
+ case TLS_RSA_WITH_AES_256_GCM_SHA384:
+ ciph.d->name = QLatin1String("AES256-GCM-SHA384");
break;
- case TLS_ECDHE_RSA_WITH_NULL_SHA:
- ciph.d->name = QLatin1String("ECDHE-RSA-NULL-SHA");
+ // RFC 5487 - PSK with SHA-256/384 and AES GCM
+ // all missing atm.
+
+ // Addenda from rfc 5289 Elliptic Curve Cipher Suites with HMAC SHA-256/384
+ case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-AES128-SHA256");
break;
- case TLS_ECDHE_RSA_WITH_RC4_128_SHA:
- ciph.d->name = QLatin1String("ECDHE-RSA-AES256-SHA");
+ case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
+ ciph.d->name = QLatin1String("ECDHE-ECDSA-AES256-SHA384");
break;
- case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-RSA-DES-CBC3-SHA");
+ case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256:
+ ciph.d->name = QLatin1String("ECDH-ECDSA-AES128-SHA256");
break;
- case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-RSA-AES128-SHA");
+ case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384:
+ ciph.d->name = QLatin1String("ECDH-ECDSA-AES256-SHA384");
break;
case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
ciph.d->name = QLatin1String("ECDHE-RSA-AES128-SHA256");
break;
- case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
- ciph.d->name = QLatin1String("ECDHE-RSA-AES256-SHA");
- break;
case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384:
ciph.d->name = QLatin1String("ECDHE-RSA-AES256-SHA384");
break;
+ case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256:
+ ciph.d->name = QLatin1String("ECDH-RSA-AES128-SHA256");
+ break;
+ case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384:
+ ciph.d->name = QLatin1String("ECDH-RSA-AES256-SHA384");
+ break;
+
+ // Addenda from rfc 5289 Elliptic Curve Cipher Suites
+ // with SHA-256/384 and AES Galois Counter Mode (GCM)
case TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:
ciph.d->name = QLatin1String("ECDHE-RSA-AES256-GCM-SHA384");
break;
+
default:
return ciph;
}
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 28576f1167..65a5c1ba3a 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -78,7 +78,6 @@
#include <QtCore/qthread.h>
#include <QtCore/qurl.h>
#include <QtCore/qvarlengtharray.h>
-#include <QLibrary> // for loading the security lib for the CA store
#include <string.h>
@@ -572,7 +571,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
resetDefaultCiphers();
resetDefaultEllipticCurves();
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
//load symbols needed to receive certificates from system store
#if defined(Q_OS_WIN)
HINSTANCE hLib = LoadLibraryW(L"Crypt32");
@@ -600,7 +599,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
}
}
#endif
-#endif //QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
// if on-demand loading was not enabled, load the certs now
if (!s_loadRootCertsOnDemand)
setDefaultCaCertificates(systemCaCertificates());
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 02364b194b..2ce7bbb3fa 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -58,7 +58,7 @@
#ifdef Q_OS_WIN
# include <private/qsystemlibrary_p.h>
-#else
+#elif QT_CONFIG(library)
# include <QtCore/qlibrary.h>
#endif
#include <QtCore/qmutex.h>
@@ -125,7 +125,7 @@ void qsslSocketUnresolvedSymbolWarning(const char *functionName)
qCWarning(lcSsl, "QSslSocket: cannot call unresolved function %s", functionName);
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
void qsslSocketCannotResolveSymbolWarning(const char *functionName)
{
qCWarning(lcSsl, "QSslSocket: cannot resolve %s", functionName);
@@ -473,12 +473,11 @@ DEFINEFUNC(void, PKCS12_free, PKCS12 *pkcs12, pkcs12, return, DUMMYARG)
#if !defined QT_LINKED_OPENSSL
-#ifdef QT_NO_LIBRARY
+#if !QT_CONFIG(library)
bool q_resolveOpenSslSymbols()
{
- qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. "
- "QT_NO_LIBRARY is defined which means runtime resolving of "
- "libraries won't work.");
+ qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. Qt is configured without the "
+ "'library' feature, which means runtime resolving of libraries won't work.");
qCWarning(lcSsl, "Either compile Qt statically or with support for runtime resolving "
"of libraries.");
return false;
@@ -1044,7 +1043,7 @@ bool q_resolveOpenSslSymbols()
delete libs.second;
return true;
}
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
#else // !defined QT_LINKED_OPENSSL
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 42baf448ac..a2124974d7 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -65,7 +65,6 @@
#include <private/qimagepixmapcleanuphooks_p.h>
#include "qcolormap.h"
#include "qfile.h"
-#include "qlibrary.h"
#include <qmutex.h>
#include "qsurfaceformat.h"
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 857a89195c..0b386ededc 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -45,7 +45,6 @@
#include <private/qfont_p.h>
#include "gl2paintengineex/qpaintengineex_opengl2_p.h"
-#include <qlibrary.h>
#include <qimage.h>
#include <qwindow.h>
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pro b/src/platformsupport/eglconvenience/eglconvenience.pro
index d364a42b3b..4301d63574 100644
--- a/src/platformsupport/eglconvenience/eglconvenience.pro
+++ b/src/platformsupport/eglconvenience/eglconvenience.pro
@@ -38,6 +38,6 @@ qtConfig(xlib) {
}
CONFIG += egl
-LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
+qtConfig(dlopen): QMAKE_USE += libdl
load(qt_module)
diff --git a/src/platformsupport/glxconvenience/glxconvenience.pro b/src/platformsupport/glxconvenience/glxconvenience.pro
index 185d6b0364..41c96d8f0d 100644
--- a/src/platformsupport/glxconvenience/glxconvenience.pro
+++ b/src/platformsupport/glxconvenience/glxconvenience.pro
@@ -7,7 +7,6 @@ CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
-qtConfig(xrender): QMAKE_USE_PRIVATE += xrender
LIBS_PRIVATE += $$QMAKE_LIBS_X11
HEADERS += qglxconvenience_p.h
diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp
index c7b5470b39..0c2b757920 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience.cpp
+++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp
@@ -47,10 +47,6 @@
#include <QtCore/QVector>
#include <QtCore/QVarLengthArray>
-#ifndef QT_NO_XRENDER
-#include <X11/extensions/Xrender.h>
-#endif
-
#include <GL/glxext.h>
enum {
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
index a24ab82057..01d988fdbe 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp
+++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
@@ -41,7 +41,9 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStandardPaths>
-#include <QtCore/QProcess>
+#if QT_CONFIG(process)
+# include <QtCore/QProcess>
+#endif
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -121,7 +123,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded());
if (debug)
qDebug("Launching %s", qPrintable(command));
-#if defined(QT_NO_PROCESS)
+#if !QT_CONFIG(process)
const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
#else
const bool ok = QProcess::startDetached(command);
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 1e1b1af4b5..4eefcace0f 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -225,6 +225,8 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
}
case QPlatformTheme::KeyboardScheme:
return QVariant(int(X11KeyboardScheme));
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
default:
break;
}
@@ -540,6 +542,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(d->singleClick);
case QPlatformTheme::WheelScrollLines:
return QVariant(d->wheelScrollLines);
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
default:
break;
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 77f88cc061..6478365d07 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1636,6 +1636,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow setContentView:m_view];
[m_view release];
[m_view setPostsFrameChangedNotifications:YES];
+ // QTBUG-58963
+ // viewDidChangeFrame() should be called for each window automatically at this point because it is
+ // registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification);
+ // The corner case when it's not called and we need to make a manual geometry update is when window's
+ // size is not specified explicitly but minimumSize is set and matches to the size NSView was created with.
+ if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize])
+ viewDidChangeFrame();
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 75a508370f..a05bd66890 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -88,6 +88,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QSet<quint32> m_acceptedKeyDowns;
}
++ (QSizeF)defaultViewSize;
- (id)init;
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
#ifndef QT_NO_OPENGL
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 2d8323bead..e16915273a 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -140,7 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (id) init
{
- self = [super initWithFrame : NSMakeRect(0,0, 300,300)];
+ self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())];
if (self) {
m_backingStore = 0;
m_maskImage = 0;
@@ -189,6 +189,11 @@ static bool _q_dontOverrideCtrlLMB = false;
[super dealloc];
}
++ (QSizeF)defaultViewSize
+{
+ return QSizeF(300.0, 300.0);
+}
+
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow
{
self = [self init];
@@ -238,6 +243,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToSuperview
{
+ if (m_platformWindow.isNull())
+ return;
+
if (!(m_platformWindow->m_viewIsToBeEmbedded))
return;
@@ -258,6 +266,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (QWindow *)topLevelWindow
{
+ if (m_platformWindow.isNull())
+ return nullptr;
+
QWindow *focusWindow = m_platformWindow->window();
// For widgets we need to do a bit of trickery as the window
@@ -273,6 +284,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)updateGeometry
{
+ if (m_platformWindow.isNull())
+ return;
+
QRect geometry;
if (self.window.parentWindow) {
@@ -619,6 +633,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
// Tablet events may come in via the mouse event handlers,
// check if this is a valid tablet event first.
if ([self handleTabletEvent: theEvent])
@@ -633,6 +650,8 @@ static bool _q_dontOverrideCtrlLMB = false;
else
m_platformWindow->m_forwardWindow.clear();
}
+ if (targetView->m_platformWindow.isNull())
+ return;
// Popups implicitly grap mouse events; forward to the active popup if there is one
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
@@ -657,6 +676,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
// get m_buttons in sync
// Don't send frme strut events if we are in the middle of a mouse drag.
if (m_buttons != Qt::NoButton)
@@ -936,6 +958,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseMovedImpl:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self isTransparentForUserInput])
return;
@@ -967,6 +992,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseEnteredImpl:(NSEvent *)theEvent
{
Q_UNUSED(theEvent)
+ if (m_platformWindow.isNull())
+ return;
+
m_platformWindow->m_windowUnderMouse = true;
if ([self isTransparentForUserInput])
@@ -986,6 +1014,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseExitedImpl:(NSEvent *)theEvent
{
Q_UNUSED(theEvent);
+ if (m_platformWindow.isNull())
+ return;
+
m_platformWindow->m_windowUnderMouse = false;
if ([self isTransparentForUserInput])
@@ -1012,6 +1043,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
- (bool)handleTabletEvent: (NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return false;
+
NSEventType eventType = [theEvent type];
if (eventType != NSTabletPoint && [theEvent subtype] != NSTabletPointEventSubtype)
return false; // Not a tablet event.
@@ -1170,6 +1204,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (bool)shouldSendSingleTouch
{
+ if (m_platformWindow.isNull())
+ return true;
+
// QtWidgets expects single-point touch events, QtDeclarative does not.
// Until there is an API we solve this by looking at the window class type.
return m_platformWindow->window()->inherits("QWidgetWindow");
@@ -1177,6 +1214,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesBeganWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesBeganWithEvent" << points;
@@ -1185,6 +1225,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesMovedWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesMovedWithEvent" << points;
@@ -1193,6 +1236,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesEndedWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesEndedWithEvent" << points;
@@ -1201,6 +1247,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesCancelledWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesCancelledWithEvent" << points;
@@ -1228,6 +1277,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
- (void)magnifyWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self handleGestureAsBeginEnd:event])
return;
@@ -1242,6 +1294,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)smartMagnifyWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
static bool zoomIn = true;
qCDebug(lcQpaGestures) << "smartMagnifyWithEvent" << zoomIn;
const NSTimeInterval timestamp = [event timestamp];
@@ -1255,6 +1310,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)rotateWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self handleGestureAsBeginEnd:event])
return;
@@ -1268,6 +1326,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)swipeWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
qCDebug(lcQpaGestures) << "swipeWithEvent" << [event deltaX] << [event deltaY];
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1290,6 +1351,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)beginGestureWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
@@ -1301,6 +1365,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)endGestureWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
qCDebug(lcQpaGestures) << "endGestureWithEvent";
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1314,6 +1381,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
#ifndef QT_NO_WHEELEVENT
- (void)scrollWheel:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self isTransparentForUserInput])
return [super scrollWheel:theEvent];
@@ -1984,6 +2054,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
// Sends drag update to Qt, return the action
- (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return NSDragOperationNone;
+
NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil];
QPoint qt_windowPoint(windowPoint.x, windowPoint.y);
Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]);
@@ -2011,6 +2084,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return;
@@ -2025,6 +2101,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
// called on drop, send the drop to Qt and return if it was accepted.
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return false;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return false;
@@ -2055,6 +2134,10 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
{
Q_UNUSED(session);
Q_UNUSED(operation);
+
+ if (m_platformWindow.isNull())
+ return;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return;
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 73e1f41dd5..645a93edf7 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -53,6 +53,9 @@
@implementation QNSView (QNSViewAccessibility)
- (id)childAccessibleElement {
+ if (m_platformWindow.isNull())
+ return nil;
+
if (!m_platformWindow->window()->accessibleRoot())
return nil;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 534467b32c..e411ea55e9 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -71,16 +71,16 @@ Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
{
QStringList list;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
list = directLoader()->keyMap().values();
@@ -104,7 +104,7 @@ QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
{
QEglFSDeviceIntegration *integration = Q_NULLPTR;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 3723142f0b..87fb3146c7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -49,6 +49,8 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtFbSupport/private/qfbvthandler_p.h>
+#include <errno.h>
+
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
index 5c084b33fc..187cbc025f 100644
--- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -20,8 +20,6 @@ qtHaveModule(input_support-private): \
qtHaveModule(platformcompositor_support-private): \
QT += platformcompositor_support-private
-LIBS += $$QMAKE_LIBS_DYNLOAD
-
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro
index 3cd7e9b160..1fa682303f 100644
--- a/src/plugins/platforms/vnc/vnc.pro
+++ b/src/plugins/platforms/vnc/vnc.pro
@@ -1,10 +1,5 @@
TARGET = qvnc
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QVncIntegrationPlugin
-!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
-load(qt_plugin)
-
QT += \
core-private network gui-private \
service_support-private theme_support-private fb_support-private \
@@ -29,3 +24,8 @@ HEADERS = \
qvncclient.h
OTHER_FILES += vnc.json
+
+PLUGIN_TYPE = platforms
+PLUGIN_CLASS_NAME = QVncIntegrationPlugin
+!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
+load(qt_plugin)
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 9275958456..a326ccac3e 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -373,34 +373,39 @@ void QWindowsOleDropSource::createCursors()
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
{
- HRESULT hr = S_OK;
- do {
- if (fEscapePressed || QWindowsDrag::isCanceled()) {
- hr = ResultFromScode(DRAGDROP_S_CANCEL);
- break;
- }
+ Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
- const Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
- if (m_currentButtons == Qt::NoButton) {
- m_currentButtons = buttons;
+ SCODE result = S_OK;
+ if (fEscapePressed || QWindowsDrag::isCanceled()) {
+ result = DRAGDROP_S_CANCEL;
+ buttons = Qt::NoButton;
} else {
- // Button changed: Complete Drop operation.
- if (!(m_currentButtons & buttons)) {
- hr = ResultFromScode(DRAGDROP_S_DROP);
- break;
+ if (buttons && !m_currentButtons) {
+ m_currentButtons = buttons;
+ } else if (!(m_currentButtons & buttons)) { // Button changed: Complete Drop operation.
+ result = DRAGDROP_S_DROP;
}
}
- QGuiApplication::processEvents();
+ switch (result) {
+ case DRAGDROP_S_DROP:
+ case DRAGDROP_S_CANCEL:
+ QGuiApplicationPrivate::modifier_buttons = toQtKeyboardModifiers(grfKeyState);
+ QGuiApplicationPrivate::mouse_buttons = buttons;
+ m_currentButtons = Qt::NoButton;
+ break;
- } while (false);
+ default:
+ QGuiApplication::processEvents();
+ break;
+ }
- if (QWindowsContext::verbose > 1 || hr != S_OK) {
+ if (QWindowsContext::verbose > 1 || result != S_OK) {
qCDebug(lcQpaMime) << __FUNCTION__ << "fEscapePressed=" << fEscapePressed
<< "grfKeyState=" << grfKeyState << "buttons" << m_currentButtons
- << "returns 0x" << hex <<int(hr) << dec;
+ << "returns 0x" << hex << int(result) << dec;
}
- return hr;
+ return ResultFromScode(result);
}
/*!
@@ -543,6 +548,12 @@ QWindowsOleDropTarget::DragLeave()
qCDebug(lcQpaMime) << __FUNCTION__ << ' ' << m_window;
QWindowSystemInterface::handleDrag(m_window, 0, QPoint(), Qt::IgnoreAction);
+
+ if (!QDragManager::self()->source()) {
+ QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
+ QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
+ m_lastKeyState = 0;
+ }
QWindowsDrag::instance()->releaseDropDataObject();
return NOERROR;
@@ -561,11 +572,9 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
<< "keys=" << grfKeyState << "pt=" << pt.x << ',' << pt.y;
m_lastPoint = QWindowsGeometryHint::mapFromGlobal(m_window, QPoint(pt.x,pt.y));
- // grfKeyState does not all ways contain button state in the drop so if
- // it doesn't then use the last known button state;
- if ((grfKeyState & KEY_STATE_BUTTON_MASK) == 0)
- grfKeyState |= m_lastKeyState & KEY_STATE_BUTTON_MASK;
- m_lastKeyState = grfKeyState;
+ // grfKeyState does not all ways contain button state in the drop
+ QGuiApplicationPrivate::mouse_buttons = toQtMouseButtons(m_lastKeyState);
+ QGuiApplicationPrivate::modifier_buttons = toQtKeyboardModifiers(grfKeyState);
QWindowsDrag *windowsDrag = QWindowsDrag::instance();
@@ -573,6 +582,10 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
m_lastPoint,
translateToQDragDropActions(*pdwEffect));
+
+ QGuiApplicationPrivate::mouse_buttons = toQtMouseButtons(grfKeyState);
+ m_lastKeyState = grfKeyState;
+
if (response.isAccepted()) {
const Qt::DropAction action = response.acceptedAction();
if (action == Qt::MoveAction || action == Qt::TargetMoveAction) {
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
index 6650ca44ae..d69d969783 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // !QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Try loading the plugin from pluginPath first:
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
index 492fbf7e10..d9add22e00 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -38,7 +38,9 @@
****************************************************************************/
#include <QDebug>
+#if QT_CONFIG(library)
#include <QLibrary>
+#endif
#include "qxcbwindow.h"
#include "qxcbscreen.h"
@@ -54,7 +56,9 @@
#include <QtGlxSupport/private/qglxconvenience_p.h>
#include <QtPlatformHeaders/QGLXNativeContext>
-#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
+#include "qxcbglintegration.h"
+
+#if !defined(QT_STATIC) && QT_CONFIG(dlopen)
#include <dlfcn.h>
#endif
@@ -564,7 +568,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB) {
QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' ');
if (glxExt.contains("GLX_ARB_get_proc_address")) {
-#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
+#if QT_CONFIG(dlopen)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB");
@@ -573,7 +577,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB)
#endif
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
extern const QString qt_gl_library_name();
// QLibrary lib(qt_gl_library_name());
QLibrary lib(QLatin1String("GL"));
@@ -689,6 +693,10 @@ void QGLXContext::queryDummyContext()
if (const char *renderer = (const char *) glGetString(GL_RENDERER)) {
for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) {
if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) {
+ qCInfo(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
+ "blacklisted renderer \""
+ << qglx_threadedgl_blacklist_renderer[i]
+ << "\"";
m_supportsThreading = false;
break;
}
@@ -698,6 +706,11 @@ void QGLXContext::queryDummyContext()
if (glxvendor) {
for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
if (strstr(glxvendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
+ qCInfo(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
+ "blacklisted vendor \""
+ << qglx_threadedgl_blacklist_vendor[i]
+ << "\"";
+
m_supportsThreading = false;
break;
}
@@ -707,6 +720,11 @@ void QGLXContext::queryDummyContext()
context.doneCurrent();
if (oldContext && oldSurface)
oldContext->makeCurrent(oldSurface);
+
+ if (!m_supportsThreading) {
+ qCInfo(lcQpaGl) << "Force-enable multithreaded OpenGL by setting "
+ "environment variable QT_OPENGL_NO_SANITY_CHECK";
+ }
}
bool QGLXContext::supportsThreading()
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index 8aa6e1febd..215f5a3fe1 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -12,7 +12,7 @@ qtConfig(xcb-glx) {
QMAKE_USE += xcb_glx
}
-LIBS += $$QMAKE_LIBS_DYNLOAD
+!static:qtConfig(dlopen): QMAKE_USE += libdl
HEADERS += \
qxcbglxintegration.h \
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 24a4c1bf22..30ab669432 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -600,7 +600,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
return;
}
- xcb_selection_notify_event_t event;
+ Q_DECLARE_XCB_EVENT(event, xcb_selection_notify_event_t);
event.response_type = XCB_SELECTION_NOTIFY;
event.requestor = req->requestor;
event.selection = req->selection;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index fa4fd68686..cdd8e64676 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -728,6 +728,19 @@ private:
std::free \
)
+template <typename T>
+union q_padded_xcb_event {
+ T event;
+ char padding[32];
+};
+
+// The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the
+// passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into
+// unrelated memory.
+#define Q_DECLARE_XCB_EVENT(event_var, event_type) \
+ q_padded_xcb_event<event_type> store = {}; \
+ auto &event_var = store.event;
+
QT_END_NAMESPACE
#endif
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 4b6642efee..c77e7b6269 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -1220,6 +1220,7 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
if (!xcbWindow)
return;
QWindow *window = xcbWindow->window();
+ const Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(ev->mods.effective_mods);
const double scale = 65536.0;
QPointF local(ev->event_x / scale, ev->event_y / scale);
QPointF global(ev->root_x / scale, ev->root_y / scale);
@@ -1261,18 +1262,18 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %s type %s seq %d detail %d time %d "
- "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
+ "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf modifiers 0x%x",
tabletData->deviceId, toolName(tabletData->tool), pointerTypeName(tabletData->pointerType),
ev->sequenceNumber, ev->detail, ev->time,
fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y),
- (int)tabletData->buttons, pressure, xTilt, yTilt, rotation);
+ (int)tabletData->buttons, pressure, xTilt, yTilt, rotation, (int)modifiers);
QWindowSystemInterface::handleTabletEvent(window, ev->time, local, global,
tabletData->tool, tabletData->pointerType,
tabletData->buttons, pressure,
xTilt, yTilt, tangentialPressure,
- rotation, 0, tabletData->serialId);
+ rotation, 0, tabletData->serialId, modifiers);
}
QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 7f8c7af2ae..d522e593fe 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -43,7 +43,9 @@
#include "qxcbimage.h"
#include "qxcbxsettings.h"
+#if QT_CONFIG(library)
#include <QtCore/QLibrary>
+#endif
#include <QtGui/QWindow>
#include <QtGui/QBitmap>
#include <QtGui/private/qguiapplication_p.h>
@@ -58,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *);
typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *);
typedef int (*PtrXcursorLibraryGetDefaultSize)(void *);
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
#include <X11/Xlib.h>
enum {
XCursorShape = CursorShape
@@ -306,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
const char *cursorStr = "cursor";
xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr);
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static bool function_ptrs_not_initialized = true;
if (function_ptrs_not_initialized) {
QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
@@ -507,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
return cursor;
}
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
bool updateCursorTheme(void *dpy, const QByteArray &theme) {
if (!ptrXcursorLibraryGetTheme
|| !ptrXcursorLibrarySetTheme)
@@ -551,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
}
return cursor;
}
-#endif //XCB_USE_XLIB / QT_NO_LIBRARY
+#endif // XCB_USE_XLIB / QT_CONFIG(library)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
@@ -560,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
if (cshape >= 0 && cshape <= Qt::LastCursor) {
void *dpy = connection()->xlib_display();
// special case for non-standard dnd-* cursors
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index c15225f6d2..41ec4dbbf8 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -101,7 +101,7 @@ private:
#ifndef QT_NO_CURSOR
CursorHash m_cursorHash;
#endif
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen,
const QByteArray &name,
const QVariant &property,
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 908a6fdf82..d4521de8e0 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1118,7 +1118,7 @@ static xcb_window_t findXdndAwareParent(QXcbConnection *c, xcb_window_t window)
void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event)
{
- xcb_selection_notify_event_t notify;
+ Q_DECLARE_XCB_EVENT(notify, xcb_selection_notify_event_t);
notify.response_type = XCB_SELECTION_NOTIFY;
notify.requestor = event->requestor;
notify.selection = event->selection;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index e2c25df111..e15c22b690 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -826,7 +826,7 @@ void QXcbWindow::hide()
xcb_unmap_window(xcb_connection(), m_window);
// send synthetic UnmapNotify event according to icccm 4.1.4
- xcb_unmap_notify_event_t event;
+ Q_DECLARE_XCB_EVENT(event, xcb_unmap_notify_event_t);
event.response_type = XCB_UNMAP_NOTIFY;
event.event = xcbScreen()->root();
event.window = m_window;
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 7cfa554418..ee439fa33e 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1421,13 +1421,17 @@ bool QMYSQLDriver::open(const QString& db,
if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) {
// force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters)
mysql_set_character_set(d->mysql, "utf8mb4");
- } else {
+#ifndef QT_NO_TEXTCODEC
+ d->tc = QTextCodec::codecForName("UTF-8");
+#endif
+ } else
+ {
// force the communication to be utf8
mysql_set_character_set(d->mysql, "utf8");
- }
-#endif
#ifndef QT_NO_TEXTCODEC
- d->tc = codec(d->mysql);
+ d->tc = codec(d->mysql);
+#endif
+ }
#endif
#if MYSQL_VERSION_ID >= 40108
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index f295de7396..32c994363e 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -56,7 +56,7 @@ class QSqlRelationalDelegate: public QItemDelegate
{
public:
-explicit QSqlRelationalDelegate(QObject *aParent = 0)
+explicit QSqlRelationalDelegate(QObject *aParent = nullptr)
: QItemDelegate(aParent)
{}
@@ -68,7 +68,7 @@ QWidget *createEditor(QWidget *aParent,
const QModelIndex &index) const override
{
const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model());
- QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
+ QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : nullptr;
if (!childModel)
return QItemDelegate::createEditor(aParent, option, index);
@@ -86,7 +86,7 @@ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex
return;
QSqlRelationalTableModel *sqlModel = qobject_cast<QSqlRelationalTableModel *>(model);
- QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
+ QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : nullptr;
QComboBox *combo = qobject_cast<QComboBox *>(editor);
if (!sqlModel || !childModel || !combo) {
QItemDelegate::setModelData(editor, model, index);
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index c933a16c35..d49d07bb70 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -42,7 +42,6 @@
#include <QtTest/private/qbenchmarkmetric_p.h>
#include <QtTest/private/qbenchmarktimemeasurers_p.h>
-#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 797071d7a4..dbfa0127b6 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
+#if (defined(Q_OS_LINUX) || defined Q_OS_MACOS) && QT_CONFIG(process)
#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 19d135e15f..2a6cad698f 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -51,7 +51,6 @@
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
-#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/private/qtools_p.h>
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 674398e783..c4184929ef 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1193,7 +1193,7 @@ void Generator::generateStaticMetacall()
}
fprintf(out, ");");
if (f.normalizedType != "void") {
- fprintf(out, "\n if (_a[0]) *reinterpret_cast< %s*>(_a[0]) = _r; } ",
+ fprintf(out, "\n if (_a[0]) *reinterpret_cast< %s*>(_a[0]) = std::move(_r); } ",
noRef(f.normalizedType).constData());
isUsed_a = true;
}
@@ -1483,10 +1483,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
}
Q_ASSERT(!def->normalizedType.isEmpty());
- if (def->arguments.isEmpty() && def->normalizedType == "void") {
- if (def->isPrivateSignal)
- fprintf(out, "QPrivateSignal");
-
+ if (def->arguments.isEmpty() && def->normalizedType == "void" && !def->isPrivateSignal) {
fprintf(out, ")%s\n{\n"
" QMetaObject::activate(%s, &staticMetaObject, %d, nullptr);\n"
"}\n", constQualifier, thisPtr.constData(), index);
@@ -1503,17 +1500,13 @@ void Generator::generateSignal(FunctionDef *def,int index)
if (def->isPrivateSignal) {
if (!def->arguments.isEmpty())
fprintf(out, ", ");
- fprintf(out, "QPrivateSignal");
+ fprintf(out, "QPrivateSignal _t%d", offset++);
}
fprintf(out, ")%s\n{\n", constQualifier);
if (def->type.name.size() && def->normalizedType != "void") {
QByteArray returnType = noRef(def->normalizedType);
- if (returnType.endsWith('*')) {
- fprintf(out, " %s _t0 = 0;\n", returnType.constData());
- } else {
- fprintf(out, " %s _t0 = %s();\n", returnType.constData(), returnType.constData());
- }
+ fprintf(out, " %s _t0{};\n", returnType.constData());
}
fprintf(out, " void *_a[] = { ");
@@ -1527,7 +1520,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
}
int i;
for (i = 1; i < offset; ++i)
- if (def->arguments.at(i - 1).type.isVolatile)
+ if (i <= def->arguments.count() && def->arguments.at(i - 1).type.isVolatile)
fprintf(out, ", const_cast<void*>(reinterpret_cast<const volatile void*>(&_t%d))", i);
else
fprintf(out, ", const_cast<void*>(reinterpret_cast<const void*>(&_t%d))", i);
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index f749b90019..fba47b74c3 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -32,6 +32,7 @@
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
+#include <qhashfunctions.h>
#include <qtextstream.h>
#include <qatomic.h>
#include <qglobal.h>
@@ -153,6 +154,9 @@ int runRcc(int argc, char *argv[])
QCommandLineOption projectOption(QStringLiteral("project"), QStringLiteral("Output a resource file containing all files from the current directory."));
parser.addOption(projectOption);
+ QCommandLineOption formatVersionOption(QStringLiteral("format-version"), QStringLiteral("The RCC format version to write"), QStringLiteral("number"));
+ parser.addOption(formatVersionOption);
+
parser.addPositionalArgument(QStringLiteral("inputs"), QStringLiteral("Input files (*.qrc)."));
@@ -160,7 +164,19 @@ int runRcc(int argc, char *argv[])
parser.process(app);
QString errorMsg;
- RCCResourceLibrary library;
+
+ quint8 formatVersion = 2;
+ if (parser.isSet(formatVersionOption)) {
+ bool ok = false;
+ formatVersion = parser.value(formatVersionOption).toUInt(&ok);
+ if (!ok) {
+ errorMsg = QLatin1String("Invalid format version specified");
+ } else if (formatVersion != 1 && formatVersion != 2) {
+ errorMsg = QLatin1String("Unsupported format version specified");
+ }
+ }
+
+ RCCResourceLibrary library(formatVersion);
if (parser.isSet(nameOption))
library.setInitName(parser.value(nameOption));
if (parser.isSet(rootOption)) {
@@ -297,16 +313,17 @@ int runRcc(int argc, char *argv[])
return 0;
}
-Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp
-
QT_END_NAMESPACE
int main(int argc, char *argv[])
{
// rcc uses a QHash to store files in the resource system.
// we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078
- if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST") && !qt_qhash_seed.testAndSetRelaxed(-1, 0)))
- qFatal("Cannot force QHash seed for testing as requested");
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST"))) {
+ qSetGlobalQHashSeed(0);
+ if (qGlobalQHashSeed() != 0)
+ qFatal("Cannot force QHash seed for testing as requested");
+ }
return QT_PREPEND_NAMESPACE(runRcc)(argc, argv);
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 24dc1092ef..84fe6ef5c7 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -204,11 +204,13 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
if (text || pass1)
lib.writeChar('\n');
- // last modified time stamp
- const QDateTime lastModified = m_fileInfo.lastModified();
- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
- if (text || pass1)
- lib.writeChar('\n');
+ if (lib.formatVersion() >= 2) {
+ // last modified time stamp
+ const QDateTime lastModified = m_fileInfo.lastModified();
+ lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
+ if (text || pass1)
+ lib.writeChar('\n');
+ }
}
qint64 RCCFileInfo::writeDataBlob(RCCResourceLibrary &lib, qint64 offset,
@@ -341,7 +343,7 @@ RCCResourceLibrary::Strings::Strings() :
{
}
-RCCResourceLibrary::RCCResourceLibrary()
+RCCResourceLibrary::RCCResourceLibrary(quint8 formatVersion)
: m_root(0),
m_format(C_Code),
m_verbose(false),
@@ -352,7 +354,8 @@ RCCResourceLibrary::RCCResourceLibrary()
m_dataOffset(0),
m_useNameSpace(CONSTANT_USENAMESPACE),
m_errorDevice(0),
- m_outDevice(0)
+ m_outDevice(0),
+ m_formatVersion(formatVersion)
{
m_out.reserve(30 * 1000 * 1000);
}
@@ -1115,7 +1118,9 @@ bool RCCResourceLibrary::writeInitializer()
if (m_root) {
writeString(" ");
writeAddNamespaceFunction("qRegisterResourceData");
- writeString("\n (0x02, qt_resource_struct, "
+ writeString("\n (");
+ writeHex(m_formatVersion);
+ writeString(" qt_resource_struct, "
"qt_resource_name, qt_resource_data);\n");
}
writeString(" return 1;\n");
@@ -1136,7 +1141,9 @@ bool RCCResourceLibrary::writeInitializer()
if (m_root) {
writeString(" ");
writeAddNamespaceFunction("qUnregisterResourceData");
- writeString("\n (0x02, qt_resource_struct, "
+ writeString("\n (");
+ writeHex(m_formatVersion);
+ writeString(" qt_resource_struct, "
"qt_resource_name, qt_resource_data);\n");
}
writeString(" return 1;\n");
@@ -1153,10 +1160,10 @@ bool RCCResourceLibrary::writeInitializer()
} else if (m_format == Binary) {
int i = 4;
char *p = m_out.data();
- p[i++] = 0; // 0x02
p[i++] = 0;
p[i++] = 0;
- p[i++] = 2;
+ p[i++] = 0;
+ p[i++] = m_formatVersion;
p[i++] = (m_treeOffset >> 24) & 0xff;
p[i++] = (m_treeOffset >> 16) & 0xff;
diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h
index 157cd4809f..19e04e401d 100644
--- a/src/tools/rcc/rcc.h
+++ b/src/tools/rcc/rcc.h
@@ -48,7 +48,7 @@ class RCCResourceLibrary
RCCResourceLibrary &operator=(const RCCResourceLibrary &);
public:
- RCCResourceLibrary();
+ RCCResourceLibrary(quint8 formatVersion);
~RCCResourceLibrary();
bool output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice);
@@ -91,6 +91,8 @@ public:
QStringList failedResources() const { return m_failedResources; }
+ int formatVersion() const { return m_formatVersion; }
+
private:
struct Strings {
Strings();
@@ -141,6 +143,7 @@ private:
QIODevice *m_errorDevice;
QIODevice *m_outDevice;
QByteArray m_out;
+ quint8 m_formatVersion;
};
QT_END_NAMESPACE
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index fca604690e..3599470403 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -32,6 +32,7 @@
#include <qfile.h>
#include <qdir.h>
+#include <qhashfunctions.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qcoreapplication.h>
@@ -39,11 +40,10 @@
#include <qcommandlineparser.h>
QT_BEGIN_NAMESPACE
-extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
int runUic(int argc, char *argv[])
{
- qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet
+ qSetGlobalQHashSeed(0); // set the hash seed to 0
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR));
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index ea3b88468b..397a58a5d4 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -41,7 +41,6 @@
#include <qaccessible.h>
#include <qapplication.h>
-#include <qabstractbutton.h>
#include <qevent.h>
#include <qheaderview.h>
#include <qtabbar.h>
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index c95b5b1097..e7db53c251 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -103,11 +103,13 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QToolButton")) {
iface = new QAccessibleToolButton(widget);
#endif // QT_NO_TOOLBUTTON
+#if QT_CONFIG(abstractbutton)
} else if (classname == QLatin1String("QCheckBox")
|| classname == QLatin1String("QRadioButton")
|| classname == QLatin1String("QPushButton")
|| classname == QLatin1String("QAbstractButton")) {
iface = new QAccessibleButton(widget);
+#endif
} else if (classname == QLatin1String("QDialog")) {
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 40aca37f11..7f77f7c524 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -64,7 +64,6 @@
#include <QAbstractItemView>
#include <QDockWidget>
#include <QMainWindow>
-#include <QAbstractButton>
#include <private/qdockwidget_p.h>
#include <QFocusFrame>
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 113172ff5a..a53e5eaf30 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -39,7 +39,9 @@
#include "simplewidgets_p.h"
+#if QT_CONFIG(abstractbutton)
#include <qabstractbutton.h>
+#endif
#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
#endif
@@ -80,6 +82,7 @@ extern QList<QWidget*> childWidgets(const QWidget *widget);
QString qt_accStripAmp(const QString &text);
QString qt_accHotKey(const QString &text);
+#if QT_CONFIG(abstractbutton)
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -267,7 +270,7 @@ QStringList QAccessibleButton::keyBindingsForAction(const QString &actionName) c
}
return QStringList();
}
-
+#endif // QT_CONFIG(abstractbutton)
#ifndef QT_NO_TOOLBUTTON
/*!
@@ -519,7 +522,7 @@ QString QAccessibleDisplay::imageDescription() const
#ifndef QT_NO_TOOLTIP
return widget()->toolTip();
#else
- return QString::null;
+ return QString();
#endif
}
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index 8bd0af8261..1e4ae5ab67 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -65,6 +65,7 @@ class QToolButton;
class QGroupBox;
class QProgressBar;
+#if QT_CONFIG(abstractbutton)
class QAccessibleButton : public QAccessibleWidget
{
Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
@@ -83,6 +84,7 @@ public:
protected:
QAbstractButton *button() const;
};
+#endif
#ifndef QT_NO_TOOLBUTTON
class QAccessibleToolButton : public QAccessibleButton
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 99e1bd6940..14e4d10d38 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -117,6 +117,12 @@
"condition": "features.tableview",
"output": [ "publicFeature", "feature" ]
},
+ "abstractbutton": {
+ "label": "QAbstractButton",
+ "purpose": "Abstract base class of button widgets, providing functionality common to buttons.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
"commandlinkbutton": {
"label": "QCommandLinkButton",
"purpose": "Provides a Vista style command link button.",
@@ -193,6 +199,7 @@
"label": "QRadioButton",
"purpose": "Provides a radio button with a text label.",
"section": "Widgets",
+ "condition": "features.abstractbutton",
"output": [ "publicFeature" ]
},
"spinbox": {
@@ -234,20 +241,21 @@
"label": "QCheckBox(",
"purpose": "Provides a checkbox with a text label.",
"section": "Widgets",
+ "condition": "features.abstractbutton",
"output": [ "publicFeature" ]
},
"pushbutton": {
"label": "QPushButton",
"purpose": "Provides a command button.",
"section": "Widgets",
- "condition": "features.action",
+ "condition": "features.abstractbutton && features.action",
"output": [ "publicFeature" ]
},
"toolbutton": {
"label": "QToolButton",
"purpose": "Provides quick-access buttons to commands and options.",
"section": "Widgets",
- "condition": "features.action",
+ "condition": "features.abstractbutton && features.action",
"output": [ "publicFeature", "feature" ]
},
"toolbar": {
@@ -274,7 +282,7 @@
"label": "QButtonGroup",
"purpose": "Supports organizing groups of button widgets.",
"section": "Widgets",
- "condition": "features.groupbox",
+ "condition": "features.abstractbutton && features.groupbox",
"output": [ "publicFeature", "feature" ]
},
"mainwindow": {
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index bd5bf08bb8..f2b8b66fed 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -4516,7 +4516,7 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
otherwise, \a matrix \e replaces the current matrix. \a combine is false
by default.
- To simplify interation with items using a transformed view, QGraphicsItem
+ To simplify interaction with items using a transformed view, QGraphicsItem
provides mapTo... and mapFrom... functions that can translate between
items' and the scene's coordinates. For example, you can call mapToScene()
to map an item coordiate to a scene coordinate, or mapFromScene() to map
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index c7cc1d155e..ed6482a8bc 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -49,7 +49,9 @@
#include <qevent.h>
#include <qbitarray.h>
#include <qscrollbar.h>
+#if QT_CONFIG(abstractbutton)
#include <qabstractbutton.h>
+#endif
#include <private/qtableview_p.h>
#include <private/qheaderview_p.h>
#include <private/qscrollbar_p.h>
@@ -578,6 +580,7 @@ bool QSpanCollection::checkConsistency() const
}
#endif
+#if QT_CONFIG(abstractbutton)
class QTableCornerButton : public QAbstractButton
{
Q_OBJECT
@@ -600,6 +603,7 @@ public:
style()->drawControl(QStyle::CE_Header, &opt, &painter, this);
}
};
+#endif
void QTableViewPrivate::init()
{
@@ -619,9 +623,11 @@ void QTableViewPrivate::init()
tabKeyNavigation = true;
+#if QT_CONFIG(abstractbutton)
cornerWidget = new QTableCornerButton(q);
cornerWidget->setFocusPolicy(Qt::NoFocus);
QObject::connect(cornerWidget, SIGNAL(clicked()), q, SLOT(selectAll()));
+#endif
}
/*!
@@ -2121,6 +2127,7 @@ void QTableView::updateGeometries()
if (d->horizontalHeader->isHidden())
QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries");
+#if QT_CONFIG(abstractbutton)
// update cornerWidget
if (d->horizontalHeader->isHidden() || d->verticalHeader->isHidden()) {
d->cornerWidget->setHidden(true);
@@ -2128,6 +2135,7 @@ void QTableView::updateGeometries()
d->cornerWidget->setHidden(false);
d->cornerWidget->setGeometry(verticalLeft, horizontalTop, width, height);
}
+#endif
// update scroll bars
@@ -2642,6 +2650,7 @@ bool QTableView::wordWrap() const
return d->wrapItemText;
}
+#if QT_CONFIG(abstractbutton)
/*!
\property QTableView::cornerButtonEnabled
\brief whether the button in the top-left corner is enabled
@@ -2664,6 +2673,7 @@ bool QTableView::isCornerButtonEnabled() const
Q_D(const QTableView);
return d->cornerWidget->isEnabled();
}
+#endif
/*!
\internal
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index 8c9ac379bc..b1c38d521f 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -58,7 +58,9 @@ class Q_WIDGETS_EXPORT QTableView : public QAbstractItemView
Q_PROPERTY(Qt::PenStyle gridStyle READ gridStyle WRITE setGridStyle)
Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled)
Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
+#if QT_CONFIG(abstractbutton)
Q_PROPERTY(bool cornerButtonEnabled READ isCornerButtonEnabled WRITE setCornerButtonEnabled)
+#endif
public:
explicit QTableView(QWidget *parent = Q_NULLPTR);
@@ -103,8 +105,10 @@ public:
void setWordWrap(bool on);
bool wordWrap() const;
+#if QT_CONFIG(abstractbutton)
void setCornerButtonEnabled(bool enable);
bool isCornerButtonEnabled() const;
+#endif
QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index 2ca158d657..d2f45d557d 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -192,7 +192,9 @@ public:
QVector<int> rowsToUpdate;
QHeaderView *horizontalHeader;
QHeaderView *verticalHeader;
+#if QT_CONFIG(abstractbutton)
QWidget *cornerWidget;
+#endif
bool sortingEnabled;
bool geometryRecursionBlock;
QPoint visualCursor; // (Row,column) cell coordinates to track through span navigation.
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index ee0c28ec76..51793bf060 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -767,7 +767,7 @@ QWidgetItemV2::QWidgetItemV2(QWidget *widget)
QWidgetItemV2::~QWidgetItemV2()
{
if (wid) {
- QWidgetPrivate *wd = wid->d_func();
+ auto *wd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(wid));
if (wd->widgetItem == this)
wd->widgetItem = 0;
}
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 4d45782170..e401444e6e 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -537,6 +537,7 @@ public:
w(widget) { }
void beginPaint() Q_DECL_OVERRIDE;
+ void endPaint() Q_DECL_OVERRIDE;
QOpenGLWidget *w;
};
@@ -634,6 +635,16 @@ void QOpenGLWidgetPaintDevicePrivate::beginPaint()
}
}
+void QOpenGLWidgetPaintDevicePrivate::endPaint()
+{
+ QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(w));
+ if (!wd->initialized)
+ return;
+
+ if (!wd->inPaintGL)
+ QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0;
+}
+
void QOpenGLWidgetPaintDevice::ensureActiveTarget()
{
QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data());
@@ -646,6 +657,9 @@ void QOpenGLWidgetPaintDevice::ensureActiveTarget()
else
wd->fbo->bind();
+ if (!wd->inPaintGL)
+ QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbo->handle();
+
// When used as a viewport, drawing is done via opening a QPainter on the widget
// without going through paintEvent(). We will have to make sure a glFlush() is done
// before the texture is accessed also in this case.
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 62d723bea5..1452bb36ae 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -9199,7 +9199,8 @@ bool QWidget::event(QEvent *event)
const QWindow *win = te->window;
d->setWinId((win && win->handle()) ? win->handle()->winId() : 0);
}
- d->updateFont(d->data.fnt);
+ if (d->data.fnt.d->dpi != logicalDpiY())
+ d->updateFont(d->data.fnt);
#ifndef QT_NO_OPENGL
d->renderToTextureReallyDirty = 1;
#endif
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 1267907303..98d45587f0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -45,7 +45,8 @@
#include <qcombobox.h>
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
-#else
+#endif
+#if QT_CONFIG(abstractbutton)
#include <qabstractbutton.h>
#endif
#include <qpainter.h>
@@ -55,7 +56,6 @@
#include <qmainwindow.h>
#include <qfont.h>
#include <qgroupbox.h>
-#include <qprocess.h>
#include <qpixmapcache.h>
#include <qscrollbar.h>
#include <qspinbox.h>
@@ -66,7 +66,6 @@
#include <qsplitter.h>
#include <qprogressbar.h>
#include <qwizard.h>
-#include <qlibrary.h>
#include <qdrawutil.h>
#include <private/qstylehelper_p.h>
#include <private/qdrawhelper_p.h>
@@ -3284,7 +3283,10 @@ void QFusionStyle::polish(QApplication *app)
void QFusionStyle::polish(QWidget *widget)
{
QCommonStyle::polish(widget);
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
#if QT_CONFIG(combobox)
|| qobject_cast<QComboBox *>(widget)
#endif
@@ -3325,7 +3327,10 @@ void QFusionStyle::polish(QPalette &pal)
void QFusionStyle::unpolish(QWidget *widget)
{
QCommonStyle::unpolish(widget);
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
#if QT_CONFIG(combobox)
|| qobject_cast<QComboBox *>(widget)
#endif
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index d9d30efc8b..47193f2a84 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1076,11 +1076,6 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
verticalShift = -verticalShift;
tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
- const bool selected = opt->state & QStyle::State_Selected;
- if (selected) {
- tr.setTop(tr.top() - verticalShift);
- tr.setRight(tr.right() - horizontalShift);
- }
// left widget
if (!opt->leftButtonSize.isEmpty()) {
@@ -2487,7 +2482,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case QAquaSizeUnknown:
const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt);
if (tb && tb->documentMode)
- ret = 24;
+ ret = 30;
else
ret = QCommonStyle::pixelMetric(metric, opt, widget);
break;
@@ -6584,7 +6579,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = sz.transposed();
int defaultTabHeight;
int extraHSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget);
- int extraVSpace = proxy()->pixelMetric(PM_TabBarTabVSpace, tab, widget);
QFontMetrics fm = opt->fontMetrics;
switch (AquaSize) {
case QAquaSizeUnknown:
@@ -6604,13 +6598,13 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool setWidth = false;
if (differentFont || !tab->icon.isNull()) {
sz.rheight() = qMax(defaultTabHeight, sz.height());
- sz.rwidth() += extraHSpace;
} else {
QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
sz.rheight() = qMax(defaultTabHeight, textSize.height());
- sz.rwidth() = textSize.width() + extraVSpace;
+ sz.rwidth() = textSize.width();
setWidth = true;
}
+ sz.rwidth() += extraHSpace;
if (vertTabs)
sz = sz.transposed();
@@ -6724,7 +6718,15 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
}
case CT_Menu: {
- sz = csz;
+ if (proxy() == this) {
+ sz = csz;
+ } else {
+ QStyleHintReturnMask menuMask;
+ QStyleOption myOption = *opt;
+ myOption.rect.setSize(sz);
+ if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask))
+ sz = menuMask.region.boundingRect().size();
+ }
break; }
case CT_HeaderSection:{
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt);
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 59f6e893b1..9bbd0995a5 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -95,7 +95,6 @@
#include <qtableview.h>
#include <qwizard.h>
#include <qdebug.h>
-#include <qlibrary.h>
#include <qdatetimeedit.h>
#include <qmath.h>
#include <qpair.h>
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 7dc1c35333..2b9f042862 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4269,6 +4269,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
case PE_PanelButtonTool:
case PE_PanelButtonCommand:
+#if QT_CONFIG(abstractbutton)
if (qobject_cast<const QAbstractButton *>(w) && rule.hasBackground() && rule.hasNativeBorder()) {
//the window style will draw the borders
ParentStyle::drawPrimitive(pe, opt, p, w);
@@ -4277,6 +4278,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
}
return;
}
+#endif
if (!rule.hasNativeBorder()) {
rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin));
return;
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index ec7c2caad3..db358e6f6c 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -58,7 +58,6 @@
#include <private/qwindowsxpstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#include <private/qpaintengine_raster_p.h>
-#include <qlibrary.h>
#include <qpaintengine.h>
#include <qwidget.h>
#include <qapplication.h>
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index f3c6069f8a..b50c4b6be4 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1139,7 +1139,10 @@ void QWindowsXPStyle::polish(QWidget *widget)
if (!QWindowsXPStylePrivate::useXP())
return;
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
|| qobject_cast<QToolButton*>(widget)
|| qobject_cast<QTabBar*>(widget)
#ifndef QT_NO_COMBOBOX
@@ -1211,7 +1214,10 @@ void QWindowsXPStyle::unpolish(QWidget *widget)
// already in the map might be old (other style).
d->cleanupHandleMap();
}
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
|| qobject_cast<QToolButton*>(widget)
|| qobject_cast<QTabBar*>(widget)
#ifndef QT_NO_COMBOBOX
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 7bf0e0b9d6..4e438bd851 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -45,6 +45,8 @@
#include <QtGui/qkeysequence.h>
#include <QtWidgets/qwidget.h>
+QT_REQUIRE_CONFIG(abstractbutton);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index d091d1e970..abdd946c49 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -65,7 +65,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
#ifdef Q_OS_WIN
-# include <qlibrary.h>
# include <qt_windows.h>
#endif
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 5a789c2d66..a3e55114bb 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -711,8 +711,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
return;
// Remove it from the standard button hash first and then from the roles
- if (QPushButton *pushButton = qobject_cast<QPushButton *>(button))
- d->standardButtonHash.remove(pushButton);
+ d->standardButtonHash.remove(reinterpret_cast<QPushButton *>(button));
for (int i = 0; i < NRoles; ++i) {
QList<QAbstractButton *> &list = d->buttonLists[i];
for (int j = 0; j < list.count(); ++j) {
@@ -878,7 +877,7 @@ void QDialogButtonBoxPrivate::_q_handleButtonDestroyed()
Q_Q(QDialogButtonBox);
if (QObject *object = q->sender()) {
QBoolBlocker skippy(internalRemove);
- q->removeButton(static_cast<QAbstractButton *>(object));
+ q->removeButton(reinterpret_cast<QAbstractButton *>(object));
}
}
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index fa0cff45c9..39e072234e 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -41,7 +41,9 @@
#include "qevent.h"
#include "qdrawutil.h"
#include "qapplication.h"
+#if QT_CONFIG(abstractbutton)
#include "qabstractbutton.h"
+#endif
#include "qstyle.h"
#include "qstyleoption.h"
#include <limits.h>
@@ -972,12 +974,14 @@ bool QLabel::event(QEvent *e)
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
if (se->shortcutId() == d->shortcutId) {
QWidget * w = d->buddy;
- QAbstractButton *button = qobject_cast<QAbstractButton *>(w);
if (w->focusPolicy() != Qt::NoFocus)
w->setFocus(Qt::ShortcutFocusReason);
+#if QT_CONFIG(abstractbutton)
+ QAbstractButton *button = qobject_cast<QAbstractButton *>(w);
if (button && !se->isAmbiguous())
button->animateClick();
else
+#endif
window()->setAttribute(Qt::WA_KeyboardFocusChange);
return true;
}
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 5ea86a592e..b348c8090d 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -1856,7 +1856,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
topLevelWindow->removeEventFilter(q);
if (baseWidget && !drawTitleBarWhenMaximized())
topLevelWindow->setWindowModified(false);
- originalTitle = QString::null;
+ originalTitle.clear();
}
#endif // QT_NO_MENUBAR
@@ -2760,7 +2760,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
#ifndef QT_NO_MENUBAR
} else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
- d->originalTitle = QString::null;
+ d->originalTitle.clear();
if (d->baseWidget && d->baseWidget->windowTitle() == windowTitle())
d->updateWindowTitle(true);
else
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 295fb7d89c..4e55f0b132 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -401,17 +401,6 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
itemsDirty = 0;
}
-QSize QMenuPrivate::adjustMenuSizeForScreen(const QRect &screen)
-{
- Q_Q(QMenu);
- QSize ret = screen.size();
- itemsDirty = true;
- updateActionRects(screen);
- const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
- ret.setWidth(actionRects.at(getLastVisibleAction()).right() + fw);
- return ret;
-}
-
int QMenuPrivate::getLastVisibleAction() const
{
//let's try to get the last visible action
@@ -2266,7 +2255,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
else
pos = p;
- QSize size = sizeHint();
+ const QSize menuSizeHint(sizeHint());
+ QSize size = menuSizeHint;
QRect screen;
#ifndef QT_NO_GRAPHICSVIEW
bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
@@ -2279,13 +2269,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen);
// if the screens have very different geometries and the menu is too big, we have to recalculate
- if (size.height() > screen.height() || size.width() > screen.width()) {
- size = d->adjustMenuSizeForScreen(screen);
- adjustToDesktop = true;
- }
- // Layout is not right, we might be able to save horizontal space
- if (d->ncols >1 && size.height() < screen.height()) {
- size = d->adjustMenuSizeForScreen(screen);
+ if ((size.height() > screen.height() || size.width() > screen.width()) ||
+ // Layout is not right, we might be able to save horizontal space
+ (d->ncols >1 && size.height() < screen.height())) {
+ size.setWidth(qMin(menuSizeHint.width(), screen.width() - desktopFrame * 2));
+ size.setHeight(qMin(menuSizeHint.height(), screen.height() - desktopFrame * 2));
adjustToDesktop = true;
}
@@ -2338,7 +2326,6 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
d->mousePopupPos = mouse;
const bool snapToMouse = !d->causedPopup.widget && (QRect(p.x() - 3, p.y() - 3, 6, 6).contains(mouse));
- const QSize menuSize(sizeHint());
if (adjustToDesktop) {
// handle popup falling "off screen"
if (isRightToLeft()) {
@@ -2372,7 +2359,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if (pos.y() < screen.top() + desktopFrame)
pos.setY(screen.top() + desktopFrame);
- if (pos.y() + menuSize.height() - 1 > screen.bottom() - desktopFrame) {
+ if (pos.y() + menuSizeHint.height() - 1 > screen.bottom() - desktopFrame) {
if (d->scroll) {
d->scroll->scrollFlags |= uint(QMenuPrivate::QMenuScroller::ScrollDown);
int y = qMax(screen.y(),pos.y());
@@ -2385,29 +2372,29 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
}
const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
QMenu *caused = qobject_cast<QMenu*>(d_func()->causedPopup.widget);
- if (caused && caused->geometry().width() + menuSize.width() + subMenuOffset < screen.width()) {
+ if (caused && caused->geometry().width() + menuSizeHint.width() + subMenuOffset < screen.width()) {
QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction));
const QPoint actionTopLeft = caused->mapToGlobal(parentActionRect.topLeft());
parentActionRect.moveTopLeft(actionTopLeft);
if (isRightToLeft()) {
- if ((pos.x() + menuSize.width() > parentActionRect.left() - subMenuOffset)
+ if ((pos.x() + menuSizeHint.width() > parentActionRect.left() - subMenuOffset)
&& (pos.x() < parentActionRect.right()))
{
- pos.rx() = parentActionRect.left() - menuSize.width();
+ pos.rx() = parentActionRect.left() - menuSizeHint.width();
if (pos.x() < screen.x())
pos.rx() = parentActionRect.right();
- if (pos.x() + menuSize.width() > screen.x() + screen.width())
+ if (pos.x() + menuSizeHint.width() > screen.x() + screen.width())
pos.rx() = screen.x();
}
} else {
if ((pos.x() < parentActionRect.right() + subMenuOffset)
- && (pos.x() + menuSize.width() > parentActionRect.left()))
+ && (pos.x() + menuSizeHint.width() > parentActionRect.left()))
{
pos.rx() = parentActionRect.right();
- if (pos.x() + menuSize.width() > screen.x() + screen.width())
- pos.rx() = parentActionRect.left() - menuSize.width();
+ if (pos.x() + menuSizeHint.width() > screen.x() + screen.width())
+ pos.rx() = parentActionRect.left() - menuSizeHint.width();
if (pos.x() < screen.x())
- pos.rx() = screen.x() + screen.width() - menuSize.width();
+ pos.rx() = screen.x() + screen.width() - menuSizeHint.width();
}
}
}
@@ -3515,11 +3502,22 @@ void QMenu::internalDelayedPopup()
d->activeMenu->d_func()->causedPopup.widget = this;
d->activeMenu->d_func()->causedPopup.action = d->currentAction;
+ QRect screen;
+#ifndef QT_NO_GRAPHICSVIEW
+ bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
+ if (isEmbedded)
+ screen = d->popupGeometry(this);
+ else
+#endif
+ screen = d->popupGeometry(QApplication::desktop()->screenNumber(pos()));
+
int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
const QRect actionRect(d->actionRect(d->currentAction));
- const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
+ QPoint subMenuPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
+ if (subMenuPos.x() > screen.right())
+ subMenuPos.setX(QCursor::pos().x());
- d->activeMenu->popup(rightPos);
+ d->activeMenu->popup(subMenuPos);
d->sloppyState.setSubMenuPopup(actionRect, d->currentAction, d->activeMenu);
#if !defined(Q_OS_DARWIN)
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 64291e842f..898fa3161b 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -311,7 +311,6 @@ public:
mutable uint ncols : 4; //4 bits is probably plenty
uint collapsibleSeparators : 1;
uint toolTipsVisible : 1;
- QSize adjustMenuSizeForScreen(const QRect & screen);
int getLastVisibleAction() const;
bool activationRecursionGuard;
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 95d159f12d..e2470524da 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -41,13 +41,14 @@
#define QTOOLBUTTON_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#if QT_CONFIG(toolbutton)
+
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_TOOLBUTTON
-
class QToolButtonPrivate;
class QMenu;
class QStyleOptionToolButton;
@@ -134,8 +135,8 @@ private:
};
-#endif // QT_NO_TOOLBUTTON
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(toolbutton)
+
#endif // QTOOLBUTTON_H
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 016598849b..dc7353a6ca 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -112,9 +112,9 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
return false;
}
- QMouseEvent *e = (QMouseEvent*)ee;
- switch (e->type()) {
+ switch (ee->type()) {
case QEvent::MouseButtonPress: {
+ QMouseEvent *e = static_cast<QMouseEvent *>(ee);
if (w->isMaximized())
break;
if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos())))
@@ -155,7 +155,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
case QEvent::MouseButtonRelease:
if (w->isMaximized())
break;
- if (e->button() == Qt::LeftButton) {
+ if (static_cast<QMouseEvent *>(ee)->button() == Qt::LeftButton) {
moveResizeMode = false;
buttonDown = false;
widget->releaseMouse();
@@ -171,6 +171,7 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
case QEvent::MouseMove: {
if (w->isMaximized())
break;
+ QMouseEvent *e = static_cast<QMouseEvent *>(ee);
buttonDown = buttonDown && (e->buttons() & Qt::LeftButton); // safety, state machine broken!
bool me = movingEnabled;
movingEnabled = (me && o == widget && (buttonDown || moveResizeMode));
@@ -184,11 +185,11 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee)
}
} break;
case QEvent::KeyPress:
- keyPressEvent((QKeyEvent*)e);
+ keyPressEvent(static_cast<QKeyEvent *>(ee));
break;
case QEvent::ShortcutOverride:
if (buttonDown) {
- ((QKeyEvent*)ee)->accept();
+ ee->accept();
return true;
}
break;
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index f67640e40f..22e083a3d4 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -3,8 +3,6 @@
HEADERS += \
widgets/qbuttongroup.h \
widgets/qbuttongroup_p.h \
- widgets/qabstractbutton.h \
- widgets/qabstractbutton_p.h \
widgets/qabstractspinbox.h \
widgets/qabstractspinbox_p.h \
widgets/qcalendarwidget.h \
@@ -76,7 +74,6 @@ HEADERS += \
SOURCES += \
widgets/qbuttongroup.cpp \
- widgets/qabstractbutton.cpp \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
widgets/qcombobox.cpp \
@@ -128,6 +125,15 @@ SOURCES += \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp
+qtConfig(abstractbutton) {
+ HEADERS += \
+ widgets/qabstractbutton.h \
+ widgets/qabstractbutton_p.h
+
+ SOURCES += \
+ widgets/qabstractbutton.cpp
+}
+
qtConfig(abstractslider) {
HEADERS += \
widgets/qabstractslider.h \