diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 83e8350f81..72b678041f 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -81,6 +81,8 @@ our @qpa_headers = (); # will be derived from sync.profile our %reverse_classnames = (); +my %ignore_for_include_check = (); +my %ignore_for_qt_begin_namespace_check = (); # global variables (modified by options) my $isunix = 0; @@ -319,6 +321,75 @@ sub classNames { return @ret; } +sub check_header { + my ($lib, $header, $iheader, $public_header, $private_header) = @_; + my $header_skip_qt_begin_namespace_test = 0; + + if ($public_header) { + return if ($ignore_for_include_check{$header}); + $header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header}); + } + + open(F, "<$iheader") or return; + my $qt_begin_namespace_found = 0; + my $qt_end_namespace_found = 0; + my $qt_namespace_suffix = ""; + my $line; + my $stop_processing = 0; + my $we_mean_it = 0; + while ($line = ) { + chomp $line; + my $output_line = 1; + if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { + $stop_processing = 1; + last; + } + if ($line =~ /^ *\# *include/) { + my $include = $line; + if ($line =~ /<.*>/) { + $include =~ s,.*<(.*)>.*,$1,; + } elsif ($line =~ /".*"/) { + $include =~ s,.*"(.*)".*,$1,; + } else { + $include = 0; + } + if ($include && $public_header) { + print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/); + for my $trylib (keys(%modules)) { + if (-e "$out_basedir/include/$trylib/$include") { + print "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n"; + } + } + } + } elsif (!$private_header) { + if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) { + $qt_namespace_suffix = defined($1) ? $1 : ""; + $qt_begin_namespace_found = 1; + } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) { + $qt_end_namespace_found = 1; + } + } elsif ($line =~ "^// We mean it.") { + ++$we_mean_it; + } + } + + if ($public_header) { + if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) { + if ($qt_begin_namespace_found == 0) { + print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; + } + + if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) { + print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n"; + } + } + } elsif ($private_header) { + print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it); + } + + close(F); +} + sub make_path { my ($dir, $lib, $be_verbose) = @_; unless(-e $dir) { @@ -801,6 +872,8 @@ loadSyncProfile(\$basedir, \$out_basedir); @modules_to_sync = keys(%modules) if($#modules_to_sync == -1); my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate; +%ignore_for_include_check = map { $_ => 1 } @ignore_for_include_check; +%ignore_for_qt_begin_namespace_check = map { $_ => 1 } @ignore_for_qt_begin_namespace_check; $isunix = checkUnix; #cache checkUnix @@ -931,6 +1004,12 @@ foreach my $lib (@modules_to_sync) { my $clean_header; my $iheader = $subdir . "/" . $header; $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow); + if ($check_includes) { + # We need both $public_header and $private_header because QPA headers count as neither + my $private_header = !$public_header && !$qpa_header + && $header =~ /_p\.h$/ && $subdir !~ /3rdparty/; + check_header($lib, $header, $iheader, $public_header, $private_header); + } my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader, \$clean_header) : (); if($showonly) { print "$header [$lib]\n"; @@ -1128,109 +1207,4 @@ foreach my $lib (@modules_to_sync) { } } -if($check_includes) { - foreach my $lib (@modules_to_sync) { - next if ($modules{$lib} =~ /^!/); - #calc subdirs - my @subdirs = listSubdirs(map { s/^\^//; $_ } split(/;/, $modules{$lib})); - - foreach my $subdir (@subdirs) { - my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0); - foreach my $header (@headers) { - my $header_skip_qt_begin_namespace_test = 0; - $header = 0 if($header =~ /^ui_.*.h/); - $header = 0 if ($header eq lc($lib)."version.h"); - foreach (@ignore_headers) { - $header = 0 if($header eq $_); - } - if($header) { - # We need both $public_header and $private_header because QPA headers count as neither - my $public_header = $header; - my $private_header = 0; - if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) { - $public_header = 0; - $private_header = $header =~ /_p.h$/ && $subdir !~ /3rdparty/ - } elsif (isQpaHeader($public_header)) { - $public_header = 0; - } else { - foreach (@ignore_for_master_contents) { - $public_header = 0 if($header eq $_); - } - if($public_header) { - foreach (@ignore_for_include_check) { - $public_header = 0 if($header eq $_); - } - foreach(@ignore_for_qt_begin_namespace_check) { - $header_skip_qt_begin_namespace_test = 1 if ($header eq $_); - } - } - } - - my $iheader = $subdir . "/" . $header; - if (open(F, "<$iheader")) { - my $qt_begin_namespace_found = 0; - my $qt_end_namespace_found = 0; - my $qt_namespace_suffix = ""; - my $line; - my $stop_processing = 0; - my $we_mean_it = 0; - while ($line = ) { - chomp $line; - my $output_line = 1; - if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { - $stop_processing = 1; - last; - } elsif ($line =~ /^ *\# *include/) { - my $include = $line; - if ($line =~ /<.*>/) { - $include =~ s,.*<(.*)>.*,$1,; - } elsif ($line =~ /".*"/) { - $include =~ s,.*"(.*)".*,$1,; - } else { - $include = 0; - } - if ($include) { - if ($public_header) { - print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/); - for my $trylib (keys(%modules)) { - if(-e "$out_basedir/include/$trylib/$include") { - print "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n"; - } - } - } - } - } elsif (!$private_header) { - if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) { - $qt_namespace_suffix = defined($1) ? $1 : ""; - $qt_begin_namespace_found = 1; - } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) { - $qt_end_namespace_found = 1; - } - } elsif ($line =~ "^// We mean it.") { - ++$we_mean_it; - } - } - - if ($public_header) { - if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) { - if ($qt_begin_namespace_found == 0) { - print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; - } - - if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) { - print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n"; - } - } - } elsif ($private_header) { - print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it); - } - - close(F); - } - } - } - } - } -} - exit 0; diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index b5eaf96a3f..c45470838a 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -43,16 +43,21 @@ manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtQuick/Qt Quick Demo - Clocks" \ "QtQuick/Qt Quick Examples - Shader Effects" \ "QtQuickExtras/Qt Quick Extras - Dashboard" \ + "QtQuickExtras/Qt Quick Extras - Flat" \ "QtQuickExtras/Qt Quick Extras - Gallery" \ "QtQuickControls/Qt Quick Controls - Gallery" \ "QtQuickControls/Qt Quick Controls - Text Editor Example" \ "QtQuickControls/Qt Quick Controls - Table View Example" \ "QtQuickControls/Qt Quick Controls - Calendar Example" \ + "QtQuickControls/Qt Quick Controls - File System Browser Example" \ "QtQuickDialogs/Qt Quick System Dialog Examples" \ "QtWinExtras/Quick Player" \ "QtMultimedia/QML Video Shader Effects Example" \ "QtCanvas3D/Planets Example" \ - "QtLocation/Map Viewer (QML)" + "QtCanvas3D/Interactive Mobile Phone Example" \ + "QtLocation/Map Viewer (QML)" \ + "QtWebEngine/WebEngine Quick Nano Browser" \ + "QtWebEngine/Markdown Editor Example" manifestmeta.highlighted.attributes = isHighlighted:true diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index 8649a14582..967bbb8ede 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -39,6 +39,7 @@ Cpp.ignoretokens += \ Q_DECL_UNUSED \ Q_DECL_CF_RETURNS_RETAINED \ Q_DECL_NS_RETURNS_AUTORELEASED \ + Q_DECL_EQ_DEFAULT \ Q_DECLARATIVE_EXPORT \ Q_EXPLICIT \ Q_EXPORT \ @@ -78,6 +79,7 @@ Cpp.ignoretokens += \ Q_REQUIRED_RESULT \ Q_SCRIPT_EXPORT \ Q_SCRIPTTOOLS_EXPORT \ + Q_SERIALBUS_EXPORT \ Q_SQL_EXPORT \ Q_SVG_EXPORT \ Q_TESTLIB_EXPORT \ diff --git a/doc/global/template/style/offline.css b/doc/global/template/style/offline.css index 123d753290..5aabd82dcb 100644 --- a/doc/global/template/style/offline.css +++ b/doc/global/template/style/offline.css @@ -515,15 +515,26 @@ li { margin-bottom: 10px; padding-left: 8px; list-style: outside; - list-style-type: square; text-align: left; } + ul > li { + list-style-type: square; + } + ol { margin: 10px; padding: 0; } +ol.A > li { + list-style-type: upper-alpha; +} + +ol.a > li{ + list-style-type: lower-alpha; +} + ol > li { margin-left: 30px; padding-left: 8px; diff --git a/doc/global/template/style/online.css b/doc/global/template/style/online.css index a98382e083..86e30e89b3 100644 --- a/doc/global/template/style/online.css +++ b/doc/global/template/style/online.css @@ -975,9 +975,23 @@ ol,ul { margin-top:0.75em; margin-left:20px } -.mainContent ol>li { - list-style-type:decimal + +.context ol > li { + margin-left: 20px } + +.mainContent ol>li { + list-style-type: decimal; +} + +.mainContent ol.a >li { + list-style-type: lower-alpha; +} + +.mainContent ol.A >li { + list-style-type: upper-alpha; +} + blockquote,q { quotes:none } diff --git a/examples/network/doc/src/fortuneserver.qdoc b/examples/network/doc/src/fortuneserver.qdoc index c55a1634e4..0b110783aa 100644 --- a/examples/network/doc/src/fortuneserver.qdoc +++ b/examples/network/doc/src/fortuneserver.qdoc @@ -87,7 +87,7 @@ \snippet fortuneserver/server.cpp 7 - We then call QTcpServer::newPendingConnection(), which returns the + We then call QTcpServer::nextPendingConnection(), which returns the QTcpSocket representing the server side of the connection. By connecting QTcpSocket::disconnected() to QObject::deleteLater(), we ensure that the socket will be deleted after disconnecting. diff --git a/mkspecs/common/angle.conf b/mkspecs/common/angle.conf new file mode 100644 index 0000000000..fffdb581c5 --- /dev/null +++ b/mkspecs/common/angle.conf @@ -0,0 +1,9 @@ +# Renaming these files requires that the LIBRARY entry of their corresponding +# def files are also updated to reflect the name. +# The .def files are found in the angle directories: +# +# qtbase\src\3rdparty\angle\src\libEGL\libEGL[d?].def +# qtbase\src\3rdparty\angle\src\libEGL\libGLESv2[d?].def + +LIBEGL_NAME="libEGL" +LIBGLESV2_NAME="libGLESv2" diff --git a/mkspecs/common/msvc-base.conf b/mkspecs/common/msvc-base.conf new file mode 100644 index 0000000000..5bd144faa0 --- /dev/null +++ b/mkspecs/common/msvc-base.conf @@ -0,0 +1,56 @@ +# +# qmake configuration for Microsoft Visual Studio C/C++ Compiler +# This mkspec is used for all win32-msvcXXXX, winrt-XXX-msvcXXX +# and winphone-XXX-msvcXXX specs +# + +# +# Version-specific changes +# + +greaterThan(MSC_VER, 1499) { + # Visual Studio 2008 (9.0) / Visual C++ 15.0 and up + QMAKE_CFLAGS_MP = -MP + QMAKE_CXXFLAGS_MP = $$QMAKE_CFLAGS_MP +} + +greaterThan(MSC_VER, 1599) { + # Visual Studio 2010 (10.0) / Visual C++ 16.0 and up + MAKEFILE_GENERATOR = MSBUILD + + QMAKE_CFLAGS_AVX = -arch:AVX + QMAKE_CFLAGS_AVX2 = -arch:AVX + + VCPROJ_EXTENSION = .vcxproj +} + +greaterThan(MSC_VER, 1699) { + # Visual Studio 2012 (11.0) / Visual C++ 17.0 and up + QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0 + QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@ + QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@ + QT_CONFIG += c++11 + CONFIG += c++11 +} + +greaterThan(MSC_VER, 1799) { + # Visual Studio 2013 (12.0) / Visual C++ 18.0 and up + QMAKE_CFLAGS += -FS + QMAKE_CXXFLAGS += -FS + + equals(MSC_VER, 1800) { + QMAKE_CFLAGS_RELEASE += -Zc:strictStrings + QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings + QMAKE_CXXFLAGS_RELEASE += -Zc:strictStrings + QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings + } +} + +greaterThan(MSC_VER, 1899) { + # Visual Studio 2015 (14.0) / Visual C++ 19.0 and up + QMAKE_CFLAGS += -Zc:strictStrings + QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458 + QMAKE_CFLAGS_AVX2 = -arch:AVX2 + QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew + QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 +} diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index a1c436388c..eec9e1f688 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -9,6 +9,8 @@ isEmpty(MSC_VER)|isEmpty(MSVC_VER): error("Source mkspec must set both MSC_VER a # Baseline: Visual Studio 2005 (8.0), VC++ 14.0 # +include(angle.conf) + MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 QMAKE_COMPILER = msvc @@ -83,8 +85,8 @@ QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib -QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib -QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL_ES2_DEBUG = $${LIBEGL_NAME}d.lib $${LIBGLESV2_NAME}d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib QMAKE_LIBS_QT_ENTRY = -lqtmain @@ -97,54 +99,6 @@ VCPROJ_EXTENSION = .vcproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 -# -# Version-specific changes -# -greaterThan(MSC_VER, 1499) { - # Visual Studio 2008 (9.0) / Visual C++ 15.0 and up - QMAKE_CFLAGS_MP = -MP - QMAKE_CXXFLAGS_MP = $$QMAKE_CFLAGS_MP -} - -greaterThan(MSC_VER, 1599) { - # Visual Studio 2010 (10.0) / Visual C++ 16.0 and up - MAKEFILE_GENERATOR = MSBUILD - - QMAKE_CFLAGS_AVX = -arch:AVX - QMAKE_CFLAGS_AVX2 = -arch:AVX - - VCPROJ_EXTENSION = .vcxproj -} - -greaterThan(MSC_VER, 1699) { - # Visual Studio 2012 (11.0) / Visual C++ 17.0 and up - QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0 - QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@ - QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@ - QT_CONFIG += c++11 - CONFIG += c++11 -} - -greaterThan(MSC_VER, 1799) { - # Visual Studio 2013 (12.0) / Visual C++ 18.0 and up - QMAKE_CFLAGS += -FS - QMAKE_CXXFLAGS += -FS - - equals(MSC_VER, 1800) { - QMAKE_CFLAGS_RELEASE += -Zc:strictStrings - QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings - QMAKE_CXXFLAGS_RELEASE += -Zc:strictStrings - QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings - } -} - -greaterThan(MSC_VER, 1899) { - # Visual Studio 2015 (14.0) / Visual C++ 19.0 and up - QMAKE_CFLAGS += -Zc:strictStrings - QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458 - QMAKE_CFLAGS_AVX2 = -arch:AVX2 - QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew - QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -} +include(msvc-base.conf) unset(MSC_VER) diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index 224c350e2f..fa1a72a1b9 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -2,6 +2,8 @@ # qmake configuration for common Windows CE # +include(../angle.conf) + MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM += wince win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target @@ -67,8 +69,8 @@ QMAKE_EXTENSION_SHLIB = dll QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = lib -QMAKE_LIBS_EGL = libEGL.lib -QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib +QMAKE_LIBS_EGL = $${LIBEGL_NAME}.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBGLESV2_NAME}.lib QMAKE_LIBS_QT_ENTRY = -lqtmain diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf index 288043da88..bf237882ff 100644 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ b/mkspecs/common/winrt_winphone/qmake.conf @@ -4,6 +4,8 @@ # Written for Microsoft Visual C++ # +include(../angle.conf) + MAKEFILE_GENERATOR = MSBUILD QMAKE_COMPILER = msvc QMAKE_PLATFORM = winrt win32 @@ -79,8 +81,8 @@ QMAKE_LIBS += runtimeobject.lib QMAKE_LIBS_CORE = QMAKE_LIBS_GUI = QMAKE_LIBS_NETWORK = -QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib -QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib +QMAKE_LIBS_OPENGL_ES2_DEBUG = $${LIBEGL_NAME}d.lib $${LIBGLESV2_NAME}d.lib QMAKE_LIBS_QT_ENTRY = -lqtmain @@ -92,4 +94,9 @@ VCPROJ_EXTENSION = .vcxproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 WINRT_ASSETS_PATH = $$PWD/assets + +include(../msvc-base.conf) + +unset(MSC_VER) + load(qt_config) diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf index 9163ac30b2..1848f00e90 100644 --- a/mkspecs/features/qt_build_paths.prf +++ b/mkspecs/features/qt_build_paths.prf @@ -20,10 +20,9 @@ isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR exists($$MODULE_BASE_INDIR/.git): \ CONFIG += git_build -!prefix_build { - QTDIR = $$[QT_HOST_PREFIX] - # Permit modules to enforce being built outside QTDIR ... - !force_independent: MODULE_BASE_OUTDIR = $$QTDIR - # ... though this sort of breaks the idea. - MODULE_QMAKE_OUTDIR = $$QTDIR +!force_independent { + # If the module is not built independently, everything ends up in qtbase. + # This is the case in non-prefix builds, except for selected modules. + MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX] + MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX] } diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index e2e56c318f..9a4ed20af8 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -93,7 +93,7 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.inclu contains(QT_CONFIG, build_all):CONFIG += build_all } -linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF +QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF QT += $$QT_FOR_PRIVATE unset(QT_FOR_PRIVATE) diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index 63f491b9e5..73f1fb6201 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -8,6 +8,7 @@ # load(device_config) +include(../common/angle.conf) MAKEFILE_GENERATOR = MINGW QMAKE_PLATFORM = win32 mingw @@ -98,8 +99,8 @@ QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 QMAKE_LIBS_NETWORK = -lws2_32 QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32 -QMAKE_LIBS_OPENGL_ES2 = -llibEGL -llibGLESv2 -lgdi32 -luser32 -QMAKE_LIBS_OPENGL_ES2_DEBUG = -llibEGLd -llibGLESv2d -lgdi32 -luser32 +QMAKE_LIBS_OPENGL_ES2 = -l$${LIBEGL_NAME} -l$${LIBGLESV2_NAME} -lgdi32 -luser32 +QMAKE_LIBS_OPENGL_ES2_DEBUG = -l$${LIBEGL_NAME}d -l$${LIBGLESV2_NAME}d -lgdi32 -luser32 QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32 QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf index 772a514b89..860fbc0e6a 100644 --- a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf +++ b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf @@ -21,7 +21,7 @@ QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = QMAKE_LIBS_OPENVG = libopenvg.lib -QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib QMAKE_RC = rc diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf index 47c512bbda..ea86bc0071 100644 --- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf +++ b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf @@ -36,7 +36,7 @@ QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = QMAKE_LIBS_OPENVG = -QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib QMAKE_LIBDIR_OPENGL_ES2 = $$(NV_WINCE_T2_PLAT)/lib/Test QMAKE_INCDIR_EGL = $$(NV_WINCE_T2_PLAT)/include QMAKE_LIBDIR_EGL = $$(NV_WINCE_T2_PLAT)/lib/Test diff --git a/mkspecs/winrt-arm-msvc2015/qmake.conf b/mkspecs/winrt-arm-msvc2015/qmake.conf index a5bb342456..7a9375246d 100644 --- a/mkspecs/winrt-arm-msvc2015/qmake.conf +++ b/mkspecs/winrt-arm-msvc2015/qmake.conf @@ -4,6 +4,7 @@ # Written for Microsoft Visual C++ 2015 # +MSC_VER = 1900 include(../common/winrt_winphone/qmake.conf) QMAKE_COMPILER_DEFINES += _MSC_VER=1900 DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 ARM __ARM__ __arm__ diff --git a/mkspecs/winrt-x64-msvc2015/qmake.conf b/mkspecs/winrt-x64-msvc2015/qmake.conf index 5b82f79981..ca2dc88bf0 100644 --- a/mkspecs/winrt-x64-msvc2015/qmake.conf +++ b/mkspecs/winrt-x64-msvc2015/qmake.conf @@ -4,6 +4,7 @@ # Written for Microsoft Visual C++ 2015 # +MSC_VER = 1900 include(../common/winrt_winphone/qmake.conf) QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32 DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X64 __X64__ __x64__ diff --git a/mkspecs/winrt-x86-msvc2015/qmake.conf b/mkspecs/winrt-x86-msvc2015/qmake.conf index bc7cf4118e..3b2681e93d 100644 --- a/mkspecs/winrt-x86-msvc2015/qmake.conf +++ b/mkspecs/winrt-x86-msvc2015/qmake.conf @@ -4,6 +4,7 @@ # Written for Microsoft Visual C++ 2015 # +MSC_VER = 1900 include(../common/winrt_winphone/qmake.conf) QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32 DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PHONE_APP=1 X86 __X86__ __x86__ diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 47f99a5c8e..c9f0d92eb9 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -532,31 +532,13 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHashfirst("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"); - QString vcprojDir = qmake_getpwd(); + QString vcprojDir = Option::output_dir; // If file doesn't exsist, then maybe the users configuration // doesn't allow it to be created. Skip to next... if (!exists(vcprojDir + Option::dir_sep + vcproj)) { - // Try to find the directory which fits relative - // to the output path, which represents the shadow - // path in case we are shadow building - QStringList list = fi.path().split(QLatin1Char('/')); - QString tmpDir = QFileInfo(Option::output).path() + Option::dir_sep; - bool found = false; - for (int i = list.size() - 1; i >= 0; --i) { - QString curr; - for (int j = i; j < list.size(); ++j) - curr += list.at(j) + Option::dir_sep; - if (exists(tmpDir + curr + vcproj)) { - vcprojDir = QDir::cleanPath(tmpDir + curr); - found = true; - break; - } - } - if (!found) { - warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(vcprojDir + Option::dir_sep + vcproj).toLatin1().constData()); - goto nextfile; // # Dirty! - } + warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(vcprojDir + Option::dir_sep + vcproj).toLatin1().constData()); + goto nextfile; // # Dirty! } VcsolutionDepend *newDep = new VcsolutionDepend; diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp index 0a4f45b5b7..696dfd72f8 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp @@ -64,7 +64,13 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory swapChainDesc.Windowed = TRUE; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - return factory->CreateSwapChain(device, &swapChainDesc, swapChain); + const HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain); + if (SUCCEEDED(result)) + { + const HRESULT makeWindowAssociationResult = factory->MakeWindowAssociation(mWindow, DXGI_MWA_NO_ALT_ENTER); + UNUSED_TRACE_VARIABLE(makeWindowAssociationResult); + } + return result; } #endif } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 1b7ec8abbb..602b25eb45 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -41,6 +41,7 @@ import java.util.concurrent.Semaphore; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.net.Uri; import android.os.Handler; import android.os.Looper; @@ -53,6 +54,7 @@ import android.view.Menu; import android.view.MotionEvent; import android.view.View; +import java.lang.reflect.Method; import java.security.KeyStore; import java.security.cert.X509Certificate; import java.util.Iterator; @@ -81,6 +83,7 @@ public class QtNative private static int m_oldx, m_oldy; private static final int m_moveThreshold = 0; private static ClipboardManager m_clipboardManager = null; + private static Method m_checkSelfPermissionMethod = null; private static ClassLoader m_classLoader = null; public static ClassLoader classLoader() @@ -393,6 +396,29 @@ public class QtNative } } + public static int checkSelfPermission(final String permission) + { + int perm = PackageManager.PERMISSION_DENIED; + synchronized (m_mainActivityMutex) { + if (m_activity == null) + return perm; + try { + if (Build.VERSION.SDK_INT >= 23) { + if (m_checkSelfPermissionMethod == null) + m_checkSelfPermissionMethod = Context.class.getMethod("checkSelfPermission", String.class); + perm = (Integer)m_checkSelfPermissionMethod.invoke(m_activity, permission); + } else { + final PackageManager pm = m_activity.getPackageManager(); + perm = pm.checkPermission(permission, m_activity.getPackageName()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + return perm; + } + private static void updateSelection(final int selStart, final int selEnd, final int candidatesStart, diff --git a/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch b/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch new file mode 100644 index 0000000000..2927176815 --- /dev/null +++ b/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch @@ -0,0 +1,36 @@ +From 00f0a46199b622b05619f56e29f172fb61fe6e82 Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint +Date: Mon, 23 Nov 2015 14:00:02 +0100 +Subject: [PATCH] ANGLE/D3D11: Suppress keyboard handling of DXGI. + +Set the DXGI_MWA_NO_ALT_ENTER to suppress the Alt-Enter shortcut +causing the window to become full screen. + +Task-number: QTBUG-44904 +Change-Id: Ia4156ddee37a8a3da6e9e3130022c63a674f4429 +--- + .../angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp +index 0a4f45b..696dfd7 100644 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp +@@ -64,7 +64,13 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory + swapChainDesc.Windowed = TRUE; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; + +- return factory->CreateSwapChain(device, &swapChainDesc, swapChain); ++ const HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain); ++ if (SUCCEEDED(result)) ++ { ++ const HRESULT makeWindowAssociationResult = factory->MakeWindowAssociation(mWindow, DXGI_MWA_NO_ALT_ENTER); ++ UNUSED_TRACE_VARIABLE(makeWindowAssociationResult); ++ } ++ return result; + } + #endif + } +-- +2.5.0.windows.1 + diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro index 94fcebda6b..695f7fd50c 100644 --- a/src/angle/src/libEGL/libEGL.pro +++ b/src/angle/src/libEGL/libEGL.pro @@ -1,9 +1,10 @@ CONFIG += installed include(../common/common.pri) - +DEF_FILE_TARGET=$${TARGET} +TARGET=$$qtLibraryTarget($${LIBEGL_NAME}) winrt: LIBS_PRIVATE += -ld3d11 -LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2) +LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget($${LIBGLESV2_NAME}) DEFINES += GL_APICALL= GL_GLEXT_PROTOTYPES= EGLAPI= LIBEGL_IMPLEMENTATION @@ -14,8 +15,8 @@ SOURCES += \ $$ANGLE_DIR/src/libEGL/libEGL.cpp !static { - DEF_FILE = $$ANGLE_DIR/src/libEGL/$${TARGET}.def - mingw:equals(QT_ARCH, i386): DEF_FILE = $$ANGLE_DIR/src/libEGL/$${TARGET}_mingw32.def + DEF_FILE = $$ANGLE_DIR/src/libEGL/$${DEF_FILE_TARGET}.def + mingw:equals(QT_ARCH, i386): DEF_FILE = $$ANGLE_DIR/src/libEGL/$${DEF_FILE_TARGET}_mingw32.def } egl_headers.files = \ diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro index 5979b68098..1da079fd40 100644 --- a/src/angle/src/libGLESv2/libGLESv2.pro +++ b/src/angle/src/libGLESv2/libGLESv2.pro @@ -1,5 +1,7 @@ CONFIG += simd installed include(../common/common.pri) +DEF_FILE_TARGET=$${TARGET} +TARGET=$$qtLibraryTarget($${LIBGLESV2_NAME}) INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libANGLE @@ -327,8 +329,8 @@ angle_d3d11 { } !static { - DEF_FILE = $$ANGLE_DIR/src/libGLESv2/$${TARGET}.def - mingw:equals(QT_ARCH, i386): DEF_FILE = $$ANGLE_DIR/src/libGLESv2/$${TARGET}_mingw32.def + DEF_FILE = $$ANGLE_DIR/src/libGLESv2/$${DEF_FILE_TARGET}.def + mingw:equals(QT_ARCH, i386): DEF_FILE = $$ANGLE_DIR/src/libGLESv2/$${DEF_FILE_TARGET}_mingw32.def } else { DEFINES += DllMain=DllMain_ANGLE # prevent symbol from conflicting with the user's DllMain } diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index 99e313daf7..083d912331 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -6,7 +6,6 @@ HEADERS += \ arch/qatomic_armv7.h \ arch/qatomic_bootstrap.h \ arch/qatomic_ia64.h \ - arch/qatomic_mips.h \ arch/qatomic_x86.h \ arch/qatomic_gcc.h \ arch/qatomic_cxx11.h diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9ca023a2ca..7fd76be3ca 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -145,7 +145,7 @@ attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey will also flip accordingly (i.e., QKeySequence::Copy will be Command+C on the keyboard regardless of the value set, though what is output for - QKeySequence::toString(QKeySequence::PortableText) will be different). + QKeySequence::toString() will be different). \value AA_Use96Dpi Assume the screen has a resolution of 96 DPI rather than using the OS-provided resolution. This will cause font rendering diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 8ff4ffc7a7..a6b01b796f 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -50,7 +50,7 @@ #include #include -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) # include #elif defined(Q_CC_INTEL) # include // for _addcarry_u diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 23a2fbecdb..354e4931b9 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -177,7 +177,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re \note The act of monitoring files and directories for modifications consumes system resources. This implies there is a limit to the number of files and directories your process can - monitor simultaneously. On Mac OS X 10.4 and all BSD variants, for + monitor simultaneously. On all BSD variants, for example, an open file descriptor is required for each monitored file. Some system limits the number of open file descriptors to 256 by default. This means that addPath() and addPaths() will fail if @@ -185,7 +185,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re the file system monitor. Also note that your process may have other file descriptors open in addition to the ones for files being monitored, and these other open descriptors also count in - the total. Mac OS X 10.5 and up use a different backend and do not + the total. OS X uses a different backend and does not suffer from this issue. diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b09c99985c..952116b9db 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2098,7 +2098,9 @@ QByteArray QProcess::readAllStandardError() \b{Windows:} The arguments are quoted and joined into a command line that is compatible with the \c CommandLineToArgvW() Windows function. For programs that have different command line quoting requirements, - you need to use setNativeArguments(). + you need to use setNativeArguments(). One notable program that does + not follow the \c CommandLineToArgvW() rules is cmd.exe and, by + consequence, all batch scripts. The OpenMode is set to \a mode. diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index 57d365e916..341a504168 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -229,7 +229,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) CFRelease(bundleUrl); CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); - CFStringRef cfResourcesPath = CFURLCopyPath(bundleUrl); + CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl); QString resourcesPath = QCFString::toQString(cfResourcesPath); CFRelease(cfResourcesPath); CFRelease(resourcesUrl); diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 98514c56af..05c18995ff 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -219,7 +219,7 @@ QT_BEGIN_NAMESPACE \value TouchEnd End of touch-event sequence (QTouchEvent). \value TouchUpdate Touch-screen event (QTouchEvent). \value UngrabKeyboard Item loses keyboard grab (QGraphicsItem only). - \value UngrabMouse Item loses mouse grab (QGraphicsItem only). + \value UngrabMouse Item loses mouse grab (QGraphicsItem, QQuickItem). \value UpdateLater The widget should be queued to be repainted at a later time. \value UpdateRequest The widget should be repainted. \value WhatsThis The widget should reveal "What's This?" help (QHelpEvent). diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 47b869f62a..62aaca88e9 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -513,7 +513,7 @@ QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext() wc.lpszClassName = className; atom = RegisterClass(&wc); if (!atom) { - qErrnoWarning("%s: RegisterClass() failed", Q_FUNC_INFO, qPrintable(qClassName)); + qErrnoWarning("%s RegisterClass() failed", qPrintable(qClassName)); delete [] className; className = 0; } @@ -549,7 +549,7 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch 0); // windows creation data. if (!wnd) { - qErrnoWarning("%s: CreateWindow() for QEventDispatcherWin32 internal window failed", Q_FUNC_INFO); + qErrnoWarning("CreateWindow() for QEventDispatcherWin32 internal window failed"); return 0; } diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index e0fe144c26..917c29b8d6 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -568,9 +568,9 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("mime/") + file); // pre-1.3 } if (mimeFiles.isEmpty()) { - qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist."; - qWarning() << "Either it was just removed, or the directory doesn't have executable permission..."; - qWarning() << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime"), QStandardPaths::LocateDirectory); + qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist.\n" + "Either it was just removed, or the directory doesn't have executable permission..." + << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime"), QStandardPaths::LocateDirectory); return; } @@ -756,7 +756,7 @@ void QMimeXMLProvider::ensureLoaded() foreach (const QString &packageDir, packageDirs) { QDir dir(packageDir); const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); - //qDebug() << static_cast(this) << Q_FUNC_INFO << packageDir << files; + //qDebug() << static_cast(this) << packageDir << files; if (!fdoXmlFound) fdoXmlFound = files.contains(QLatin1String("freedesktop.org.xml")); QStringList::const_iterator endIt(files.constEnd()); diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 9924bef8f5..7556f5caf8 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -147,8 +147,8 @@ void QFactoryLoader::update() library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); if (!library->isPlugin()) { if (qt_debug_component()) { - qDebug() << library->errorString; - qDebug() << " not a plugin"; + qDebug() << library->errorString << endl + << " not a plugin"; } library->release(); continue; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 763f0fb1e9..38e82fc059 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -337,12 +337,10 @@ static void installCoverageTool(QLibraryPrivate *libPrivate) if (qt_debug_component()) { if (ret >= 0) { - qDebug("%s: coverage data for %s registered", - Q_FUNC_INFO, + qDebug("coverage data for %s registered", qPrintable(libPrivate->fileName)); } else { - qWarning("%s: could not register %s: error %d; coverage data may be incomplete", - Q_FUNC_INFO, + qWarning("could not register %s: error %d; coverage data may be incomplete", qPrintable(libPrivate->fileName), ret); } diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 59f8f66869..bbe2e28ea8 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -248,6 +248,8 @@ bool QCollator::numericMode() const The default is locale dependent. + \note This method is not currently supported on Apple platforms or if Qt is configured to not use ICU on Linux. + \sa ignorePunctuation() */ void QCollator::setIgnorePunctuation(bool on) diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 8ed0da7ca0..5710f3925b 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -820,8 +820,8 @@ void **QListData::erase(void **xi) /*! \fn void QList::insert(int i, const T &value) - Inserts \a value at index position \a i in the list. If \a i - is 0, the value is prepended to the list. If \a i is size(), the + Inserts \a value at index position \a i in the list. If \a i <= 0, + the value is prepended to the list. If \a i >= size(), the value is appended to the list. Example: diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 0fcba3c0c4..f1cf23cc6a 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -384,6 +384,9 @@ initialized with a \l{default-constructed value}. If \a size is less than the current size, elements are removed from the end. + Since Qt 5.6, resize() doesn't shrink the capacity anymore. + To shed excess capacity, use squeeze(). + \sa size() */ diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 890dbd317d..3ce33fb477 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -406,9 +406,6 @@ void QVector::resize(int asize) if (asize > oldAlloc) { // there is not enough space newAlloc = asize; opt = QArrayData::Grow; - } else if (!d->capacityReserved && asize < d->size && asize < (oldAlloc >> 1)) { // we want to shrink - newAlloc = asize; - opt = QArrayData::Grow; } else { newAlloc = oldAlloc; } diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index cc00f5c172..6090f42ba7 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1228,6 +1228,12 @@ bool QIcon::hasThemeIcon(const QString &name) */ void QIcon::setIsMask(bool isMask) { + if (!d) { + d = new QIconPrivate; + d->engine = new QPixmapIconEngine; + } else { + detach(); + } d->is_mask = isMask; } @@ -1242,6 +1248,8 @@ void QIcon::setIsMask(bool isMask) */ bool QIcon::isMask() const { + if (!d) + return false; return d->is_mask; } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 492268402d..9c42cd44a6 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -907,7 +907,7 @@ void QPixmap::fill(const QPaintDevice *device, const QPoint &p) { Q_UNUSED(device) Q_UNUSED(p) - qWarning("%s is deprecated, ignored", Q_FUNC_INFO); + qWarning("this function is deprecated, ignored"); } @@ -1703,8 +1703,8 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { - qWarning("%s is deprecated, use QScreen::grabWindow() instead." - " Defaulting to primary screen.", Q_FUNC_INFO); + qWarning("this function is deprecated, use QScreen::grabWindow() instead." + " Defaulting to primary screen."); return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h); } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f88f6dc01a..49a05c48dd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -165,7 +165,7 @@ int QGuiApplicationPrivate::mouse_double_click_distance = -1; QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0; -static Qt::LayoutDirection layout_direction = Qt::LeftToRight; +static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto; static bool force_reverse = false; QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0; @@ -1305,7 +1305,6 @@ void QGuiApplicationPrivate::init() pluginList << argv[i]; } else if (arg == "-reverse") { force_reverse = true; - QGuiApplication::setLayoutDirection(Qt::RightToLeft); #ifdef Q_OS_MAC } else if (arg.startsWith("-psn_")) { // eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder. @@ -1429,6 +1428,9 @@ void QGuiApplicationPrivate::init() #else Q_UNUSED(loadTestability); #endif // QT_NO_LIBRARY + + if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) + QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); } extern void qt_cleanupFontDatabase(); @@ -3300,7 +3302,10 @@ void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction) Qt::LayoutDirection QGuiApplication::layoutDirection() { - return layout_direction; + // layout_direction is only ever Qt::LayoutDirectionAuto if setLayoutDirection + // was never called, or called with Qt::LayoutDirectionAuto (which is a no-op). + // In that case we return the default LeftToRight. + return layout_direction == Qt::LayoutDirectionAuto ? Qt::LeftToRight : layout_direction; } /*! diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index ce4a0ec09e..a0769ca671 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -175,7 +175,8 @@ static bool convert(const QVariant::Private *d, int t, switch (t) { case QVariant::ByteArray: if (d->type == QVariant::Color) { - *static_cast(result) = v_cast(d)->name().toLatin1(); + const QColor *c = v_cast(d); + *static_cast(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1(); return true; } break; @@ -190,9 +191,11 @@ static bool convert(const QVariant::Private *d, int t, case QVariant::Font: *str = v_cast(d)->toString(); return true; - case QVariant::Color: - *str = v_cast(d)->name(); + case QVariant::Color: { + const QColor *c = v_cast(d); + *str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); return true; + } default: break; } diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index a002b8c48d..a3201aa23f 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -94,32 +94,121 @@ static inline qreal initialGlobalScaleFactor() plugin interfacing parts of QtGui, for example the QWindow, QScreen and QWindowSystemInterface implementation. - The coordinate system scaling is enabled by setting one or more scale - factors. These will then be factored into the value returned by the - devicePixelRatio() accessors (any native scale factor will also be - included in this value). Several setters are available: + There are now up to three active coordinate systems in Qt: - - A process-global scale factor - - QT_SCALE_FACTOR (environment variable) - - QHighDpiScaling::setGlobalFactor() + --------------------------------------------------- + | Application Device Independent Pixels | devicePixelRatio + | Qt Widgets | = + | Qt Gui | + |---------------------------------------------------| Qt Scale Factor + | Qt Gui QPlatform* Native Pixels | * + | Qt platform plugin | + |---------------------------------------------------| OS Scale Factor + | Display Device Pixels | + | (Graphics Buffers) | + ----------------------------------------------------- - - A per-screen scale factor - - QT_AUTO_SCALE_FACTOR (environment variable) - Setting this to a true-ish value will make QHighDpiScaling - call QPlatformScreen::pixelDensity() - - QHighDpiScaling::setScreenFactor(screen, factor); - - QT_SCREEN_SCALE_FACTORS (environment variable) - Set this to a semicolon-separated list of scale factors - (matching the order of QGuiApplications::screens()), - or to a list of name=value pairs (where name matches - QScreen::name()). + This is an simplification and shows the main coordinate system. All layers + may work with device pixels in specific cases: OpenGL, creating the backing + store, and QPixmap management. The "Native Pixels" coordinate system is + internal to Qt and should not be exposed to Qt users: Seen from the outside + there are only two coordinate systems: device independent pixels and device + pixels. - All scale factors are of type qreal. + The devicePixelRatio seen by applications is the product of the Qt scale + factor and the OS scale factor. The value of the scale factors may be 1, + in which case two or more of the coordinate systems are equivalent. Platforms + that (may) have an OS scale factor include OS X, iOS and Wayland. - The main scaling functions for use in QtGui are: + Note that the functions in this file do not work with the OS scale factor + directly and are limited to converting between device independent and native + pixels. The OS scale factor is accunted for by QWindow::devicePixelRatio() + and similar functions. + + Configuration Examples: + + 'Classic': Device Independent Pixels = Native Pixels = Device Pixels + --------------------------------------------------- devicePixelRatio: 1 + | Application / Qt Gui 100 x 100 | + | | Qt Scale Factor: 1 + | Qt Platform / OS 100 x 100 | + | | OS Scale Factor: 1 + | Display 100 x 100 | + ----------------------------------------------------- + + 'Retina Device': Device Independent Pixels = Native Pixels + --------------------------------------------------- devicePixelRatio: 2 + | Application / Qt Gui 100 x 100 | + | | Qt Scale Factor: 1 + | Qt Platform / OS 100 x 100 | + |---------------------------------------------------| OS Scale Factor: 2 + | Display 200 x 200 | + ----------------------------------------------------- + + '2x Qt Scaling': Native Pixels = Device Pixels + --------------------------------------------------- devicePixelRatio: 2 + | Application / Qt Gui 100 x 100 | + |---------------------------------------------------| Qt Scale Factor: 2 + | Qt Platform / OS 200 x 200 | + | | OS Scale Factor: 1 + | Display 200 x 200 | + ----------------------------------------------------- + + The Qt Scale Factor is the product of two sub-scale factors, which + are independently either set or determined by the platform plugin. + Several APIs are offered for this, targeting both developers and + end users. All scale factors are of type qreal. + + 1) A global scale factor + The QT_SCALE_FACTOR environment variable can be used to set + a global scale factor for all windows in the processs. This + is useful for testing and debugging (you can simulate any + devicePixelRatio without needing access to sepcial hardware), + and perhaps also for targeting a specific application to + a specific display type (embedded use cases). + + 2) A per-screen scale factors + Some platform plugins support providing a per-screen scale + factor based on display density information. These platforms + include X11, Windows, and Android. + + There are two APIs for enabling or disabling this behavior: + - The QT_AUTO_SCALE_FACTOR environment variable. + - The AA_EnableHighDpiScaling and AA_DisableHighDpiScaling + application attributes + + Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity() + and use the value provided as the scale factor for the screen in + question. Disabling is done on a 'veto' basis where either the + environment or the application source can disable. The intended use + cases are 'My system is not providing correct display density + information' and 'My application needs to work in display pixels', + respectively. + + The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen + scale factors manually.Set this to a semicolon-separated + list of scale factors (matching the order of QGuiApplications::screens()), + or to a list of name=value pairs (where name matches QScreen::name()). + + Coordinate conversion functions must be used when writing code that passes + geometry across the Qt Gui / Platform plugin boundary. The main conversion + functions are: T toNativePixels(T, QWindow *) T fromNativePixels(T, QWindow*) - Where T is QPoint, QSize, QRect etc. + + The following classes in QtGui use native pixels, for the convenience of the + plataform plugins: + QPlatformWindow + QPlatformScreen + QWindowSystemInterface (API only - Events are in device independent pixels) + + As a special consideration platform plugin code should be careful about + calling QtGui geometry accessor functions: + QRect r = window->geometry(); + Here the returned geometry is in device independent pixels. Add a conversion call: + QRect r = QHighDpi::toNativePixels(window->geometry()); + (Avoiding calling QWindow and instead using the QPlatformWindow geometry + might be a better course of action in this case.) */ qreal QHighDpiScaling::m_factor = 1.0; @@ -227,7 +316,7 @@ void QHighDpiScaling::setGlobalFactor(qreal factor) if (qFuzzyCompare(factor, m_factor)) return; if (!QGuiApplication::allWindows().isEmpty()) - qWarning() << Q_FUNC_INFO << "QHighDpiScaling::setFactor: Should only be called when no windows exist."; + qWarning("QHighDpiScaling::setFactor: Should only be called when no windows exist."); m_globalScalingActive = !qFuzzyCompare(factor, qreal(1)); m_factor = m_globalScalingActive ? factor : qreal(1); diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp index 2749b05691..1d59c38598 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp @@ -69,18 +69,18 @@ bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer { if (graphicsBuffer->lock(QPlatformGraphicsBuffer::TextureAccess)) { if (!graphicsBuffer->bindToTexture(rect)) { - qWarning() << Q_FUNC_INFO << "Failed to bind graphicsbuffer to texture"; + qWarning("Failed to bind %sgraphicsbuffer to texture", ""); return false; } if (swizzle) *swizzle = false; } else if (graphicsBuffer->lock(QPlatformGraphicsBuffer::SWReadAccess)) { if (!bindSWToTexture(graphicsBuffer, swizzle, rect)) { - qWarning() << Q_FUNC_INFO << "Failed to bind SW graphcisbuffer to texture"; + qWarning("Failed to bind %sgraphicsbuffer to texture", "SW "); return false; } } else { - qWarning() << Q_FUNC_INFO << "Failed to lock"; + qWarning("Failed to lock"); return false; } return true; diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 00c50a9861..af89a73455 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -91,7 +91,8 @@ public: SyncState, RasterGLSurface, AllGLFunctionsQueryable, - ApplicationIcon + ApplicationIcon, + SwitchableWidgetComposition }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 8666d0a04c..8e9767d69e 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -362,7 +362,7 @@ static int log2(uint i) int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "angle"); return 0; } @@ -384,7 +384,7 @@ int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "transform"); return QTransform(); } @@ -415,7 +415,7 @@ QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::Screen QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "map"); return rect; } diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index b6b50372ae..fb322ae74f 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -680,7 +680,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) { const QPlatformScreen *platformScreen = handle(); if (!platformScreen) { - qWarning("%s invoked with handle==0", Q_FUNC_INFO); + qWarning("invoked with handle==0"); return QPixmap(); } return platformScreen->grabWindow(window, x, y, width, height); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 95f0f1cc90..45e0acec63 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -369,7 +369,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) { Q_Q(QWindow); if (parentWindow) { - qWarning() << this << Q_FUNC_INFO << '(' << newScreen << "): Attempt to set a screen on a child window."; + qWarning() << this << '(' << newScreen << "): Attempt to set a screen on a child window."; return; } if (newScreen != topLevelScreen) { @@ -625,7 +625,7 @@ void QWindow::setParent(QWindow *parent) QScreen *newScreen = parent ? parent->screen() : screen(); if (d->windowRecreationRequired(newScreen)) { - qWarning() << this << Q_FUNC_INFO << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')'; + qWarning() << this << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')'; return; } @@ -1186,7 +1186,7 @@ void QWindow::setTransientParent(QWindow *parent) { Q_D(QWindow); if (parent && !parent->isTopLevel()) { - qWarning() << Q_FUNC_INFO << parent << "must be a top level window."; + qWarning() << parent << "must be a top level window."; return; } diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 68cd8a82b4..a77d6743ad 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -184,7 +184,7 @@ struct VersionTerm { bool VersionTerm::matches(const QVersionNumber &other) const { if (isNull() || other.isNull()) { - qWarning() << Q_FUNC_INFO << "called with invalid parameters"; + qWarning("called with invalid parameters"); return false; } switch (op) { @@ -262,7 +262,7 @@ struct OsTypeTerm bool matches(const QString &osName, const QVersionNumber &kernelVersion, const QString &osRelease) const { if (isNull() || osName.isEmpty() || kernelVersion.isNull()) { - qWarning() << Q_FUNC_INFO << "called with invalid parameters"; + qWarning("called with invalid parameters"); return false; } if (type != osName) diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp index 1c6a7937e5..9e611a160d 100644 --- a/src/gui/opengl/qopengltextureblitter.cpp +++ b/src/gui/opengl/qopengltextureblitter.cpp @@ -285,7 +285,7 @@ bool QOpenGLTextureBlitterPrivate::buildProgram(ProgramIndex idx, const char *vs p->glProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, fs); p->glProgram->link(); if (!p->glProgram->isLinked()) { - qWarning() << Q_FUNC_INFO << "Could not link shader program:\n" << p->glProgram->log(); + qWarning() << "Could not link shader program:\n" << p->glProgram->log(); return false; } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index fd9ae0aaca..5b25c2fd95 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -101,11 +101,11 @@ SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \ painting/qimagescale_sse4.cpp AVX2_SOURCES += painting/qdrawhelper_avx2.cpp -!ios:!contains(QT_ARCH, "arm64") { +!ios { CONFIG += no_clang_integrated_as NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h - NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S + !contains(QT_ARCH, "arm64"): NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S } MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 988bee9b27..5854008ea3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3885,7 +3885,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData) QSpanData *data = reinterpret_cast(userData); Operator op = getOperator(data, spans, count); if (!op.funcSolid64) { - qDebug() << Q_FUNC_INFO << "unsupported 64bit blend attempted"; + qDebug("unsupported 64bit blend attempted"); return blend_color_generic(count, spans, userData); } @@ -4180,7 +4180,7 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi Operator op = getOperator(data, spans, count); if (!op.func64) { - qWarning() << Q_FUNC_INFO << "Unsupported blend"; + qWarning("Unsupported blend"); return blend_untransformed_generic(count, spans, userData); } QRgba64 buffer[buffer_size]; @@ -6309,7 +6309,7 @@ void qt_memfill16(quint16 *dest, quint16 color, int count) qt_memfill_template(dest, color, count); } #endif -#if !defined(__SSE2__) && (!defined(__ARM_NEON__) || defined(Q_PROCESSOR_ARM_64)) +#if !defined(__SSE2__) && !defined(__ARM_NEON__) # ifdef QT_COMPILER_SUPPORTS_MIPS_DSP extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int); # endif @@ -6425,14 +6425,11 @@ void qInitDrawhelperAsm() #endif // SSE2 -#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) && !defined(Q_PROCESSOR_ARM_64) +#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; @@ -6440,6 +6437,21 @@ void qInitDrawhelperAsm() qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; #endif + qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + + extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, + int y, int x, int length); + + qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; + +#if !defined(Q_PROCESSOR_ARM_64) + // The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64 + qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; @@ -6448,19 +6460,13 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; +#endif - extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, - int y, int x, int length); - - qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; #endif #if defined(Q_PROCESSOR_MIPS_32) && defined(QT_COMPILER_SUPPORTS_MIPS_DSP) diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index bf4758afd2..413fddcfdc 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -44,6 +44,7 @@ QT_BEGIN_NAMESPACE void qt_memfill32(quint32 *dest, quint32 value, int count) { const int epilogueSize = count % 16; +#if !defined(Q_PROCESSOR_ARM_64) if (count >= 16) { quint32 *const neonEnd = dest + count - epilogueSize; register uint32x4_t valueVector1 asm ("q0") = vdupq_n_u32(value); @@ -58,6 +59,22 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) ); } } +#else + if (count >= 16) { + quint32 *const neonEnd = dest + count - epilogueSize; + register uint32x4_t valueVector1 asm ("v0") = vdupq_n_u32(value); + register uint32x4_t valueVector2 asm ("v1") = valueVector1; + while (dest != neonEnd) { + asm volatile ( + "st2 { v0.4s, v1.4s }, [%[DST]], #32 \n\t" + "st2 { v0.4s, v1.4s }, [%[DST]], #32 \n\t" + : [DST]"+r" (dest) + : [VALUE1]"w"(valueVector1), [VALUE2]"w"(valueVector2) + : "memory" + ); + } + } +#endif switch (epilogueSize) { @@ -118,6 +135,7 @@ static inline uint16x8_t qvsource_over_u16(uint16x8_t src16, uint16x8_t dst16, u return vaddq_u16(src16, qvbyte_mul_u16(dst16, alpha16, half)); } +#if !defined(Q_PROCESSOR_ARM_64) extern "C" void pixman_composite_over_8888_0565_asm_neon (int32_t w, int32_t h, @@ -164,7 +182,6 @@ pixman_composite_src_0565_0565_asm_neon (int32_t w, int32_t dst_stride, uint16_t *src, int32_t src_stride); - // qblendfunctions.cpp void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, @@ -204,6 +221,7 @@ void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, int w, int h, int const_alpha); + template static inline void scanLineBlit16(quint16 *dst, quint16 *src, int dstride) { @@ -329,11 +347,16 @@ void qt_blend_argb32_on_rgb16_neon(uchar *destPixels, int dbpl, pixman_composite_over_8888_0565_asm_neon(w, h, dst, dbpl / 2, src, sbpl / 4); } +#endif void qt_blend_argb32_on_argb32_scanline_neon(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) { +#if !defined(Q_PROCESSOR_ARM_64) pixman_composite_scanline_over_asm_neon(length, dest, src); +#else + qt_blend_argb32_on_argb32_neon((uchar *)dest, 4 * length, (uchar *)src, 4 * length, length, 1, 256); +#endif } else { qt_blend_argb32_on_argb32_neon((uchar *)dest, 4 * length, (uchar *)src, 4 * length, length, 1, (const_alpha * 256) / 255); } @@ -349,7 +372,51 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl, uint16x8_t half = vdupq_n_u16(0x80); uint16x8_t full = vdupq_n_u16(0xff); if (const_alpha == 256) { +#if !defined(Q_PROCESSOR_ARM_64) pixman_composite_over_8888_8888_asm_neon(w, h, (uint32_t *)destPixels, dbpl / 4, (uint32_t *)srcPixels, sbpl / 4); +#else + for (int y=0; y= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } +#endif } else if (const_alpha != 0) { const_alpha = (const_alpha * 255) >> 8; uint16x8_t const_alpha16 = vdupq_n_u16(const_alpha); @@ -463,6 +530,7 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl, } } +#if !defined(Q_PROCESSOR_ARM_64) void qt_alphamapblit_quint16_neon(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *bitmap, @@ -703,6 +771,7 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int data[i + j] = dstBuffer[j]; } } +#endif void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha) { @@ -754,16 +823,13 @@ void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uin uint *const neonEnd = end - 3; while (dst < neonEnd) { - asm volatile ( - "vld2.8 { d0, d1 }, [%[SRC]] !\n\t" - "vld2.8 { d2, d3 }, [%[DST]]\n\t" - "vqadd.u8 q0, q0, q1\n\t" - "vst2.8 { d0, d1 }, [%[DST]] !\n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : - : "memory", "d0", "d1", "d2", "d3", "q0", "q1" - ); - } + uint8x16_t vs = vld1q_u8((const uint8_t*)src); + const uint8x16_t vd = vld1q_u8((uint8_t*)dst); + vs = vqaddq_u8(vs, vd); + vst1q_u8((uint8_t*)dst, vs); + src += 4; + dst += 4; + }; while (dst != end) { *dst = comp_func_Plus_one_pixel(*dst, *src); @@ -802,6 +868,7 @@ void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uin } } +#if !defined(Q_PROCESSOR_ARM_64) static const int tileSize = 32; extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); @@ -945,6 +1012,7 @@ void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, } } } +#endif class QSimdNeon { diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 5f873bfe7e..4e26d8f741 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -75,8 +75,15 @@ public: ~QPlatformBackingStorePrivate() { #ifndef QT_NO_OPENGL - if (blitter) - blitter->destroy(); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx) { + if (textureId) + ctx->functions()->glDeleteTextures(1, &textureId); + if (blitter) + blitter->destroy(); + } else if (textureId || blitter) { + qWarning("No context current during QPlatformBackingStore destruction, OpenGL resources not released"); + } delete blitter; #endif } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 746a51318e..2f755d0c25 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1277,14 +1277,14 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; } - - if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { - for (uint i = 0; i < num_glyphs; ++i) - g.advances[i] = g.advances[i].round(); - } } #endif + if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) { + for (uint i = 0; i < num_glyphs; ++i) + g.advances[i] = g.advances[i].round(); + } + glyphs_shaped += num_glyphs; } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 429e910f18..1fd20cfbef 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -279,6 +279,12 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("p%1") .arg(block.blockFormatIndex())); for (QTextBlock::Iterator frag = block.begin(); !frag.atEnd(); ++frag) { + bool isHyperlink = frag.fragment().charFormat().hasProperty(QTextFormat::AnchorHref); + if (isHyperlink) { + QString value = frag.fragment().charFormat().property(QTextFormat::AnchorHref).toString(); + writer.writeStartElement(textNS, QString::fromLatin1("a")); + writer.writeAttribute(xlinkNS, QString::fromLatin1("href"), value); + } writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed in front of it. writer.writeStartElement(textNS, QString::fromLatin1("span")); @@ -335,6 +341,9 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeCharacters(fragmentText.mid(exportedIndex)); writer.writeEndElement(); // span + writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed behind it. + if (isHyperlink) + writer.writeEndElement(); // a } writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed behind it. writer.writeEndElement(); // p diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 354dfeb78c..70daf55b61 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -197,7 +197,7 @@ bool QDesktopServices::openUrl(const QUrl &url) QPlatformServices *platformServices = platformIntegration->services(); if (!platformServices) { - qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO); + qWarning("The platform plugin does not support services."); return false; } return url.scheme() == QLatin1String("file") ? diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index c07064fd94..b0e366d2f8 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -492,7 +492,7 @@ void QHttpThreadDelegate::finishedSlot() if (httpReply->statusCode() >= 400) { // it's an error reply QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", - "Error downloading %1 - server replied: %2")); + "Error transferring %1 - server replied: %2")); msg = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); emit error(statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()), msg); } @@ -518,7 +518,7 @@ void QHttpThreadDelegate::synchronousFinishedSlot() if (httpReply->statusCode() >= 400) { // it's an error reply QString msg = QLatin1String(QT_TRANSLATE_NOOP("QNetworkReply", - "Error downloading %1 - server replied: %2")); + "Error transferring %1 - server replied: %2")); incomingErrorDetail = msg.arg(httpRequest.url().toString(), httpReply->reasonPhrase()); incomingErrorCode = statusCodeFromHttp(httpReply->statusCode(), httpRequest.url()); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 12ecad5ff7..681c88e87b 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -127,8 +127,10 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } else { #ifndef QT_NO_BEARERMANAGEMENT - QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); + if (session) { + QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); + } #endif } diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 7d2c0dfef2..5f9697ab92 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -452,7 +452,7 @@ bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray break; } default: { - qWarning() << Q_FUNC_INFO << "got unexpected zlib return value:" << zlibRet; + qWarning() << "got unexpected zlib return value:" << zlibRet; return false; } } @@ -688,7 +688,7 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID) Q_ASSERT(replyPrivate); if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) { - qWarning() << Q_FUNC_INFO << "Trying to upload to closed stream"; + qWarning("Trying to upload to closed stream"); return false; } @@ -843,7 +843,7 @@ void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) // break; } default: - qWarning() << Q_FUNC_INFO << "cannot handle frame of type" << type; + qWarning() << "cannot handle frame of type" << type; } } @@ -887,13 +887,13 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD QByteArray uncompressedHeader; if (!uncompressHeader(headerValuePairs, &uncompressedHeader)) { - qWarning() << Q_FUNC_INFO << "error reading header from SYN_REPLY message"; + qWarning("error reading header from SYN_REPLY message"); return; } qint32 headerCount = fourBytesToInt(uncompressedHeader.constData()); if (headerCount * 8 > uncompressedHeader.size()) { - qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + qWarning("error parsing header from SYN_REPLY message"); sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); return; } @@ -904,7 +904,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD QByteArray name = uncompressedHeader.mid(readPointer, count); readPointer += count; if (readPointer > uncompressedHeader.size()) { - qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + qWarning("error parsing header from SYN_REPLY message"); sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); return; } @@ -913,7 +913,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD QByteArray value = uncompressedHeader.mid(readPointer, count); readPointer += count; if (readPointer > uncompressedHeader.size()) { - qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + qWarning("error parsing header from SYN_REPLY message"); sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); return; } @@ -1014,7 +1014,7 @@ void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length, errorMessage = "server cannot process the frame because it is too large"; break; default: - qWarning() << Q_FUNC_INFO << "could not understand servers RST_STREAM status code"; + qWarning("could not understand servers RST_STREAM status code"); errorCode = QNetworkReply::ProtocolFailure; errorMessage = "got SPDY RST_STREAM message with unknown error code"; } @@ -1078,7 +1078,7 @@ void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const break; } default: - qWarning() << Q_FUNC_INFO << "found unknown settings value" << value; + qWarning() << "found unknown settings value" << value; } } } @@ -1117,7 +1117,7 @@ void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/, break; } default: - qWarning() << Q_FUNC_INFO << "unexpected status code" << statusCode; + qWarning() << "unexpected status code" << statusCode; errorCode = QNetworkReply::ProtocolUnknownError; } @@ -1252,7 +1252,7 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) } if (flag_compress) { - qWarning() << Q_FUNC_INFO << "SPDY level compression is not supported"; + qWarning("SPDY level compression is not supported"); } if (flag_fin) { diff --git a/src/network/kernel/qdnslookup_android.cpp b/src/network/kernel/qdnslookup_android.cpp index b03c63c320..978da57609 100644 --- a/src/network/kernel/qdnslookup_android.cpp +++ b/src/network/kernel/qdnslookup_android.cpp @@ -41,7 +41,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN Q_UNUSED(requestName); Q_UNUSED(nameserver); Q_UNUSED(reply); - qWarning() << Q_FUNC_INFO << "Not yet supported on Android"; + qWarning("Not yet supported on Android"); reply->error = QDnsLookup::ResolverError; reply->errorString = tr("Not yet supported on Android"); return; diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp index fa782dadf7..a5e97c4a93 100644 --- a/src/network/kernel/qdnslookup_unix.cpp +++ b/src/network/kernel/qdnslookup_unix.cpp @@ -166,7 +166,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN ns->sin6_addr.s6_addr[i] = ipv6Address[i]; } #else - qWarning() << Q_FUNC_INFO << "IPv6 addresses for nameservers is currently not supported"; + qWarning("IPv6 addresses for nameservers is currently not supported"); reply->error = QDnsLookup::ResolverError; reply->errorString = tr("IPv6 addresses for nameservers is currently not supported"); return; diff --git a/src/network/kernel/qdnslookup_win.cpp b/src/network/kernel/qdnslookup_win.cpp index 056a9c7a62..4a6c631983 100644 --- a/src/network/kernel/qdnslookup_win.cpp +++ b/src/network/kernel/qdnslookup_win.cpp @@ -60,9 +60,9 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN // For supoprting IPv6 nameserver addresses, we'll need to switch // from DnsQuey() to DnsQueryEx() as it supports passing an IPv6 // address in the nameserver list - qWarning() << Q_FUNC_INFO << "IPv6 addresses for nameservers is currently not supported"; + qWarning("IPv6 addresses for nameservers are currently not supported"); reply->error = QDnsLookup::ResolverError; - reply->errorString = tr("IPv6 addresses for nameservers is currently not supported"); + reply->errorString = tr("IPv6 addresses for nameservers are currently not supported"); return; } } diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index c11b889220..e86d3ad76e 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -672,6 +672,24 @@ int QNativeSocketEngine::accept() return d->nativeAccept(); } +/*! + Returns the number of bytes that are currently available for + reading. On error, -1 is returned. + + For UDP sockets, this function returns the accumulated size of all + pending datagrams, and it is therefore more useful for UDP sockets + to call hasPendingDatagrams() and pendingDatagramSize(). +*/ +qint64 QNativeSocketEngine::bytesAvailable() const +{ + Q_D(const QNativeSocketEngine); + Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1); + Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1); + + return d->nativeBytesAvailable(); +} + +#ifndef QT_NO_UDPSOCKET #ifndef QT_NO_NETWORKINTERFACE /*! @@ -733,23 +751,6 @@ bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface) #endif // QT_NO_NETWORKINTERFACE -/*! - Returns the number of bytes that are currently available for - reading. On error, -1 is returned. - - For UDP sockets, this function returns the accumulated size of all - pending datagrams, and it is therefore more useful for UDP sockets - to call hasPendingDatagrams() and pendingDatagramSize(). -*/ -qint64 QNativeSocketEngine::bytesAvailable() const -{ - Q_D(const QNativeSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1); - Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1); - - return d->nativeBytesAvailable(); -} - /*! Returns \c true if there is at least one datagram pending. This function is only called by UDP sockets, where a datagram can have @@ -834,6 +835,7 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, const Q return d->nativeSendDatagram(data, size, header); } +#endif // QT_NO_UDPSOCKET /*! Writes a block of \a size bytes from \a data to the socket. diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 5cc5e529fc..39e4d5e457 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -125,6 +125,12 @@ public: int accept() Q_DECL_OVERRIDE; void close() Q_DECL_OVERRIDE; + qint64 bytesAvailable() const Q_DECL_OVERRIDE; + + qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; + qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; + +#ifndef QT_NO_UDPSOCKET #ifndef QT_NO_NETWORKINTERFACE bool joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) Q_DECL_OVERRIDE; @@ -134,16 +140,12 @@ public: bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE; #endif - qint64 bytesAvailable() const Q_DECL_OVERRIDE; - - qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; - qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0, PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE; qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE; bool hasPendingDatagrams() const Q_DECL_OVERRIDE; qint64 pendingDatagramSize() const Q_DECL_OVERRIDE; +#endif // QT_NO_UDPSOCKET qint64 bytesToWrite() const Q_DECL_OVERRIDE; diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index e9fa227733..173221dec0 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -78,6 +78,21 @@ typedef IAsyncOperationWithProgress IAsyncBufferOperation; QT_BEGIN_NAMESPACE +static QByteArray socketDescription(const QAbstractSocketEngine *s) +{ + QByteArray result; + if (const QObject *o = s->parent()) { + const QString name = o->objectName(); + if (!name.isEmpty()) { + result += '"'; + result += name.toLocal8Bit(); + result += "\"/"; + } + result += o->metaObject()->className(); + } + return result; +} + // Common constructs #define Q_CHECK_VALID_SOCKETLAYER(function, returnValue) do { \ if (!isValid()) { \ @@ -275,8 +290,9 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) else if (d->socketType == QAbstractSocket::UdpSocket) hr = d->udpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp); if (hr == E_ACCESSDENIED) { - qErrnoWarning(hr, "QNativeSocketEngine::connectToHostByName: Unable to connect to host. \ - Please check your manifest capabilities."); + qErrnoWarning(hr, "QNativeSocketEngine::connectToHostByName: Unable to connect to host (%s:%hu/%s). " + "Please check your manifest capabilities.", + qPrintable(name), port, socketDescription(this).constData()); return false; } Q_ASSERT_SUCCEEDED(hr); @@ -328,7 +344,8 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); } if (hr == E_ACCESSDENIED) { - qErrnoWarning(hr, "Unable to bind socket. Please check your manifest capabilities."); + qErrnoWarning(hr, "Unable to bind socket (%s:%hu/%s). Please check your manifest capabilities.", + qPrintable(address.toString()), port, socketDescription(this).constData()); return false; } Q_ASSERT_SUCCEEDED(hr); @@ -381,12 +398,14 @@ int QNativeSocketEngine::accept() ComPtr op; hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &op); if (FAILED(hr)) { - qErrnoWarning(hr, "Faild to read from the socket buffer."); + qErrnoWarning(hr, "accept(): Failed to read from the socket buffer (%s).", + socketDescription(this).constData()); return -1; } hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to set socket read callback."); + qErrnoWarning(hr, "accept(): Failed to set socket read callback (%s).", + socketDescription(this).constData()); return -1; } d->currentConnections.append(socket); @@ -1272,12 +1291,14 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async ComPtr op; hr = stream->ReadAsync(buffer.Get(), bufferLength, InputStreamOptions_Partial, &op); if (FAILED(hr)) { - qErrnoWarning(hr, "Could not read into socket stream buffer."); + qErrnoWarning(hr, "handleReadyRead(): Could not read into socket stream buffer (%s).", + socketDescription(q).constData()); return S_OK; } hr = op->put_Completed(Callback(this, &QNativeSocketEnginePrivate::handleReadyRead).Get()); if (FAILED(hr)) { - qErrnoWarning(hr, "Failed to set socket read callback."); + qErrnoWarning(hr, "handleReadyRead(): Failed to set socket read callback (%s).", + socketDescription(q).constData()); return S_OK; } return S_OK; diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 2af0264116..326686fad0 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -51,12 +51,291 @@ #include #include +#include + #ifdef Q_OS_OSX #include #endif QT_BEGIN_NAMESPACE +static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode) +{ + const bool isServer = mode == QSslSocket::SslServerMode; + SSLContextRef context = Q_NULLPTR; + +#ifndef Q_OS_OSX + const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide; + // We never use kSSLDatagramType, so it's kSSLStreamType unconditionally. + context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType); + if (!context) + qCWarning(lcSsl) << "SSLCreateContext failed"; +#else // Q_OS_OSX + +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { + const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide; + // We never use kSSLDatagramType, so it's kSSLStreamType unconditionally. + context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType); + if (!context) + qCWarning(lcSsl) << "SSLCreateContext failed"; + } else { +#else + { +#endif + const OSStatus errCode = SSLNewContext(isServer, &context); + if (errCode != noErr || !context) + qCWarning(lcSsl) << "SSLNewContext failed with error:" << errCode; + } +#endif // !Q_OS_OSX + + return context; +} + +static void qt_releaseSecureTransportContext(SSLContextRef context) +{ + if (!context) + return; + +#ifndef Q_OS_OSX + CFRelease(context); +#else + +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { + CFRelease(context); + } else { +#else + { +#endif // QT_MAC_PLATFORM_... + const OSStatus errCode = SSLDisposeContext(context); + if (errCode != noErr) + qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode; + } +#endif // !Q_OS_OSX +} + +static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfigurationPrivate &configuration, + QTcpSocket *plainSocket) +{ + Q_ASSERT(context); + +#ifndef QSSLSOCKET_DEBUG + Q_UNUSED(plainSocket) +#endif + + OSStatus err = noErr; + +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_5_0) + if (configuration.protocol == QSsl::SslV3) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3"; + #endif + err = SSLSetProtocolVersionMin(context, kSSLProtocol3); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kSSLProtocol3); + } else if (configuration.protocol == QSsl::TlsV1_0) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol1); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol1); + } else if (configuration.protocol == QSsl::TlsV1_1) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol11); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol11); + } else if (configuration.protocol == QSsl::TlsV1_2) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol12); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::AnyProtocol) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : any"; + #endif + // kSSLProtocol3, since kSSLProtocol2 is disabled: + err = SSLSetProtocolVersionMin(context, kSSLProtocol3); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::TlsV1SslV3) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kSSLProtocol3); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::SecureProtocols) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol1); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::TlsV1_0OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol1); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::TlsV1_1OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol11); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else if (configuration.protocol == QSsl::TlsV1_2OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; + #endif + err = SSLSetProtocolVersionMin(context, kTLSProtocol12); + if (err == noErr) + err = SSLSetProtocolVersionMax(context, kTLSProtocol12); + } else { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration"; + #endif + return false; + } +#endif + + return err == noErr; +} + +#ifdef Q_OS_OSX + +static bool qt_setSessionProtocolOSX(SSLContextRef context, const QSslConfigurationPrivate &configuration, + QTcpSocket *plainSocket) +{ + // This function works with (now) deprecated API that does not even exist on + // iOS but is the only API we have on OS X below 10.8 + + // Without SSLSetProtocolVersionMin/Max functions it's quite difficult + // to have the required result: + // If we use SSLSetProtocolVersion - any constant except the ones with 'Only' suffix - + // allows a negotiation and we can not set the lower limit. + // SSLSetProtocolVersionEnabled supports only a limited subset of constants, if you believe their docs: + // kSSLProtocol2 + // kSSLProtocol3 + // kTLSProtocol1 + // kSSLProtocolAll + // Here we can only have a look into the SecureTransport's code and hope that what we see there + // and what we have on 10.7 is similar: + // SSLSetProtocoLVersionEnabled actually accepts other constants also, + // called twice with two different protocols it sets a range, + // called once with a protocol (when all protocols were disabled) + // - only this protocol is enabled (without a lower limit negotiation). + + Q_ASSERT(context); + +#ifndef QSSLSOCKET_DEBUG + Q_UNUSED(plainSocket) +#endif + + OSStatus err = noErr; + + // First, disable ALL: + if (SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, false) != noErr) + return false; + + if (configuration.protocol == QSsl::SslV3) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3"; + #endif + err = SSLSetProtocolVersion(context, kSSLProtocol3Only); + } else if (configuration.protocol == QSsl::TlsV1_0) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0"; + #endif + err = SSLSetProtocolVersion(context, kTLSProtocol1Only); + } else if (configuration.protocol == QSsl::TlsV1_1) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true); + } else if (configuration.protocol == QSsl::TlsV1_2) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + } else if (configuration.protocol == QSsl::AnyProtocol) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : any"; + #endif + err = SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, true); + } else if (configuration.protocol == QSsl::TlsV1SslV3) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + if (err == noErr) + err = SSLSetProtocolVersionEnabled(context, kSSLProtocol3, true); + } else if (configuration.protocol == QSsl::SecureProtocols) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + if (err == noErr) + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true); + } else if (configuration.protocol == QSsl::TlsV1_0OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + if (err == noErr) + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true); + } else if (configuration.protocol == QSsl::TlsV1_1OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + if (err == noErr) + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true); + } else if (configuration.protocol == QSsl::TlsV1_2OrLater) { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; + #endif + err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true); + } else { + #ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration"; + #endif + return false; + } + + return err == noErr; +} + +#endif // Q_OS_OSX + +QSecureTransportContext::QSecureTransportContext(SSLContextRef c) + : context(c) +{ +} + +QSecureTransportContext::~QSecureTransportContext() +{ + qt_releaseSecureTransportContext(context); +} + +QSecureTransportContext::operator SSLContextRef()const +{ + return context; +} + +void QSecureTransportContext::reset(SSLContextRef newContext) +{ + qt_releaseSecureTransportContext(context); + context = newContext; +} + Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_securetransport_mutex, (QMutex::Recursive)) //#define QSSLSOCKET_DEBUG @@ -144,7 +423,7 @@ void QSslSocketPrivate::ensureInitialized() // from QSslCertificatePrivate's ctor. s_loadedCiphersAndCerts = true; - QCFType context(SSLCreateContext(Q_NULLPTR, kSSLClientSide, kSSLStreamType)); + const QSecureTransportContext context(qt_createSecureTransportContext(QSslSocket::SslClientMode)); if (context) { QList ciphers; QList defaultCiphers; @@ -171,7 +450,6 @@ void QSslSocketPrivate::ensureInitialized() if (!s_loadRootCertsOnDemand) setDefaultCaCertificates(systemCaCertificates()); } else { - qCWarning(lcSsl) << "SSLCreateContext failed"; s_loadedCiphersAndCerts = false; } @@ -640,11 +918,7 @@ bool QSslSocketBackendPrivate::initSslContext() Q_ASSERT_X(!context, Q_FUNC_INFO, "invalid socket state, context is not null"); Q_ASSERT(plainSocket); - SSLProtocolSide side = kSSLClientSide; - if (mode == QSslSocket::SslServerMode) - side = kSSLServerSide; - - context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType); + context.reset(qt_createSecureTransportContext(mode)); if (!context) { setErrorAndEmit(QAbstractSocket::SslInternalError, "SSLCreateContext failed"); return false; @@ -740,7 +1014,7 @@ bool QSslSocketBackendPrivate::initSslContext() void QSslSocketBackendPrivate::destroySslContext() { - context = Q_NULLPTR; + context.reset(Q_NULLPTR); } static QByteArray _q_makePkcs12(const QList &certs, const QSslKey &key, const QString &passPhrase); @@ -837,8 +1111,6 @@ bool QSslSocketBackendPrivate::setSessionProtocol() { Q_ASSERT_X(context, Q_FUNC_INFO, "invalid SSL context (null)"); - OSStatus err = noErr; - // QSsl::SslV2 == kSSLProtocol2 is disabled in secure transport and // always fails with errSSLIllegalParam: // if (version < MINIMUM_STREAM_VERSION || version > MAXIMUM_STREAM_VERSION) @@ -849,85 +1121,20 @@ bool QSslSocketBackendPrivate::setSessionProtocol() return false; } - if (configuration.protocol == QSsl::SslV3) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : SSLv3"; -#endif - err = SSLSetProtocolVersionMin(context, kSSLProtocol3); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kSSLProtocol3); - } else if (configuration.protocol == QSsl::TlsV1_0) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol1); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol1); - } else if (configuration.protocol == QSsl::TlsV1_1) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol11); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol11); - } else if (configuration.protocol == QSsl::TlsV1_2) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol12); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::AnyProtocol) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : any"; -#endif - // kSSLProtocol3, since kSSLProtocol2 is disabled: - err = SSLSetProtocolVersionMin(context, kSSLProtocol3); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::TlsV1SslV3) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kSSLProtocol3); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::SecureProtocols) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol1); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::TlsV1_0OrLater) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol1); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::TlsV1_1OrLater) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol11); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else if (configuration.protocol == QSsl::TlsV1_2OrLater) { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; -#endif - err = SSLSetProtocolVersionMin(context, kTLSProtocol12); - if (err == noErr) - err = SSLSetProtocolVersionMax(context, kTLSProtocol12); - } else { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration"; -#endif - return false; - } +#ifndef Q_OS_OSX + return qt_setSessionProtocol(context, configuration, plainSocket); +#else - return err == noErr; +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { + return qt_setSessionProtocol(context, configuration, plainSocket); + } else { +#else + { +#endif + return qt_setSessionProtocolOSX(context, configuration, plainSocket); + } +#endif } bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h index 414c155882..7a622db185 100644 --- a/src/network/ssl/qsslsocket_mac_p.h +++ b/src/network/ssl/qsslsocket_mac_p.h @@ -45,8 +45,6 @@ // We mean it. // -#include - #include #include #include @@ -59,6 +57,20 @@ QT_BEGIN_NAMESPACE +class QSecureTransportContext +{ +public: + explicit QSecureTransportContext(SSLContextRef context); + ~QSecureTransportContext(); + + operator SSLContextRef () const; + void reset(SSLContextRef newContext); +private: + SSLContextRef context; + + Q_DISABLE_COPY(QSecureTransportContext); +}; + class QSslSocketBackendPrivate : public QSslSocketPrivate { Q_DECLARE_PUBLIC(QSslSocket) @@ -76,8 +88,8 @@ public: void startServerEncryption() Q_DECL_OVERRIDE; void transmit() Q_DECL_OVERRIDE; - static QList (verify)(QList certificateChain, - const QString &hostName); + static QList verify(QList certificateChain, + const QString &hostName); static bool importPkcs12(QIODevice *device, QSslKey *key, QSslCertificate *cert, @@ -101,7 +113,7 @@ private: bool checkSslErrors(); bool startHandshake(); - mutable QCFType context; + QSecureTransportContext context; Q_DISABLE_COPY(QSslSocketBackendPrivate); }; diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index abd4a59fb8..0617c36236 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -246,8 +246,7 @@ bool QGLShaderPrivate::create() else shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER); if (!shader) { - qWarning("%s: Could not create shader of type %d.", - Q_FUNC_INFO, int(shaderType)); + qWarning("Could not create shader of type %d.", int(shaderType)); return false; } shaderGuard = createSharedResourceGuard(context, shader, freeShaderFunc); diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index bb3ea6981a..6f71fb637f 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -71,6 +71,7 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window) : QPlatformBackingStore(window), m_window(window), m_bsTexture(0), + m_bsTextureContext(0), m_textures(new QPlatformTextureList), m_lockedWidgetTextures(0) { @@ -78,6 +79,14 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window) QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore() { + if (m_bsTexture) { + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx && m_bsTextureContext && ctx->shareGroup() == m_bsTextureContext->shareGroup()) + glDeleteTextures(1, &m_bsTexture); + else + qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context"); + } + delete m_textures; } @@ -89,6 +98,8 @@ QPaintDevice *QOpenGLCompositorBackingStore::paintDevice() void QOpenGLCompositorBackingStore::updateTexture() { if (!m_bsTexture) { + m_bsTextureContext = QOpenGLContext::currentContext(); + Q_ASSERT(m_bsTextureContext); glGenTextures(1, &m_bsTexture); glBindTexture(GL_TEXTURE_2D, m_bsTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h index 49d8bfd6e7..bd843e8bd9 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h @@ -83,6 +83,7 @@ private: QImage m_image; QRegion m_dirty; uint m_bsTexture; + QOpenGLContext *m_bsTextureContext; QPlatformTextureList *m_textures; QPlatformTextureList *m_lockedWidgetTextures; }; diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp index b59ae431f4..33cb4391f0 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp +++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp @@ -134,7 +134,7 @@ bool QGenericUnixServices::openUrl(const QUrl &url) return openDocument(url); if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) { - qWarning("%s: Unable to detect a web browser to launch '%s'", Q_FUNC_INFO, qPrintable(url.toString())); + qWarning("Unable to detect a web browser to launch '%s'", qPrintable(url.toString())); return false; } return launch(m_webBrowser, url); @@ -143,7 +143,7 @@ bool QGenericUnixServices::openUrl(const QUrl &url) bool QGenericUnixServices::openDocument(const QUrl &url) { if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) { - qWarning("%s: Unable to detect a launcher for '%s'", Q_FUNC_INFO, qPrintable(url.toString())); + qWarning("Unable to detect a launcher for '%s'", qPrintable(url.toString())); return false; } return launch(m_documentLauncher, url); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 60fb7e2cce..ee62710913 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -546,7 +546,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme() kdeDirs.removeDuplicates(); if (kdeDirs.isEmpty()) { - qWarning("%s: Unable to determine KDE dirs", Q_FUNC_INFO); + qWarning("Unable to determine KDE dirs"); return 0; } diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 75c4ce2014..fc9a3281b8 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -74,7 +74,7 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) if (!propsReply.isError()) { propertyMap = propsReply.value(); } else { - qWarning() << Q_FUNC_INFO << "propsReply"< > nmReply @@ -83,7 +83,7 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) if (!nmReply.isError()) { devicesPathList = nmReply.value(); } else { - qWarning() << Q_FUNC_INFO <<"nmReply"<header.type; - qDebug() << "size:" << blob->header.dwSize; - qDebug() << "next offset:" << blob->header.nextOffset; + << "type:" << blob->header.type << endl + << "size:" << blob->header.dwSize << endl + << "next offset:" << blob->header.nextOffset; switch (blob->header.type) { case NLA_RAW_DATA: - qDebug() << "Raw Data"; - qDebug() << '\t' << blob->data.rawData; + qDebug() << "Raw Data" << endl + << '\t' << blob->data.rawData; break; case NLA_INTERFACE: - qDebug() << "Interface"; - qDebug() << "\ttype:" << blob->data.interfaceData.dwType; - qDebug() << "\tspeed:" << blob->data.interfaceData.dwSpeed; - qDebug() << "\tadapter:" << blob->data.interfaceData.adapterName; + qDebug() << "Interface" << endl + << "\ttype:" << blob->data.interfaceData.dwType << endl + << "\tspeed:" << blob->data.interfaceData.dwSpeed << endl + << "\tadapter:" << blob->data.interfaceData.adapterName; break; case NLA_802_1X_LOCATION: - qDebug() << "802.1x Location"; - qDebug() << '\t' << blob->data.locationData.information; + qDebug() << "802.1x Location" << endl + << '\t' << blob->data.locationData.information; break; case NLA_CONNECTIVITY: - qDebug() << "Connectivity"; - qDebug() << "\ttype:" << blob->data.connectivity.type; - qDebug() << "\tinternet:" << blob->data.connectivity.internet; + qDebug() << "Connectivity" << endl + << "\ttype:" << blob->data.connectivity.type << endl + << "\tinternet:" << blob->data.connectivity.internet; break; case NLA_ICS: - qDebug() << "ICS"; - qDebug() << "\tspeed:" << blob->data.ICS.remote.speed; - qDebug() << "\ttype:" << blob->data.ICS.remote.type; - qDebug() << "\tstate:" << blob->data.ICS.remote.state; - qDebug() << "\tmachine name:" << blob->data.ICS.remote.machineName; - qDebug() << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; + qDebug() << "ICS" << endl + << "\tspeed:" << blob->data.ICS.remote.speed << endl + << "\ttype:" << blob->data.ICS.remote.type << endl + << "\tstate:" << blob->data.ICS.remote.state << endl + << "\tmachine name:" << blob->data.ICS.remote.machineName << endl + << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; break; default: qDebug() << "UNKNOWN BLOB TYPE"; diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro index 82a4ad4ce8..0c1943b7dd 100644 --- a/src/plugins/generic/generic.pro +++ b/src/plugins/generic/generic.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs +load(qfeatures) + contains(QT_CONFIG, evdev) { SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet } @@ -8,7 +10,9 @@ contains(QT_CONFIG, tslib) { SUBDIRS += tslib } -SUBDIRS += tuiotouch +!contains(QT_DISABLED_FEATURES, udpsocket) { + SUBDIRS += tuiotouch +} contains(QT_CONFIG, libinput) { SUBDIRS += libinput diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 9a96534c38..2bc3b0dc7d 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -498,8 +498,8 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para } if (Q_UNLIKELY(!m_main)) { - qCritical() << "dlsym failed:" << dlerror(); - qCritical() << "Could not find main method"; + qCritical() << "dlsym failed:" << dlerror() << endl + << "Could not find main method"; return false; } diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index 949d31740a..94e132fc9a 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -46,6 +46,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -217,7 +218,7 @@ QJsonObject AndroidStyle::loadStyleData() static std::shared_ptr loadAndroidStyle(QPalette *defaultPalette) { - double pixelDensity = qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") ? QtAndroid::pixelDensity() : 1.0; + double pixelDensity = QHighDpiScaling::isActive() ? QtAndroid::pixelDensity() : 1.0; std::shared_ptr style = std::make_shared(); style->m_styleData = AndroidStyle::loadStyleData(); if (style->m_styleData.isEmpty()) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index aa7a09805a..ad491855ff 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -294,7 +294,7 @@ void QCocoaMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem * int index = m_menuItems.indexOf(beforeItem); // if a before item is supplied, it should be in the menu if (index < 0) { - qWarning() << Q_FUNC_INFO << "Before menu item not found"; + qWarning("Before menu item not found"); return; } m_menuItems.insert(index, cocoaItem); @@ -315,7 +315,7 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) return; if ([item->nsItem() menu]) { - qWarning() << Q_FUNC_INFO << "Menu item is already in a menu, remove it from the other menu first before inserting"; + qWarning("Menu item is already in a menu, remove it from the other menu first before inserting"); return; } // if the item we're inserting before is merged, skip along until @@ -326,7 +326,7 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) if (beforeItem) { if (beforeItem->isMerged()) { - qWarning() << Q_FUNC_INFO << "No non-merged before menu item found"; + qWarning("No non-merged before menu item found"); return; } NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeItem->nsItem()]; @@ -342,7 +342,7 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) QMacAutoReleasePool pool; QCocoaMenuItem *cocoaItem = static_cast(menuItem); if (!m_menuItems.contains(cocoaItem)) { - qWarning() << Q_FUNC_INFO << "Menu does not contain the item to be removed"; + qWarning("Menu does not contain the item to be removed"); return; } @@ -352,7 +352,7 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) m_menuItems.removeOne(cocoaItem); if (!cocoaItem->isMerged()) { if (m_nativeMenu != [cocoaItem->nsItem() menu]) { - qWarning() << Q_FUNC_INFO << "Item to remove does not belong to this menu"; + qWarning("Item to remove does not belong to this menu"); return; } [m_nativeMenu removeItem: cocoaItem->nsItem()]; @@ -372,7 +372,7 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem) QMacAutoReleasePool pool; QCocoaMenuItem *cocoaItem = static_cast(menuItem); if (!m_menuItems.contains(cocoaItem)) { - qWarning() << Q_FUNC_INFO << "Item does not belong to this menu"; + qWarning("Item does not belong to this menu"); return; } diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index af5905f846..d404438db6 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -108,12 +108,12 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor #endif if (m_menus.contains(menu)) { - qWarning() << Q_FUNC_INFO << "This menu already belongs to the menubar, remove it first"; + qWarning("This menu already belongs to the menubar, remove it first"); return; } if (beforeMenu && !m_menus.contains(beforeMenu)) { - qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar"; + qWarning("The before menu does not belong to the menubar"); return; } @@ -138,7 +138,7 @@ void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) { QCocoaMenu *menu = static_cast(platformMenu); if (!m_menus.contains(menu)) { - qWarning() << Q_FUNC_INFO << "Trying to remove a menu that does not belong to the menubar"; + qWarning("Trying to remove a menu that does not belong to the menubar"); return; } m_menus.removeOne(menu); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 76406539c3..968d1a2a4d 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -283,7 +283,7 @@ NSMenuItem *QCocoaMenuItem::sync() } default: - qWarning() << Q_FUNC_INFO << "menu item" << m_text << "has unsupported role" << (int)m_role; + qWarning() << "menu item" << m_text << "has unsupported role" << (int)m_role; } if (mergeItem) { @@ -400,7 +400,7 @@ QKeySequence QCocoaMenuItem::mergeAccel() void QCocoaMenuItem::syncMerged() { if (!m_merged) { - qWarning() << Q_FUNC_INFO << "Trying to sync a non-merged item"; + qWarning("Trying to sync a non-merged item"); return; } [m_native setTag:reinterpret_cast(this)]; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 6a247d04e1..18abaddfd7 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1534,7 +1534,7 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState) // do nothing except set the new state NSRect contentRect = [contentView() frame]; if (contentRect.size.width <= 0 || contentRect.size.height <= 0) { - qWarning() << Q_FUNC_INFO << "invalid window content view size, check your window geometry"; + qWarning("invalid window content view size, check your window geometry"); m_synchedWindowState = newState; return; } diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index b95be7a883..9ca5e22b90 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -351,6 +351,7 @@ { QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); + QWindowSystemInterface::flushWindowSystemEvents(); } #ifndef QT_NO_SHORTCUT @@ -898,7 +899,6 @@ // UITextInput selects the text to be deleted before calling this method. To avoid // drawing the selection, we flush after posting the key press/release. [self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier]; - QWindowSystemInterface::flushWindowSystemEvents(); } @end diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp index 985cc14b1d..7bec1fb603 100644 --- a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp +++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp @@ -62,7 +62,7 @@ bool QQnxAbstractNavigator::invokeUrl(const QUrl &url) // which is not recognized by the navigator anymore const bool result = requestInvokeUrl(url.toString().toUtf8()); - qNavigatorDebug() << Q_FUNC_INFO << "url=" << url << "result=" << result; + qNavigatorDebug() << "url=" << url << "result=" << result; return result; } diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index 8589775fdf..5d838ac189 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -51,13 +51,13 @@ QT_BEGIN_NAMESPACE QQnxBuffer::QQnxBuffer() : m_buffer(0) { - qBufferDebug() << Q_FUNC_INFO << "empty"; + qBufferDebug("empty"); } QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) : m_buffer(buffer) { - qBufferDebug() << Q_FUNC_INFO << "normal"; + qBufferDebug("normal"); // Get size of buffer int size[2]; @@ -118,17 +118,17 @@ QQnxBuffer::QQnxBuffer(const QQnxBuffer &other) : m_buffer(other.m_buffer), m_image(other.m_image) { - qBufferDebug() << Q_FUNC_INFO << "copy"; + qBufferDebug("copy"); } QQnxBuffer::~QQnxBuffer() { - qBufferDebug() << Q_FUNC_INFO; + qBufferDebug(); } void QQnxBuffer::invalidateInCache() { - qBufferDebug() << Q_FUNC_INFO; + qBufferDebug(); // Verify native buffer exists if (Q_UNLIKELY(!m_buffer)) diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp index 635f56e8b6..ec30e79ab5 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp @@ -74,7 +74,7 @@ QQnxButtonEventNotifier::~QQnxButtonEventNotifier() void QQnxButtonEventNotifier::start() { - qButtonDebug() << Q_FUNC_INFO << "starting hardware button event processing"; + qButtonDebug("starting hardware button event processing"); if (m_fd != -1) return; @@ -91,7 +91,7 @@ void QQnxButtonEventNotifier::start() m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read); QObject::connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(updateButtonStates())); - qButtonDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd =" << m_fd; + qButtonDebug() << "successfully connected to Navigator. fd =" << m_fd; } void QQnxButtonEventNotifier::updateButtonStates() @@ -115,7 +115,7 @@ void QQnxButtonEventNotifier::updateButtonStates() // Ensure data is null terminated buffer[bytes] = '\0'; - qButtonDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer; + qButtonDebug() << "received PPS message:\n" << buffer; // Process received message QByteArray ppsData = QByteArray::fromRawData(buffer, bytes); @@ -197,7 +197,7 @@ bool QQnxButtonEventNotifier::parsePPS(const QByteArray &ppsData, QHashtype()) { case QEvent::CloseSoftwareInputPanel: @@ -691,19 +691,19 @@ QRectF QQnxInputContext::keyboardRect() const void QQnxInputContext::reset() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); endComposition(); } void QQnxInputContext::commit() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); endComposition(); } void QQnxInputContext::update(Qt::InputMethodQueries queries) { - qInputContextDebug() << Q_FUNC_INFO << queries; + qInputContextDebug() << queries; if (queries & Qt::ImCursorPosition) { int lastCaret = m_caretPosition; @@ -715,7 +715,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent)); caretEvent.old_pos = lastCaret; caretEvent.new_pos = m_caretPosition; - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition; + qInputContextDebug() << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition; p_ictrl_dispatch_event(&caretEvent.event); } } @@ -723,7 +723,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) void QQnxInputContext::closeSession() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); if (!imfAvailable()) return; @@ -745,7 +745,7 @@ bool QQnxInputContext::openSession() closeSession(); sInputSession = p_ictrl_open_session(&ic_funcs); - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); return sInputSession != 0; } @@ -769,7 +769,7 @@ bool QQnxInputContext::hasSelectedText() bool QQnxInputContext::dispatchRequestSoftwareInputPanel() { - qInputContextDebug() << Q_FUNC_INFO << "requesting keyboard" << m_inputPanelVisible; + qInputContextDebug() << "requesting keyboard" << m_inputPanelVisible; m_virtualKeyboard.showKeyboard(); return true; @@ -777,7 +777,7 @@ bool QQnxInputContext::dispatchRequestSoftwareInputPanel() bool QQnxInputContext::dispatchCloseSoftwareInputPanel() { - qInputContextDebug() << Q_FUNC_INFO << "hiding keyboard" << m_inputPanelVisible; + qInputContextDebug() << "hiding keyboard" << m_inputPanelVisible; m_virtualKeyboard.hideKeyboard(); return true; @@ -823,7 +823,7 @@ bool QQnxInputContext::dispatchFocusGainEvent(int inputHints) focusEvent.style |= IMF_EMAIL_TYPE; } - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_event focus gain style:" << focusEvent.style; + qInputContextDebug() << "ictrl_dispatch_event focus gain style:" << focusEvent.style; p_ictrl_dispatch_event((event_t *)&focusEvent); @@ -833,7 +833,7 @@ bool QQnxInputContext::dispatchFocusGainEvent(int inputHints) void QQnxInputContext::dispatchFocusLossEvent() { if (hasSession()) { - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_event focus lost"; + qInputContextDebug("ictrl_dispatch_event focus lost"); focus_event_t focusEvent; initEvent(&focusEvent.event, sInputSession, EVENT_FOCUS, FOCUS_LOST, sizeof(focusEvent)); @@ -908,7 +908,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent)); navEvent.magnitude = 1; - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_even navigation" << key; + qInputContextDebug() << "ictrl_dispatch_even navigation" << key; p_ictrl_dispatch_event(&navEvent.event); } } else { @@ -921,7 +921,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.sequence_id = sequenceId; p_ictrl_dispatch_event(&keyEvent.event); - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_even key" << key; + qInputContextDebug() << "ictrl_dispatch_even key" << key; } return true; @@ -937,7 +937,7 @@ void QQnxInputContext::updateCursorPosition() QCoreApplication::sendEvent(input, &query); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << Q_FUNC_INFO << m_caretPosition; + qInputContextDebug() << m_caretPosition; } void QQnxInputContext::endComposition() @@ -950,7 +950,7 @@ void QQnxInputContext::endComposition() if (hasSession()) { action_event_t actionEvent; initEvent(&actionEvent.event, sInputSession, EVENT_ACTION, ACTION_END_COMPOSITION, sizeof(actionEvent)); - qInputContextDebug() << Q_FUNC_INFO << "ictrl_dispatch_even end composition"; + qInputContextDebug("ictrl_dispatch_even end composition"); p_ictrl_dispatch_event(&actionEvent.event); } } @@ -967,7 +967,7 @@ void QQnxInputContext::updateComposition(spannable_string_t *text, int32_t new_c m_composingText = QString::fromWCharArray(text->str, text->length); m_isComposing = true; - qInputContextDebug() << Q_FUNC_INFO << m_composingText << new_cursor_position; + qInputContextDebug() << m_composingText << new_cursor_position; QList attributes; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, @@ -1016,7 +1016,7 @@ void QQnxInputContext::finishComposingText() QObject *input = qGuiApp->focusObject(); if (input) { - qInputContextDebug() << Q_FUNC_INFO << m_composingText; + qInputContextDebug() << m_composingText; QInputMethodEvent event; event.setCommitString(m_composingText); @@ -1081,13 +1081,13 @@ int32_t QQnxInputContext::processEvent(event_t *event) int32_t result = -1; switch (event->event_type) { case EVENT_SPELL_CHECK: { - qInputContextDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK"; + qInputContextDebug("EVENT_SPELL_CHECK"); result = handleSpellCheck(reinterpret_cast(event)); break; } case EVENT_NAVIGATION: { - qInputContextDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION"; + qInputContextDebug("EVENT_NAVIGATION"); int key = event->event_id == NAVIGATE_UP ? KEYCODE_UP : event->event_id == NAVIGATE_DOWN ? KEYCODE_DOWN : @@ -1110,7 +1110,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int flags = KEY_SYM_VALID | KEY_CAP_VALID; if (event->event_id == IMF_KEY_DOWN) flags |= KEY_DOWN; - qInputContextDebug() << Q_FUNC_INFO << "EVENT_KEY" << flags << keySym; + qInputContextDebug() << "EVENT_KEY" << flags << keySym; QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap); result = 0; break; @@ -1126,10 +1126,10 @@ int32_t QQnxInputContext::processEvent(event_t *event) case EVENT_USER_ACTION: case EVENT_STROKE: case EVENT_INVOKE_LATER: - qCritical() << Q_FUNC_INFO << "Unsupported event type: " << event->event_type; + qCritical() << "Unsupported event type: " << event->event_type; break; default: - qCritical() << Q_FUNC_INFO << "Unknown event type: " << event->event_type; + qCritical() << "Unknown event type: " << event->event_type; } return result; } @@ -1150,7 +1150,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length) { - qInputContextDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length; + qInputContextDebug() << "L:" << left_length << " R:" << right_length; QObject *input = qGuiApp->focusObject(); if (!input) @@ -1181,7 +1181,7 @@ int32_t QQnxInputContext::onFinishComposingText() int32_t QQnxInputContext::onGetCursorPosition() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); QObject *input = qGuiApp->focusObject(); if (!input) @@ -1195,7 +1195,7 @@ int32_t QQnxInputContext::onGetCursorPosition() spannable_string_t *QQnxInputContext::onGetTextAfterCursor(int32_t n, int32_t flags) { Q_UNUSED(flags); - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); QObject *input = qGuiApp->focusObject(); if (!input) @@ -1212,7 +1212,7 @@ spannable_string_t *QQnxInputContext::onGetTextAfterCursor(int32_t n, int32_t fl spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(int32_t n, int32_t flags) { Q_UNUSED(flags); - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); QObject *input = qGuiApp->focusObject(); if (!input) @@ -1231,7 +1231,7 @@ spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(int32_t n, int32_t f int32_t QQnxInputContext::onSendEvent(event_t *event) { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); return processEvent(event); } @@ -1247,7 +1247,7 @@ int32_t QQnxInputContext::onSetComposingRegion(int32_t start, int32_t end) QString text = query.value(Qt::ImSurroundingText).toString(); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << Q_FUNC_INFO << text; + qInputContextDebug() << text; m_isUpdatingText = true; @@ -1290,7 +1290,7 @@ int32_t QQnxInputContext::onIsTextSelected(int32_t* pIsSelected) { *pIsSelected = hasSelectedText(); - qInputContextDebug() << Q_FUNC_INFO << *pIsSelected; + qInputContextDebug() << *pIsSelected; return 0; } @@ -1306,20 +1306,20 @@ int32_t QQnxInputContext::onIsAllTextSelected(int32_t* pIsSelected) *pIsSelected = query.value(Qt::ImSurroundingText).toString().length() == query.value(Qt::ImCurrentSelection).toString().length(); - qInputContextDebug() << Q_FUNC_INFO << *pIsSelected; + qInputContextDebug() << *pIsSelected; return 0; } void QQnxInputContext::showInputPanel() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); dispatchRequestSoftwareInputPanel(); } void QQnxInputContext::hideInputPanel() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); dispatchCloseSoftwareInputPanel(); } @@ -1335,7 +1335,7 @@ QLocale QQnxInputContext::locale() const void QQnxInputContext::keyboardVisibilityChanged(bool visible) { - qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; + qInputContextDebug() << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -1344,7 +1344,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { - qInputContextDebug() << Q_FUNC_INFO << "locale=" << locale; + qInputContextDebug() << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -1353,7 +1353,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setHighlightColor(int index, const QColor &color) { - qInputContextDebug() << Q_FUNC_INFO << "setHighlightColor" << index << color << qGuiApp->focusObject(); + qInputContextDebug() << "setHighlightColor" << index << color << qGuiApp->focusObject(); if (!sInputContextInstance) return; @@ -1372,7 +1372,7 @@ void QQnxInputContext::setHighlightColor(int index, const QColor &color) void QQnxInputContext::setFocusObject(QObject *object) { - qInputContextDebug() << Q_FUNC_INFO << "input item=" << object; + qInputContextDebug() << "input item=" << object; // Ensure the colors are reset if we've a change in focus object setHighlightColor(-1, QColor()); @@ -1402,7 +1402,7 @@ void QQnxInputContext::setFocusObject(QObject *object) bool QQnxInputContext::checkSpelling(const QString &text, void *context, void (*spellCheckDone)(void *context, const QString &text, const QList &indices)) { - qInputContextDebug() << Q_FUNC_INFO << "text" << text; + qInputContextDebug() << "text" << text; if (!imfAvailable()) return false; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 3860cdf0db..af280f5c6f 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -88,13 +88,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) if (event->type() == QEvent::CloseSoftwareInputPanel) { m_virtualKeyboard.hideKeyboard(); - qInputContextDebug() << Q_FUNC_INFO << "hiding virtual keyboard"; + qInputContextDebug("hiding virtual keyboard"); return false; } if (event->type() == QEvent::RequestSoftwareInputPanel) { m_virtualKeyboard.showKeyboard(); - qInputContextDebug() << Q_FUNC_INFO << "requesting virtual keyboard"; + qInputContextDebug("requesting virtual keyboard"); return false; } @@ -121,13 +121,13 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan void QQnxInputContext::showInputPanel() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); m_virtualKeyboard.showKeyboard(); } void QQnxInputContext::hideInputPanel() { - qInputContextDebug() << Q_FUNC_INFO; + qInputContextDebug(); m_virtualKeyboard.hideKeyboard(); } @@ -148,7 +148,7 @@ void QQnxInputContext::keyboardHeightChanged() void QQnxInputContext::keyboardVisibilityChanged(bool visible) { - qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; + qInputContextDebug() << "visible=" << visible; if (m_inputPanelVisible != visible) { m_inputPanelVisible = visible; emitInputPanelVisibleChanged(); @@ -157,7 +157,7 @@ void QQnxInputContext::keyboardVisibilityChanged(bool visible) void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) { - qInputContextDebug() << Q_FUNC_INFO << "locale=" << locale; + qInputContextDebug() << "locale=" << locale; if (m_inputPanelLocale != locale) { m_inputPanelLocale = locale; emitLocaleChanged(); @@ -166,7 +166,7 @@ void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale) void QQnxInputContext::setFocusObject(QObject *object) { - qInputContextDebug() << Q_FUNC_INFO << "input item=" << object; + qInputContextDebug() << "input item=" << object; if (!inputMethodAccepted()) { if (m_inputPanelVisible) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 36d59ef134..0616ac626f 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -143,7 +143,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) #endif { ms_options = parseOptions(paramList); - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); // Open connection to QNX composition manager Q_SCREEN_CRITICALERROR(screen_create_context(&ms_screenContext, SCREEN_APPLICATION_CONTEXT), "Failed to create screen context"); @@ -210,7 +210,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) QQnxIntegration::~QQnxIntegration() { - qIntegrationDebug() << Q_FUNC_INFO << "platform plugin shutdown begin"; + qIntegrationDebug("platform plugin shutdown begin"); delete m_nativeInterface; #if !defined(QT_NO_DRAGANDDROP) @@ -267,12 +267,12 @@ QQnxIntegration::~QQnxIntegration() // Destroy navigator interface delete m_navigator; - qIntegrationDebug() << Q_FUNC_INFO << "platform plugin shutdown end"; + qIntegrationDebug("platform plugin shutdown end"); } bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); switch (cap) { case MultipleWindows: case ThreadedPixmaps: @@ -290,7 +290,7 @@ bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); QSurface::SurfaceType surfaceType = window->surfaceType(); const bool needRootWindow = options() & RootWindow; switch (surfaceType) { @@ -308,14 +308,14 @@ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *window) const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); return new QQnxRasterBackingStore(window); } #if !defined(QT_NO_OPENGL) QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); return new QQnxGLContext(context); } #endif @@ -323,14 +323,14 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont #if defined(QQNX_PPS) QPlatformInputContext *QQnxIntegration::inputContext() const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); return m_inputContext; } #endif void QQnxIntegration::moveToScreen(QWindow *window, int screen) { - qIntegrationDebug() << Q_FUNC_INFO << "w =" << window << ", s =" << screen; + qIntegrationDebug() << "w =" << window << ", s =" << screen; // get platform window used by widget QQnxWindow *platformWindow = static_cast(window->handle()); @@ -344,7 +344,7 @@ void QQnxIntegration::moveToScreen(QWindow *window, int screen) QAbstractEventDispatcher *QQnxIntegration::createEventDispatcher() const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); // We transfer ownersip of the event-dispatcher to QtCoreApplication QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher; @@ -361,7 +361,7 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const #if !defined(QT_NO_CLIPBOARD) QPlatformClipboard *QQnxIntegration::clipboard() const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); #if defined(QQNX_PPS) if (!m_clipboard) @@ -380,7 +380,7 @@ QPlatformDrag *QQnxIntegration::drag() const QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); if ((hint == ShowIsFullScreen) && (ms_options & FullScreenApplication)) return true; @@ -394,7 +394,7 @@ QPlatformServices * QQnxIntegration::services() const QWindow *QQnxIntegration::window(screen_window_t qnxWindow) { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); return ms_windowMapper.value(qnxWindow, 0); @@ -402,7 +402,7 @@ QWindow *QQnxIntegration::window(screen_window_t qnxWindow) void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); ms_windowMapper.insert(qnxWindow, window); @@ -410,7 +410,7 @@ void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window) void QQnxIntegration::removeWindow(screen_window_t qnxWindow) { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); QMutexLocker locker(&ms_windowMapperMutex); Q_UNUSED(locker); ms_windowMapper.remove(qnxWindow); @@ -418,7 +418,7 @@ void QQnxIntegration::removeWindow(screen_window_t qnxWindow) void QQnxIntegration::createDisplays() { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); // Query number of displays int displayCount = 0; int result = screen_get_context_property_iv(ms_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT, @@ -447,11 +447,11 @@ void QQnxIntegration::createDisplays() Q_SCREEN_CHECKERROR(result, "Failed to query display attachment"); if (!isAttached) { - qIntegrationDebug() << Q_FUNC_INFO << "Skipping non-attached display" << i; + qIntegrationDebug() << "Skipping non-attached display" << i; continue; } - qIntegrationDebug() << Q_FUNC_INFO << "Creating screen for display" << i; + qIntegrationDebug() << "Creating screen for display" << i; createDisplay(displays[i], /*isPrimary=*/false); } // of displays iteration } @@ -485,7 +485,7 @@ void QQnxIntegration::removeDisplay(QQnxScreen *screen) void QQnxIntegration::destroyDisplays() { - qIntegrationDebug() << Q_FUNC_INFO; + qIntegrationDebug(); Q_FOREACH (QQnxScreen *screen, m_screens) { QPlatformIntegration::destroyScreen(screen); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp index f179719c6b..647c53e32c 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp @@ -57,20 +57,20 @@ bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle) { // reply to navigator that (any) orientation is acceptable // TODO: check if top window flags prohibit orientation change - qNavigatorEventHandlerDebug() << Q_FUNC_INFO << "angle=" << angle; + qNavigatorEventHandlerDebug() << "angle=" << angle; return true; } void QQnxNavigatorEventHandler::handleOrientationChange(int angle) { // update screen geometry and reply to navigator that we're ready - qNavigatorEventHandlerDebug() << Q_FUNC_INFO << "angle=" << angle; + qNavigatorEventHandlerDebug() << "angle=" << angle; emit rotationChanged(angle); } void QQnxNavigatorEventHandler::handleSwipeDown() { - qNavigatorEventHandlerDebug() << Q_FUNC_INFO; + qNavigatorEventHandlerDebug(); Q_EMIT swipeDown(); } @@ -78,25 +78,25 @@ void QQnxNavigatorEventHandler::handleSwipeDown() void QQnxNavigatorEventHandler::handleExit() { // shutdown everything - qNavigatorEventHandlerDebug() << Q_FUNC_INFO; + qNavigatorEventHandlerDebug(); QCoreApplication::quit(); } void QQnxNavigatorEventHandler::handleWindowGroupActivated(const QByteArray &id) { - qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; + qNavigatorEventHandlerDebug() << id; Q_EMIT windowGroupActivated(id); } void QQnxNavigatorEventHandler::handleWindowGroupDeactivated(const QByteArray &id) { - qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; + qNavigatorEventHandlerDebug() << id; Q_EMIT windowGroupDeactivated(id); } void QQnxNavigatorEventHandler::handleWindowGroupStateChanged(const QByteArray &id, Qt::WindowState state) { - qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; + qNavigatorEventHandlerDebug() << id; Q_EMIT windowGroupStateChanged(id, state); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index d7221a9185..8098c9970e 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -74,18 +74,18 @@ QQnxNavigatorEventNotifier::~QQnxNavigatorEventNotifier() if (m_fd != -1) close(m_fd); - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "navigator event notifier stopped"; + qNavigatorEventNotifierDebug("navigator event notifier stopped"); } void QQnxNavigatorEventNotifier::start() { - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "navigator event notifier started"; + qNavigatorEventNotifierDebug("navigator event notifier started"); // open connection to navigator errno = 0; m_fd = open(navigatorControlPath, O_RDWR); if (m_fd == -1) { - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << ": failed to open navigator pps:" + qNavigatorEventNotifierDebug() << "failed to open navigator pps:" << strerror(errno); return; } @@ -96,7 +96,7 @@ void QQnxNavigatorEventNotifier::start() void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id) { - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "data=" << ppsData; + qNavigatorEventNotifierDebug() << "data=" << ppsData; // tokenize pps data into lines QList lines = ppsData.split('\n'); @@ -110,7 +110,7 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray // tokenize current attribute const QByteArray &attr = lines.at(i); - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "attr=" << attr; + qNavigatorEventNotifierDebug() << "attr=" << attr; int firstColon = attr.indexOf(':'); if (firstColon == -1) { @@ -127,8 +127,8 @@ void QQnxNavigatorEventNotifier::parsePPS(const QByteArray &ppsData, QByteArray QByteArray key = attr.left(firstColon); QByteArray value = attr.mid(secondColon + 1); - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "key=" << key; - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "val=" << value; + qNavigatorEventNotifierDebug() << "key=" << key; + qNavigatorEventNotifierDebug() << "val=" << value; // save attribute value if (key == "msg") @@ -155,7 +155,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra } ppsData += "\n"; - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "reply=" << ppsData; + qNavigatorEventNotifierDebug() << "reply=" << ppsData; // send pps message to navigator errno = 0; @@ -166,7 +166,7 @@ void QQnxNavigatorEventNotifier::replyPPS(const QByteArray &res, const QByteArra void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id) { - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "msg=" << msg << ", dat=" << dat << ", id=" << id; + qNavigatorEventNotifierDebug() << "msg=" << msg << ", dat=" << dat << ", id=" << id; // check message type if (msg == "orientationCheck") { @@ -190,7 +190,7 @@ void QQnxNavigatorEventNotifier::handleMessage(const QByteArray &msg, const QByt void QQnxNavigatorEventNotifier::readData() { - qNavigatorEventNotifierDebug() << Q_FUNC_INFO << "reading navigator data"; + qNavigatorEventNotifierDebug("reading navigator data"); // allocate buffer for pps data char buffer[ppsBufferSize]; diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp index d5bdbb3ec6..ca8e2bd3ab 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -73,7 +73,7 @@ bool QQnxNavigatorPps::openPpsConnection() return false; } - qNavigatorDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd=" << m_fd; + qNavigatorDebug() << "successfully connected to Navigator. fd=" << m_fd; return true; } @@ -95,7 +95,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra ppsMessage += "\n"; - qNavigatorDebug() << Q_FUNC_INFO << "sending PPS message:\n" << ppsMessage; + qNavigatorDebug() << "sending PPS message:\n" << ppsMessage; // send pps message to navigator errno = 0; @@ -117,7 +117,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra // ensure data is null terminated buffer[bytes] = '\0'; - qNavigatorDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer; + qNavigatorDebug() << "received PPS message:\n" << buffer; // process received message QByteArray ppsData(buffer); @@ -136,7 +136,7 @@ bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArra void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash &messageFields) { - qNavigatorDebug() << Q_FUNC_INFO << "data=" << ppsData; + qNavigatorDebug() << "data=" << ppsData; // tokenize pps data into lines QList lines = ppsData.split('\n'); @@ -151,7 +151,7 @@ void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHashscreenForNative(nativeDisplay); if (!screen) { @@ -593,7 +593,7 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event) break; default: // event ignored - qScreenEventDebug() << Q_FUNC_INFO << "Ignore property event for property: " << property; + qScreenEventDebug() << "Ignore property event for property: " << property; } } diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp index e0801a2d60..a7d5c4d4bc 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp @@ -84,7 +84,7 @@ void QQnxScreenEventThread::unlock() void QQnxScreenEventThread::run() { - qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread started"; + qScreenEventThreadDebug("screen event thread started"); int errorCounter = 0; // loop indefinitely @@ -117,7 +117,7 @@ void QQnxScreenEventThread::run() if (qnxType == SCREEN_EVENT_USER) { // treat all user events as shutdown requests - qScreenEventThreadDebug() << Q_FUNC_INFO << "QNX user screen event"; + qScreenEventThreadDebug("QNX user screen event"); m_quit = true; } else { m_mutex.lock(); @@ -127,7 +127,7 @@ void QQnxScreenEventThread::run() } } - qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread stopped"; + qScreenEventThreadDebug("screen event thread stopped"); // cleanup m_mutex.lock(); @@ -160,10 +160,10 @@ void QQnxScreenEventThread::shutdown() // cleanup screen_destroy_event(event); - qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread shutdown begin"; + qScreenEventThreadDebug("screen event thread shutdown begin"); // block until thread terminates wait(); - qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread shutdown end"; + qScreenEventThreadDebug("screen event thread shutdown end"); } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index 33e5cf2947..880a914c84 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -75,7 +75,7 @@ QQnxVirtualKeyboardPps::~QQnxVirtualKeyboardPps() void QQnxVirtualKeyboardPps::start() { - qVirtualKeyboardDebug() << Q_FUNC_INFO << "starting keyboard event processing"; + qVirtualKeyboardDebug("starting keyboard event processing"); if (!connect()) return; } @@ -120,7 +120,7 @@ bool QQnxVirtualKeyboardPps::connect() m_fd = ::open(ms_PPSPath, O_RDWR); if (m_fd == -1) { - qVirtualKeyboardDebug() << Q_FUNC_INFO << ": Unable to open" << ms_PPSPath + qVirtualKeyboardDebug() << "Unable to open" << ms_PPSPath << ':' << strerror(errno); close(); return false; @@ -158,7 +158,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() { ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); - qVirtualKeyboardDebug() << Q_FUNC_INFO << "keyboardMessage size: " << nread; + qVirtualKeyboardDebug() << "keyboardMessage size: " << nread; if (nread < 0){ connect(); // reconnect return; @@ -197,7 +197,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() else if (strcmp(value, "info") == 0) handleKeyboardInfoMessage(); else if (strcmp(value, "connect") == 0) - qVirtualKeyboardDebug() << Q_FUNC_INFO << "Unhandled command 'connect'"; + qVirtualKeyboardDebug("Unhandled command 'connect'"); else qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value : "[null]"); } else if (pps_decoder_get_string(m_decoder, "res", &value) == PPS_DECODER_OK) { @@ -224,12 +224,12 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage() } setHeight(newHeight); - qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight; + qVirtualKeyboardDebug() << "size=" << newHeight; } bool QQnxVirtualKeyboardPps::showKeyboard() { - qVirtualKeyboardDebug() << Q_FUNC_INFO; + qVirtualKeyboardDebug(); if (!prepareToSend()) return false; @@ -251,7 +251,7 @@ bool QQnxVirtualKeyboardPps::showKeyboard() bool QQnxVirtualKeyboardPps::hideKeyboard() { - qVirtualKeyboardDebug() << Q_FUNC_INFO; + qVirtualKeyboardDebug(); if (!prepareToSend()) return false; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 6adc352e2d..47888178c4 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -150,7 +150,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW m_windowState(Qt::WindowNoState), m_mmRendererWindow(0) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); + qWindowDebug() << "window =" << window << ", size =" << window->size(); QQnxScreen *platformScreen = static_cast(window->screen()->handle()); @@ -209,7 +209,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW QQnxWindow::~QQnxWindow() { - qWindowDebug() << Q_FUNC_INFO << "window =" << window(); + qWindowDebug() << "window =" << window(); // Qt should have already deleted the children before deleting the parent. Q_ASSERT(m_childWindows.size() == 0); @@ -241,7 +241,7 @@ void QQnxWindow::setGeometry(const QRect &rect) void QQnxWindow::setGeometryHelper(const QRect &rect) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() + qWindowDebug() << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")"; @@ -271,7 +271,7 @@ void QQnxWindow::setGeometryHelper(const QRect &rect) void QQnxWindow::setVisible(bool visible) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; + qWindowDebug() << "window =" << window() << "visible =" << visible; if (m_visible == visible || window()->type() == Qt::Desktop) return; @@ -302,7 +302,7 @@ void QQnxWindow::setVisible(bool visible) void QQnxWindow::updateVisibility(bool parentVisible) { - qWindowDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window(); + qWindowDebug() << "parentVisible =" << parentVisible << "window =" << window(); // Set window visibility int val = (m_visible && parentVisible) ? 1 : 0; Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val), @@ -314,7 +314,7 @@ void QQnxWindow::updateVisibility(bool parentVisible) void QQnxWindow::setOpacity(qreal level) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level; + qWindowDebug() << "window =" << window() << "opacity =" << level; // Set window global alpha int val = (int)(level * 255); Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val), @@ -325,7 +325,7 @@ void QQnxWindow::setOpacity(qreal level) void QQnxWindow::setExposed(bool exposed) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "expose =" << exposed; + qWindowDebug() << "window =" << window() << "expose =" << exposed; if (m_exposed != exposed) { m_exposed = exposed; @@ -340,7 +340,7 @@ bool QQnxWindow::isExposed() const void QQnxWindow::setBufferSize(const QSize &size) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size; + qWindowDebug() << "window =" << window() << "size =" << size; // libscreen fails when creating empty buffers const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size; @@ -402,7 +402,7 @@ void QQnxWindow::setBufferSize(const QSize &size) void QQnxWindow::setScreen(QQnxScreen *platformScreen) { - qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen; + qWindowDebug() << "window =" << window() << "platformScreen =" << platformScreen; if (platformScreen == 0) { // The screen has been destroyed m_screen = 0; @@ -416,7 +416,7 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) return; if (m_screen) { - qWindowDebug() << Q_FUNC_INFO << "Moving window to different screen"; + qWindowDebug("Moving window to different screen"); m_screen->removeWindow(this); if ((QQnxIntegration::options() & QQnxIntegration::RootWindow)) { @@ -447,7 +447,7 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) void QQnxWindow::removeFromParent() { - qWindowDebug() << Q_FUNC_INFO << "window =" << window(); + qWindowDebug() << "window =" << window(); // Remove from old Hierarchy position if (m_parentWindow) { if (Q_UNLIKELY(!m_parentWindow->m_childWindows.removeAll(this))) @@ -461,7 +461,7 @@ void QQnxWindow::removeFromParent() void QQnxWindow::setParent(const QPlatformWindow *window) { - qWindowDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window; + qWindowDebug() << "window =" << this->window() << "platformWindow =" << window; // Cast away the const, we need to modify the hierarchy. QQnxWindow* const newParent = static_cast(const_cast(window)); @@ -493,7 +493,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window) void QQnxWindow::raise() { - qWindowDebug() << Q_FUNC_INFO << "window =" << window(); + qWindowDebug() << "window =" << window(); if (m_parentWindow) { m_parentWindow->m_childWindows.removeAll(this); @@ -507,7 +507,7 @@ void QQnxWindow::raise() void QQnxWindow::lower() { - qWindowDebug() << Q_FUNC_INFO << "window =" << window(); + qWindowDebug() << "window =" << window(); if (m_parentWindow) { m_parentWindow->m_childWindows.removeAll(this); @@ -577,7 +577,7 @@ void QQnxWindow::setFocus(screen_window_t newFocusWindow) void QQnxWindow::setWindowState(Qt::WindowState state) { - qWindowDebug() << Q_FUNC_INFO << "state =" << state; + qWindowDebug() << "state =" << state; // Prevent two calls with Qt::WindowFullScreen from changing m_unmaximizedGeometry if (m_windowState == state) @@ -592,7 +592,7 @@ void QQnxWindow::setWindowState(Qt::WindowState state) void QQnxWindow::propagateSizeHints() { // nothing to do; silence base class warning - qWindowDebug() << Q_FUNC_INFO << ": ignored"; + qWindowDebug("ignored"); } void QQnxWindow::setMMRendererWindowName(const QString &name) @@ -632,7 +632,7 @@ void QQnxWindow::minimize() void QQnxWindow::setRotation(int rotation) { - qWindowDebug() << Q_FUNC_INFO << "angle =" << rotation; + qWindowDebug() << "angle =" << rotation; Q_SCREEN_CHECKERROR( screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation), "Failed to set window rotation"); @@ -694,7 +694,7 @@ void QQnxWindow::joinWindowGroup(const QByteArray &groupName) { bool changed = false; - qWindowDebug() << Q_FUNC_INFO << "group:" << groupName; + qWindowDebug() << "group:" << groupName; if (!groupName.isEmpty()) { if (groupName != m_parentGroupName) { diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 1e003e2d15..2672711d3a 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -66,6 +66,18 @@ "features": [ "disable_desktopgl", "disable_angle" ] + }, + { + "id": 6, + "description": "Intel(R) HD Graphics 4000 / 5500 cause crashes on orientation changes in fullscreen mode (QTBUG-49541)", + "vendor_id": "0x8086", + "device_id": [ "0x0166", "0x1616" ], + "os": { + "type": "win" + }, + "features": [ + "disable_rotation" + ] } ] } diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index 25cfd12b44..1071a2e038 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -236,7 +236,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L // suspended by a shell prompt 'Select' or debugger). if (QWindowsContext::user32dll.isHungAppWindow && QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) { - qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); + qWarning("Cowardly refusing to send clipboard message to hung application..."); return; } // Do not block if the process is being debugged, specifically, if it is diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 82cc1deb23..217444d129 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -177,7 +177,8 @@ QWindowsUser32DLL::QWindowsUser32DLL() : isHungAppWindow(0), isTouchWindow(0), registerTouchWindow(0), unregisterTouchWindow(0), getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0), - addClipboardFormatListener(0), removeClipboardFormatListener(0) + addClipboardFormatListener(0), removeClipboardFormatListener(0), + getDisplayAutoRotationPreferences(0), setDisplayAutoRotationPreferences(0) { } @@ -198,6 +199,8 @@ void QWindowsUser32DLL::init() addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); } + getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences"); + setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences"); } bool QWindowsUser32DLL::initTouch() diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 641e3ed41f..d08fc8f726 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -94,6 +94,8 @@ struct QWindowsUser32DLL typedef BOOL (WINAPI *SetProcessDPIAware)(); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); + typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); + typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); // Functions missing in Q_CC_GNU stub libraries. SetLayeredWindowAttributes setLayeredWindowAttributes; @@ -116,6 +118,10 @@ struct QWindowsUser32DLL // Clipboard listeners, Windows Vista onwards AddClipboardFormatListener addClipboardFormatListener; RemoveClipboardFormatListener removeClipboardFormatListener; + + // Rotation API + GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences; + SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; }; struct QWindowsShell32DLL diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 21eba6da7e..65a9763be6 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -118,11 +118,11 @@ void *QWindowsLibEGL::resolve(const char *name) bool QWindowsLibEGL::init() { -#ifdef QT_DEBUG - const char dllName[] = "libEGLd.dll"; -#else - const char dllName[] = "libEGL.dll"; + const char dllName[] = QT_STRINGIFY(LIBEGL_NAME) +#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) + "d" #endif + ""; qCDebug(lcQpaGl) << "Qt: Using EGL from" << dllName; @@ -178,11 +178,12 @@ void *QWindowsLibGLESv2::resolve(const char *name) bool QWindowsLibGLESv2::init() { -#ifdef QT_DEBUG - const char dllName[] = "libGLESv2d.dll"; -#else - const char dllName[] = "libGLESv2.dll"; + + const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME) +#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) + "d" #endif + ""; qCDebug(lcQpaGl) << "Qt: Using OpenGL ES 2.0 from" << dllName; #if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index c31063e1fd..8d1bbc75a6 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -61,6 +62,38 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DIRECTWRITE +// ### fixme: Consider direct linking of dwrite.dll once Windows Vista pre SP2 is dropped (QTBUG-49711) + +typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID &, IUnknown **); + +static inline DWriteCreateFactoryType resolveDWriteCreateFactory() +{ + if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) + return Q_NULLPTR; + QSystemLibrary library(QStringLiteral("dwrite")); + QFunctionPointer result = library.resolve("DWriteCreateFactory"); + if (Q_UNLIKELY(!result)) { + qWarning("Unable to load dwrite.dll"); + return Q_NULLPTR; + } + return reinterpret_cast(result); +} + +static IDWriteFactory *createDirectWriteFactory() +{ + static const DWriteCreateFactoryType dWriteCreateFactory = resolveDWriteCreateFactory(); + if (!dWriteCreateFactory) + return Q_NULLPTR; + IUnknown *result = Q_NULLPTR; + if (FAILED(dWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &result))) { + qErrnoWarning("DWriteCreateFactory failed"); + return Q_NULLPTR; + } + return reinterpret_cast(result); +} +#endif // !QT_NO_DIRECTWRITE + // Helper classes for creating font engines directly from font data namespace { @@ -467,14 +500,9 @@ namespace { class CustomFontFileLoader { public: - CustomFontFileLoader() : m_directWriteFactory(0), m_directWriteFontFileLoader(0) + CustomFontFileLoader() : m_directWriteFactory(createDirectWriteFactory()), m_directWriteFontFileLoader(0) { - HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, - __uuidof(IDWriteFactory), - reinterpret_cast(&m_directWriteFactory)); - if (FAILED(hres)) { - qErrnoWarning(hres, "%s: DWriteCreateFactory failed.", __FUNCTION__); - } else { + if (m_directWriteFactory) { m_directWriteFontFileLoader = new DirectWriteFontFileLoader(); m_directWriteFactory->RegisterFontFileLoader(m_directWriteFontFileLoader); } @@ -572,15 +600,9 @@ qreal QWindowsFontDatabase::fontSmoothingGamma() static inline bool initDirectWrite(QWindowsFontEngineData *d) { if (!d->directWriteFactory) { - const HRESULT hr = DWriteCreateFactory( - DWRITE_FACTORY_TYPE_SHARED, - __uuidof(IDWriteFactory), - reinterpret_cast(&d->directWriteFactory) - ); - if (FAILED(hr)) { - qErrnoWarning("%s: DWriteCreateFactory failed", __FUNCTION__); + d->directWriteFactory = createDirectWriteFactory(); + if (!d->directWriteFactory) return false; - } } if (!d->directWriteGdiInterop) { const HRESULT hr = d->directWriteFactory->GetGdiInterop(&d->directWriteGdiInterop); @@ -1218,11 +1240,13 @@ QT_WARNING_POP fontFile->Release(); - fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize, + fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, + pixelSize, fontEngineData); // Get font family from font data fontEngine->fontDef.family = font.familyName(); + fontEngine->fontDef.hintingPreference = hintingPreference; directWriteFontFace->Release(); } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index b6bc65055f..41fa8c015d 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1358,6 +1358,12 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at) QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, fontEngine->fontDef.pixelSize, data); + if (fontEngine->fontDef.weight > QFont::Normal) + fedw->fontDef.weight = fontEngine->fontDef.weight; + if (fontEngine->fontDef.style > QFont::StyleNormal) + fedw->fontDef.style = fontEngine->fontDef.style; + fedw->fontDef.family = fam; + fedw->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference; return fedw; } else { qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__); @@ -1369,7 +1375,14 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at) // Get here if original font is not DirectWrite or DirectWrite creation failed for some // reason - return new QWindowsFontEngine(fam, lf, data); + QFontEngine *fe = new QWindowsFontEngine(fam, lf, data); + if (fontEngine->fontDef.weight > QFont::Normal) + fe->fontDef.weight = fontEngine->fontDef.weight; + if (fontEngine->fontDef.style > QFont::StyleNormal) + fe->fontDef.style = fontEngine->fontDef.style; + fe->fontDef.family = fam; + fe->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference; + return fe; } bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 75449e22ed..593ac7d810 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -196,8 +196,8 @@ namespace { */ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, - qreal pixelSize, - const QSharedPointer &d) + qreal pixelSize, + const QSharedPointer &d) : QFontEngine(DirectWrite) , m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) @@ -547,12 +547,17 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, transform.m21 = xform.m21(); transform.m22 = xform.m22(); + DWRITE_RENDERING_MODE renderMode = + fontDef.hintingPreference == QFont::PreferNoHinting + ? DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC + : DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL; + IDWriteGlyphRunAnalysis *glyphAnalysis = NULL; HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis( &glyphRun, 1.0f, &transform, - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + renderMode, DWRITE_MEASURING_MODE_NATURAL, 0.0, 0.0, &glyphAnalysis @@ -626,7 +631,8 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const { QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace, - pixelSize, m_fontEngineData); + pixelSize, + m_fontEngineData); fontEngine->fontDef = fontDef; fontEngine->fontDef.pixelSize = pixelSize; diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index a06707b84c..8d33e2f0db 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -463,7 +463,7 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format, PIXELFORMATDESCRIPTOR *obtainedPfd) { if (QOpenGLStaticContext::opengl32.moduleIsNotOpengl32()) { - qWarning("%s: Attempted to use GDI functions with a non-opengl32.dll library", Q_FUNC_INFO); + qWarning("Attempted to use GDI functions with a non-opengl32.dll library"); return 0; } @@ -1018,7 +1018,7 @@ QByteArray QOpenGLStaticContext::getGlString(unsigned int which) QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering) { if (!opengl32.init(softwareRendering)) { - qWarning("%s: Failed to load and resolve WGL/OpenGL functions", Q_FUNC_INFO); + qWarning("Failed to load and resolve WGL/OpenGL functions"); return 0; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 81525775c6..5f22ca1887 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -285,6 +285,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case AllGLFunctionsQueryable: return true; + case SwitchableWidgetComposition: + return true; default: return QPlatformIntegration::hasCapability(cap); } @@ -341,11 +343,18 @@ QWindowsWindow *QWindowsIntegration::createPlatformWindowHelper(QWindow *window, QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() { #if defined(QT_OPENGL_DYNAMIC) + const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); + QWindowsOpenGLTester::Renderer requestedRenderer = QWindowsOpenGLTester::requestedRenderer(); switch (requestedRenderer) { case QWindowsOpenGLTester::DesktopGl: - if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) { + if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag) + && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) { + qCWarning(lcQpaGl, "Unable to disable rotation."); + } return glCtx; + } qCWarning(lcQpaGl, "System OpenGL failed. Falling back to Software OpenGL."); return QOpenGLStaticContext::create(true); // If ANGLE is requested, use it, don't try anything else. @@ -366,10 +375,14 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() break; } - const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); if (supportedRenderers & QWindowsOpenGLTester::DesktopGl) { - if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) { + if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag) + && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) { + qCWarning(lcQpaGl, "Unable to disable rotation."); + } return glCtx; + } } if (QWindowsOpenGLTester::Renderers glesRenderers = supportedRenderers & QWindowsOpenGLTester::GlesMask) { if (QWindowsEGLStaticContext *eglCtx = QWindowsEGLStaticContext::create(glesRenderers)) diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index e32a7e32af..fcbe488f93 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -268,7 +268,10 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c result &= ~QWindowsOpenGLTester::AngleRendererD3d9; } } - + if (features.contains(QStringLiteral("disable_rotation"))) { + qCDebug(lcQpaGl) << "Disabling rotation: " << gpu; + result |= DisableRotationFlag; + } srCache->insert(qgpu, result); return result; #endif // !Q_OS_WINCE && !QT_NO_OPENGL diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index f22031aa4e..0fad3d960e 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -76,7 +76,9 @@ public: AngleBackendMask = AngleRendererD3d11 | AngleRendererD3d9 | AngleRendererD3d11Warp, Gles = 0x0010, // ANGLE/unspecified or Generic GLES for Windows CE. GlesMask = Gles | AngleBackendMask, - SoftwareRasterizer = 0x0020 + SoftwareRasterizer = 0x0020, + RendererMask = 0x00FF, + DisableRotationFlag = 0x0100 }; Q_DECLARE_FLAGS(Renderers, Renderer) diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index e69665e4a9..02696c87cd 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -325,6 +325,74 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) } } +enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE +#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_CC_MSVC) + : DWORD +#endif +{ + orientationPreferenceNone = 0, + orientationPreferenceLandscape = 0x1, + orientationPreferencePortrait = 0x2, + orientationPreferenceLandscapeFlipped = 0x4, + orientationPreferencePortraitFlipped = 0x8 +}; + +bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) +{ + bool result = false; +#ifndef Q_OS_WINCE + if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) { + DWORD orientationPreference = 0; + switch (o) { + case Qt::PrimaryOrientation: + orientationPreference = orientationPreferenceNone; + break; + case Qt::PortraitOrientation: + orientationPreference = orientationPreferencePortrait; + break; + case Qt::LandscapeOrientation: + orientationPreference = orientationPreferenceLandscape; + break; + case Qt::InvertedPortraitOrientation: + orientationPreference = orientationPreferencePortraitFlipped; + break; + case Qt::InvertedLandscapeOrientation: + orientationPreference = orientationPreferenceLandscapeFlipped; + break; + } + result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference); + } +#endif // !Q_OS_WINCE + return result; +} + +Qt::ScreenOrientation QWindowsScreen::orientationPreference() +{ + Qt::ScreenOrientation result = Qt::PrimaryOrientation; +#ifndef Q_OS_WINCE + if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) { + DWORD orientationPreference = 0; + if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) { + switch (orientationPreference) { + case orientationPreferenceLandscape: + result = Qt::LandscapeOrientation; + break; + case orientationPreferencePortrait: + result = Qt::PortraitOrientation; + break; + case orientationPreferenceLandscapeFlipped: + result = Qt::InvertedLandscapeOrientation; + break; + case orientationPreferencePortraitFlipped: + result = Qt::InvertedPortraitOrientation; + break; + } + } + } +#endif // !Q_OS_WINCE + return result; +} + /*! \brief Queries ClearType settings to check the pixel layout */ diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 879cda047e..b46bd88ec6 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -97,6 +97,9 @@ public: QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const Q_DECL_OVERRIDE; QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const Q_DECL_OVERRIDE; + static Qt::ScreenOrientation orientationPreference(); + static bool setOrientationPreference(Qt::ScreenOrientation o); + inline void handleChanges(const QWindowsScreenData &newData); #ifndef QT_NO_CURSOR diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c49682cc26..48484209b5 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1779,7 +1779,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) { if (visible) ShowWindow(m_data.hwnd, (newState == Qt::WindowMinimized) ? SW_MINIMIZE : - (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); + (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNORMAL); } qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << newState; } diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index 29297116da..67af5c03ef 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -13,7 +13,6 @@ wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" DEFINES *= QT_NO_CAST_FROM_ASCII contains(QT_CONFIG, directwrite) { - LIBS *= -ldwrite SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp HEADERS += $$PWD/qwindowsfontenginedirectwrite.h } else { @@ -132,3 +131,6 @@ contains(QT_CONFIG, freetype) { } contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri) + +DEFINES *= LIBEGL_NAME=$${LIBEGL_NAME} +DEFINES *= LIBGLESV2_NAME=$${LIBGLESV2_NAME} diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp index 9d8792a6db..a0474b6710 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp @@ -81,7 +81,7 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen) IInputPaneStatics *statics; if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), &statics))) { - qWarning(Q_FUNC_INFO ": failed to retrieve input pane statics."); + qWarning("failed to retrieve input pane statics."); return; } @@ -98,7 +98,7 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen) m_keyboardRect = getInputPaneRect(inputPane, m_screen->scaleFactor()); m_isInputPanelVisible = !m_keyboardRect.isEmpty(); } else { - qWarning(Q_FUNC_INFO ": failed to retrieve InputPane."); + qWarning("failed to retrieve InputPane."); } } diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 9cedfa77ad..19e8b1de7d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -252,6 +252,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const case ForeignWindows: return true; case SyncState: return true; case RasterGLSurface: return true; + case SwitchableWidgetComposition: return true; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 46cee5d6d0..effdbf7334 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -147,7 +147,7 @@ public: return; char byteOrder = xSettings.at(0); if (byteOrder != LSBFirst && byteOrder != MSBFirst) { - qWarning("%s ByteOrder byte %d not 0 or 1", Q_FUNC_INFO , byteOrder); + qWarning("ByteOrder byte %d not 0 or 1", byteOrder); return; } @@ -157,7 +157,7 @@ public: qFromBigEndian((const uchar *)(x))) #define VALIDATE_LENGTH(x) \ if ((size_t)xSettings.length() < (offset + local_offset + 12 + x)) { \ - qWarning("%s Length %d runs past end of data", Q_FUNC_INFO , x); \ + qWarning("Length %d runs past end of data", x); \ return; \ } diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index c8ce2e482d..00a8ca7c98 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1633,7 +1633,7 @@ void QWin32PrintEnginePrivate::updatePageLayout() // Update orientation first as is needed to obtain printable margins when changing page size m_pageLayout.setOrientation(devMode->dmOrientation == DMORIENT_LANDSCAPE ? QPageLayout::Landscape : QPageLayout::Portrait); - if (devMode->dmPaperSize >= DMPAPER_USER) { + if (devMode->dmPaperSize >= DMPAPER_LAST) { // Is a custom size QPageSize pageSize = QPageSize(QSizeF(devMode->dmPaperWidth / 10.0f, devMode->dmPaperLength / 10.0f), QPageSize::Millimeter); diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h index 628145f3b0..a397a09908 100644 --- a/src/testlib/qtestaccessible.h +++ b/src/testlib/qtestaccessible.h @@ -135,13 +135,12 @@ public: for (int i = 0; eventList().isEmpty() && i < 5; ++i) QTest::qWait(50); if (eventList().isEmpty()) { - qWarning("%s: Timeout waiting for accessibility event.", Q_FUNC_INFO); + qWarning("Timeout waiting for accessibility event."); return false; } const bool res = *eventList().first() == *ev; if (!res) - qWarning("%s: %s", Q_FUNC_INFO, - qPrintable(msgAccessibilityEventListMismatch(eventList(), ev))); + qWarning("%s", qPrintable(msgAccessibilityEventListMismatch(eventList(), ev))); delete eventList().takeFirst(); return res; } @@ -172,9 +171,9 @@ private: if (object) { QGuiApplication* app = qobject_cast(object); if ( !app ) - qWarning("%s: root Object is not a QGuiApplication!", Q_FUNC_INFO); + qWarning("root Object is not a QGuiApplication!"); } else { - qWarning("%s: root Object called with 0 pointer", Q_FUNC_INFO); + qWarning("root Object called with 0 pointer"); } } diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 11067544c3..870780683a 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1971,6 +1971,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider) QFileIconProvider *QFileDialog::iconProvider() const { Q_D(const QFileDialog); + if (!d->model) + return Q_NULLPTR; return d->model->iconProvider(); } diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 7329019a87..92d6b8f3be 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -287,7 +287,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil } for (int i = infoList.count() - 1; i >= 0; --i) { QString driveName = translateDriveName(infoList.at(i)); - QList > updatedFiles; + QVector > updatedFiles; updatedFiles.append(QPair(driveName, infoList.at(i))); emit updates(path, updatedFiles); } @@ -298,7 +298,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil base.start(); QFileInfo fileInfo; bool firstTime = true; - QList > updatedFiles; + QVector > updatedFiles; QStringList filesToCheck = files; QString itPath = QDir::fromNativeSeparators(files.isEmpty() ? path : QLatin1String("")); @@ -324,7 +324,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil emit directoryLoaded(path); } -void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList > &updatedFiles, const QString &path) { +void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QVector > &updatedFiles, const QString &path) { updatedFiles.append(QPair(fileInfo.fileName(), fileInfo)); QElapsedTimer current; current.start(); diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index 6bd15b5388..03f87fdba5 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -149,7 +149,7 @@ class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread Q_OBJECT Q_SIGNALS: - void updates(const QString &directory, const QList > &updates); + void updates(const QString &directory, const QVector > &updates); void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const; void nameResolved(const QString &fileName, const QString &resolvedName) const; void directoryLoaded(const QString &path); @@ -176,7 +176,7 @@ private: void run() Q_DECL_OVERRIDE; // called by run(): void getFileInfos(const QString &path, const QStringList &files); - void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList > &updatedFiles, const QString &path); + void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QVector > &updatedFiles, const QString &path); private: mutable QMutex mutex; diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index d0c3edcd69..3c154c3dbb 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -154,6 +155,11 @@ QT_BEGIN_NAMESPACE Returns the QFileInfo for the item stored in the model under the given \a index. */ +QFileInfo QFileSystemModel::fileInfo(const QModelIndex &index) const +{ + Q_D(const QFileSystemModel); + return d->node(index)->fileInfo(); +} /*! \fn void QFileSystemModel::rootPathChanged(const QString &newPath); @@ -989,84 +995,6 @@ void QFileSystemModelPrivate::_q_performDelayedSort() q->sort(sortColumn, sortOrder); } -static inline QChar getNextChar(const QString &s, int location) -{ - return (location < s.length()) ? s.at(location) : QChar(); -} - -/*! - Natural number sort, skips spaces. - - Examples: - 1, 2, 10, 55, 100 - 01.jpg, 2.jpg, 10.jpg - - Note on the algorithm: - Only as many characters as necessary are looked at and at most they all - are looked at once. - - Slower then QString::compare() (of course) - */ -int QFileSystemModelPrivate::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs) -{ - for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) { - // skip spaces, tabs and 0's - QChar c1 = getNextChar(s1, l1); - while (c1.isSpace()) - c1 = getNextChar(s1, ++l1); - QChar c2 = getNextChar(s2, l2); - while (c2.isSpace()) - c2 = getNextChar(s2, ++l2); - - if (c1.isDigit() && c2.isDigit()) { - while (c1.digitValue() == 0) - c1 = getNextChar(s1, ++l1); - while (c2.digitValue() == 0) - c2 = getNextChar(s2, ++l2); - - int lookAheadLocation1 = l1; - int lookAheadLocation2 = l2; - int currentReturnValue = 0; - // find the last digit, setting currentReturnValue as we go if it isn't equal - for ( - QChar lookAhead1 = c1, lookAhead2 = c2; - (lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length()); - lookAhead1 = getNextChar(s1, ++lookAheadLocation1), - lookAhead2 = getNextChar(s2, ++lookAheadLocation2) - ) { - bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit(); - bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit(); - if (!is1ADigit && !is2ADigit) - break; - if (!is1ADigit) - return -1; - if (!is2ADigit) - return 1; - if (currentReturnValue == 0) { - if (lookAhead1 < lookAhead2) { - currentReturnValue = -1; - } else if (lookAhead1 > lookAhead2) { - currentReturnValue = 1; - } - } - } - if (currentReturnValue != 0) - return currentReturnValue; - } - - if (cs == Qt::CaseInsensitive) { - if (!c1.isLower()) c1 = c1.toLower(); - if (!c2.isLower()) c2 = c2.toLower(); - } - int r = QString::localeAwareCompare(c1, c2); - if (r < 0) - return -1; - if (r > 0) - return 1; - } - // The two strings are the same (02 == 2) so fall back to the normal sort - return QString::compare(s1, s2, cs); -} /* \internal @@ -1075,7 +1003,11 @@ int QFileSystemModelPrivate::naturalCompare(const QString &s1, const QString &s2 class QFileSystemModelSorter { public: - inline QFileSystemModelSorter(int column) : sortColumn(column) {} + inline QFileSystemModelSorter(int column) : sortColumn(column) + { + naturalCompare.setNumericMode(true); + naturalCompare.setCaseSensitivity(Qt::CaseInsensitive); + } bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l, const QFileSystemModelPrivate::QFileSystemNode *r) const @@ -1089,8 +1021,7 @@ public: if (left ^ right) return left; #endif - return QFileSystemModelPrivate::naturalCompare(l->fileName, - r->fileName, Qt::CaseInsensitive) < 0; + return naturalCompare.compare(l->fileName, r->fileName) < 0; } case 1: { @@ -1102,22 +1033,22 @@ public: qint64 sizeDifference = l->size() - r->size(); if (sizeDifference == 0) - return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + return naturalCompare.compare(l->fileName, r->fileName) < 0; return sizeDifference < 0; } case 2: { - int compare = QString::localeAwareCompare(l->type(), r->type()); + int compare = naturalCompare.compare(l->type(), r->type()); if (compare == 0) - return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + return naturalCompare.compare(l->fileName, r->fileName) < 0; return compare < 0; } case 3: { if (l->lastModified() == r->lastModified()) - return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + return naturalCompare.compare(l->fileName, r->fileName) < 0; return l->lastModified() < r->lastModified(); } @@ -1134,6 +1065,7 @@ public: private: + QCollator naturalCompare; int sortColumn; }; @@ -1193,7 +1125,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order) emit layoutAboutToBeChanged(); QModelIndexList oldList = persistentIndexList(); - QList > oldNodes; + QVector > oldNodes; const int nodeCount = oldList.count(); oldNodes.reserve(nodeCount); for (int i = 0; i < nodeCount; ++i) { @@ -1839,7 +1771,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int The thread has received new information about files, update and emit dataChanged if it has actually changed. */ -void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QList > &updates) +void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector > &updates) { #ifndef QT_NO_FILESYSTEMWATCHER Q_Q(QFileSystemModel); @@ -1958,12 +1890,12 @@ void QFileSystemModelPrivate::_q_resolvedName(const QString &fileName, const QSt void QFileSystemModelPrivate::init() { Q_Q(QFileSystemModel); - qRegisterMetaType > >(); + qRegisterMetaType > >(); #ifndef QT_NO_FILESYSTEMWATCHER q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)), q, SLOT(_q_directoryChanged(QString,QStringList))); - q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QList >)), - q, SLOT(_q_fileSystemChanged(QString,QList >))); + q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector >)), + q, SLOT(_q_fileSystemChanged(QString,QVector >))); q->connect(&fileInfoGatherer, SIGNAL(nameResolved(QString,QString)), q, SLOT(_q_resolvedName(QString,QString))); q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)), diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index cef85a0c8c..51c01220a2 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -133,7 +133,7 @@ public: inline QString fileName(const QModelIndex &index) const; inline QIcon fileIcon(const QModelIndex &index) const; QFile::Permissions permissions(const QModelIndex &index) const; - inline QFileInfo fileInfo(const QModelIndex &index) const; + QFileInfo fileInfo(const QModelIndex &index) const; bool remove(const QModelIndex &index); protected: @@ -147,7 +147,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list)) Q_PRIVATE_SLOT(d_func(), void _q_performDelayedSort()) - Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QList > &)) + Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QVector > &)) Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName)) friend class QFileDialogPrivate; @@ -157,8 +157,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const { return aindex.data(Qt::DisplayRole).toString(); } inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const { return qvariant_cast(aindex.data(Qt::DecorationRole)); } -inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const -{ return QFileInfo(filePath(aindex)); } #endif // QT_NO_FILESYSTEMMODEL diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index 57fb457071..d2a40a1cb5 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -107,6 +107,7 @@ public: return true; return false; } + inline QFileInfo fileInfo() const { if (info) return info->fileInfo(); return QFileInfo(); } inline bool isFile() const { if (info) return info->isFile(); return true; } inline bool isSystem() const { if (info) return info->isSystem(); return true; } inline bool isHidden() const { if (info) return info->isHidden(); return false; } @@ -282,7 +283,7 @@ public: void _q_directoryChanged(const QString &directory, const QStringList &list); void _q_performDelayedSort(); - void _q_fileSystemChanged(const QString &path, const QList > &); + void _q_fileSystemChanged(const QString &path, const QVector > &); void _q_resolvedName(const QString &fileName, const QString &resolvedName); static int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index d0dcb02d7f..0e38485f5a 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -201,9 +201,7 @@ QDebug operator<<(QDebug str, const QSpanCollection::Span &span) void QSpanCollection::updateInsertedRows(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << Q_FUNC_INFO; - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -251,9 +249,7 @@ void QSpanCollection::updateInsertedRows(int start, int end) void QSpanCollection::updateInsertedColumns(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << Q_FUNC_INFO; - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -334,9 +330,7 @@ bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int void QSpanCollection::updateRemovedRows(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << Q_FUNC_INFO; - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; @@ -463,9 +457,7 @@ void QSpanCollection::updateRemovedRows(int start, int end) void QSpanCollection::updateRemovedColumns(int start, int end) { #ifdef DEBUG_SPAN_UPDATE - qDebug() << Q_FUNC_INFO; - qDebug() << start << end; - qDebug() << index; + qDebug() << start << end << endl << index; #endif if (spans.isEmpty()) return; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3c48f29ef1..6fffe33ce8 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2242,8 +2242,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) QApplication::setActiveWindow(tlw); // QTBUG-37126, Active X controls may set the focus on native child widgets. if (wnd && tlw && wnd != tlw->windowHandle()) { - if (QWidgetWindow *widgetWindow = qobject_cast(wnd)) - widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); + if (QWidgetWindow *widgetWindow = qobject_cast(wnd)) { + if (widgetWindow->widget()->inherits("QAxHostWidget")) + widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); + } } } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index fbaa14a2b2..66f68766cd 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -73,6 +73,7 @@ #include #include #include +#include #include #include @@ -1822,26 +1823,49 @@ void QWidgetPrivate::deleteSysExtra() { } +static void deleteBackingStore(QWidgetPrivate *d) +{ + QTLWExtra *topData = d->topData(); + + // The context must be current when destroying the backing store as it may attempt to + // release resources like textures and shader programs. The window may not be suitable + // anymore as there will often not be a platform window underneath at this stage. Fall + // back to a QOffscreenSurface in this case. + QScopedPointer tempSurface; +#ifndef QT_NO_OPENGL + if (d->textureChildSeen && topData->shareContext) { + if (topData->window->handle()) { + topData->shareContext->makeCurrent(topData->window); + } else { + tempSurface.reset(new QOffscreenSurface); + tempSurface->setFormat(topData->shareContext->format()); + tempSurface->create(); + topData->shareContext->makeCurrent(tempSurface.data()); + } + } +#endif + + delete topData->backingStore; + topData->backingStore = 0; + +#ifndef QT_NO_OPENGL + if (d->textureChildSeen && topData->shareContext) + topData->shareContext->doneCurrent(); +#endif +} + void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { //the qplatformbackingstore may hold a reference to the window, so the backingstore //needs to be deleted first. If the backingstore holds GL resources, we need to - // make the context current here, since the platform bs does not have a reference - // to the widget. + // make the context current here. This is taken care of by deleteBackingStore(). -#ifndef QT_NO_OPENGL - if (textureChildSeen && extra->topextra->shareContext) - extra->topextra->shareContext->makeCurrent(extra->topextra->window); -#endif extra->topextra->backingStoreTracker.destroy(); - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; + deleteBackingStore(this); #ifndef QT_NO_OPENGL qDeleteAll(extra->topextra->widgetTextures); extra->topextra->widgetTextures.clear(); - if (textureChildSeen && extra->topextra->shareContext) - extra->topextra->shareContext->doneCurrent(); delete extra->topextra->shareContext; extra->topextra->shareContext = 0; #endif @@ -12030,7 +12054,7 @@ void QWidget::setBackingStore(QBackingStore *store) return; QBackingStore *oldStore = topData->backingStore; - delete topData->backingStore; + deleteBackingStore(d); topData->backingStore = store; QWidgetBackingStore *bs = d->maybeBackingStore(); @@ -12320,6 +12344,12 @@ QPaintEngine *QWidget::paintEngine() const return 0; //##### @@@ } +// Do not call QWindow::mapToGlobal() until QPlatformWindow is properly showing. +static inline bool canMapPosition(QWindow *window) +{ + return window->handle() && !qt_window_private(window)->resizeEventPending; +} + /*! \fn QPoint QWidget::mapToGlobal(const QPoint &pos) const @@ -12347,7 +12377,7 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const #endif // !QT_NO_GRAPHICSVIEW QWindow *window = w->windowHandle(); - if (window && window->handle()) + if (window && canMapPosition(window)) return window->mapToGlobal(QPoint(x, y)); x += w->data->crect.x(); @@ -12383,7 +12413,7 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const #endif // !QT_NO_GRAPHICSVIEW QWindow *window = w->windowHandle(); - if (window && window->handle()) + if (window && canMapPosition(window)) return window->mapFromGlobal(QPoint(x, y)); x -= w->data->crect.x(); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index a108dcf03b..d5c8691459 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -104,7 +104,6 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack #ifndef QT_NO_OPENGL if (widgetTextures) { - Q_ASSERT(!widgetTextures->isEmpty()); qt_window_private(tlw->windowHandle())->compositing = true; widget->window()->d_func()->sendComposeStatus(widget->window(), false); // A window may have alpha even when the app did not request @@ -955,6 +954,8 @@ static void findAllTextureWidgetsRecursively(QWidget *tlw, QWidget *widget) } } +Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList) + static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) { foreach (QPlatformTextureList *tl, QWidgetPrivate::get(tlw)->topData()->widgetTextures) { @@ -965,6 +966,20 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) return tl; } } + + if (QWidgetPrivate::get(tlw)->textureChildSeen) { + // No render-to-texture widgets in the (sub-)tree due to hidden or native + // children. Returning null results in using the normal backingstore flush path + // without OpenGL-based compositing. This is very desirable normally. However, + // some platforms cannot handle switching between the non-GL and GL paths for + // their windows so it has to be opt-in. + static bool switchableWidgetComposition = + QGuiApplicationPrivate::instance()->platformIntegration() + ->hasCapability(QPlatformIntegration::SwitchableWidgetComposition); + if (!switchableWidgetComposition) + return qt_dummy_platformTextureList(); + } + return 0; } diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index cce667ffbf..e65c2c8bef 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -799,7 +799,7 @@ void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event) void QWidgetWindow::handleDropEvent(QDropEvent *event) { if (Q_UNLIKELY(m_dragTarget.isNull())) { - qWarning() << Q_FUNC_INFO << m_widget << ": No drag target set."; + qWarning() << m_widget << ": No drag target set."; event->ignore(); return; } diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 3be5ae3524..4c16b182a8 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -2472,12 +2472,12 @@ bool QWindowsVistaStylePrivate::initTreeViewTheming() m_treeViewHelper = createTreeViewHelperWindow(); if (Q_UNLIKELY(!m_treeViewHelper)) { - qWarning("%s: Unable to create the treeview helper window.", Q_FUNC_INFO); + qWarning("Unable to create the treeview helper window."); return false; } const HRESULT hr = QWindowsXPStylePrivate::pSetWindowTheme(m_treeViewHelper, L"explorer", NULL); if (Q_UNLIKELY(hr != S_OK)) { - qErrnoWarning("%s: SetWindowTheme() failed.", Q_FUNC_INFO); + qErrnoWarning("SetWindowTheme() failed."); return false; } return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper); diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 8bd4f69d20..d5f511b771 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -338,15 +338,15 @@ void QWindowsXPStylePrivate::cleanupHandleMap() HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd) { if (Q_UNLIKELY(theme < 0 || theme >= NThemes || !hwnd)) { - qWarning("%s: Invalid parameters #%d, %p", Q_FUNC_INFO, theme, hwnd); + qWarning("Invalid parameters #%d, %p", theme, hwnd); return 0; } if (!m_themes[theme]) { const wchar_t *name = themeNames[theme]; m_themes[theme] = pOpenThemeData(hwnd, name); if (Q_UNLIKELY(!m_themes[theme])) - qErrnoWarning("%s: OpenThemeData() failed for theme %d (%s).", - Q_FUNC_INFO, theme, qPrintable(themeName(theme))); + qErrnoWarning("OpenThemeData() failed for theme %d (%s).", + theme, qPrintable(themeName(theme))); } return m_themes[theme]; } diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index c540c3cdf0..bc7c11127e 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -1870,8 +1870,8 @@ void QScrollerPrivate::setContentPositionHelperScrolling() newPos.setY(nextSegmentPosition(ySegments, now, newPos.y())); // -- set the position and handle overshoot - qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()"; - qScrollerDebug() << " --> overshoot:" << overshootPosition << "- new pos:" << newPos; + qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()\n" + " --> overshoot:" << overshootPosition << "- new pos:" << newPos; QPointF newClampedPos = clampToRect(newPos, contentPosRange); diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index 1809c36483..f1b86ba2df 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -395,7 +395,7 @@ void QSystemTrayIconPrivate::install_sys() sys->createIcon(); sys->trayMessage(NIM_ADD); } else { - qWarning("%s: The platform plugin failed to create a message window.", Q_FUNC_INFO); + qWarning("The platform plugin failed to create a message window."); } } } diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 27e977f027..4239e7f3d4 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -502,8 +502,8 @@ void QMenuPrivate::hideMenu(QMenu *menu) if (activeMenu == menu) activeMenu = 0; menu->d_func()->causedPopup.action = 0; - menu->d_func()->causedPopup.widget = 0; menu->close(); + menu->d_func()->causedPopup.widget = 0; if (previousMouseMenu.data() == menu) handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR); } diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index dc39221b60..b5379f594c 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -1129,7 +1129,7 @@ QLayoutItem *QToolBarAreaLayout::plug(const QList &path) { QToolBarAreaLayoutItem *item = this->item(path); if (Q_UNLIKELY(!item)) { - qWarning() << Q_FUNC_INFO << "No item at" << path; + qWarning() << "No item at" << path; return 0; } Q_ASSERT(item->gap); diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index c88a9da396..29dfb0684c 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -2,4 +2,5 @@ CONFIG += testcase TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp -contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11): CONFIG += c++11 +contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index d382001296..df002c5728 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,6 +1,7 @@ CONFIG += testcase CONFIG -= app_bundle debug_and_release_target -contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11): CONFIG += c++11 +contains(QT_CONFIG, c++14): CONFIG += c++14 TARGET = ../tst_qlogging QT = core testlib SOURCES = ../tst_qlogging.cpp diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index e47b2e2e69..24765a82a8 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -78,6 +78,9 @@ public: QList tests; static void setupDatabase(); + +private: + QScopedPointer m_dirModelTempDir; }; @@ -306,18 +309,20 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) } if (QDirModel *dirModel = qobject_cast(model)) { - if (!QDir::current().mkdir("test")) - qFatal("%s: cannot create directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test"))); + m_dirModelTempDir.reset(new QTemporaryDir); + if (!m_dirModelTempDir->isValid()) + qFatal("Cannot create temporary directory \"%s\": %s", + qPrintable(QDir::toNativeSeparators(m_dirModelTempDir->path())), + qPrintable(m_dirModelTempDir->errorString())); + + QDir tempDir(m_dirModelTempDir->path()); for (int i = 0; i < 26; ++i) { - QString subdir = QLatin1String("test/foo_") + QString::number(i); - if (!QDir::current().mkdir(subdir)) - qFatal("%s: cannot create directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir))); + const QString subdir = QLatin1String("foo_") + QString::number(i); + if (!tempDir.mkdir(subdir)) + qFatal("Cannot create directory %s", + qPrintable(QDir::toNativeSeparators(tempDir.path() + QLatin1Char('/') +subdir))); } - return dirModel->index(QDir::currentPath()+"/test"); + return dirModel->index(tempDir.path()); } if (QSqlQueryModel *queryModel = qobject_cast(model)) { @@ -383,22 +388,8 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) */ void ModelsToTest::cleanupTestArea(QAbstractItemModel *model) { - if (qobject_cast(model)) - { - if (QDir(QDir::currentPath()+"/test").exists()) - { - for (int i = 0; i < 26; ++i) { - QString subdir(QLatin1String("test/foo_") + QString::number(i)); - if (!QDir::current().rmdir(subdir)) - qFatal("%s: cannot remove directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/"+subdir))); - } - if (!QDir::current().rmdir("test")) - qFatal("%s: cannot remove directory %s", - Q_FUNC_INFO, - qPrintable(QDir::toNativeSeparators(QDir::currentPath()+"/test"))); - } + if (qobject_cast(model)) { + m_dirModelTempDir.reset(); } else if (qobject_cast(model)) { QSqlQuery q("DROP TABLE test"); } diff --git a/tests/auto/corelib/thread/qthreadpool/BLACKLIST b/tests/auto/corelib/thread/qthreadpool/BLACKLIST index 684f650a72..1c392ce96c 100644 --- a/tests/auto/corelib/thread/qthreadpool/BLACKLIST +++ b/tests/auto/corelib/thread/qthreadpool/BLACKLIST @@ -1,5 +1,2 @@ [expiryTimeoutRace] osx -[tryStartCount] -windows msvc-2012 -linux diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index c9fdb4b718..c465a07487 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -821,7 +821,7 @@ void tst_QThreadPool::tryStartCount() ++count; QCOMPARE(count, QThread::idealThreadCount()); - QTest::qWait(100); + QTRY_COMPARE(threadPool.activeThreadCount(), 0); } } diff --git a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro index 219afa661b..a996dab23e 100644 --- a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro +++ b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro @@ -3,6 +3,7 @@ TARGET = tst_qlatin1string QT = core testlib SOURCES = tst_qlatin1string.cpp DEFINES += QT_NO_CAST_TO_ASCII -contains(QT_CONFIG,c++11): CONFIG += c++11 c++14 +contains(QT_CONFIG,c++11): CONFIG += c++11 +contains(QT_CONFIG,c++14): CONFIG += c++14 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro index e3a231060c..834fc85a29 100644 --- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro +++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro @@ -1,5 +1,6 @@ CONFIG += testcase -contains(QT_CONFIG, c++11):CONFIG += c++11 c++14 +contains(QT_CONFIG, c++11):CONFIG += c++11 +contains(QT_CONFIG, c++14):CONFIG += c++14 TARGET = tst_qversionnumber QT = core testlib SOURCES = tst_qversionnumber.cpp diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index afa72f6922..329c3ae66d 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -53,6 +53,7 @@ private slots: void actualSize2_data(); // test with 2 pixmaps with different aspect ratio void actualSize2(); void isNull(); + void isMask(); void swap(); void bestMatch(); void cacheKey(); @@ -219,6 +220,20 @@ void tst_QIcon::isNull() { QVERIFY(iconSupportedFormat.actualSize(QSize(32, 32)).isValid()); } +void tst_QIcon::isMask() +{ + QIcon icon; + icon.setIsMask(true); + icon.addPixmap(QPixmap()); + QVERIFY(icon.isMask()); + + QIcon icon2; + icon2.setIsMask(true); + QVERIFY(icon2.isMask()); + icon2.setIsMask(false); + QVERIFY(!icon2.isMask()); +} + void tst_QIcon::swap() { QPixmap p1(1, 1), p2(2, 2); diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 84fdd81f6c..c45342cc06 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -250,6 +250,14 @@ void tst_QGuiVariant::toColor_data() QColor c("red"); QTest::newRow( "string" ) << QVariant( QString( "red" ) ) << c; QTest::newRow( "solid brush" ) << QVariant( QBrush(c) ) << c; + QTest::newRow("qbytearray") << QVariant(QByteArray("red")) << c; + QTest::newRow("same color") << QVariant(c) << c; + QTest::newRow("qstring(#ff0000)") << QVariant(QString::fromUtf8("#ff0000")) << c; + QTest::newRow("qbytearray(#ff0000)") << QVariant(QByteArray("#ff0000")) << c; + + c.setNamedColor("#88112233"); + QTest::newRow("qstring(#88112233)") << QVariant(QString::fromUtf8("#88112233")) << c; + QTest::newRow("qbytearray(#88112233)") << QVariant(QByteArray("#88112233")) << c; } void tst_QGuiVariant::toColor() @@ -260,6 +268,8 @@ void tst_QGuiVariant::toColor() QVERIFY( value.canConvert( QVariant::Color ) ); QColor d = qvariant_cast(value); QCOMPARE( d, result ); + QVERIFY(value.convert(QMetaType::QColor)); + QCOMPARE(d, QColor(value.toString())); } void tst_QGuiVariant::toPixmap_data() diff --git a/tests/auto/other/compiler/compiler.pro b/tests/auto/other/compiler/compiler.pro index 57871429d2..19f86582e9 100644 --- a/tests/auto/other/compiler/compiler.pro +++ b/tests/auto/other/compiler/compiler.pro @@ -3,6 +3,7 @@ TARGET = tst_compiler SOURCES += tst_compiler.cpp baseclass.cpp derivedclass.cpp othersource.cpp HEADERS += baseclass.h derivedclass.h QT = core testlib -contains(QT_CONFIG, c++11): CONFIG += c++14 c++11 +contains(QT_CONFIG, c++11): CONFIG += c++11 +contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index ed4cc64410..32253674d8 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -165,6 +165,7 @@ private slots: #endif // QT_BUILD_INTERNAL #endif void rejectModalDialogs(); + void QTBUG49600_nativeIconProviderCrash(); private: void cleanupSettingsFile(); @@ -1487,5 +1488,13 @@ void tst_QFiledialog::rejectModalDialogs() QVERIFY(file.isEmpty()); } +void tst_QFiledialog::QTBUG49600_nativeIconProviderCrash() +{ + if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog)) + QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog."); + QFileDialog fd; + fd.iconProvider(); +} + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index acf45f8fb7..260aa25512 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -78,10 +78,6 @@ private slots: void indexPath(); void rootPath(); -#ifdef QT_BUILD_INTERNAL - void naturalCompare_data(); - void naturalCompare(); -#endif void readOnly(); void iconProvider(); @@ -242,80 +238,6 @@ void tst_QFileSystemModel::rootPath() } } -#ifdef QT_BUILD_INTERNAL -void tst_QFileSystemModel::naturalCompare_data() -{ - QTest::addColumn("s1"); - QTest::addColumn("s2"); - QTest::addColumn("caseSensitive"); - QTest::addColumn("result"); - QTest::addColumn("swap"); - -#define ROWNAME(name) (("prefix=" + prefix.toLatin1() + ", postfix=" + postfix.toLatin1() \ - + ", num=" + num.toLatin1() + ", i=" + QByteArray::number(i) \ - + ", test=" + name).constData()) - - for (int j = 0; j < 4; ++j) { // <- set a prefix and a postfix string (not numbers) - QString prefix = (j == 0 || j == 1) ? "b" : ""; - QString postfix = (j == 1 || j == 2) ? "y" : ""; - - for (int k = 0; k < 3; ++k) { // <- make 0 not a special case - const QString num = QString::number(k); - const QString nump = QString::number(k + 1); - for (int i = 10; i < 12; ++i) { // <- swap s1 and s2 and reverse the result - QTest::newRow(ROWNAME("basic")) << prefix + "0" + postfix << prefix + "0" + postfix << int(Qt::CaseInsensitive) << 0; - - // s1 should always be less then s2 - QTest::newRow(ROWNAME("just text")) << prefix + "fred" + postfix << prefix + "jane" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("just numbers")) << prefix + num + postfix << prefix + "9" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("zero")) << prefix + num + postfix << prefix + "0" + nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("space b")) << prefix + num + postfix << prefix + " " + nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("space a")) << prefix + num + postfix << prefix + nump + " " + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("tab b")) << prefix + num + postfix << prefix + " " + nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("tab a")) << prefix + num + postfix << prefix + nump + " " + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("10 vs 2")) << prefix + num + postfix << prefix + "10" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("diff len")) << prefix + num + postfix << prefix + nump + postfix + "x" << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("01 before 1")) << prefix + "0" + num + postfix << prefix + nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums 2nd 1")) << prefix + "1-" + num + postfix << prefix + "1-" + nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums 2nd 2")) << prefix + "10-" + num + postfix<< prefix + "10-10" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums 2nd 3")) << prefix + "10-0"+ num + postfix<< prefix + "10-10" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums 2nd 4")) << prefix + "10-" + num + postfix<< prefix + "10-010" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums big 1")) << prefix + "10-" + num + postfix<< prefix + "20-0" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums big 2")) << prefix + "2-" + num + postfix << prefix + "10-0" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul alphabet 1")) << prefix + num + "-a" + postfix << prefix + num + "-c" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul alphabet 2")) << prefix + num + "-a9" + postfix<< prefix + num + "-c0" + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("mul nums w\\0")) << prefix + num + "-"+ num + postfix<< prefix + num+"-0"+nump + postfix << int(Qt::CaseInsensitive) << i; - QTest::newRow(ROWNAME("num first")) << prefix + num + postfix << prefix + "a" + postfix << int(Qt::CaseInsensitive) << i; - } - } - } -#undef ROWNAME -} -#endif - -#ifdef QT_BUILD_INTERNAL -void tst_QFileSystemModel::naturalCompare() -{ - QFETCH(QString, s1); - QFETCH(QString, s2); - QFETCH(int, caseSensitive); - QFETCH(int, result); - - if (result == 10) - QCOMPARE(QFileSystemModelPrivate::naturalCompare(s1, s2, Qt::CaseSensitivity(caseSensitive)), -1); - else - if (result == 11) - QCOMPARE(QFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), 1); - else - QCOMPARE(QFileSystemModelPrivate::naturalCompare(s2, s1, Qt::CaseSensitivity(caseSensitive)), result); -#if defined(Q_OS_WINCE) - // On Windows CE we need to wait after each test, otherwise no new threads can be - // created. The scheduler takes its time to recognize ended threads. - QTest::qWait(300); -#endif -} -#endif - void tst_QFileSystemModel::readOnly() { QCOMPARE(model->isReadOnly(), true); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 54f279139f..f146955e95 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1860,10 +1860,6 @@ void tst_QWidget::activation() QCOMPARE(QApplication::activeWindow(), &widget1); widget2.showNormal(); QTest::qWait(waitTime); -#ifndef Q_OS_WINCE - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) - QEXPECT_FAIL("", "MS introduced new behavior after XP", Continue); -#endif QTest::qWait(waitTime); QCOMPARE(QApplication::activeWindow(), &widget2); widget2.hide(); diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 789a280e80..d76dbf6b46 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -47,13 +47,12 @@ class Widget : public QWidget { + Q_OBJECT public: - Widget() { } - QList events; protected: - bool event(QEvent *ev) { + bool event(QEvent *ev) Q_DECL_OVERRIDE { events.append(ev->type()); return QWidget::event(ev); } @@ -62,19 +61,14 @@ protected: class tst_QLabel : public QObject { -Q_OBJECT + Q_OBJECT -public: - tst_QLabel(); - virtual ~tst_QLabel(); - - -public slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); -private slots: + void getSetCheck(); void setText_data(); void setText(); @@ -143,15 +137,6 @@ void tst_QLabel::getSetCheck() delete var3; } - -tst_QLabel::tst_QLabel(): test_box(0) -{ -} - -tst_QLabel::~tst_QLabel() -{ -} - void tst_QLabel::initTestCase() { // Create the test class @@ -164,8 +149,7 @@ void tst_QLabel::cleanupTestCase() { delete testWidget; testWidget = 0; - if (test_box) - delete test_box; + delete test_box; } void tst_QLabel::init() diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index eaa277093c..ec46d7e625 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -94,6 +94,7 @@ private slots: void task208001_stylesheet(); void activeSubMenuPosition(); + void activeSubMenuPositionExec(); void task242454_sizeHint(); void task176201_clear(); void task250673_activeMultiColumnSubMenuPosition(); @@ -694,6 +695,61 @@ void tst_QMenu::activeSubMenuPosition() #endif } +// QTBUG-49588, QTBUG-48396: activeSubMenuPositionExec() is the same as +// activeSubMenuPosition(), but uses QMenu::exec(), which produces a different +// sequence of events. Verify that the sub menu is positioned to the right of the +// main menu. +class SubMenuPositionExecMenu : public QMenu +{ + Q_OBJECT +public: + SubMenuPositionExecMenu() : QMenu("Menu-Title"), m_timerId(-1), m_timerTick(0) + { + addAction("Item 1"); + m_subMenu = addMenu("Submenu"); + m_subAction = m_subMenu->addAction("Sub-Item1"); + setActiveAction(m_subMenu->menuAction()); + } + +protected: + void showEvent(QShowEvent *e) Q_DECL_OVERRIDE + { + QVERIFY(m_subMenu->isVisible()); + QVERIFY2(m_subMenu->x() > x(), + (QByteArray::number(m_subMenu->x()) + ' ' + QByteArray::number(x())).constData()); + m_timerId = startTimer(50); + QMenu::showEvent(e); + } + + void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE + { + if (e->timerId() == m_timerId) { + switch (m_timerTick++) { + case 0: + m_subMenu->close(); + break; + case 1: + close(); + break; + } + } + } + +private: + int m_timerId; + int m_timerTick; + QMenu *m_subMenu; + QAction *m_subAction; +}; + +void tst_QMenu::activeSubMenuPositionExec() +{ +#ifndef Q_OS_WINCE + SubMenuPositionExecMenu menu; + menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center()); +#endif // !Q_OS_WINCE +} + void tst_QMenu::task242454_sizeHint() { QMenu menu; diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index baf60551c4..f787d73a02 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -117,6 +117,7 @@ private slots: // void check_mouse2(); void check_altPress(); + void check_altClosePress(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) void check_shortcutPress(); void check_menuPosition(); @@ -978,6 +979,35 @@ void tst_QMenuBar::check_altPress() QTRY_VERIFY( ::qobject_cast(qApp->focusWidget()) ); } +// QTBUG-47377: Pressing 'Alt' after opening a menu by pressing 'Alt+Accelerator' +// should close it and QMenuBar::activeAction() should be 0. +void tst_QMenuBar::check_altClosePress() +{ + const QStyle *style = QApplication::style(); + if (!style->styleHint(QStyle::SH_MenuBar_AltKeyNavigation) ) { + QSKIP(("This test is not supposed to work in the " + style->objectName().toLatin1() + + " style. Skipping.").constData()); + } + + QMainWindow w; + w.setWindowTitle(QTest::currentTestFunction()); + QMenu *menuFile = w.menuBar()->addMenu(tr("&File")); + menuFile->addAction("Quit"); + QMenu *menuEdit = w.menuBar()->addMenu(tr("&Edit")); + menuEdit->addAction("Copy"); + + w.show(); + w.move(QGuiApplication::primaryScreen()->availableGeometry().center()); + QApplication::setActiveWindow(&w); + QVERIFY(QTest::qWaitForWindowActive(&w)); + + QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier); + QTRY_VERIFY(menuFile->isVisible()); + QTest::keyClick(menuFile, Qt::Key_Alt, Qt::AltModifier); + QTRY_VERIFY(!menuFile->isVisible()); + QTRY_VERIFY(!w.menuBar()->activeAction()); +} + // Qt/Mac,WinCE does not use the native popups/menubar #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) void tst_QMenuBar::check_shortcutPress() diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 26299f2b79..7949d81bf9 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1426,8 +1426,8 @@ void Configure::parseCmdLine() cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"] << "\" which is not a supported platform" << endl; } else { // was autodetected from environment - cout << "Unable to detect the platform from environment. Use -platform command line" - "argument or set the QMAKESPEC environment variable and run configure again" << endl; + cout << "Unable to detect the platform from environment. Use -platform command line" << endl + << "argument or set the QMAKESPEC environment variable and run configure again." << endl; } cout << "See the README file for a list of supported operating systems and compilers." << endl; } else {