From 3c657383c64ac09f46d3f6201b917531a6b5f2e8 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sun, 3 Feb 2013 04:19:32 +0100 Subject: [PATCH 01/20] Doc: Fixed value descriptions for enum QAbstractSocket::SocketError. Change-Id: I7ef5ff53ac838a7793852c1eadd9610e630cae43 Reviewed-by: Jerome Pasion --- src/network/socket/qabstractsocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 833c07dfe0..c19238d768 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -313,15 +313,15 @@ or the proxy server stopped responding in the authentication phase. \value ProxyNotFoundError The proxy address set with setProxy() (or the application proxy) was not found. - \value ProxyProtocolError The connection negotiation with the proxy server + \value ProxyProtocolError The connection negotiation with the proxy server failed, because the response from the proxy server could not be understood. \value OperationError An operation was attempted while the socket was in a state that did not permit it. - \value SslInternalError The SSL library being used reported a internal error, this is + \value SslInternalError The SSL library being used reported an internal error. This is probably the result of a bad installation or misconfiguration of the library. - \value SslInvalidUserDataError Invalid data(certificate, key, cypher, etc.) was + \value SslInvalidUserDataError Invalid data (certificate, key, cypher, etc.) was provided and its use resulted in an error in the SSL library. - \value TemporaryError A temporary error occurred(e.g., operation would block and socket + \value TemporaryError A temporary error occurred (e.g., operation would block and socket is non-blocking). \value UnknownSocketError An unidentified error occurred. From 18a65b6cdf0895e3ce8a101f8a315751297b3541 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Mon, 18 Feb 2013 12:20:59 +0100 Subject: [PATCH 02/20] Blackberry: Specify QMAKE_LFLAGS_RPATHLINK for BB10 platform The linker from the BBNDK needs -rpath-link to resolve transitive dependencies, like on Linux. Change-Id: I85726841ea15070e8661b9bdbffaf950fdd247e9 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/qcc-base-qnx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf index 68a4182e0f..b1bae7122d 100644 --- a/mkspecs/common/qcc-base-qnx.conf +++ b/mkspecs/common/qcc-base-qnx.conf @@ -14,6 +14,7 @@ QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_SONAME += -Wl,-soname, QMAKE_LFLAGS_THREAD += QMAKE_LFLAGS_RPATH = -Wl,-rpath, +QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link, # -Bsymbolic-functions (ld) support QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions From 9dcbfc1c44099d2d510163cf16bbb72e6ea42cae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Feb 2013 18:15:18 +0100 Subject: [PATCH 03/20] refactor build config resolution the current approach of having "free-flying" prf files for such a core issue is rather insane. this was noticed early on, as evidenced by the forcible loading of debug/release/debug_and_release in default_post. however, things remained a mess, in particular static vs. shared. consequently, the commit merges all related feature files. the actual config resolution is put in a separate feature file, so it can be loaded by resolve_target if that happens to be loaded early on. Change-Id: Ie30e7c63cabe9409a3263ca1650e323a870926f2 Reviewed-by: Joerg Bornemann --- mkspecs/features/debug.prf | 7 ---- mkspecs/features/debug_and_release.prf | 1 - mkspecs/features/default_post.prf | 29 +++++++++++---- mkspecs/features/dll.prf | 2 - mkspecs/features/release.prf | 7 ---- mkspecs/features/resolve_config.prf | 51 ++++++++++++++++++++++++++ mkspecs/features/resolve_target.prf | 2 + mkspecs/features/shared.prf | 7 ---- mkspecs/features/static.prf | 14 ------- mkspecs/features/static_and_shared.prf | 3 -- mkspecs/features/staticlib.prf | 1 - 11 files changed, 75 insertions(+), 49 deletions(-) delete mode 100644 mkspecs/features/debug.prf delete mode 100644 mkspecs/features/debug_and_release.prf delete mode 100644 mkspecs/features/dll.prf delete mode 100644 mkspecs/features/release.prf create mode 100644 mkspecs/features/resolve_config.prf delete mode 100644 mkspecs/features/shared.prf delete mode 100644 mkspecs/features/static.prf delete mode 100644 mkspecs/features/static_and_shared.prf delete mode 100644 mkspecs/features/staticlib.prf diff --git a/mkspecs/features/debug.prf b/mkspecs/features/debug.prf deleted file mode 100644 index b11bfbf6b6..0000000000 --- a/mkspecs/features/debug.prf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG -= release -QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG -QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG -QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG -QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG -!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(debug, release) diff --git a/mkspecs/features/debug_and_release.prf b/mkspecs/features/debug_and_release.prf deleted file mode 100644 index 8b8932184f..0000000000 --- a/mkspecs/features/debug_and_release.prf +++ /dev/null @@ -1 +0,0 @@ -!macx-xcode:addExclusiveBuilds(debug, Debug, release, Release) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 3afab5240e..fe825f5807 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -4,10 +4,7 @@ contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target !have_target:!force_qt: CONFIG -= qt -!shared:!dll:!static:!staticlib { - contains(QT_CONFIG, static): CONFIG += static - else: CONFIG += shared -} +load(resolve_config) QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) !isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ... @@ -24,9 +21,27 @@ force_debug_info { QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO } -CONFIG(debug, debug|release):load(debug) -else:load(release) -debug_and_release:load(debug_and_release) +debug { + QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG + QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG + QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG + QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG + QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG +} else { + QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE + QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE + QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE + QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE + QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE +} + +dll:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL +static:mac: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB +staticlib:unix { + QMAKE_CFLAGS += $$QMAKE_CFLAGS_STATIC_LIB + QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB +} + incredibuild_xge { CONFIG -= incredibuild_xge CONFIG = incredibuild_xge $$CONFIG diff --git a/mkspecs/features/dll.prf b/mkspecs/features/dll.prf deleted file mode 100644 index 943ab93def..0000000000 --- a/mkspecs/features/dll.prf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG += shared - diff --git a/mkspecs/features/release.prf b/mkspecs/features/release.prf deleted file mode 100644 index 2d63c240d0..0000000000 --- a/mkspecs/features/release.prf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG -= debug -QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE -QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE -QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE -QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE -!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(release, debug) \ No newline at end of file diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf new file mode 100644 index 0000000000..e85435cf73 --- /dev/null +++ b/mkspecs/features/resolve_config.prf @@ -0,0 +1,51 @@ +# +# W A R N I N G +# ------------- +# +# This file is not part of the Qt API. It exists purely as an +# implementation detail. It may change from version to version +# without notice, or even be removed. +# +# We mean it. +# + +staticlib: \ + CONFIG += static +else: dll: \ + CONFIG += shared + +!shared:!static { + contains(QT_CONFIG, static): CONFIG += static + else: CONFIG += shared +} + +CONFIG(static, static|shared) { + CONFIG -= shared dll + contains(TEMPLATE, ".*lib"): CONFIG += staticlib +} else { + CONFIG -= static staticlib + contains(TEMPLATE, ".*lib"): CONFIG += dll +} + +static_and_shared { + !macx-xcode: addExclusiveBuilds(static, Static, shared, Shared) +} else: fix_output_dirs { + static: \ + fixExclusiveOutputDirs(static, shared) + else: \ + fixExclusiveOutputDirs(shared, static) +} + +CONFIG(debug, debug|release): \ + CONFIG -= release +else: \ + CONFIG -= debug + +debug_and_release { + !macx-xcode: addExclusiveBuilds(debug, Debug, release, Release) +} else: fix_output_dirs { + debug: \ + fixExclusiveOutputDirs(debug, release) + else: \ + fixExclusiveOutputDirs(release, debug) +} diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf index c60faf22c0..8cd12b2a00 100644 --- a/mkspecs/features/resolve_target.prf +++ b/mkspecs/features/resolve_target.prf @@ -9,6 +9,8 @@ # We mean it. # +load(resolve_config) + QMAKE_RESOLVED_TARGET = $$absolute_path($$DESTDIR, $$OUT_PWD)/ win32 { diff --git a/mkspecs/features/shared.prf b/mkspecs/features/shared.prf deleted file mode 100644 index 86efd8e6d8..0000000000 --- a/mkspecs/features/shared.prf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG -= static -contains(TEMPLATE, ".*lib"): { - CONFIG += dll - CONFIG -= staticlib - win32:QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL -} -!static_and_shared:fix_output_dirs:fixExclusiveOutputDirs(shared, static) diff --git a/mkspecs/features/static.prf b/mkspecs/features/static.prf deleted file mode 100644 index 288852d5df..0000000000 --- a/mkspecs/features/static.prf +++ /dev/null @@ -1,14 +0,0 @@ -CONFIG -= shared dll -contains(TEMPLATE, ".*lib"):{ - CONFIG += staticlib - unix { - QMAKE_CFLAGS += $$QMAKE_CFLAGS_STATIC_LIB - QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB - } -} - -mac { - QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB -} - -!static_and_shared:fix_output_dirs:fixExclusiveOutputDirs(static, shared) diff --git a/mkspecs/features/static_and_shared.prf b/mkspecs/features/static_and_shared.prf deleted file mode 100644 index 47c68e50a0..0000000000 --- a/mkspecs/features/static_and_shared.prf +++ /dev/null @@ -1,3 +0,0 @@ -have_target:!macx-xcode { - addExclusiveBuilds(static, Static, shared, Shared) -} diff --git a/mkspecs/features/staticlib.prf b/mkspecs/features/staticlib.prf deleted file mode 100644 index 4884964a6f..0000000000 --- a/mkspecs/features/staticlib.prf +++ /dev/null @@ -1 +0,0 @@ -CONFIG += static From 2e4ce301f98d3f463a7151c21dc8cc407cd8702c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Feb 2013 18:15:22 +0100 Subject: [PATCH 04/20] take advantage of new safety regarding build config resolution all tests that happen after default_post loads resolve_config can rely on debug vs. release, static vs. shared, and staticlib vs. dll being properly "de-conflicted". Change-Id: Ie0b4defcd6024bd1c25f53ba7e03621052d96492 Reviewed-by: Joerg Bornemann --- mkspecs/features/default_post.prf | 2 +- mkspecs/features/qt.prf | 2 +- mkspecs/features/unix/bsymbolic_functions.prf | 2 +- mkspecs/features/unix/gdb_dwarf_index.prf | 2 +- mkspecs/features/unix/separate_debug_info.prf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index fe825f5807..cdd200e80b 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -8,7 +8,7 @@ load(resolve_config) QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) !isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ... - !staticlib:!static:CONFIG(release, debug|release):have_target: \ # is it applicable? + !static:release:have_target: \ # is it applicable? !contains(TARGET, .*phony_target.*): \ # monster hack, you don't really see this here, right? ;) system($$QT_BREAKPAD_ROOT_PATH/qtbreakpadsymbols --breakpad-exists) { # do we really have it? CONFIG += breakpad force_debug_info diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 5a1e39b1c7..8de038c5f8 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -125,7 +125,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { } isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:wince*: { QT_ITEM = - CONFIG(debug, debug|release): QT_ITEM = $${QTPLUG}d4.dll + debug: QT_ITEM = $${QTPLUG}d4.dll else: QT_ITEM = $${QTPLUG}4.dll eval(qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS/get]/$${QT_PLUGINPATH}/$${QT_ITEM}) diff --git a/mkspecs/features/unix/bsymbolic_functions.prf b/mkspecs/features/unix/bsymbolic_functions.prf index 5a60463e36..5fca5ac170 100644 --- a/mkspecs/features/unix/bsymbolic_functions.prf +++ b/mkspecs/features/unix/bsymbolic_functions.prf @@ -1,5 +1,5 @@ -!staticlib:!static:contains(TEMPLATE, lib) { +dll { QMAKE_LFLAGS_SHLIB += $$QMAKE_LFLAGS_BSYMBOLIC_FUNC !isEmpty(QMAKE_DYNAMIC_LIST_FILE):QMAKE_LFLAGS_SHLIB += $$QMAKE_LFLAGS_DYNAMIC_LIST$$QMAKE_DYNAMIC_LIST_FILE diff --git a/mkspecs/features/unix/gdb_dwarf_index.prf b/mkspecs/features/unix/gdb_dwarf_index.prf index 9a7a8e01bc..0a5ee507ff 100644 --- a/mkspecs/features/unix/gdb_dwarf_index.prf +++ b/mkspecs/features/unix/gdb_dwarf_index.prf @@ -1,4 +1,4 @@ -!CONFIG(separate_debug_info):CONFIG(debug, debug|release):have_target:!staticlib:!static:!isEmpty(QMAKE_OBJCOPY) { +!separate_debug_info:have_target:debug:!static:!isEmpty(QMAKE_OBJCOPY) { contains(TEMPLATE, "lib") { QMAKE_GDB_INDEX = { test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\"; } && diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index 0e0f60e16e..cea1731888 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -1,5 +1,5 @@ -!separate_debug_info_nocopy:have_target:!staticlib:!static:!isEmpty(QMAKE_OBJCOPY) { +!separate_debug_info_nocopy:have_target:!static:!isEmpty(QMAKE_OBJCOPY) { qnx:debug_info_suffix=sym else:debug_info_suffix=debug QMAKE_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.$$debug_info_suffix\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.$$debug_info_suffix\" \"\$\$targ\" && chmod -x \"\$\$targ.$$debug_info_suffix\" From 489d8a0627c46092d20f476d5521ecafd42e5ce5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Feb 2013 19:28:28 +0100 Subject: [PATCH 05/20] add QT_CONFIG's static/shared to CONFIG on startup ... instead of as a fallback in default_post. it was this way in qt4, and it requires less code to be written in the end. we are already doing it for debug/release as well. Change-Id: I6e02849d61d14a18375cf64a5990768931ebac48 Reviewed-by: Joerg Bornemann --- configure | 2 ++ mkspecs/features/qt_functions.prf | 2 +- mkspecs/features/qt_module.prf | 8 +------- mkspecs/features/qt_plugin.prf | 5 +---- mkspecs/features/resolve_config.prf | 5 ----- tools/configure/configureapp.cpp | 1 + 6 files changed, 6 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 0d30c97504..4a1836e5b0 100755 --- a/configure +++ b/configure @@ -5330,9 +5330,11 @@ fi if [ "$CFG_SHARED" = "yes" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared" QT_CONFIG="$QT_CONFIG shared" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared" elif [ "$CFG_SHARED" = "no" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-static" QT_CONFIG="$QT_CONFIG static" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG static" fi #FIXME: qpa is implicit this should all be removed diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index b6e3454f0e..bac7ca1751 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -10,7 +10,7 @@ defineReplace(qtPlatformTargetSuffix) { defineReplace(qtLibraryTarget) { LIBRARY_NAME = $$1 - mac:!static:contains(QT_CONFIG, qt_framework) { + mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) { QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME export(QMAKE_FRAMEWORK_BUNDLE_NAME) } else { diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index e6263af7a5..728d1f5f85 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -25,12 +25,6 @@ isEmpty(VERSION):VERSION = $$QT_VERSION # Compile as shared/DLL or static according to the option given to configure # unless overridden. Host builds are always static host_build|staticlib: CONFIG += static -!static:!shared { - contains(QT_CONFIG, static): \ - CONFIG += static - else: \ - CONFIG += shared -} ucmodule = $$upper($$MODULE) @@ -87,7 +81,7 @@ contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_no contains(QT_CONFIG, c++11):CONFIG += c++11 #mac frameworks -mac:!static:contains(QT_CONFIG, qt_framework) { +mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) { #QMAKE_FRAMEWORK_VERSION = 4.0 CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework CONFIG(release, debug|release) { diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 2ec523d78c..54a995daae 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -28,10 +28,7 @@ contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy contains(QT_CONFIG, c++11):CONFIG += c++11 -contains(QT_CONFIG, static):CONFIG += static -else:CONFIG += shared - -static { +CONFIG(static, static|shared) { isEmpty(MODULE): MODULE = $$basename(TARGET) MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_plugin_$${MODULE}.pri diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf index e85435cf73..41e82b2382 100644 --- a/mkspecs/features/resolve_config.prf +++ b/mkspecs/features/resolve_config.prf @@ -14,11 +14,6 @@ staticlib: \ else: dll: \ CONFIG += shared -!shared:!static { - contains(QT_CONFIG, static): CONFIG += static - else: CONFIG += shared -} - CONFIG(static, static|shared) { CONFIG -= shared dll contains(TEMPLATE, ".*lib"): CONFIG += staticlib diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 5fe1e029fb..966571be77 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3029,6 +3029,7 @@ void Configure::generateQConfigPri() configStream << "CONFIG+= "; configStream << dictionary[ "BUILD" ]; + configStream << (dictionary[ "SHARED" ] == "no" ? " static" : " shared"); if (dictionary[ "LTCG" ] == "yes") configStream << " ltcg"; From 8afd7b4675b2d5bfd0a00981095a6cac6c83e0a4 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Feb 2013 14:59:32 +0000 Subject: [PATCH 06/20] QNX: Print the buffer size before crashing, for debug purposes. Change-Id: I2d423ee3717bb09b7bb2c63f645e5315be1fa611 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 2cee666e23..7c57f6a656 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -362,6 +362,7 @@ void QQnxWindow::setBufferSize(const QSize &size) errno = 0; result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT); if (result != 0) { + qWarning() << "QQnxWindow: Buffer size was" << size; qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno); } From 4b42c91821b913aec32ab82d2d5e29ffa2f2a8ad Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Feb 2013 11:27:24 +0100 Subject: [PATCH 07/20] QColorDialog/QFontDialog: Fix setOption(). Call setOptions() such that the option takes effect. Task-number: QTBUG-28817 Change-Id: Ibef834efc988d3ba49e88ea88ef475b1fd7fd98f Reviewed-by: J-P Nurmi Reviewed-by: Oliver Wolff --- src/widgets/dialogs/qcolordialog.cpp | 5 +++-- src/widgets/dialogs/qfontdialog.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 5adb4ba6da..af43ecc8df 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1735,8 +1735,9 @@ QColor QColorDialog::selectedColor() const */ void QColorDialog::setOption(ColorDialogOption option, bool on) { - Q_D(QColorDialog); - d->options->setOption(static_cast(option), on); + const QColorDialog::ColorDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*! diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 79aab3280f..4036dc80ab 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -853,8 +853,9 @@ QFont QFontDialog::selectedFont() const */ void QFontDialog::setOption(FontDialogOption option, bool on) { - Q_D(QFontDialog); - d->options->setOption(static_cast(option), on); + const QFontDialog::FontDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*! From 73d32873cf307a60bbe83f2c9e973236bccb4162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 5 Feb 2013 10:06:51 +0100 Subject: [PATCH 08/20] Cocoa: Add QMdiSubWindow size grip back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change all Q_WS_MAC -> Q_OS_MAC in qmdisubwindow.cpp Remove QEXPECT_FAIL from tst_qmdisubwindow.cpp. Task-number: QTBUG-29434, QTBUG-25297 Change-Id: I299b87ab994e2d5ba93d5bbae48de0df1ac1c9d6 Reviewed-by: Morten Johan Sørvig --- src/widgets/widgets/qmdisubwindow.cpp | 28 +++++++++---------- .../qmdisubwindow/tst_qmdisubwindow.cpp | 12 -------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 13d0b180cc..02b3cc7ba2 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -160,7 +160,7 @@ #include #include #include -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) #include #endif #include @@ -304,7 +304,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti Q_ASSERT(helpEvent->type() == QEvent::ToolTip); Q_ASSERT(widget); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) // Native Mac windows don't show tool tip. if (qobject_cast(widget->style())) return; @@ -1079,7 +1079,7 @@ void QMdiSubWindowPrivate::updateCursor() { #ifndef QT_NO_CURSOR Q_Q(QMdiSubWindow); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) return; #endif @@ -1499,7 +1499,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMinButton: -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) { if (q->isMinimized()) q->showNormal(); @@ -1516,7 +1516,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMaxButton: -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) { if (q->isMaximized()) q->showNormal(); @@ -1563,7 +1563,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const } QRegion region; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) return region; #endif @@ -1717,7 +1717,7 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co } int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) // ### Fix mac style, the +4 pixels hack is not necessary anymore if (qobject_cast(q->style())) height -= 4; @@ -1772,7 +1772,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) return true; #else if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) @@ -2180,7 +2180,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) return; newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); bool putSizeGripInLayout = layout ? true : false; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) putSizeGripInLayout = false; #endif @@ -2263,7 +2263,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) d->titleBarPalette = d->desktopPalette(); d->font = QApplication::font("QMdiSubWindowTitleBar"); // We don't want the menu icon by default on mac. -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (windowIcon().isNull()) d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); else @@ -2831,7 +2831,7 @@ bool QMdiSubWindow::event(QEvent *event) d->isMaximizeMode = false; d->isWidgetHiddenByUs = false; if (!parent()) { -#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style())) delete d->sizeGrip; #endif @@ -2926,7 +2926,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) return; } -#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style()) && !d->sizeGrip && !(windowFlags() & Qt::FramelessWindowHint)) { d->setSizeGrip(new QSizeGrip(0)); @@ -3320,7 +3320,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, d->hoveredSubControl, this); } -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style()) && !hoverRegion.isEmpty()) hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options)); #endif @@ -3530,7 +3530,7 @@ QSize QMdiSubWindow::minimumSizeHint() const int sizeGripHeight = 0; if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast(this))) sizeGripHeight = d->sizeGrip->height(); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) else if (parent() && qobject_cast(style()) && !d->sizeGrip) sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); #endif diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 6198aa8668..2163426cac 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -600,9 +600,6 @@ void tst_QMdiSubWindow::showShaded() else #endif mouseReceiver = window; -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "QTBUG-25297", Abort); -#endif QVERIFY(mouseReceiver); sendMouseMove(mouseReceiver, mousePosition, Qt::NoButton); sendMousePress(mouseReceiver, mousePosition); @@ -711,9 +708,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove() mouseReceiver = qFindChild(window); else mouseReceiver = window; -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "QTBUG-25297", Abort); -#endif QVERIFY(mouseReceiver); // ----------------------------- resize ----------------------------- @@ -1451,9 +1445,6 @@ void tst_QMdiSubWindow::defaultSizeGrip() // QSizeGrip on windows with decoration. QMdiSubWindow *windowWithDecoration = mdiArea.addSubWindow(new QWidget); windowWithDecoration->show(); -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "QTBUG-25297", Abort); -#endif QVERIFY(qFindChild(windowWithDecoration)); // ...but not on windows without decoration (Qt::FramelessWindowHint). @@ -1713,9 +1704,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize() // to minimize the window. subWindow->showMinimized(); QVERIFY(subWindow->isMinimized()); -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "QTBUG-25297", Abort); -#endif QCOMPARE(subWindow->size(), minimizedSize); QCOMPARE(subWindow->minimumSize(), minimizedSize); From 5d6916b4c1f6ea3b86cc3d820c433fec8a42fad0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 14 Feb 2013 14:44:48 +0100 Subject: [PATCH 09/20] Doc: Removed reference to deprecated \badcode command. -QDoc doesn't differentiate between \badcode and \code. They both look the same in the output. Change-Id: Ifabd51b7e433a1c30cf30c267d3ce63dded1bd43 Reviewed-by: Leena Miettinen --- src/corelib/doc/src/threads-basics.qdoc | 3 +- src/dbus/qdbusargument.cpp | 3 +- src/tools/qdoc/doc/qdoc-manual.qdoc | 79 +++---------------------- src/widgets/widgets/qmdisubwindow.cpp | 3 +- 4 files changed, 14 insertions(+), 74 deletions(-) diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc index dad41368c6..dd5267f0ba 100644 --- a/src/corelib/doc/src/threads-basics.qdoc +++ b/src/corelib/doc/src/threads-basics.qdoc @@ -269,7 +269,8 @@ This is the result of running the code: - \badcode + \code + //bad code hello from GUI thread 3079423696 hello from worker thread 3076111216 \endcode diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 191eb5eea6..dab2daf90f 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -212,7 +212,8 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d) The following example illustrates this wrong usage in context of a class that may contain invalid data: - \badcode + \code + //bad code // Wrongly marshall the MyTime data into a D-Bus argument QDBusArgument &operator<<(QDBusArgument &argument, const MyTime &mytime) { diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index 5254c46eb5..4d70faa968 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -243,7 +243,6 @@ \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)} \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} @@ -1175,8 +1174,7 @@ snippets. It renders the code verbatim in a separate paragraph in the code font. - When processing any of the \\code, \l {badcode-command} - {\\badcode}, \l {newcode-command} {\\newcode} or \l + When processing any of the \\code, \l {newcode-command} {\\newcode} or \l {oldcode-command} {\\oldcode} commands, QDoc removes all indentation that is common for the verbatim code blocks within a \c{/}\c{*!} ... \c{*}\c{/} comment before it adds the standard @@ -1225,67 +1223,9 @@ See also \l {c-command} {\\c}, \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} - {\\quotefromfile}, \l {badcode-command} {\\badcode}, \l - {newcode-command} {\\newcode} and \l {oldcode-command} + {\\quotefromfile}, \l{newcode-command} {\\newcode} and \l {oldcode-command} {\\oldcode}. - \target badcode-command - \section1 \\badcode - - The \\badcode and \\endcode commands delimit a snippet of code - that doesn't compile or is wrong for some other reason. - - The \\badcode command is similar to the \l {code-command} {\\code} - command, but it renders the code snippet using a grey font instead - of black. - - Like the \l {code-command} {\\code} command, this command begins - its code snippet on a new line rendered in the code font and with - the standard indentation. - - \code - / *! - The statement below is rendered using the - regular \\code command: - - \code - statusbar()->message(tr("Host %1 found").arg(hostName)); - \ endcode - - While the following statement is rendered using - the \\badcode command: - - \badcode - statusbar()->message(tr("Host" + hostName + " found")); - \ endcode - * / - \endcode - - QDoc renders this as: - - \quotation - The statement below is rendered using the - regular \\code command: - - \code - statusbar()->message(tr("Host %1 found").arg(hostName)); - \endcode - - While the following statement is rendered using - the \\badcode command: - - \badcode - statusbar()->message(tr("Host" + hostName + " found")); - \endcode - \endquotation - - Other QDoc commands are disabled within \\badcode... \\endcode, - and the special character '\\' is accepted and rendered like the - rest of the code. - - See also \l {code-command} {\\code}, \l {newcode-command} - {\\newcode} and \l {oldcode-command} {\\oldcode}. - \target newcode-command \section1 \\newcode @@ -1293,14 +1233,12 @@ show how to port a snippet of code to a new version of an API. The \\newcode command, and its companion the \\oldcode command, is - a convenience combination of the \l {code-command} {\\code} and \l - {badcode-command} {\\badcode} commands: The combination provides a - text relating the two code snippets to each other. The command - requires a preceding \\oldcode statement. + a convenience combination of the \l {code-command} {\\code} commands: + The combination provides a text relating the two code snippets to each + other. The command requires a preceding \\oldcode statement. - Like the \l {code-command} {\\code} and \l {badcode-command} - {\\badcode} commands, the \\newcode command renders its code on a - new line in the documentation using a typewriter font and the + Like the \l{code-command}{\\code} command, the \\newcode command renders its + code on a new line in the documentation using a typewriter font and the standard indentation. \code @@ -1339,7 +1277,7 @@ \\newcode statement; otherwise QDoc fails to parse the command and emits a warning. - See also \l {newcode-command} {\\newcode} and \l {badcode-command} {\\badcode}. + See also \l {newcode-command} {\\newcode}. \target qml-command \section1 \\qml @@ -8688,7 +8626,6 @@ \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} \li \l { 22-qdoc-configuration-generalvariables.html#basedir-variable} {basedir} \span {class="newStuff"} {(experimental)} - \li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 02b3cc7ba2..01ee2528f3 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -2236,7 +2236,8 @@ void QMdiSubWindowPrivate::updateInternalWindowTitle() Note that only \l{QMdiSubWindow}s can be set as children of QMdiArea; you cannot, for instance, write: - \badcode + \code + //bad code QMdiArea mdiArea; QTextEdit editor(&mdiArea); // invalid child widget \endcode From 39b1bd8f45b9d1e0f2db0cd0d410d64422ffd992 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 19 Feb 2013 16:50:02 +0100 Subject: [PATCH 10/20] undef B0 to build on PPC (conflict with definition in termios.h) This is the same fix that was already done in qprinter.h /usr/include/bits/termios.h:122:#define B0 0000000 /* hang up */ so the compiler sees B0 as a numeric constant Task-number: QTBUG-29704 Change-Id: I2df5e1783f3142558cbc1606e0c61fcf636f2de8 Reviewed-by: David Faure (KDE) --- src/gui/painting/qpagedpaintdevice.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h index 02ed2583ee..b2b53d8038 100644 --- a/src/gui/painting/qpagedpaintdevice.h +++ b/src/gui/painting/qpagedpaintdevice.h @@ -48,6 +48,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +#if defined(B0) +#undef B0 // Terminal hang-up. We assume that you do not want that. +#endif class QPagedPaintDevicePrivate; From c02a2f8e76bcad5814134414c4c860d64880ebcd Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Feb 2013 19:43:29 +0000 Subject: [PATCH 11/20] QNX: Don't crash with 0 by 0 sized windows In the rare event of an invalid sized window, the application crashes because libscreen doesn't like creating empty buffers. Not creating the buffers at all would also be a solution, if we didn't have QPainter crashes due do null paint devices. Change-Id: I561d0082576b6226dd52129f9640952ba46273c8 Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7c57f6a656..ab9c94772b 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -335,7 +335,11 @@ void QQnxWindow::setBufferSize(const QSize &size) // Set window buffer size errno = 0; - int val[2] = { size.width(), size.height() }; + + // libscreen fails when creating empty buffers + const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size; + + int val[2] = { nonEmptySize.width(), nonEmptySize.height() }; int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); if (result != 0) { qFatal("QQnxWindow: failed to set window buffer size, errno=%d", errno); @@ -381,7 +385,7 @@ void QQnxWindow::setBufferSize(const QSize &size) } // Cache new buffer size - m_bufferSize = size; + m_bufferSize = nonEmptySize; // Buffers were destroyed; reacquire them m_currentBufferIndex = -1; From eb09f9b82c249db096754d9cbeea3424149c1869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2013 16:36:40 +0100 Subject: [PATCH 12/20] moc: Error out when detecting unterminated macro usage Exhausting the symbol list while looking for the final right parenthesis means it is missing. Task-number: QTBUG-29308 Change-Id: Iccf5897b0f5eb719699fd12d6c8e4a16ff189d9b Reviewed-by: Simon Hausmann --- src/tools/moc/preprocessor.cpp | 2 + tests/auto/tools/moc/tst_moc.cpp | 21 ++++++++ .../tools/moc/unterminated-function-macro.h | 51 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tests/auto/tools/moc/unterminated-function-macro.h diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 7430c4a86c..96b920b7cd 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -630,6 +630,8 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym if (nesting < 0) break; + else if (!symbols.hasNext()) + that->error("missing ')' in macro usage"); } // empty VA_ARGS diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 15e1bc0620..f0d1934a93 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -555,6 +555,7 @@ private slots: void autoMethodArgumentMetaTypeRegistration(); void parseDefines(); void preprocessorOnly(); + void unterminatedFunctionMacro(); signals: void sigWithUnsignedArg(unsigned foo); @@ -2802,6 +2803,26 @@ void tst_Moc::preprocessorOnly() #endif } + +void tst_Moc::unterminatedFunctionMacro() +{ +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) + QProcess proc; + proc.start("moc", QStringList() << "-E" << srcify("/unterminated-function-macro.h")); + QVERIFY(proc.waitForFinished()); + QCOMPARE(proc.exitCode(), 1); + QCOMPARE(proc.readAllStandardOutput(), QByteArray()); + QByteArray errorOutput = proc.readAllStandardError(); + QVERIFY(!errorOutput.isEmpty()); + QVERIFY(errorOutput.contains("missing ')' in macro usage")); +#else + QSKIP("Only tested on linux/gcc"); +#endif +} + QTEST_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/tools/moc/unterminated-function-macro.h b/tests/auto/tools/moc/unterminated-function-macro.h new file mode 100644 index 0000000000..813d60f0e4 --- /dev/null +++ b/tests/auto/tools/moc/unterminated-function-macro.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +class Dummy : public QObject { + Q_OBJECT +} + +#define MACRO(arg) do_something(arg) + +static void foo() { + MACRO(foo +} + From 64106705e7ca6132b1de15529c6206ebb0c58dfa Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 19 Feb 2013 14:58:51 +0100 Subject: [PATCH 13/20] Clean whitespace Change-Id: Iec1950a0f4053cd71633162f0cb50efc9d4d493f Reviewed-by: Friedemann Kleint --- .../widgets/qstackedwidget/tst_qstackedwidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp index 3b5c73ca57..5c9f46095c 100644 --- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp +++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp @@ -58,7 +58,7 @@ public: private slots: void getSetCheck(); - void testMinimumSize(); + void testMinimumSize(); }; tst_QStackedWidget::tst_QStackedWidget() @@ -72,15 +72,15 @@ tst_QStackedWidget::~tst_QStackedWidget() // Testing that stackedwidget respect the minimum size of it's contents (task 95319) void tst_QStackedWidget::testMinimumSize() { - QWidget w; + QWidget w; QStackedWidget sw(&w); QPushButton button("Text", &sw); - sw.addWidget(&button); + sw.addWidget(&button); QHBoxLayout hboxLayout; hboxLayout.addWidget(&sw); w.setLayout(&hboxLayout); w.show(); - QVERIFY(w.minimumSize() != QSize(0, 0)); + QVERIFY(w.minimumSize() != QSize(0, 0)); } // Testing get/set functions @@ -111,7 +111,7 @@ void tst_QStackedWidget::getSetCheck() // has no problem handling out-of-bounds indices. // ("convenience function" => "just another way of achieving the // same goal") - obj1.setCurrentWidget((QWidget *)0); + obj1.setCurrentWidget((QWidget *)0); QCOMPARE(obj1.currentWidget(), var2); #endif delete var2; From 18f9eb797bffe8626f1edeca3c88f80dae0da8d7 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 19 Feb 2013 15:02:24 +0100 Subject: [PATCH 14/20] QStackedLayout: Fix crash when focus widget is destroyed in hide() We also have to make sure that when moving back to a page that has a focusWidget(), the focus should go to the focusWidget() Task-number: QTBUG-18242 Change-Id: Ibfa7d6361c1a456480b2f1584a88ef4c4f405709 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qstackedlayout.cpp | 27 +++--- .../qstackedwidget/tst_qstackedwidget.cpp | 88 +++++++++++++++++++ 2 files changed, 103 insertions(+), 12 deletions(-) diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index cb2711c636..f38f0a6f08 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -300,7 +300,9 @@ void QStackedLayout::setCurrentIndex(int index) parent->setUpdatesEnabled(false); } - QWidget *fw = parent ? parent->window()->focusWidget() : 0; + QPointer fw = parent ? parent->window()->focusWidget() : 0; + const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw)); + if (prev) { prev->clearFocus(); if (d->stackingMode == StackOne) @@ -315,24 +317,25 @@ void QStackedLayout::setCurrentIndex(int index) // was somewhere on the outgoing widget. if (parent) { - if (fw && (prev && prev->isAncestorOf(fw))) { // focus was on old page + if (focusWasOnOldPage) { // look for the best focus widget we can find if (QWidget *nfw = next->focusWidget()) nfw->setFocus(); else { // second best: first child widget in the focus chain - QWidget *i = fw; - while ((i = i->nextInFocusChain()) != fw) { - if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus) - && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled() - && next->isAncestorOf(i)) { - i->setFocus(); - break; + if (QWidget *i = fw) { + while ((i = i->nextInFocusChain()) != fw) { + if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus) + && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled() + && next->isAncestorOf(i)) { + i->setFocus(); + break; + } } + // third best: incoming widget + if (i == fw ) + next->setFocus(); } - // third best: incoming widget - if (i == fw ) - next->setFocus(); } } } diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp index 5c9f46095c..c17db4c7f3 100644 --- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp +++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp @@ -47,6 +47,7 @@ #include #include #include +#include class tst_QStackedWidget : public QObject { @@ -59,6 +60,7 @@ public: private slots: void getSetCheck(); void testMinimumSize(); + void dynamicPages(); }; tst_QStackedWidget::tst_QStackedWidget() @@ -117,5 +119,91 @@ void tst_QStackedWidget::getSetCheck() delete var2; } +// QTBUG-18242, a widget that deletes its children in hideEvent(). +// This caused a crash in QStackedLayout::setCurrentIndex() since +// the focus widget was destroyed while hiding the previous page. +class TestPage : public QWidget +{ +public: + TestPage (bool staticWidgets = false) : QWidget(0), m_staticWidgets(staticWidgets) + { + new QVBoxLayout (this); + } + + ~TestPage() { + destroyWidgets(); + } + + void setN(int n) + { + m_n = n; + if (m_staticWidgets) + createWidgets(); + } + + virtual void showEvent (QShowEvent *) + { + if (!m_staticWidgets) + createWidgets(); + } + + virtual void hideEvent (QHideEvent *) + { + if (!m_staticWidgets) + destroyWidgets(); + } + +private: + void createWidgets() { + for (int i = 0; i < m_n; ++i) { + QLineEdit *le = new QLineEdit(this); + le->setObjectName(QString::fromLatin1("lineEdit%1").arg(i)); + layout ()->addWidget(le); + m_les << le; + } + } + + void destroyWidgets() + { + qDeleteAll(m_les); + m_les.clear (); + } + + int m_n; + const bool m_staticWidgets; + QList m_les; +}; + +void tst_QStackedWidget::dynamicPages() +{ + QStackedWidget *sw = new QStackedWidget; + + TestPage *w1 = new TestPage(true); + w1->setN(3); + + TestPage *w2 = new TestPage; + w2->setN(3); + + sw->addWidget(w1); + sw->addWidget(w2); + + QLineEdit *le11 = w1->findChild(QLatin1String("lineEdit1")); + le11->setFocus(); // set focus to second widget in the page + sw->resize(200, 200); + sw->show(); + qApp->setActiveWindow(sw); + QTest::qWaitForWindowActive(sw); + QTRY_COMPARE(QApplication::focusWidget(), le11); + + sw->setCurrentIndex(1); + QLineEdit *le22 = w2->findChild(QLatin1String("lineEdit2")); + le22->setFocus(); + QTRY_COMPARE(QApplication::focusWidget(), le22); + // Going back should move focus back to le11 + sw->setCurrentIndex(0); + QTRY_COMPARE(QApplication::focusWidget(), le11); + +} + QTEST_MAIN(tst_QStackedWidget) #include "tst_qstackedwidget.moc" From 3f99983e76d359cb45b15ae96150d4cc798b61c7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Jan 2013 10:19:49 +0100 Subject: [PATCH 15/20] Fix focus handling of native child widgets in xcb. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If4d596195624011142bff6853849a23064e478df Reviewed-by: Samuel Rødal (cherry picked from commit fc663b5f9aae16fe6a03160e3eb148a5f742ac58) --- src/gui/kernel/qwindow_p.h | 2 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 8 +++++++- src/plugins/platforms/xcb/qxcbconnection.h | 5 +++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 14 +++++++++++++- src/widgets/kernel/qwidgetwindow.cpp | 18 +++++++++++++++++- 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index ed34693faa..6933c892a0 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -120,6 +120,8 @@ public: return offset; } + virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; } + QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; QWindow *parentWindow; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7fc5847167..32de54562a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -258,6 +258,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char , has_randr_extension(false) , has_input_shape(false) , m_buttons(0) + , m_focusWindow(0) { #ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); @@ -418,7 +419,7 @@ break; if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) { \ handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \ if (!handled) \ - m_keyboard->handler(platformWindow, e); \ + m_keyboard->handler(m_focusWindow, e); \ } \ } \ break; @@ -943,6 +944,11 @@ void QXcbEventReader::unlock() m_mutex.unlock(); } +void QXcbConnection::setFocusWindow(QXcbWindow *w) +{ + m_focusWindow = w; +} + void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id) { xcb_client_message_event_t event; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 68d2b85f78..b499f75b78 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -385,6 +385,9 @@ public: Qt::MouseButtons buttons() const { return m_buttons; } + QXcbWindow *focusWindow() const { return m_focusWindow; } + void setFocusWindow(QXcbWindow *); + private slots: void processXcbEvents(); @@ -511,6 +514,8 @@ private: bool has_input_shape; Qt::MouseButtons m_buttons; + + QXcbWindow *m_focusWindow; }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b7668e6270..c0ddf5c0ae 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -403,6 +403,9 @@ QXcbWindow::~QXcbWindow() void QXcbWindow::destroy() { + if (connection()->focusWindow() == this) + connection()->setFocusWindow(0); + if (m_syncCounter && m_screen->syncRequestSupported()) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); if (m_window) { @@ -1473,6 +1476,11 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { + if (window() != QGuiApplication::focusWindow()) { + QWindow *w = static_cast(QObjectPrivate::get(window()))->eventReceiver(); + w->requestActivate(); + } + updateNetWmUserTime(event->time); QPoint local(event->event_x, event->event_y); @@ -1635,7 +1643,10 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) { - QWindowSystemInterface::handleWindowActivated(window()); + QWindow *w = window(); + w = static_cast(QObjectPrivate::get(w))->eventReceiver(); + connection()->setFocusWindow(static_cast(w->handle())); + QWindowSystemInterface::handleWindowActivated(w); } static bool focusInPeeker(xcb_generic_event_t *event) @@ -1651,6 +1662,7 @@ static bool focusInPeeker(xcb_generic_event_t *event) void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) { + connection()->setFocusWindow(0); // Do not set the active window to 0 if there is a FocusIn coming. // There is however no equivalent for XPutBackEvent so register a // callback for QXcbConnection instead. diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 462ebc605b..50b61beb05 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "private/qwindow_p.h" #include "qwidgetwindow_qpa_p.h" #include "private/qwidget_p.h" @@ -60,8 +61,23 @@ extern int openPopupCount; bool qt_replay_popup_mouse_event = false; extern bool qt_try_modal(QWidget *widget, QEvent::Type type); +class QWidgetWindowPrivate : public QWindowPrivate +{ + Q_DECLARE_PUBLIC(QWidgetWindow) +public: + QWindow *eventReceiver() { + Q_Q(QWidgetWindow); + QWindow *w = q; + while (w->parent() && qobject_cast(w) && qobject_cast(w->parent())) { + w = w->parent(); + } + return w; + } +}; + QWidgetWindow::QWidgetWindow(QWidget *widget) - : m_widget(widget) + : QWindow(*new QWidgetWindowPrivate(), 0) + , m_widget(widget) { updateObjectName(); connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); From 7203e88084a313fb6e7a96b9080f965e3ffcd89f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 18 Feb 2013 23:19:57 +0100 Subject: [PATCH 16/20] Don't enable HIDPI when rendering directly to PDF on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When rendering to PDF using the PDF paint engine on Mac it would consider it to be rendering as HIDPI when ScreenResolution was used. This would mean nothing was being rendered at all in the PDF as a result. Task-number: QTBUG-28709 Change-Id: Ieb97ca9d0b47f6b96debbcf5e05e96c39292e412 Reviewed-by: Morten Johan Sørvig --- src/gui/painting/qpainter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 0811b5282f..786136d203 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -229,7 +229,7 @@ QTransform QPainterPrivate::hidpiScaleTransform() const { #ifdef Q_OS_MAC // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - if (device->physicalDpiX() == 0 || device->logicalDpiX() == 0) + if (device->devType() == QInternal::Printer || device->physicalDpiX() == 0 || device->logicalDpiX() == 0) return QTransform(); const qreal deviceScale = (device->physicalDpiX() / device->logicalDpiX()); if (deviceScale > 1.0) @@ -1843,7 +1843,7 @@ bool QPainter::begin(QPaintDevice *pd) #ifdef Q_OS_MAC // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - const bool isHighDpi = (d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ? + const bool isHighDpi = (pd->devType() == QInternal::Printer || d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ? false : (d->device->physicalDpiX() / d->device->logicalDpiX() > 1); #else const bool isHighDpi = false; From 2f5b4d47f6da4702dc6bfd411289aedf612bed6a Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Tue, 19 Feb 2013 23:52:48 +0000 Subject: [PATCH 17/20] Document the qintptr for public usage The QAbstractSocket API has been already using this as a return type. Hence, this has already been exposed to the public API users, anyhow. http://qt-project.org/doc/qt-5.0/qtnetwork/qabstractsocket.html#socketDescriptor A minor mistake has also been fixed in this commit at the quintptr section. Change-Id: I8143b3050428548ff6baee2e3a0bce4058ea8701 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a0c12b7b06..7fd9283579 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -642,12 +642,30 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); \sa Q_UINT64_C(), qint64, qulonglong */ +/*! + \typedef qintptr + \relates + + Integral type for representing pointers in a signed integer (useful for + hashing, etc.). + + Typedef for either qint32 or qint64. This type is guaranteed to + be the same size as a pointer on all platforms supported by Qt. On + a system with 32-bit pointers, qintptr is a typedef for qint32; + on a system with 64-bit pointers, qintptr is a typedef for + qint64. + + Note that qintptr is signed. Use quintptr for unsigned values. + + \sa qptrdiff, qint32, qint64 +*/ + /*! \typedef quintptr \relates - Integral type for representing a pointers (useful for hashing, - etc.). + Integral type for representing pointers in an unsigned integer (useful for + hashing, etc.). Typedef for either quint32 or quint64. This type is guaranteed to be the same size as a pointer on all platforms supported by Qt. On From dd30f3e65b7fb56f64c992dc5f341a9c5dba6c07 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Feb 2013 15:19:41 +0100 Subject: [PATCH 18/20] Fix QDockWidget being unable to dock when initially floating. When setFloating(true) is called before show, frame strut events are not enabled for the native window (since there is none yet) in QDockWidgetPrivate::setWindowState(). In that case, do it in the show event handling. Task-number: QTBUG-29012 Change-Id: I93b679f20200c149d608a1bcc65b4936a035c6a0 Reviewed-by: J-P Nurmi --- src/widgets/widgets/qdockwidget.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index c5694d9d8c..a2e363f991 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1000,6 +1000,14 @@ void QDockWidgetPrivate::plug(const QRect &rect) setWindowState(false, false, rect); } +static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled) +{ + if (const QWindow *window = w->windowHandle()) + if (QPlatformWindow *platformWindow = window->handle()) + if (platformWindow->frameStrutEventsEnabled() != enabled) + platformWindow->setFrameStrutEventsEnabled(enabled); +} + void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect) { Q_Q(QDockWidget); @@ -1053,9 +1061,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect } if (floating && nativeDeco) - if (const QWindow *window = q->windowHandle()) - if (QPlatformWindow *platformWindow = window->handle()) - platformWindow->setFrameStrutEventsEnabled(true); + setFrameStrutEventsEnabled(q, true); resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco); } @@ -1391,6 +1397,8 @@ bool QDockWidget::event(QEvent *event) emit visibilityChanged(false); break; case QEvent::Show: + if (static_cast(QDockWidget::layout())->nativeWindowDeco(isFloating())) + setFrameStrutEventsEnabled(this, true); d->toggleViewAction->setChecked(true); emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0); break; From 79498af6e44d8c44b681c1a857523d633d3aea3a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 15 Feb 2013 14:44:18 +0100 Subject: [PATCH 19/20] Fix the default handling of cursor shape when there is no standard one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the cursor specified is a bitmap one we cannot cache it based on the shape as the pixmap set on the cursor may be different. Therefore we should always create a new cursor in this instance. Change-Id: I2c201590ff632490d76c1b423908ae32aa584eb6 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoacursor.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 9b30351d70..b97531545f 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -96,10 +96,15 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window) break; case Qt::DragLinkCursor: [[NSCursor dragLinkCursor] set]; + break; default : { // No suitable OS cursor exist, use cursors provided // by Qt for the rest. Check for a cached cursor: NSCursor *cocoaCursor = m_cursors.value(cursor->shape()); + if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) { + [cocoaCursor release]; + cocoaCursor = 0; + } if (cocoaCursor == 0) { cocoaCursor = createCursorData(cursor); if (cocoaCursor == 0) { From e47c2744e6cefa42fc70320e07d534742934f737 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 15 Feb 2013 14:51:48 +0100 Subject: [PATCH 20/20] Clean up the cached cursors inside the destructor of QCocoaCursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4e1222832efa29680b4e658a5c9109641599a2b9 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoacursor.h | 1 + src/plugins/platforms/cocoa/qcocoacursor.mm | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h index f8829c53e6..dfa1fcff81 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.h +++ b/src/plugins/platforms/cocoa/qcocoacursor.h @@ -53,6 +53,7 @@ class QCocoaCursor : public QPlatformCursor { public: QCocoaCursor(); + ~QCocoaCursor(); virtual void changeCursor(QCursor * widgetCursor, QWindow * widget); virtual QPoint pos() const; diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index b97531545f..a36a855bcd 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -48,6 +48,10 @@ QT_BEGIN_NAMESPACE QCocoaCursor::QCocoaCursor() +{ +} + +QCocoaCursor::~QCocoaCursor() { // release cursors QHash::const_iterator i = m_cursors.constBegin();