From 2afc8e3ad67989644576f232187003ba0c6b7a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 12 Jan 2018 14:16:43 +0100 Subject: Add bearer plugin removal notice to changelog Task-number: QTBUG-40332 Change-Id: Ie975ad86a235ccfff0c3f72bb108b6fa9a89ad13 Reviewed-by: Timur Pocheptsov --- dist/changes-5.9.4 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dist/changes-5.9.4 b/dist/changes-5.9.4 index 0bb768424f..f0cc6007c2 100644 --- a/dist/changes-5.9.4 +++ b/dist/changes-5.9.4 @@ -65,6 +65,12 @@ QtCore QtNetwork --------- + - Bearer Management: + * [QTBUG-40332] The nativewifi (Windows) bearer plugin was determined + to be causing network interference in the form of system-wide higher + latency and has been disabled. The CoreWlan (macOS) plugin has also + been disabled. + - QUdpSocket: * [QTBUG-64718] Fixed a regression from Qt 5.9.3 caused by an apparent Win32 API quirk we triggered when using readDatagram(), resulting in -- cgit v1.2.3 From 0d9208cecbbd9ed08e4ffb6540729668e3bd7754 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 15 Jan 2018 12:59:22 -0800 Subject: QMacStyle: Revert state changes for PE_IndicatorMenuCheckMark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changes introduced in 0e810e27a5e5a6c2e244ca439fbdf4f4ccc5b3da turn out to be incompatible with our style sheets styling. We partially revert the style option state check, so that the look for a highlighted PE_IndicatorMenuCheckMark only depends on State_On, as it's expected in QWindowsStyle and QCommonStyle. [ChangeLog][QtWidgets][QMacStyle] PE_IndicatorMenuCheckMark goes back to only depend on State_On for its highlighted look. Change-Id: I20f8e712196b5515bd5528ff6eedcdca9df5856f Task-number: QTBUG-65773 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/styles/qmacstyle_mac.mm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index f45bf7011f..e6436f82a6 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3389,13 +3389,12 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai } break; case PE_IndicatorMenuCheckMark: { - if (!(opt->state & State_On)) - break; QColor pc; - if (opt->state & State_Selected) + if (opt->state & State_On) pc = opt->palette.highlightedText().color(); else pc = opt->palette.text().color(); + QCFType checkmarkColor = CGColorCreateGenericRGB(static_cast(pc.redF()), static_cast(pc.greenF()), static_cast(pc.blueF()), @@ -4493,8 +4492,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter const int xp = contentRect.x() + macItemFrame; checkmarkOpt.rect = QRect(xp, contentRect.y() - checkmarkOpt.fontMetrics.descent(), mw, mh); - checkmarkOpt.state |= State_On; // Always on. Never rendered when off. - checkmarkOpt.state.setFlag(State_Selected, active); + checkmarkOpt.state.setFlag(State_On, active); checkmarkOpt.state.setFlag(State_Enabled, enabled); if (widgetSize == QAquaSizeMini) checkmarkOpt.state |= State_Mini; -- cgit v1.2.3 From 9de2ef6f5ab3b21b4e1679e010ee488193cb41e4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Jan 2018 08:23:55 +0100 Subject: QWidget: Fix a crash when platform window creation fails Add a check on the platform window to QWidgetPrivate::create_sys(). Task-number: QTBUG-65783 Change-Id: I077882e1cf22ef49bb6f578f7460493ef48c9627 Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b38565493e..1fea3836ec 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1480,7 +1480,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (q->windowType() != Qt::Desktop || q->testAttribute(Qt::WA_NativeWindow)) { win->create(); // Enable nonclient-area events for QDockWidget and other NonClientArea-mouse event processing. - win->handle()->setFrameStrutEventsEnabled(true); + if (QPlatformWindow *platformWindow = win->handle()) + platformWindow->setFrameStrutEventsEnabled(true); } data.window_flags = win->flags(); -- cgit v1.2.3 From 40e87491886957696486b87dc2dedec2adaf6e1a Mon Sep 17 00:00:00 2001 From: Alexander Shevchenko Date: Wed, 10 Jan 2018 17:51:54 +0200 Subject: unify windows mkspecs: update definitions mingw-w64 toolchain: - add missing compiler definitions, similar to 'msvc-desktop.conf' toolchain, - describe the reasons of missing compiler definitions, available in 'msvc-desktop.conf' toolchain, - add missing 'QMAKE_CXXFLAGS' and 'QMAKE_CXXFLAGS_WARN_ON' variables, similar to 'msvc-desktop.conf' toolchain. ICC on Windows toolchain: - add 'QMAKE_CFLAGS_OPTIMIZE_FULL' variable, similar to 'gcc-base.conf' toolchain, though left it unused for now, - add missing flags to 'QMAKE_CFLAGS' variable, similar to 'msvc-desktop.conf' toolchain, - update deprecated 'Qwd' flag with 'Qdiag-disable', - use 'QMAKE_CFLAGS_OPTIMIZE_DEBUG' variable instead of '-Od' flag, similar to 'gcc-base.conf' toolchain (ICC implies '-O2' optimization level by default, while MSVC implies '-Od'), - add 'QMAKE_CFLAGS_UTF8_SOURCE' variable, similar to 'msvc-version.conf' toolchain; use a workaround to initialize it, until '-utf-8' flag would be supported by ICC on Windows, - update deprecated '-Qstd=c++1z' flag with '-Qstd=c++17', MSVC toolchain: - remove 'incremental' from MSVC 'CONFIG' variable, since it has relevance only for the Unix generator, - add 'QMAKE_CFLAGS_OPTIMIZE_DEBUG' variable, used in ICC for Windows toolchain, - add empty 'QMAKE_LIBS' variable, similar to 'win32-g++' toolchain, - add 'uuid.lib' library to 'QMAKE_LIBS_GUI' variable, similar to 'win32-g++' toolchain, - add C++14 and C++17 language support flags, though left them disabled for now, similar to 'win32-icc' toolchain. Change-Id: Ideef62d0422674184836faa655bfc5d09a5f612f Reviewed-by: Joerg Bornemann Reviewed-by: Kai Koehne Reviewed-by: Oswald Buddenhagen --- mkspecs/common/msvc-desktop.conf | 6 ++++-- mkspecs/common/msvc-version.conf | 5 +++++ mkspecs/win32-g++/qmake.conf | 9 +++++++-- mkspecs/win32-icc/qmake.conf | 15 +++++++++------ 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index 496ca1179d..546b9cf3cb 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -15,7 +15,7 @@ MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 QMAKE_COMPILER = msvc -CONFIG += incremental flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe +CONFIG += flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe DEFINES += UNICODE _UNICODE WIN32 QMAKE_COMPILER_DEFINES += _WIN32 contains(QMAKE_TARGET.arch, x86_64) { @@ -23,6 +23,7 @@ contains(QMAKE_TARGET.arch, x86_64) { QMAKE_COMPILER_DEFINES += _WIN64 } +QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Od QMAKE_CFLAGS_OPTIMIZE = -O2 QMAKE_CFLAGS_OPTIMIZE_SIZE = -O1 @@ -92,7 +93,8 @@ QMAKE_EXTENSION_SHLIB = dll QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = 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 = +QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib uuid.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 = gdi32.lib user32.lib diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf index ba74c49f9c..cfafb06305 100644 --- a/mkspecs/common/msvc-version.conf +++ b/mkspecs/common/msvc-version.conf @@ -85,6 +85,11 @@ greaterThan(QMAKE_MSC_VER, 1909) { # API is used in direct2d, but also in multimedia, positioning and sensors. # We can try again with a later version of Visual Studio. # QMAKE_CXXFLAGS_STRICTCXX = -permissive- + # MSVC partially supports the following, but '__cplusplus' definition is set + # as for C++98 until MSVC fully conforms with C++14, see + # https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html + # QMAKE_CXXFLAGS_CXX14 = -std:c++14 + # QMAKE_CXXFLAGS_CXX1Z = -std:c++latest } greaterThan(QMAKE_MSC_VER, 1910) { diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index a4955e99f3..96c94e7021 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -16,8 +16,11 @@ include(../common/g++-base.conf) MAKEFILE_GENERATOR = MINGW QMAKE_PLATFORM = win32 mingw CONFIG += debug_and_release debug_and_release_target precompile_header -DEFINES += UNICODE _UNICODE -QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 +DEFINES += UNICODE _UNICODE WIN32 +QMAKE_COMPILER_DEFINES += __GNUC__ _WIN32 +# can't add 'DEFINES += WIN64' and 'QMAKE_COMPILER_DEFINES += _WIN64' defines for +# x86_64 platform similar to 'msvc-desktop.conf' toolchain, because, unlike for MSVC, +# 'QMAKE_TARGET.arch' is inherently unavailable. QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_LEX = flex @@ -30,6 +33,8 @@ QMAKE_CFLAGS_WARN_ON += -Wextra QMAKE_CFLAGS_SSE2 += -mstackrealign QMAKE_CXX = $${CROSS_COMPILE}g++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_RTTI_ON = -frtti QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 4d18b1cc55..c66d73383a 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -4,7 +4,7 @@ # Written for Intel C++ Compiler on Windows / icl 16.0 or higher # -# Use the Microsoft (R) C/C++ Optimizing Compiler configuration, +# Use the Microsoft C/C++ Optimizing Compiler configuration, # since ICC on Windows pretends to be MSVC include(../common/msvc-desktop.conf) @@ -13,11 +13,14 @@ include(../common/msvc-desktop.conf) QMAKE_COMPILER += intel_icl +QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 + QMAKE_CC = icl -QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373 -QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673 -QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673 -QMAKE_CFLAGS_DEBUG = -Od -Zi -MDd +QMAKE_CFLAGS = -nologo -Zc:wchar_t -Qprec -Zm200 -Qdiag-disable:1744,1738,809,3373 +QMAKE_CFLAGS_WARN_ON = -W3 -Qdiag-disable:673 +QMAKE_CFLAGS_WARN_OFF = -W0 -Qdiag-disable:673 +QMAKE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_OPTIMIZE_DEBUG -Zi -MDd +QMAKE_CFLAGS_UTF8_SOURCE = -Qoption,cpp,--unicode_source_kind,UTF-8 QMAKE_CFLAGS_LTCG = -Qipo QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo @@ -44,7 +47,7 @@ QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_CXX11 = -Qstd=c++11 # ICC supports the following but Qt won't compile #QMAKE_CXXFLAGS_CXX14 = -Qstd=c++14 -#QMAKE_CXXFLAGS_CXX1Z = -Qstd=c++1z +#QMAKE_CXXFLAGS_CXX1Z = -Qstd=c++17 QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG -- cgit v1.2.3 From 8c023326c79b4fdb7eaa26600b1af622f5bce318 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 11 Jan 2018 12:26:32 +0100 Subject: config_help.txt: document that some sanitize combinations are not valid Saves people the trouble of trying it out themselves. When I tried "address" and "thread", I got: cc1plus: error: -fsanitize=address and -fsanitize=kernel-address are incompatible with -fsanitize=thread Change-Id: I48ae817e60d0b71d5349e1dbce8706cc8430c2c4 Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- config_help.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config_help.txt b/config_help.txt index 9c424391a9..0bb440b556 100644 --- a/config_help.txt +++ b/config_help.txt @@ -121,6 +121,9 @@ Build options: -gcov ................ Instrument with the GCov code coverage tool [no] -sanitize {address|thread|memory|undefined} Instrument with the specified compiler sanitizer. + Note that some sanitizers cannot be combined; + for example, -sanitize address cannot be combined with + -sanitize thread. -c++std .... Select C++ standard [c++1z/c++14/c++11] (Not supported with MSVC) -- cgit v1.2.3 From a57585961823cfc4d9a20ffd5dde3520c9229d61 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 17 Jan 2018 20:56:34 +0100 Subject: QThreadPool: Add missing semicolon after class in documentation Makes it easier to copy and paste the snippet into a code editor. Change-Id: I27c0a7aa268bd4fd0af885e929f67a28f083dabf Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp b/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp index a1372976ae..ba31972aa1 100644 --- a/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_concurrent_qthreadpool.cpp @@ -55,7 +55,7 @@ class HelloWorldTask : public QRunnable { qDebug() << "Hello world from thread" << QThread::currentThread(); } -} +}; HelloWorldTask *hello = new HelloWorldTask(); // QThreadPool takes ownership and deletes 'hello' automatically -- cgit v1.2.3 From 1aae404a4cf7f92d4135c1b24a3b6efef6c54708 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Tue, 18 Oct 2016 12:36:23 +0200 Subject: QProcess/Windows: Include PID in pipe names Although qt_create_pipe() tries again if the pipe name is already in use, it doesn't handle the case when another user has created the pipe with the name (the error is "access denied" in that case). The chance that it happens is small, but it can be entirely eliminated by including a unique part in the pipe name, in this case the PID. [ChangeLog][Windows] Named pipes internally created by QProcess now contain the PID in their name to ensure uniqueness. Change-Id: I079f1b68695c1ddea3eccad241061d11e08b60f4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 05c9d6594c..fa9efcb1ce 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -102,7 +102,7 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) // ### The user must make sure to call qsrand() to make the pipe names less predictable. // ### Replace the call to qrand() with a secure version, once we have it in Qt. _snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]), - L"\\\\.\\pipe\\qt-%X", qrand()); + L"\\\\.\\pipe\\qt-%lX-%X", long(QCoreApplication::applicationPid()), qrand()); DWORD dwOpenMode = FILE_FLAG_OVERLAPPED; DWORD dwOutputBufferSize = 0; -- cgit v1.2.3 From 2b47afadc0fcc9a2617d5c9e8be0ee035762e0b9 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 12 Jul 2017 17:15:10 +0200 Subject: gtk3: Disable native file dialogs on GTK3 < 3.15.5 Showing file dialogs if running on a system that has an older GTK3 version installed results in a crash. Do a version check at runtime and disable native file dialog support if the version is too old. (GTK3 bug: https://bugzilla.gnome.org/show_bug.cgi?id=725164) Change-Id: I77bd23f1298333412bae04f52153e1a224ddf470 Reviewed-by: Oswald Buddenhagen Reviewed-by: J-P Nurmi Reviewed-by: Dmitry Shachnev --- src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 17 ++++++++++++++++- src/plugins/platformthemes/gtk3/qgtk3theme.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index 6447776f25..077955eb4e 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -153,7 +153,7 @@ bool QGtk3Theme::usePlatformNativeDialog(DialogType type) const case ColorDialog: return true; case FileDialog: - return true; + return useNativeFileDialog(); case FontDialog: return true; default: @@ -167,6 +167,8 @@ QPlatformDialogHelper *QGtk3Theme::createPlatformDialogHelper(DialogType type) c case ColorDialog: return new QGtk3ColorDialogHelper; case FileDialog: + if (!useNativeFileDialog()) + return nullptr; return new QGtk3FileDialogHelper; case FontDialog: return new QGtk3FontDialogHelper; @@ -185,4 +187,17 @@ QPlatformMenuItem* QGtk3Theme::createPlatformMenuItem() const return new QGtk3MenuItem; } +bool QGtk3Theme::useNativeFileDialog() +{ + /* Require GTK3 >= 3.15.5 to avoid running into this bug: + * https://bugzilla.gnome.org/show_bug.cgi?id=725164 + * + * While this bug only occurs when using widget-based file dialogs + * (native GTK3 dialogs are fine) we have to disable platform file + * dialogs entirely since we can't avoid creation of a platform + * dialog helper. + */ + return gtk_check_version(3, 15, 5) == 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.h b/src/plugins/platformthemes/gtk3/qgtk3theme.h index 52036680c6..abc5dbfd17 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.h +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.h @@ -59,6 +59,8 @@ public: QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; static const char *name; +private: + static bool useNativeFileDialog(); }; QT_END_NAMESPACE -- cgit v1.2.3 From bed6292dde5c9a017a7cac7be6948471949174e8 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 7 Dec 2017 14:49:44 +0100 Subject: Win: Document limitation regarding registry types not being preserved QSettings does not preserve the original key type in the registry, it will set the type for the key based on the value that is being set. Therefore we should make it clear that existing key types will be overridden as this can cause some problems with types we do not directly support (such as REG_EXPAND_SZ). Task-number: QTBUG-2894 Change-Id: Ib2f2eed02759591e69fefb98a4a1f3cf897dd5cb Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index d5460238ec..9b930e7e14 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2358,6 +2358,11 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, limitations is to store the settings using the IniFormat instead of the NativeFormat. + \li On Windows, when the Windows system registry is used, QSettings + does not preserve the original type of the value. Therefore, + the type of the value might change when a new value is set. For + example, a value with type \c REG_EXPAND_SZ will change to \c REG_SZ. + \li On \macos and iOS, allKeys() will return some extra keys for global settings that apply to all applications. These keys can be read using value() but cannot be changed, only shadowed. -- cgit v1.2.3 From 3149d0fb13bacc20b75ad8ca650c71df9edd8734 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 18 Jan 2018 12:51:21 +0100 Subject: use correct path separators when invoking testcases on windows Change-Id: Iad541f0d62ffdb2751da6225b9d40229d7d9a03f Reviewed-by: Joerg Bornemann Reviewed-by: Edward Welbourne --- mkspecs/features/testcase.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 3e1537dde0..8d51c9d028 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -44,7 +44,7 @@ unix { $${type}.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET) } else { # Windows - !isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = $${TEST_TARGET_DIR}$${QMAKE_DIR_SEP} + !isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = $$shell_path($$TEST_TARGET_DIR)$${QMAKE_DIR_SEP} $${type}.commands += $${TEST_TARGET_DIR}$(TARGET) } -- cgit v1.2.3 From e86f3c018833141776db2d15772ba53995656eac Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 28 Jul 2017 13:25:27 +0200 Subject: qmake: require a drive in a DOS path for it to be absolute For Q_OS_WIN, a path is only truly absolute if it includes a drive letter; merely starting with a slash is not enough. (We can't support UNC paths, so don't even try: qmake runs various commands in the source directory using CMD.exe, which doesn't support UNC as PWD.) This requires, when resolving a path relative to a root, transcribing the root's drive to such not-quite-absolute paths. Changed QMakeGlobals, $$absolute_path() and $$relative_path() to now use IoUtils::resolvePath() rather than delegating to QDir's absolute path method, since that doesn't correctly recognize the need for a drive letter (and qmake did run into problems with some paths, from splitPathList and a failing test, as a result). Moved existing ioUtils tests for handling of relative / absolute paths out into separate functions and expanded significantly. Fixed some existing tests to use an absolute path where one is needed; added two tests involving driveless (but rooted) paths; and fixed the test init to set a value for QT_HOST_DATA/src property (the lack of which lead to an assertion failure with this fix). Task-number: QTBUG-50839 Change-Id: I2bfc13c1bfbe1ae09997274622ea55cb3de31b43 Reviewed-by: Oswald Buddenhagen --- qmake/library/ioutils.cpp | 23 ++++--- qmake/library/qmakebuiltins.cpp | 13 ++-- qmake/library/qmakeglobals.cpp | 15 ++--- tests/auto/tools/qmakelib/evaltest.cpp | 46 ++++++++++---- tests/auto/tools/qmakelib/tst_qmakelib.cpp | 97 +++++++++++++++++++++++++++--- tests/auto/tools/qmakelib/tst_qmakelib.h | 5 ++ 6 files changed, 157 insertions(+), 42 deletions(-) diff --git a/qmake/library/ioutils.cpp b/qmake/library/ioutils.cpp index 684bcb9a37..afd41912fe 100644 --- a/qmake/library/ioutils.cpp +++ b/qmake/library/ioutils.cpp @@ -66,21 +66,22 @@ IoUtils::FileType IoUtils::fileType(const QString &fileName) bool IoUtils::isRelativePath(const QString &path) { - if (path.startsWith(QLatin1Char('/'))) - return false; #ifdef QMAKE_BUILTIN_PRFS if (path.startsWith(QLatin1String(":/"))) return false; #endif #ifdef Q_OS_WIN - if (path.startsWith(QLatin1Char('\\'))) - return false; - // Unlike QFileInfo, this won't accept a relative path with a drive letter. - // Such paths result in a royal mess anyway ... + // Unlike QFileInfo, this considers only paths with both a drive prefix and + // a subsequent (back-)slash absolute: if (path.length() >= 3 && path.at(1) == QLatin1Char(':') && path.at(0).isLetter() - && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) + && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) { return false; -#endif + } + // (... unless, of course, they're UNC, which qmake fails on anyway) +#else + if (path.startsWith(QLatin1Char('/'))) + return false; +#endif // Q_OS_WIN return true; } @@ -100,6 +101,12 @@ QString IoUtils::resolvePath(const QString &baseDir, const QString &fileName) return QString(); if (isAbsolutePath(fileName)) return QDir::cleanPath(fileName); +#ifdef Q_OS_WIN // Add drive to otherwise-absolute path: + if (fileName.at(0).unicode() == '/' || fileName.at(0).unicode() == '\\') { + Q_ASSERT(isAbsolutePath(baseDir)); + return QDir::cleanPath(baseDir.left(2) + fileName); + } +#endif // Q_OS_WIN return QDir::cleanPath(baseDir + QLatin1Char('/') + fileName); } diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 1b98cbd909..e4b00a6cb3 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1173,9 +1173,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( if (args.count() > 2) { evalError(fL1S("absolute_path(path[, base]) requires one or two arguments.")); } else { - QString rstr = QDir::cleanPath( - QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory()) - .absoluteFilePath(args.at(0).toQString(m_tmp1))); + QString arg = args.at(0).toQString(m_tmp1); + QString baseDir = args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory(); + QString rstr = arg.isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, arg); ret << (rstr.isSharedWith(m_tmp1) ? args.at(0) : args.count() > 1 && rstr.isSharedWith(m_tmp2) @@ -1187,9 +1187,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( if (args.count() > 2) { evalError(fL1S("relative_path(path[, base]) requires one or two arguments.")); } else { - QDir baseDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory()); - QString rstr = baseDir.relativeFilePath(baseDir.absoluteFilePath( - args.at(0).toQString(m_tmp1))); + QString arg = args.at(0).toQString(m_tmp1); + QString baseDir = args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory(); + QString absArg = arg.isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, arg); + QString rstr = QDir(baseDir).relativeFilePath(absArg); ret << (rstr.isSharedWith(m_tmp1) ? args.at(0) : ProString(rstr).setSource(args.at(0))); } break; diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index b6dc8b20b6..d733d479cf 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -68,6 +68,7 @@ #endif QT_BEGIN_NAMESPACE +using namespace QMakeInternal; // for IoUtils #define fL1S(s) QString::fromLatin1(s) @@ -96,9 +97,9 @@ QString QMakeGlobals::cleanSpec(QMakeCmdLineParserState &state, const QString &s { QString ret = QDir::cleanPath(spec); if (ret.contains(QLatin1Char('/'))) { - QString absRet = QDir(state.pwd).absoluteFilePath(ret); + QString absRet = IoUtils::resolvePath(state.pwd, ret); if (QFile::exists(absRet)) - ret = QDir::cleanPath(absRet); + ret = absRet; } return ret; } @@ -126,10 +127,10 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( user_template_prefix = arg; break; case ArgCache: - cachefile = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg)); + cachefile = args[*pos] = IoUtils::resolvePath(state.pwd, arg); break; case ArgQtConf: - qtconf = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg)); + qtconf = args[*pos] = IoUtils::resolvePath(state.pwd, arg); break; default: if (arg.startsWith(QLatin1Char('-'))) { @@ -259,11 +260,11 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const { QStringList ret; if (!val.isEmpty()) { - QDir bdir; + QString cwd(QDir::currentPath()); const QStringList vals = val.split(dirlist_sep); ret.reserve(vals.length()); for (const QString &it : vals) - ret << QDir::cleanPath(bdir.absoluteFilePath(it)); + ret << IoUtils::resolvePath(cwd, it); } return ret; } @@ -318,7 +319,7 @@ bool QMakeGlobals::initProperties() return false; data = proc.readAll(); #else - if (FILE *proc = QT_POPEN(QString(QMakeInternal::IoUtils::shellQuote(qmake_abslocation) + if (FILE *proc = QT_POPEN(QString(IoUtils::shellQuote(qmake_abslocation) + QLatin1String(" -query")).toLocal8Bit(), QT_POPEN_READ)) { char buff[1024]; while (!feof(proc)) diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 03fd4753fd..cf69cc4026 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -34,6 +34,12 @@ #include #include +#ifdef Q_OS_WIN +# define EVAL_DRIVE "R:" +#else +# define EVAL_DRIVE +#endif + void tst_qmakelib::addAssignments() { QTest::newRow("assignment") @@ -1599,20 +1605,28 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << true; QTest::newRow("$$absolute_path(): file & path") - << "VAR = $$absolute_path(dir/file.ext, /root/sub)" - << "VAR = /root/sub/dir/file.ext" + << "VAR = $$absolute_path(dir/file.ext, " EVAL_DRIVE "/root/sub)" + << "VAR = " EVAL_DRIVE "/root/sub/dir/file.ext" << "" << true; +#ifdef Q_OS_WIN + QTest::newRow("$$absolute_path(): driveless file & absolute path") + << "VAR = $$absolute_path(/root/sub/dir/file.ext, " EVAL_DRIVE "/other)" + << "VAR = " EVAL_DRIVE "/root/sub/dir/file.ext" + << "" + << true; +#endif + QTest::newRow("$$absolute_path(): absolute file & path") - << "VAR = $$absolute_path(/root/sub/dir/file.ext, /other)" - << "VAR = /root/sub/dir/file.ext" + << "VAR = $$absolute_path(" EVAL_DRIVE "/root/sub/dir/file.ext, " EVAL_DRIVE "/other)" + << "VAR = " EVAL_DRIVE "/root/sub/dir/file.ext" << "" << true; QTest::newRow("$$absolute_path(): empty file & path") - << "VAR = $$absolute_path('', /root/sub)" - << "VAR = /root/sub" + << "VAR = $$absolute_path('', " EVAL_DRIVE "/root/sub)" + << "VAR = " EVAL_DRIVE "/root/sub" << "" << true; @@ -1634,14 +1648,22 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "" << true; +#ifdef Q_OS_WIN + QTest::newRow("$$relative_path(): driveless file & absolute path") + << "VAR = $$relative_path(/root/sub/dir/file.ext, " EVAL_DRIVE "/root/sub)" + << "VAR = dir/file.ext" + << "" + << true; +#endif + QTest::newRow("$$relative_path(): absolute file & path") - << "VAR = $$relative_path(/root/sub/dir/file.ext, /root/sub)" + << "VAR = $$relative_path(" EVAL_DRIVE "/root/sub/dir/file.ext, " EVAL_DRIVE "/root/sub)" << "VAR = dir/file.ext" << "" << true; QTest::newRow("$$relative_path(): empty file & path") - << "VAR = $$relative_path('', /root/sub)" + << "VAR = $$relative_path('', " EVAL_DRIVE "/root/sub)" << "VAR = ." << "" << true; @@ -2555,20 +2577,20 @@ void tst_qmakelib::addTestFunctions(const QString &qindir) << true; QTest::newRow("touch(): missing target") - << "touch(/does/not/exist, files/other.txt): OK = 1" + << "touch(" EVAL_DRIVE "/does/not/exist, files/other.txt): OK = 1" << "OK = UNDEF" #ifdef Q_OS_WIN - << "##:1: Cannot open /does/not/exist: The system cannot find the path specified." + << "##:1: Cannot open " EVAL_DRIVE "/does/not/exist: The system cannot find the path specified." #else << "##:1: Cannot touch /does/not/exist: No such file or directory." #endif << true; QTest::newRow("touch(): missing reference") - << "touch(" + wpath + ", /does/not/exist): OK = 1" + << "touch(" + wpath + ", " EVAL_DRIVE "/does/not/exist): OK = 1" << "OK = UNDEF" #ifdef Q_OS_WIN - << "##:1: Cannot open reference file /does/not/exist: The system cannot find the path specified." + << "##:1: Cannot open reference file " EVAL_DRIVE "/does/not/exist: The system cannot find the path specified." #else << "##:1: Cannot stat() reference file /does/not/exist: No such file or directory." #endif diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.cpp b/tests/auto/tools/qmakelib/tst_qmakelib.cpp index b1250f4f1a..4a4b20fe50 100644 --- a/tests/auto/tools/qmakelib/tst_qmakelib.cpp +++ b/tests/auto/tools/qmakelib/tst_qmakelib.cpp @@ -42,6 +42,7 @@ void tst_qmakelib::initTestCase() #endif m_prop.insert(ProKey("P1"), ProString("prop val")); m_prop.insert(ProKey("QT_HOST_DATA/get"), ProString(m_indir)); + m_prop.insert(ProKey("QT_HOST_DATA/src"), ProString(m_indir)); QVERIFY(!m_indir.isEmpty()); QVERIFY(QDir(m_outdir).removeRecursively()); @@ -224,21 +225,99 @@ void tst_qmakelib::pathUtils() QVERIFY(IoUtils::isRelativePath(fn0)); QString fn1 = "/a/unix/file/path"; - QVERIFY(IoUtils::isAbsolutePath(fn1)); QCOMPARE(IoUtils::pathName(fn1).toString(), QStringLiteral("/a/unix/file/")); QCOMPARE(IoUtils::fileName(fn1).toString(), QStringLiteral("path")); +} -#ifdef Q_OS_WIN - QString fn0a = "c:file/path"; - QVERIFY(IoUtils::isRelativePath(fn0a)); +void tst_qmakelib::ioUtilRelativity_data() +{ + QTest::addColumn("path"); + QTest::addColumn("relative"); - QString fn1a = "c:\\file\\path"; - QVERIFY(IoUtils::isAbsolutePath(fn1a)); + static const struct { + const char *name; + const char *path; + bool relative; + } rows[] = { + { "resource", ":/resource", +#ifdef QMAKE_BUILTIN_PRFS + false +#else + true #endif + }, +#ifdef Q_OS_WIN // all the complications: + // (except UNC: unsupported) + { "drive-abs", "c:/path/to/file", false }, + { "drive-abs-bs", "c:\\path\\to\\file", false }, + { "drive-path", "c:path/to/file.txt", true }, + { "drive-path-bs", "c:path\\to\\file.txt", true }, + { "rooted", "/Users/qt/bin/true", true }, + { "rooted-bs", "\\Users\\qt\\bin\\true", true }, + { "drive-rel", "c:file.txt", true }, + { "subdir-bs", "path\\to\\file", true }, +#else + { "rooted", "/usr/bin/false", false }, +#endif // Q_OS_WIN + { "subdir", "path/to/file", true }, + { "simple", "file.name", true }, + { "empty", "", true } + }; + + for (unsigned int i = sizeof(rows) / sizeof(rows[0]); i-- > 0; ) + QTest::newRow(rows[i].name) << QString::fromLatin1(rows[i].path) + << rows[i].relative; +} + +void tst_qmakelib::ioUtilRelativity() +{ + QFETCH(QString, path); + QFETCH(bool, relative); + + QCOMPARE(IoUtils::isRelativePath(path), relative); +} + +void tst_qmakelib::ioUtilResolve_data() +{ + QTest::addColumn("base"); + QTest::addColumn("path"); + QTest::addColumn("expect"); + + static const struct { + const char *name; + const char *base; + const char *path; + const char *expect; + } data[] = { +#ifdef Q_OS_WIN // all the complications: + { "drive-drive", "a:/ms/dir", "z:/root/file", "z:/root/file" }, + { "drive-drive-bs", "a:\\ms\\dir", "z:\\root\\file", "z:/root/file" }, + { "drive-root", "a:/ms/dir", "/root/file", "a:/root/file" }, + { "drive-root-bs", "a:\\ms\\dir", "\\root\\file", "a:/root/file" }, + { "drive-sub", "a:/ms/dir", "sub/file", "a:/ms/dir/sub/file" }, + { "drive-sub-bs", "a:\\ms\\dir", "sub\\file", "a:/ms/dir/sub/file" }, + { "drive-rel", "a:/ms/dir", "file.txt", "a:/ms/dir/file.txt" }, + { "drive-rel-bs", "a:\\ms\\dir", "file.txt", "a:/ms/dir/file.txt" }, +#else + { "abs-abs", "/a/unix/dir", "/root/file", "/root/file" }, + { "abs-sub", "/a/unix/dir", "sub/file", "/a/unix/dir/sub/file" }, + { "abs-rel", "/a/unix/dir", "file.txt", "/a/unix/dir/file.txt" }, +#endif // Q_OS_WIN + }; + + for (unsigned i = sizeof(data) / sizeof(data[0]); i-- > 0; ) + QTest::newRow(data[i].name) << QString::fromLatin1(data[i].base) + << QString::fromLatin1(data[i].path) + << QString::fromLatin1(data[i].expect); +} + +void tst_qmakelib::ioUtilResolve() +{ + QFETCH(QString, base); + QFETCH(QString, path); + QFETCH(QString, expect); - QString fnbase = "/another/dir"; - QCOMPARE(IoUtils::resolvePath(fnbase, fn0), QStringLiteral("/another/dir/file/path")); - QCOMPARE(IoUtils::resolvePath(fnbase, fn1), QStringLiteral("/a/unix/file/path")); + QCOMPARE(IoUtils::resolvePath(base, path), expect); } void QMakeTestHandler::print(const QString &fileName, int lineNo, int type, const QString &msg) diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.h b/tests/auto/tools/qmakelib/tst_qmakelib.h index e75dedb7ec..acfeb43ecd 100644 --- a/tests/auto/tools/qmakelib/tst_qmakelib.h +++ b/tests/auto/tools/qmakelib/tst_qmakelib.h @@ -48,7 +48,12 @@ private slots: void quoteArgUnix(); void quoteArgWin_data(); void quoteArgWin(); + void pathUtils(); + void ioUtilRelativity_data(); + void ioUtilRelativity(); + void ioUtilResolve_data(); + void ioUtilResolve(); void proString(); void proStringList(); -- cgit v1.2.3 From b772d9cbd786a2180f8ead923a04b537c8904ddd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 15 Jan 2018 12:02:16 +0100 Subject: fix example source installation of qrc/rc files in subdirs such a project structure violates the assumption that the referenced resources are specified relative to the sub-project root, so we must resolve them to absolute paths manually. Task-number: QTBUG-65753 Change-Id: I8bcd5c6e7d7c6a713e5fcd3668be7d2f23169501 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_example_installs.prf | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 668669e4cd..c9ce926b1a 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -44,19 +44,25 @@ contains(TEMPLATE, .*app): \ for(ex, EXAMPLE_FILES): \ sourcefiles += $$files($$absolute_path($$ex, $$_PRO_FILE_PWD_)) for(res, RESOURCES) { - rfile = $$cat($$absolute_path($$res, $$_PRO_FILE_PWD_), lines) - for(rline, rfile) { + !contains(res, \\.qrc$): \ + next() + rfile = $$absolute_path($$res, $$_PRO_FILE_PWD_) + rpath = $$dirname(rfile) + rcont = $$cat($$rfile, lines) + for (rline, rcont) { resrc = $$replace(rline, ^[ \\t]*]*>([^<]+)[ \\t]*$, \\1) !equals(resrc, $$rline): \ - sourcefiles += $$resrc + sourcefiles += $$absolute_path($$resrc, $$rpath) } } for(res, RC_FILE) { - rfile = $$cat($$absolute_path($$res, $$_PRO_FILE_PWD_), lines) - for(rline, rfile) { + rfile = $$absolute_path($$res, $$_PRO_FILE_PWD_) + rpath = $$dirname(rfile) + rcont = $$cat($$rfile, lines) + for (rline, rcont) { resrc = $$replace(rline, "^\\d+\\s+ICON\\s+[^\"]*\"([^\"]+)\"\$", \\1) !equals(resrc, $$rline): \ - sourcefiles += $$resrc + sourcefiles += $$absolute_path($$resrc, $$rpath) } } sourcefiles += \ -- cgit v1.2.3 From f6f6958a3e71230d4f2ef4db54d8d7fa010fa58b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 17 Jan 2018 14:44:32 +0100 Subject: configure: inline D3D11_QUERY_DATA_TIMESTAMP_DISJOINT test amends a96656a8fb. Change-Id: Ic434c272bfe985ea0410090537b8a22aad3192f1 Reviewed-by: Thiago Macieira --- .../win/angle_d3d11_qdtd/angle_d3d11_qdtd.cpp | 47 ---------------------- .../win/angle_d3d11_qdtd/angle_d3d11_qdtd.pro | 3 -- src/gui/configure.json | 8 +++- 3 files changed, 7 insertions(+), 51 deletions(-) delete mode 100644 config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.cpp delete mode 100644 config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.pro diff --git a/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.cpp b/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.cpp deleted file mode 100644 index 2dde2914a2..0000000000 --- a/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int, char**) -{ - D3D11_QUERY_DATA_TIMESTAMP_DISJOINT qdtd; - (void)qdtd; - return 0; -} diff --git a/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.pro b/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.pro deleted file mode 100644 index f1e530ab6e..0000000000 --- a/config.tests/win/angle_d3d11_qdtd/angle_d3d11_qdtd.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = angle_d3d11_qdtd.cpp -CONFIG -= qt -CONFIG += console diff --git a/src/gui/configure.json b/src/gui/configure.json index 1252dc507c..f7377eb903 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -595,7 +595,13 @@ "angle_d3d11_qdtd": { "label": "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT", "type": "compile", - "test": "win/angle_d3d11_qdtd" + "test": { + "include": "d3d11.h", + "main": [ + "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT qdtd;", + "(void) qdtd;" + ] + } }, "directwrite2": { "label": "DirectWrite 2", -- cgit v1.2.3 From 016ab238b66d84a58b665782d25daaffdf1708bd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Dec 2017 11:59:30 +0100 Subject: configure: express dependency of fontconfig on freetype more clearly use a "use" entry instead of including the transitive dep into the list of libraries. this also removes the redundant check of freetype features from the fontconfig test code. Change-Id: I86b78028255c9bf0a62be5ec0f97a62ef3fda36f Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- src/gui/configure.json | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index f7377eb903..1e4e56422f 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -164,25 +164,20 @@ "label": "Fontconfig", "test": { "head": [ - "#include ", - "#include FT_FREETYPE_H", "#include ", "#ifndef FC_RGBA_UNKNOWN", "# error This version of fontconfig is tool old, it is missing the FC_RGBA_UNKNOWN define", - "#endif", - "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20110)", - "# error This version of freetype is too old.", "#endif" ], "main": [ - "FT_Face face = 0;", "FcPattern *pattern = 0;" ] }, "sources": [ - { "type": "pkgConfig", "args": "fontconfig freetype2" }, - { "type": "freetype", "libs": "-lfontconfig -lfreetype" } - ] + { "type": "pkgConfig", "args": "fontconfig" }, + { "type": "freetype", "libs": "-lfontconfig" } + ], + "use": "freetype" }, "gbm": { "label": "GBM", -- cgit v1.2.3 From f9b8ea4b0eaea94a6d724a0955b13fd8a97d96e3 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 6 Dec 2016 13:44:00 +0100 Subject: Fix QMacTimeZonePrivate::previousTransition() for early after epoch The native APIs don't support previous transition, only next after a stipulated date. The prior code started its search at the epoch; if used for a time before the first transition after the epoch, this found no transitions so returned invalid data, when the last transition before the epoch would have been suitable. It also wound through all transitions since the epoch, on its way to the selected time, which was potentially laborious. Instead, start a year before the stipulated time; this should get a transition if the zone uses DST. If it doesn't, start with the first known transition and binary-chop our way to one within a year of the last before the stipulated time; then wind forward one transition at a time, as before. The chopping is actually faster than binary: each time we find a transition after the interval mid-point but early enough, we move the early end of our interval to the transition, which is later than the old interval's middle. Using halving, starting with a vast interval, should thus only incur modest cost, while ensuring we give up early when no transition data is available at all or the zone's first transition ever was after the stipulated time. Task-number: QTBUG-65443 Change-Id: I96c14540fc2600837e6a22e480fb8dc36cb37220 (cherry picked from commit 7c0b706488b0edcc2fd6db7870db700ff0548f21) (cherry picked from commit a090076e93487f8e461d9b866b9da1c0c21cb59b) Reviewed-by: Andy Shaw Reviewed-by: Jason Dolan --- src/corelib/tools/qtimezoneprivate_mac.mm | 88 ++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 18 deletions(-) diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index 4e9a432fbf..fa0dd87cfc 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -226,27 +226,79 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { - // No direct Mac API, so get all transitions since epoch and return the last one - QList secsList; - if (beforeMSecsSinceEpoch > 0) { - const int endSecs = beforeMSecsSinceEpoch / 1000.0; - NSTimeInterval prevSecs = 0; - NSTimeInterval nextSecs = 0; - NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs]; - // If invalid may return a nil date or an Epoch date + // The native API only lets us search forward, so we need to find an early-enough start: + const NSTimeInterval lowerBound = std::numeric_limits::min(); + const qint64 endSecs = beforeMSecsSinceEpoch / 1000; + const int year = 366 * 24 * 3600; // a (long) year, in seconds + NSTimeInterval prevSecs = endSecs; // sentinel for later check + NSTimeInterval nextSecs = prevSecs - year; + NSTimeInterval tranSecs = lowerBound; // time at a transition; may be > endSecs + + NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs]; + nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + if (nextDate != nil + && (tranSecs = [nextDate timeIntervalSince1970]) < endSecs) { + // There's a transition within the last year before endSecs: + nextSecs = tranSecs; + } else { + // Need to start our search earlier: + nextDate = [NSDate dateWithTimeIntervalSince1970:lowerBound]; nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; - nextSecs = [nextDate timeIntervalSince1970]; - while (nextDate != nil && nextSecs > prevSecs && nextSecs < endSecs) { - secsList.append(nextSecs); - prevSecs = nextSecs; - nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + if (nextDate != nil) { + NSTimeInterval lateSecs = nextSecs; nextSecs = [nextDate timeIntervalSince1970]; - } + Q_ASSERT(nextSecs <= endSecs - year || nextSecs == tranSecs); + /* + We're looking at the first ever transition for our zone, at + nextSecs (and our zone *does* have at least one transition). If + it's later than endSecs - year, then we must have found it on the + initial check and therefore set tranSecs to the same transition + time (which, we can infer here, is >= endSecs). In this case, we + won't enter the binary-chop loop, below. + + In the loop, nextSecs < lateSecs < endSecs: we have a transition + at nextSecs and there is no transition between lateSecs and + endSecs. The loop narrows the interval between nextSecs and + lateSecs by looking for a transition after their mid-point; if it + finds one < endSecs, nextSecs moves to this transition; otherwise, + lateSecs moves to the mid-point. This soon enough narrows the gap + to within a year, after which walking forward one transition at a + time (the "Wind through" loop, below) is good enough. + */ + + // Binary chop to within a year of last transition before endSecs: + while (nextSecs + year < lateSecs) { + // Careful about overflow, not fussy about rounding errors: + NSTimeInterval middle = nextSecs / 2 + lateSecs / 2; + NSDate *split = [NSDate dateWithTimeIntervalSince1970:middle]; + split = [m_nstz nextDaylightSavingTimeTransitionAfterDate:split]; + if (split != nil + && (tranSecs = [split timeIntervalSince1970]) < endSecs) { + nextDate = split; + nextSecs = tranSecs; + } else { + lateSecs = middle; + } + } + Q_ASSERT(nextDate != nil); + // ... and nextSecs < endSecs unless first transition ever was >= endSecs. + } // else: we have no data - prevSecs is still endSecs, nextDate is still nil } - if (secsList.size() >= 1) - return data(qint64(secsList.constLast()) * 1000); - else - return invalidData(); + // Either nextDate is nil or nextSecs is at its transition. + + // Wind through remaining transitions (spanning at most a year), one at a time: + while (nextDate != nil && nextSecs < endSecs) { + prevSecs = nextSecs; + nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + nextSecs = [nextDate timeIntervalSince1970]; + if (nextSecs <= prevSecs) // presumably no later data available + break; + } + if (prevSecs < endSecs) // i.e. we did make it into that while loop + return data(qint64(prevSecs * 1e3)); + + // No transition data; or first transition later than requested time. + return invalidData(); } QByteArray QMacTimeZonePrivate::systemTimeZoneId() const -- cgit v1.2.3 From 957c1d9abd854a3b5c43ace807ab7cbf89c91491 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 28 Jul 2017 13:25:41 +0200 Subject: Use a proper test for absolute path for qmake's location QFileInfo.isRelative() deems any path starting with a slash to be absolute; on MS-Win, such paths need a drive specifier (unless they're UNC), so use IoUtils's more robust test for absolute paths. Change-Id: I7d0872a87833cbf1cc1a6ef107941adc4c529624 Reviewed-by: Oswald Buddenhagen --- qmake/option.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 4da2a1ae2c..8e457a2626 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -28,6 +28,7 @@ #include "option.h" #include "cachekeys.h" +#include #include #include #include @@ -38,6 +39,8 @@ QT_BEGIN_NAMESPACE +using namespace QMakeInternal; + EvalHandler Option::evalHandler; QMakeGlobals *Option::globals; ProFileCache *Option::proFileCache; @@ -325,7 +328,7 @@ Option::init(int argc, char **argv) #endif if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) Option::qmake_mode = default_mode(argv0); - if(!argv0.isEmpty() && !QFileInfo(argv0).isRelative()) { + if (!argv0.isEmpty() && IoUtils::isAbsolutePath(argv0)) { globals->qmake_abslocation = argv0; } else if (argv0.contains(QLatin1Char('/')) #ifdef Q_OS_WIN -- cgit v1.2.3 From 13f6eb9773c0a4c64da7070be4ac3bbf66f8c82d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 10 Jan 2018 16:29:17 +0100 Subject: Doc: Mention exact Qt version the third party attributions apply to MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do add, remove or update third party code in minor releases, sometimes even in patch level releases. However, the documentation is supposed to be valid for all existing Qt 5 versions, but doing this for attributions would require infrastructure we don't have. Therefore rather make it explicit which Qt version the attributions apply to. Also mention since when Qt is available under LGPLv3 (starting with Qt 5.4). Task-number: QTBUG-65665 Change-Id: I328b5bf0c143f78ea61aad51f0644c3cbb6dee49 Reviewed-by: Edward Welbourne Reviewed-by: Topi Reiniö --- doc/global/macros.qdocconf | 1 + src/corelib/doc/src/qtcore-index.qdoc | 7 ++++--- src/gui/doc/src/qtgui.qdoc | 5 +++-- src/sql/doc/src/qtsql.qdoc | 5 +++-- src/testlib/doc/src/qttest-index.qdoc | 5 +++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf index 5544da425a..dbf8c5cc6a 100644 --- a/doc/global/macros.qdocconf +++ b/doc/global/macros.qdocconf @@ -18,6 +18,7 @@ macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" macro.QQV = "\\e{Qt QML Viewer}" +macro.QtVersion = "$QT_VERSION" macro.param = "\\e" macro.raisedaster.HTML = "*" macro.rarrow.HTML = "→" diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index 9004c018ed..04af0e9416 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -104,17 +104,18 @@ \section1 Licenses and Attributions Qt Core is available under commercial licenses from \l{The Qt Company}. - In addition, it is available under the + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are \l{GNU Lesser General Public License, version 3}, or the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. Executables on Windows potentially link against \l{The qtmain Library}. This library is available - under commercial licenses, and in addition under the + under commercial licenses and also under the \l{BSD 3-clause "New" or "Revised" License}. - Furthermore Qt Core potentially contains third party + Furthermore, Qt Core in Qt \QtVersion may contain third party modules under following permissive licenses: \generatelist{groupsbymodule attributions-qtcore} diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index a9fe520d5e..9a486569c9 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -190,12 +190,13 @@ \section1 Licenses and Attributions Qt GUI is available under commercial licenses from \l{The Qt Company}. - In addition, it is available under the + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are \l{GNU Lesser General Public License, version 3}, or the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. - Furthermore Qt GUI potentially contains third party + Furthermore, Qt GUI in Qt \QtVersion may contain third-party modules under following permissive licenses: \generatelist{groupsbymodule attributions-qtgui} diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc index 56d714becf..f0d74739b0 100644 --- a/src/sql/doc/src/qtsql.qdoc +++ b/src/sql/doc/src/qtsql.qdoc @@ -54,12 +54,13 @@ \section1 Licenses and Attributions Qt SQL is available under commercial licenses from \l{The Qt Company}. - In addition, it is available under the + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are \l{GNU Lesser General Public License, version 3}, or the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. - Furthermore Qt SQL potentially contains third party + Furthermore, Qt SQL in Qt \QtVersion may contain third party modules under following permissive licenses: \generatelist{groupsbymodule attributions-qtsql} diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc index 36ebfee463..f5b077e8e8 100644 --- a/src/testlib/doc/src/qttest-index.qdoc +++ b/src/testlib/doc/src/qttest-index.qdoc @@ -53,12 +53,13 @@ \section1 Licenses and Attributions Qt Test is available under commercial licenses from \l{The Qt Company}. - In addition, it is available under the + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are \l{GNU Lesser General Public License, version 3}, or the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. - Furthermore Qt Test potentially contains third party + Furthermore, Qt Test in Qt \QtVersion may contain third party modules under following permissive licenses: \generatelist{groupsbymodule attributions-qttestlib} -- cgit v1.2.3 From dc742e9394c2796acce1317af7bb9fc304f820a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Thu, 18 Jan 2018 13:16:44 +0200 Subject: Enable glyph cache workaround for Mali-T880 Change-Id: I531e57c26e886cd8de09ca860d7e10b05d1a724b Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index ad5e0b518d..620f7f74c8 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1002,6 +1002,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (rendererString) needsWorkaround = qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 + || qstrcmp(rendererString, "Mali-T880") == 0 || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 -- cgit v1.2.3 From e211ab76d766878b4dbe88901b9a7a4a70ce7332 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Thu, 18 Jan 2018 18:43:25 +0100 Subject: Handle OOM condition in the validation of plugin metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A large plugin dll (e.g., one with many MB of debug info) could cause a 32-bit application to crash when the entire dll file could not fit within the address space of the process. The code for validating a plugin library and retrieving metadata from it first tried to map the entire file in memory, which failed for large files, returning NULL. In this case, the code tried then to read the entire file via QFile::readAll(), which deep below caused a bad_alloc exception in malloc, resulting in the termination of the application. This change handles the case where the library could not be mapped into memory, in spite of memory mapping being supported, by reporting the error and returning false, making the plugin unavailable. [ChangeLog][QtCore][QPluginLoader] Fixed a bug that would cause the Qt plugin scanning system to allocate too much memory and possibly crash the process. Task-number: QTBUG-65197 Change-Id: I8c7235d86175c9fcd2b87fcb1151570da9b9ebe3 Reviewed-by: Jan Arve Sæther --- src/corelib/plugin/qlibrary.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index ebad7f1751..9e6e70756f 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -237,21 +237,34 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) if (lib) lib->errorString = file.errorString(); if (qt_debug_component()) { - qWarning("%s: %s", (const char*) QFile::encodeName(library), + qWarning("%s: %s", QFile::encodeName(library).constData(), qPrintable(QSystemError::stdString())); } return false; } QByteArray data; - const char *filedata = 0; ulong fdlen = file.size(); - filedata = (char *) file.map(0, fdlen); + const char *filedata = reinterpret_cast(file.map(0, fdlen)); + if (filedata == 0) { - // try reading the data into memory instead - data = file.readAll(); - filedata = data.constData(); - fdlen = data.size(); + if (uchar *mapdata = file.map(0, 1)) { + file.unmap(mapdata); + // Mapping is supported, but failed for the entire file, likely due to OOM. + // Return false, as readAll() would cause a bad_alloc and terminate the process. + if (lib) + lib->errorString = QLibrary::tr("Out of memory while loading plugin '%1'.").arg(library); + if (qt_debug_component()) { + qWarning("%s: %s", QFile::encodeName(library).constData(), + qPrintable(QSystemError::stdString(ENOMEM))); + } + return false; + } else { + // Try reading the data into memory instead. + data = file.readAll(); + filedata = data.constData(); + fdlen = data.size(); + } } /* @@ -745,7 +758,7 @@ void QLibraryPrivate::updatePluginState() if (qt_debug_component()) { qWarning("In %s:\n" " Plugin uses incompatible Qt library (%d.%d.%d) [%s]", - (const char*) QFile::encodeName(fileName), + QFile::encodeName(fileName).constData(), (qt_version&0xff0000) >> 16, (qt_version&0xff00) >> 8, qt_version&0xff, debug ? "debug" : "release"); } -- cgit v1.2.3 From 6d50f746fe05a7008b63818e77784dd0c99270a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= Date: Fri, 2 Jun 2017 12:53:23 +0300 Subject: Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flags The Embedded Android build (Boot to Qt Android injection) is defined by having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined, as well as having Qt config android-embedded. This commit enables the possibility to build embedded Android builds. (i.e. Qt build for Android baselayer only, without JNI) Change-Id: I8406e959fdf1c8d9efebbbe53f1a391fa25f336a Reviewed-by: Oswald Buddenhagen Reviewed-by: Paul Olav Tvete --- mkspecs/features/android/android_deployment_settings.prf | 2 +- src/corelib/global/qglobal.cpp | 12 ++++++------ src/corelib/global/qlogging.cpp | 4 ++-- src/corelib/global/qoperatingsystemversion.cpp | 4 ++-- src/corelib/io/io.pri | 2 +- src/corelib/kernel/kernel.pri | 2 +- src/corelib/kernel/qcoreapplication.cpp | 6 +++--- src/corelib/tools/qsimd_p.h | 2 +- src/corelib/tools/qtimezone.cpp | 8 ++++---- src/corelib/tools/qtimezoneprivate_p.h | 6 +++--- src/corelib/tools/tools.pri | 2 +- src/gui/kernel/qguiapplication.cpp | 4 ++-- src/network/ssl/qsslsocket_openssl.cpp | 2 ++ src/network/ssl/qsslsocket_p.h | 2 +- src/network/ssl/ssl.pri | 2 +- src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 4 ++-- src/plugins/bearer/bearer.pro | 2 +- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 2 +- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 6 +++--- src/plugins/platforms/platforms.pro | 2 +- src/src.pro | 8 +++++--- tests/auto/corelib/io/qdatastream/qdatastream.pro | 2 +- tests/auto/corelib/io/qdir/qdir.pro | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 6 +++--- tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp | 2 +- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 4 ++-- .../corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 2 +- tests/auto/corelib/io/qiodevice/qiodevice.pro | 2 +- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 2 +- tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 2 +- tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro | 2 +- tests/auto/corelib/io/qresourceengine/qresourceengine.pro | 2 +- .../auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 6 +++--- tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 2 +- tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro | 2 +- tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 8 ++++---- tests/auto/corelib/kernel/qtranslator/qtranslator.pro | 2 +- tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp | 2 +- tests/auto/corelib/tools/qbytearray/qbytearray.pro | 2 +- tests/auto/corelib/tools/qchar/qchar.pro | 2 +- tests/auto/corelib/tools/qcollator/tst_qcollator.cpp | 2 +- .../tools/qcommandlineparser/tst_qcommandlineparser.cpp | 6 +++--- .../corelib/tools/qcryptographichash/qcryptographichash.pro | 2 +- .../tools/qtextboundaryfinder/qtextboundaryfinder.pro | 2 +- tests/auto/gui/image/qimage/qimage.pro | 2 +- tests/auto/gui/image/qimagereader/qimagereader.pro | 2 +- tests/auto/gui/image/qimagewriter/qimagewriter.pro | 2 +- tests/auto/gui/painting/qpainter/qpainter.pro | 2 +- .../tst_qprocess_and_guieventloop.cpp | 2 +- tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp | 2 +- .../graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp | 6 +++--- tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro | 2 +- tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 4 ++-- tests/auto/widgets/kernel/qlayout/qlayout.pro | 2 +- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 2 +- tests/auto/widgets/styles/qstyle/qstyle.pro | 2 +- 56 files changed, 92 insertions(+), 88 deletions(-) diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf index 913ab71412..e6b2431f9a 100644 --- a/mkspecs/features/android/android_deployment_settings.prf +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -1,4 +1,4 @@ -contains(TEMPLATE, ".*app"):!build_pass: { +contains(TEMPLATE, ".*app"):!build_pass:!android-embedded { defineReplace(emitString) { return("\"$$replace(1, \\\\, \\\\)\"") diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d609f6a30a..ea2c8d3ae2 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -81,7 +81,7 @@ # include #endif -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #include #endif @@ -2312,7 +2312,7 @@ static bool findUnixOsVersion(QUnixOSVersion &v) # endif // USE_ETC_OS_RELEASE #endif // Q_OS_UNIX -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) static const char *osVer_helper(QOperatingSystemVersion) { /* Data: @@ -2793,7 +2793,7 @@ QString QSysInfo::productVersion() */ QString QSysInfo::prettyProductName() { -#if defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN) +#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN) const auto version = QOperatingSystemVersion::current(); const char *name = osVer_helper(version); if (name) @@ -3349,7 +3349,7 @@ bool qunsetenv(const char *varName) #endif } -#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21) typedef QThreadStorage AndroidRandomStorage; Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) @@ -3383,7 +3383,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value */ void qsrand(uint seed) { -#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod("setSeed", "(J)V", jlong(seed)); return; @@ -3437,7 +3437,7 @@ void qsrand(uint seed) */ int qrand() { -#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 1307118bdf..f99675a7b9 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1546,7 +1546,7 @@ static void syslog_default_message_handler(QtMsgType type, const char *message) } #endif -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) static void android_default_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message) @@ -1594,7 +1594,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con #elif QT_CONFIG(syslog) syslog_default_message_handler(type, logMessage.toUtf8().constData()); return; -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) android_default_message_handler(type, context, logMessage); return; #endif diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 594dc6bc17..3210a0a125 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -44,7 +44,7 @@ #include -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #include #endif @@ -160,7 +160,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current() { QOperatingSystemVersion version; version.m_os = currentType(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #ifndef QT_BOOTSTRAPPED const QVersionNumber v = QVersionNumber::fromString(QJNIObjectPrivate::getStaticObjectField( "android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString()); diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index d24c290508..b2c531a8ad 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -167,7 +167,7 @@ win32 { } else { LIBS += -framework MobileCoreServices } - } else:android { + } else:android:!android-embedded { SOURCES += \ io/qstandardpaths_android.cpp \ io/qstorageinfo_unix.cpp diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 9bc6e198f8..66f1294d53 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -199,7 +199,7 @@ qnx:qtConfig(qqnx_pps) { kernel/qppsobjectprivate_p.h } -android { +android:!android-embedded { SOURCES += \ kernel/qjnionload.cpp \ kernel/qjnihelpers.cpp \ diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index ee269ef8de..12c2669f36 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -95,7 +95,7 @@ #endif #endif // QT_NO_QOBJECT -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) # include # include #endif @@ -180,7 +180,7 @@ QString QCoreApplicationPrivate::appVersion() const #ifndef QT_BOOTSTRAPPED # ifdef Q_OS_DARWIN applicationVersion = infoDictionaryStringProperty(QStringLiteral("CFBundleVersion")); -# elif defined(Q_OS_ANDROID) +# elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QJNIObjectPrivate context(QtAndroidPrivate::context()); if (context.isValid()) { QJNIObjectPrivate pm = context.callObjectMethod( @@ -2189,7 +2189,7 @@ QString QCoreApplication::applicationFilePath() } #endif #if defined( Q_OS_UNIX ) -# if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) +# if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)) // Try looking for a /proc//exe symlink first which points to // the absolute path of the executable QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid())); diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 05f118a9eb..36c0a9097b 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -198,7 +198,7 @@ // SSE intrinsics #if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) -#if defined(QT_LINUXBASE) +#if defined(QT_LINUXBASE) || defined(Q_OS_ANDROID_EMBEDDED) /// this is an evil hack - the posix_memalign declaration in LSB /// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431 # define posix_memalign _lsb_hack_posix_memalign diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index c4cd76c59c..567c819813 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -62,9 +62,9 @@ static QTimeZonePrivate *newBackendTimeZone() #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(); -#elif defined Q_OS_ANDROID +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) return new QAndroidTimeZonePrivate(); -#elif defined Q_OS_UNIX +#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED) return new QTzTimeZonePrivate(); // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN @@ -89,9 +89,9 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId) #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(ianaId); -#elif defined Q_OS_ANDROID +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) return new QAndroidTimeZonePrivate(ianaId); -#elif defined Q_OS_UNIX +#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED) return new QTzTimeZonePrivate(ianaId); // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 74b79dce16..83e06ffcb0 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -68,7 +68,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone); #include #endif // Q_OS_WIN -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #include #endif @@ -266,7 +266,7 @@ private: }; #endif -#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)) struct QTzTransitionTime { qint64 atMSecsSinceEpoch; @@ -443,7 +443,7 @@ private: }; #endif // Q_OS_WIN -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) class QAndroidTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate { public: diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 7ba3ff4a8b..bea8e97435 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -158,7 +158,7 @@ qtConfig(timezone) { tools/qtimezoneprivate.cpp !nacl:darwin: \ SOURCES += tools/qtimezoneprivate_mac.mm - else: android: \ + else: android:!android-embedded: \ SOURCES += tools/qtimezoneprivate_android.cpp else: unix: \ SOURCES += tools/qtimezoneprivate_tz.cpp diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index cff11367f7..25818b456a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2040,7 +2040,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE QWindow *window = e->window.data(); modifier_buttons = e->modifiers; if (e->nullWindow() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) || e->key == Qt::Key_Back || e->key == Qt::Key_Menu #endif ) { @@ -2076,7 +2076,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE if (window && !window->d_func()->blockedByModalWindow) QGuiApplication::sendSpontaneousEvent(window, &ev); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) else ev.setAccepted(false); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index ab82cdcfc9..f5b493897e 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -727,12 +727,14 @@ QList QSslSocketPrivate::systemCaCertificates() directories << ministroPath; nameFilters << QLatin1String("*.der"); platformEncodingFormat = QSsl::Der; +# ifndef Q_OS_ANDROID_EMBEDDED if (ministroPath.isEmpty()) { QList certificateData = fetchSslCertificateData(); for (int i = 0; i < certificateData.size(); ++i) { systemCerts.append(QSslCertificate::fromData(certificateData.at(i), QSsl::Der)); } } else +# endif //Q_OS_ANDROID_EMBEDDED # endif //Q_OS_ANDROID { currentDir.setNameFilters(nameFilters); diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 827f27cff1..217d6be1dc 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -209,7 +209,7 @@ public: private: static bool ensureLibraryLoaded(); static void ensureCiphersAndCertsLoaded(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) static QList fetchSslCertificateData(); #endif diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 52ce2eeade..d2b0c2d60d 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -70,7 +70,7 @@ qtConfig(ssl) { darwin:SOURCES += ssl/qsslsocket_mac_shared.cpp - android: SOURCES += ssl/qsslsocket_openssl_android.cpp + android:!android-embedded: SOURCES += ssl/qsslsocket_openssl_android.cpp # Add optional SSL libs # Static linking of OpenSSL with msvc: diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 674ab29012..7a9a98573e 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -45,7 +45,7 @@ #include #include -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) #include #endif #ifndef Q_OS_WIN @@ -332,7 +332,7 @@ void QEGLPlatformContext::updateFormatFromGL() QByteArray version = QByteArray(reinterpret_cast(s)); int major, minor; if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) { -#ifdef Q_OS_ANDROID +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) // Some Android 4.2.2 devices report OpenGL ES 3.0 without the functions being available. static int apiLevel = QtAndroidPrivate::androidSdkVersion(); if (apiLevel <= 17 && major >= 3) { diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 824fd0388f..afdc613167 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -6,6 +6,6 @@ QT_FOR_CONFIG += network-private SUBDIRS += connman networkmanager } -android:SUBDIRS += android +android:!android-embedded: SUBDIRS += android isEmpty(SUBDIRS):SUBDIRS = generic diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 9b4732eab4..17e4aa1df8 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -117,7 +117,7 @@ void QEglFSWindow::create() QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); if (screen->primarySurface() != EGL_NO_SURFACE) { if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) { -#if !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED) // We can have either a single OpenGL window or multiple raster windows. // Other combinations cannot work. qFatal("EGLFS: OpenGL windows cannot be mixed with others."); diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 6f79cd96d3..f835dbf6d4 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -59,13 +59,13 @@ #include #endif -#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) #include #include #include #endif -#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(tslib) #include #endif @@ -162,7 +162,7 @@ void QLinuxFbIntegration::createInputHandlers() new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); #endif -#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); #if QT_CONFIG(tslib) diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 9ccc2b54b9..9414f01ef0 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs QT_FOR_CONFIG += gui-private -android: SUBDIRS += android +android:!android-embedded: SUBDIRS += android !android: SUBDIRS += minimal diff --git a/src/src.pro b/src/src.pro index 43fc06f2e5..3e32f7edb0 100644 --- a/src/src.pro +++ b/src/src.pro @@ -193,9 +193,11 @@ qtConfig(gui) { src_plugins.depends += src_gui src_platformsupport src_platformheaders src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers qtConfig(widgets) { - SUBDIRS += src_tools_uic src_widgets src_printsupport + SUBDIRS += src_tools_uic src_widgets + !android-embedded: SUBDIRS += src_printsupport TOOLS += src_tools_uic - src_plugins.depends += src_widgets src_printsupport + src_plugins.depends += src_widgets + !android-embedded: src_plugins.depends += src_printsupport src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers qtConfig(opengl) { SUBDIRS += src_opengl @@ -207,7 +209,7 @@ SUBDIRS += src_plugins nacl: SUBDIRS -= src_network src_testlib -android: SUBDIRS += src_android src_3rdparty_gradle +android:!android-embedded: SUBDIRS += src_android src_3rdparty_gradle TR_EXCLUDE = \ src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_tools_qlalr \ diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 291b3eb611..25f8b889a0 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,7 +5,7 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index 4870922312..2252e71cd8 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -8,6 +8,6 @@ TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 8dbac28183..9d47bb2884 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -228,13 +228,13 @@ private: Q_DECLARE_METATYPE(tst_QDir::UncHandling) tst_QDir::tst_QDir() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) : m_dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) #elif !defined(BUILTIN_TESTDATA) : m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath()) #endif { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString resourceSourcePath = QStringLiteral(":/android_testdata/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -2186,7 +2186,7 @@ void tst_QDir::equalityOperator_data() QString pathinroot(QDir::rootPath() + QLatin1String("assets/..")); #elif defined (Q_OS_WIN) QString pathinroot("c:/windows/.."); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString pathinroot("/system/.."); #elif defined(Q_OS_HAIKU) QString pathinroot("/boot/.."); diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 6450e9af7b..a55989aacd 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -118,7 +118,7 @@ private: void tst_QDirIterator::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString testdata_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); QString resourceSourcePath = QStringLiteral(":/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index efb261ce7e..38db4c7b63 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1200,7 +1200,7 @@ void tst_QFileInfo::fileTimes() QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue); #elif defined(Q_OS_QNX) QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) if (fileInfo.lastRead() <= beforeRead) QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue); #endif @@ -1664,7 +1664,7 @@ void tst_QFileInfo::isWritable() void tst_QFileInfo::isExecutable() { QString appPath = QCoreApplication::applicationDirPath(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) appPath += "/libtst_qfileinfo.so"; #else appPath += "/tst_qfileinfo"; diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 154c7ec5bf..b05a876a52 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -89,7 +89,7 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher() m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); #endif // QT_NO_FILESYSTEMWATCHER -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); #endif } diff --git a/tests/auto/corelib/io/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro index 945022a289..1c978953d6 100644 --- a/tests/auto/corelib/io/qiodevice/qiodevice.pro +++ b/tests/auto/corelib/io/qiodevice/qiodevice.pro @@ -6,7 +6,7 @@ SOURCES = tst_qiodevice.cpp TESTDATA += tst_qiodevice.cpp MOC_DIR=tmp -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index a76fd4703e..9e0b9c2329 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -66,7 +66,7 @@ private: void tst_QIODevice::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QVERIFY(QFileInfo(QStringLiteral("./tst_qiodevice.cpp")).exists() || QFile::copy(QStringLiteral(":/tst_qiodevice.cpp"), QStringLiteral("./tst_qiodevice.cpp"))); #endif diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index d2f345feb5..59196dc40b 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -72,7 +72,7 @@ public: void tst_QLockFile::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("This test requires deploying and running external console applications"); #elif !QT_CONFIG(process) QSKIP("This test requires QProcess support"); diff --git a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro index 287ab30993..ac976e9b9c 100644 --- a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro +++ b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro @@ -7,7 +7,7 @@ QT = core core-private testlib SOURCES += tst_qloggingregistry.cpp TESTDATA += qtlogging.ini -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index 658201e03a..f937d23fe2 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -18,6 +18,6 @@ TESTDATA += \ testqrc/* GENERATED_TESTDATA = $${runtime_resource.target} -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 7fdd00876f..ab1866fb2d 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -36,7 +36,7 @@ class tst_QResourceEngine: public QObject public: tst_QResourceEngine() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) : m_runtimeResourceRcc(QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/runtime_resource.rcc")).absoluteFilePath()) #else : m_runtimeResourceRcc(QFINDTESTDATA("runtime_resource.rcc")) @@ -64,7 +64,7 @@ private: void tst_QResourceEngine::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourcePath(QStringLiteral(":/android_testdata/")); QString dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); @@ -121,7 +121,7 @@ void tst_QResourceEngine::checkStructure_data() << QLatin1String("test") << QLatin1String("withoutslashes"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) rootContents.insert(1, QLatin1String("android_testdata")); #endif diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 4cb3bfe549..21936faca5 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -288,7 +288,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) const char nonWritableDir[] = "/data"; # else const char nonWritableDir[] = "/home"; diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index e17cb05cd8..11a5d58dc8 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,6 +5,6 @@ SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp RESOURCES += qtemporaryfile.qrc -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 64b61839c1..a4e7aa0316 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -99,7 +99,7 @@ void tst_QTemporaryFile::initTestCase() QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -323,7 +323,7 @@ void tst_QTemporaryFile::nonWritableCurrentDir() ChdirOnReturn cor(QDir::currentPath()); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent("/data"); #else QDir::setCurrent("/home"); @@ -492,7 +492,7 @@ void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) ChdirOnReturn cor(QDir::currentPath()); QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); # endif @@ -701,7 +701,7 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); #else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index e673278920..d8924c2d5f 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -4,6 +4,6 @@ QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -android: RESOURCES += android_testdata.qrc +android:!android-embedded: RESOURCES += android_testdata.qrc else: TESTDATA += dependencies_la.qm hellotr_la.qm msgfmt_from_po.qm diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 66971af7b4..e3eee6dbdd 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -64,7 +64,7 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index f59cdf3524..c2101b0611 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -10,7 +10,7 @@ mac { LIBS += -framework Foundation } -android { +android:!android-embedded { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 012e591298..70c1222988 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -5,7 +5,7 @@ SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index 35a9af05f6..480e723f44 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -187,7 +187,7 @@ void tst_QCollator::compare() QCollator collator(locale); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) if (collator.locale() != QLocale()) QSKIP("Posix implementation of collation only supports default locale"); #endif diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 10398f1a99..527e07593c 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -512,7 +512,7 @@ void tst_QCommandLineParser::testVersionOption() #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); #else -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -578,7 +578,7 @@ void tst_QCommandLineParser::testHelpOption() #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); #else -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -625,7 +625,7 @@ void tst_QCommandLineParser::testQuoteEscaping() { #if !QT_CONFIG(process) QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Deploying executable applications to file system on Android not supported."); #else QCoreApplication app(empty_argc, empty_argv); diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index 7fead5938b..8d3957a524 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -5,7 +5,7 @@ SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 8e0216b175..3c9f03842d 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,7 +5,7 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 39ce4e26cb..56618e0bfa 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -5,6 +5,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib qtConfig(c++11): CONFIG += c++11 -android: RESOURCES+=qimage.qrc +android:!android-embedded: RESOURCES += qimage.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 3d35bf59da..b06f56dddf 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,7 +5,7 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc -android { +android:!android-embedded { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 34adedd187..e63e57886c 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -3,5 +3,5 @@ TARGET = tst_qimagewriter QT += testlib SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp -android: RESOURCES+= qimagewriter.qrc +android:!android-embedded: RESOURCES += qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 0d3899ee92..9ccf8f20ba 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -9,7 +9,7 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 5842d58fab..b8d19c0c0d 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -40,7 +40,7 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Not supported on Android"); #else diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 78d0372ac0..3c189f92cc 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -84,7 +84,7 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) // temp and home is the same directory on Android testDir.mkdir(QStringLiteral("test")); QVERIFY(testDir.cd(QStringLiteral("test"))); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7615c5e821..2a77321bf8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2657,7 +2657,7 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test only works on platforms with resizable windows"); #endif @@ -2736,7 +2736,7 @@ protected: void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test fails on some Android devices (QTBUG-44430)"); #endif @@ -4009,7 +4009,7 @@ void tst_QGraphicsScene::polishItems2() void tst_QGraphicsScene::isActive() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Fails on Android (QTBUG-44430)"); #endif diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 3527b424c1..0429315d95 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -12,7 +12,7 @@ android { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 2044704e76..48d39bbb11 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -112,7 +112,7 @@ void tst_QDirModel::getSetCheck() void tst_QDirModel::initTestCase() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QString dataPath = SRCDIR; QString resourceSourcePath = QStringLiteral(":/android_testdata"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); @@ -614,7 +614,7 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QEXPECT_FAIL("", "QTBUG-43818", Continue); #else if (EmulationDetector::isRunningArmOnX86()) diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 8e0ea1bfdb..e768e19a26 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -6,7 +6,7 @@ QT += widgets widgets-private testlib testlib-private SOURCES += tst_qlayout.cpp TESTDATA += baseline/* -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index a55693bb6c..300a8878ba 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -337,7 +337,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QSKIP("Test does not work on platforms which default to showMaximized()"); #endif diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 0fb7499946..9ad0940245 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -3,7 +3,7 @@ TARGET = tst_qstyle QT += widgets testlib testlib-private SOURCES += tst_qstyle.cpp -android { +android:!android-embedded { RESOURCES += \ testdata.qrc } -- cgit v1.2.3 From d80b0eb12c477592b590b768e21dc26c137beadc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 9 Jan 2018 10:24:18 -0800 Subject: Doc: make a note about use of QStringLiteral with non-ASCII chars Both ICC and MSVC have bugs concatenating strings and that's despite the standard giving an example ([lex.string] table 9) that says that u"a" "b" is the same as u"ab" We can't change to preprocessor concatenation (u ## STR) because that fails when QStringLiteral is used with a macro instead of an actual string literal. Task-number: QTBUG-65479 Change-Id: I39332e0a867442d58082fffd1504a0a868c291ef Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c0a03e0011..aff384a257 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -10802,7 +10802,7 @@ QString QString::toHtmlEscaped() const This cost can be avoided by using QStringLiteral instead: \code - if (node.hasAttribute(QStringLiteral("http-contents-length"))) //... + if (node.hasAttribute(QStringLiteral(u"http-contents-length"))) //... \endcode In this case, QString's internal data will be generated at compile time; no @@ -10822,6 +10822,10 @@ QString QString::toHtmlEscaped() const if (attribute.name() == QLatin1String("http-contents-length")) //... \endcode + \note Some compilers have bugs encoding strings containing characters outside + the US-ASCII character set. Make sure you prefix your string with \c{u} in + those cases. It is optional otherwise. + \sa QByteArrayLiteral */ -- cgit v1.2.3 From 631f68c97280436b4d241865d9a1d33fc9444691 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 15 Jan 2018 13:34:28 -0800 Subject: QFusionStyle: Set alpha on color before creating pen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This affected PE_IndicatorCheckBox in some cases. Change-Id: I6f10dabd2ca4093f4c1bdaa2bd0ebf73c02e8d12 Task-number: QTBUG-65737 Reviewed-by: Friedemann Kleint Reviewed-by: Yulong Bai Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qfusionstyle.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 0b56c1e3a8..e6ad0fc898 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -798,16 +798,14 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, painter->setPen(QPen(checkMarkColor, 1)); painter->setBrush(gradient); painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding)); - - } else if (checkbox->state & (State_On)) { + } else if (checkbox->state & State_On) { qreal penWidth = QStyleHelper::dpiScaled(1.8); penWidth = qMax(penWidth , 0.18 * rect.height()); penWidth = qMin(penWidth , 0.30 * rect.height()); - QPen checkPen = QPen(checkMarkColor, penWidth); checkMarkColor.setAlpha(210); - painter->translate(-0.8, 0.5); - painter->setPen(checkPen); + painter->setPen(QPen(checkMarkColor, penWidth)); painter->setBrush(Qt::NoBrush); + painter->translate(-0.8, 0.5); // Draw checkmark QPainterPath path; -- cgit v1.2.3 From 0236e3ab94508b700a11ab83fab7bbd39ee651bf Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 15 Jan 2018 18:03:36 -0800 Subject: QStyleSheetsStyle: Avoid possible division by zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5a7588c07106227e2a8b5e1f180230ef5b0342d1 Task-number: QTBUG-65228 Reviewed-by: Friedemann Kleint Reviewed-by: Alexandru Croitor Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qstylesheetstyle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 8ff8ab65a6..f70313d49e 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3971,10 +3971,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q x += reverse ? -chunkWidth : chunkWidth; --chunkCount; }; - } else { + } else if (chunkWidth > 0) { + const int chunkCount = ceil(qreal(fillWidth)/chunkWidth); int x = reverse ? r.left() + r.width() - chunkWidth : r.x(); - for (int i = 0; i < ceil(qreal(fillWidth)/chunkWidth); ++i) { + for (int i = 0; i < chunkCount; ++i) { r.setRect(x, rect.y(), chunkWidth, rect.height()); r = m.mapRect(QRectF(r)).toRect(); subRule.drawRule(p, r); -- cgit v1.2.3 From a69a0e8254b79c62fad7372e8c14f66d440ad744 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 23 Jan 2018 10:21:49 +0100 Subject: glx: Avoid losing the stereo flag in QSurfaceFormat Task-number: QTBUG-59636 Change-Id: I38394009993e92ab9db853a1450687fc48e471f5 Reviewed-by: Andy Nichols --- src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index e2e573f0e1..fc1806f982 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -134,7 +134,11 @@ static void updateFormatFromContext(QSurfaceFormat &format) } format.setProfile(QSurfaceFormat::NoProfile); + const bool isStereo = format.testOption(QSurfaceFormat::StereoBuffers); format.setOptions(QSurfaceFormat::FormatOptions()); + // Restore flags that come from the VisualInfo/FBConfig. + if (isStereo) + format.setOption(QSurfaceFormat::StereoBuffers); if (format.renderableType() == QSurfaceFormat::OpenGL) { if (format.version() < qMakePair(3, 0)) { -- cgit v1.2.3 From 1d9547c9a4b58cadc1105521df27e40ff5945259 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 11 Jul 2017 09:07:51 +0200 Subject: Don't indefinitely wait for data if it was able to read some data Passing -1 to waitForReadyRead() may cause it to wait for some time but the data retrieved may be enough for processing. So if 0 is passed from read, indicating that there is potentially more to come, then it will do a waitForReadyRead() then for more data to come. Change-Id: I75f270d1f124ecc12b18512cc20fb11f7a88f02e Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/xml/sax/qxml.cpp | 14 +--- .../sax/qxmlinputsource/tst_qxmlinputsource.cpp | 84 ++++++++++++++++++++++ 2 files changed, 86 insertions(+), 12 deletions(-) diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index bc7d00483a..717a8c327d 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -1265,18 +1265,8 @@ void QXmlInputSource::fetchData() } else if (device->isOpen() || device->open(QIODevice::ReadOnly)) { rawData.resize(BufferSize); qint64 size = device->read(rawData.data(), BufferSize); - - if (size != -1) { - // We don't want to give fromRawData() less than four bytes if we can avoid it. - while (size < 4) { - if (!device->waitForReadyRead(-1)) - break; - int ret = device->read(rawData.data() + size, BufferSize - size); - if (ret <= 0) - break; - size += ret; - } - } + if (size == 0 && device->waitForReadyRead(-1)) + size = device->read(rawData.data(), BufferSize); rawData.resize(qMax(qint64(0), size)); } diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index c5e9a44398..752e39c23f 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -48,6 +48,7 @@ private slots: void reset() const; void resetSimplified() const; void waitForReadyIODevice() const; + void inputFromSlowDevice() const; }; /*! @@ -207,5 +208,88 @@ void tst_QXmlInputSource::waitForReadyIODevice() const QVERIFY(sv.success); } +// This class is used to emulate a case where less than 4 bytes are sent in +// a single packet to ensure it is still parsed correctly +class SlowIODevice : public QIODevice +{ +public: + SlowIODevice(const QString &expectedData, QObject *parent = 0) + : QIODevice(parent), currentPos(0), readyToSend(true) + { + stringData = expectedData.toUtf8(); + dataTimer = new QTimer(this); + connect(dataTimer, &QTimer::timeout, [=]() { + readyToSend = true; + emit readyRead(); + dataTimer->stop(); + }); + dataTimer->start(1000); + } + bool open(SlowIODevice::OpenMode) override + { + setOpenMode(ReadOnly); + return true; + } + bool isSequential() const override + { + return true; + } + qint64 bytesAvailable() const override + { + if (readyToSend && stringData.size() != currentPos) + return qMax(3, stringData.size() - currentPos); + return 0; + } + qint64 readData(char *data, qint64 maxSize) override + { + if (!readyToSend) + return 0; + const qint64 readSize = qMin(qMin((qint64)3, maxSize), (qint64)(stringData.size() - currentPos)); + if (readSize > 0) + memcpy(data, &stringData.constData()[currentPos], readSize); + currentPos += readSize; + readyToSend = false; + if (currentPos != stringData.size()) + dataTimer->start(1000); + return readSize; + } + qint64 writeData(const char *, qint64) override { return 0; } + bool waitForReadyRead(int msecs) override + { + // Delibrately wait a maximum of 10 seconds for the sake + // of the test, so it doesn't unduly hang + const int waitTime = qMax(10000, msecs); + QTime t; + t.start(); + while (t.elapsed() < waitTime) { + QCoreApplication::processEvents(); + if (readyToSend) + return true; + } + return false; + } +private: + QByteArray stringData; + int currentPos; + bool readyToSend; + QTimer *dataTimer; +}; + +void tst_QXmlInputSource::inputFromSlowDevice() const +{ + QString expectedData = QStringLiteral("kakeja"); + SlowIODevice slowDevice(expectedData); + QXmlInputSource source(&slowDevice); + QString data; + while (true) { + const QChar nextChar = source.next(); + if (nextChar == QXmlInputSource::EndOfDocument) + break; + else if (nextChar != QXmlInputSource::EndOfData) + data += nextChar; + } + QCOMPARE(data, expectedData); +} + QTEST_MAIN(tst_QXmlInputSource) #include "tst_qxmlinputsource.moc" -- cgit v1.2.3 From aaacae8fe7bb1ca4983cf95fcb8d38320bb21450 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 23 Jan 2018 09:36:45 +0100 Subject: Document what the QT qmake variable does in more detail Make it clearer what the variable actually does by mentioning that it makes its headers available for inclusion and causes it to be linked to the binary. Change-Id: I72821d4bceea7a92e91175ba6c5acc4c3377d7b7 Reviewed-by: Oswald Buddenhagen --- qmake/doc/src/qmake-manual.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 9db8a9af48..75a93fd996 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2279,6 +2279,9 @@ Specifies the \l{All Modules}{Qt modules} that are used by your project. For the value to add for each module, see the module documentation. + At the C++ implementation level, using a Qt module makes its headers + available for inclusion and causes it to be linked to the binary. + By default, \c QT contains \c core and \c gui, ensuring that standard GUI applications can be built without further configuration. -- cgit v1.2.3 From c4b596fb7902abfb9d53e7819612b9a83ac5a8d6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 22 Jan 2018 16:04:46 +0100 Subject: Document licenses for all Qt modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the example of the other modules and explicitly mention the valid licenses on each module landing page, optionally combining it with trademark information. Change-Id: I9f1fea0f002e0ab607da89a0cbfe7c53060582d7 Reviewed-by: Leena Miettinen Reviewed-by: Topi Reiniö --- src/concurrent/doc/src/qtconcurrent-index.qdoc | 11 ++++++++++- src/dbus/doc/src/qtdbus-index.qdoc | 11 ++++++++++- src/opengl/doc/src/qtopengl-index.qdoc | 17 +++++++++++++---- src/printsupport/doc/src/qtprintsupport-index.qdoc | 15 ++++++++++++++- src/widgets/doc/src/qtwidgets-index.qdoc | 11 ++++++++++- src/xml/doc/src/qtxml-index.qdoc | 11 ++++++++++- 6 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/concurrent/doc/src/qtconcurrent-index.qdoc b/src/concurrent/doc/src/qtconcurrent-index.qdoc index 836cde131c..3e4aa791f1 100644 --- a/src/concurrent/doc/src/qtconcurrent-index.qdoc +++ b/src/concurrent/doc/src/qtconcurrent-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -133,4 +133,13 @@ copy of the container when called. If you are using STL containers this copy operation might take some time, in this case we recommend specifying the begin and end iterators for the container instead. + + \section1 Licenses + + The Qt Concurrent module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. */ diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc index 080066cfa8..eed5e42731 100644 --- a/src/dbus/doc/src/qtdbus-index.qdoc +++ b/src/dbus/doc/src/qtdbus-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -200,6 +200,15 @@ Information about the messages will be written to the console the application was launched from. + \section1 Licenses + + The Qt D-Bus module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + \section1 Further Reading The following documents contain information about Qt's D-Bus integration diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc index 6ab888a14d..30b657f6db 100644 --- a/src/opengl/doc/src/qtopengl-index.qdoc +++ b/src/opengl/doc/src/qtopengl-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -41,9 +41,6 @@ platform, Microsoft Foundation Classes (MFC) under Windows, or Qt on both platforms. - \note OpenGL is a trademark of Silicon Graphics, Inc. in - the United States and other countries. - The Qt OpenGL module makes it easy to use OpenGL in Qt applications. It provides an OpenGL widget class that can be used just like any other Qt widget, except that it opens an OpenGL display buffer where @@ -68,4 +65,16 @@ The \l{Qt OpenGL C++ Classes} page gives an overview over the available classes in this module. + + \section1 Licenses and Trademarks + + The Qt OpenGL module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + OpenGL\reg is a trademark of Silicon Graphics, Inc. in + the United States and other countries. */ diff --git a/src/printsupport/doc/src/qtprintsupport-index.qdoc b/src/printsupport/doc/src/qtprintsupport-index.qdoc index 7ac448f66f..a8a0f0cb20 100644 --- a/src/printsupport/doc/src/qtprintsupport-index.qdoc +++ b/src/printsupport/doc/src/qtprintsupport-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -165,6 +165,19 @@ QTextEdit requires a QPrinter rather than a QPainter because it uses information about the configured page dimensions in order to insert page breaks at the most appropriate places in printed documents. + + \section1 Licenses and Trademarks + + The Qt Print Support module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Please note that Adobe\reg places restrictions on the use of its trademarks + (including logos) in conjunction with PDF; e.g. "Adobe PDF". Please refer + to \l{http://www.adobe.com}{www.adobe.com} for guidelines. */ /*! diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc index 9f9a25140b..31dd3dcf40 100644 --- a/src/widgets/doc/src/qtwidgets-index.qdoc +++ b/src/widgets/doc/src/qtwidgets-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -128,6 +128,15 @@ interfaces \image graphicsview-items.png + \section1 Licenses + + The Qt Widgets module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + \section1 Related Information \section2 Tutorials diff --git a/src/xml/doc/src/qtxml-index.qdoc b/src/xml/doc/src/qtxml-index.qdoc index eb35903756..91f2515d60 100644 --- a/src/xml/doc/src/qtxml-index.qdoc +++ b/src/xml/doc/src/qtxml-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -45,4 +45,13 @@ The \l{Qt XML C++ Classes} page gives an overview over the available classes in this module. + + \section1 Licenses + + The Qt XML module is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. */ -- cgit v1.2.3 From a5810375bff382b9a578b6b655125cb7714a2bc1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 20 Feb 2017 14:52:29 +0100 Subject: CoreText: Add Apple Symbols as a fallback to cover some symbols Since braille characters are not included in Apple Unicode MS, we extend the fallback to include Apple Symbols to cover those too. Task-number: QTBUG-63510 Change-Id: I3977f1f9b7370a9fe9cfde643c86518e006c050a Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 7397312820..722a53ac20 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -507,6 +507,23 @@ static QString familyNameFromPostScriptName(NSString *psName) } #endif +static void addExtraFallbacks(QStringList *fallbackList) +{ +#if defined(Q_OS_MACOS) + // Since we are only returning a list of default fonts for the current language, we do not + // cover all unicode completely. This was especially an issue for some of the common script + // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk + // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most + // of Unicode 2.1. + if (!fallbackList->contains(QStringLiteral("Arial Unicode MS"))) + fallbackList->append(QStringLiteral("Arial Unicode MS")); + // Since some symbols (specifically Braille) are not in Arial Unicode MS, we + // add Apple Symbols to cover those too. + if (!fallbackList->contains(QStringLiteral("Apple Symbols"))) + fallbackList->append(QStringLiteral("Apple Symbols")); +#endif +} + QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { Q_UNUSED(style); @@ -534,16 +551,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo fallbackList.append(QString::fromCFString(fallbackFamilyName)); } -#if defined(Q_OS_OSX) - // Since we are only returning a list of default fonts for the current language, we do not - // cover all unicode completely. This was especially an issue for some of the common script - // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk - // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most - // of Unicode 2.1. - if (!fallbackList.contains(QStringLiteral("Arial Unicode MS"))) - fallbackList.append(QStringLiteral("Arial Unicode MS")); -#endif - + addExtraFallbacks(&fallbackList); extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &); fallbackList = qt_sort_families_by_writing_system(script, fallbackList); @@ -584,14 +592,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo fallbackList.append(QLatin1String("Apple Color Emoji")); - // Since we are only returning a list of default fonts for the current language, we do not - // cover all unicode completely. This was especially an issue for some of the common script - // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk - // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most - // of Unicode 2.1. - if (!fallbackList.contains(QStringLiteral("Arial Unicode MS"))) - fallbackList.append(QStringLiteral("Arial Unicode MS")); - + addExtraFallbacks(&fallbackList); fallbackLists[styleLookupKey.arg(fallbackStyleHint)] = fallbackList; } #else -- cgit v1.2.3 From 965bcca6d4e22788721a9af906adfbd97af9af29 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 23 Mar 2017 17:49:16 +0100 Subject: Cocoa: Explicitly hide popup windows when the application is hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the application is hidden then Qt will hide the popup windows associated with it when it has lost the activation for the application. However, when it gets to this point it believes the popup windows to be hidden already due to the fact that the application itself is hidden. As a result, when the application is restored it causes a problem with the still visible popup window as it is taking the input events without responding to them. Therefore we need to explicitly hide the windows right before the application is hidden to ensure that they are actually hidden correctly. Task-number: QTBUG-58727 Change-Id: I4be1e1c0b1388d0c9ec872e7732185670998b7af Reviewed-by: Tor Arne Vestbø --- .../platforms/cocoa/qcocoaapplicationdelegate.mm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 35ac7182af..03148c769b 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -328,6 +328,24 @@ QT_END_NAMESPACE return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together. } +- (void)applicationWillHide:(NSNotification *)notification +{ + if (reflectionDelegate + && [reflectionDelegate respondsToSelector:@selector(applicationWillHide:)]) { + [reflectionDelegate applicationWillHide:notification]; + } + + // When the application is hidden Qt will hide the popup windows associated with + // it when it has lost the activation for the application. However, when it gets + // to this point it believes the popup windows to be hidden already due to the + // fact that the application itself is hidden, which will cause a problem when + // the application is made visible again. + const QWindowList topLevelWindows = QGuiApplication::topLevelWindows(); + for (QWindow *topLevelWindow : qAsConst(topLevelWindows)) { + if ((topLevelWindow->type() & Qt::Popup) == Qt::Popup && topLevelWindow->isVisible()) + topLevelWindow->hide(); + } +} - (void)applicationDidBecomeActive:(NSNotification *)notification { -- cgit v1.2.3 From a87b549edfb66b3c3bc14466455792aea6e80c84 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Wed, 17 Jan 2018 11:01:28 +0200 Subject: Fix compilation with -no-feature-regularexpression Change-Id: I4d213a266034d388af723337deeeb4cdd1f5cbdb Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowsdialoghelpers.cpp | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 6b978a38fe..bdae764025 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -65,7 +65,6 @@ #include #include #include -#include #include #include @@ -1153,12 +1152,32 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel } } +static bool isHexRange(const QString& s, int start, int end) +{ + for (;start < end; ++start) { + QChar ch = s.at(start); + if (!(ch.isDigit() + || (ch >= QLatin1Char('a') && ch <= QLatin1Char('f')) + || (ch >= QLatin1Char('A') && ch <= QLatin1Char('F')))) + return false; + } + return true; +} + static inline bool isClsid(const QString &s) { // detect "374DE290-123F-4565-9164-39C4925E467B". - static const QRegularExpression pattern(QLatin1String("\\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\z")); - Q_ASSERT(pattern.isValid()); - return pattern.match(s).hasMatch(); + const QChar dash(QLatin1Char('-')); + return s.size() == 36 + && isHexRange(s, 0, 8) + && s.at(8) == dash + && isHexRange(s, 9, 13) + && s.at(13) == dash + && isHexRange(s, 14, 18) + && s.at(18) == dash + && isHexRange(s, 19, 23) + && s.at(23) == dash + && isHexRange(s, 24, 36); } void QWindowsNativeFileDialogBase::selectFile(const QString &fileName) const -- cgit v1.2.3 From 342bb5b03a76d1428fafb8e1532d66e172bd1c0b Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Fri, 12 Jan 2018 16:29:00 +0200 Subject: Do a static_cast in bit-blasts that are UB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this, building Qt and Qt applications fails with GCC 8. The errors look like this: writing to an object of type ‘class QPointer’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Task-number: QTBUG-65691 Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira --- src/gui/painting/qmatrix.h | 4 ++-- src/gui/painting/qtransform.h | 6 +++--- src/gui/text/qtextengine_p.h | 8 ++++---- src/gui/text/qtextobject.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 15e0ab5be1..dafb746bc6 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -65,10 +65,10 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! QMatrix &operator=(QMatrix &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QMatrix)); return *this; } + { memcpy(static_cast(this), static_cast(&other), sizeof(QMatrix)); return *this; } QMatrix &operator=(const QMatrix &) Q_DECL_NOTHROW; // = default QMatrix(QMatrix &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QMatrix)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(QMatrix)); } QMatrix(const QMatrix &other) Q_DECL_NOTHROW; // = default #endif diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 06ae611861..efb0fd7e83 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -78,14 +78,14 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QTransform)); return *this; } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); return *this; } QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default QTransform(QTransform &&other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } QTransform(const QTransform &other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } #endif bool isAffine() const; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index f49e2638f5..58ddc7c06d 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -236,13 +236,13 @@ struct QGlyphLayout last = numGlyphs; if (first == 0 && last == numGlyphs && reinterpret_cast(offsets + numGlyphs) == reinterpret_cast(glyphs)) { - memset(offsets, 0, (numGlyphs * SpaceNeeded)); + memset(static_cast(offsets), 0, (numGlyphs * SpaceNeeded)); } else { const int num = last - first; - memset(offsets + first, 0, num * sizeof(QFixedPoint)); + memset(static_cast(offsets + first), 0, num * sizeof(QFixedPoint)); memset(glyphs + first, 0, num * sizeof(glyph_t)); - memset(advances + first, 0, num * sizeof(QFixed)); - memset(justifications + first, 0, num * sizeof(QGlyphJustification)); + memset(static_cast(advances + first), 0, num * sizeof(QFixed)); + memset(static_cast(justifications + first), 0, num * sizeof(QGlyphJustification)); memset(attributes + first, 0, num * sizeof(QGlyphAttributes)); } } diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index a5030de112..4cc2535b58 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -154,9 +154,9 @@ public: iterator(const iterator &o) Q_DECL_NOTHROW; // = default iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default iterator(iterator &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(iterator)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); } iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(iterator)); return *this; } + { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); return *this; } #endif QTextFrame *parentFrame() const { return f; } -- cgit v1.2.3 From b0310ddd163847beabf7da66c2190d0b9b5e6afb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 26 Jan 2018 09:46:24 +0100 Subject: hellogles3 example: Fix start-up crash when using dynamic GL Move the instantiation of QGuiApplication to the top since it is required by QOpenGLContext::openGLModuleType(). Task-number: QTBUG-55671 Change-Id: I506cee193fe2ba48400851588a8ef079848bc2f4 Reviewed-by: Laszlo Agocs --- examples/opengl/hellogles3/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/opengl/hellogles3/main.cpp b/examples/opengl/hellogles3/main.cpp index a6c6398628..29b3b9617a 100644 --- a/examples/opengl/hellogles3/main.cpp +++ b/examples/opengl/hellogles3/main.cpp @@ -64,6 +64,8 @@ int main(int argc, char *argv[]) { + QGuiApplication app(argc, argv); + QSurfaceFormat fmt; fmt.setDepthBufferSize(24); @@ -79,8 +81,6 @@ int main(int argc, char *argv[]) QSurfaceFormat::setDefaultFormat(fmt); - QGuiApplication app(argc, argv); - GLWindow glWindow; glWindow.showMaximized(); -- cgit v1.2.3 From f5b1b10a1120ce5f9ffb43cc05fe4a0e39f43e36 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 24 Jan 2018 12:38:10 +0100 Subject: Android: Fix compilation with warnings-are-errors Variable was added in e2e874415e1f1c6a96915d9dc85dd31c61f73e24 but is not used anywhere. Change-Id: Iff1e7c20317bb489978eb77d24b8da12493d7e45 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/androidjniclipboard.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/android/androidjniclipboard.cpp b/src/plugins/platforms/android/androidjniclipboard.cpp index 833996403c..d169035339 100644 --- a/src/plugins/platforms/android/androidjniclipboard.cpp +++ b/src/plugins/platforms/android/androidjniclipboard.cpp @@ -47,7 +47,6 @@ namespace QtAndroidClipboard { QAndroidPlatformClipboard *m_manager = nullptr; - static char const *const QtNativeClassName = "org/qtproject/qt5/android/QtNative"; static JNINativeMethod methods[] = { {"onClipboardDataChanged", "()V", (void *)onClipboardDataChanged} }; -- cgit v1.2.3 From 089969540f4877c778172ee0ccbd69960a179b43 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Fri, 26 Jan 2018 19:10:46 +0300 Subject: Remove traces of Growl in QSystemTrayIcon code and documentation Growl support was removed in Qt 5.8. Change-Id: I00a36cd955194ca8ceee52841a89ca579da01284 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 2 -- src/widgets/util/qsystemtrayicon.cpp | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index e756f0aeb0..f4c968ab57 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -72,8 +72,6 @@ ** ****************************************************************************/ -#define QT_MAC_SYSTEMTRAY_USE_GROWL - #include "qcocoasystemtrayicon.h" #ifndef QT_NO_SYSTEMTRAYICON diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index f7d048edcd..884bed2e68 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -107,9 +107,7 @@ static QIcon messageIcon2qIcon(QSystemTrayIcon::MessageIcon icon) \li All X11 desktop environments that implement the D-Bus \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem} specification, including recent versions of KDE and Unity. - \li All supported versions of \macos. Note that the Growl - notification system must be installed for - QSystemTrayIcon::showMessage() to display messages on \macos prior to 10.8 (Mountain Lion). + \li All supported versions of \macos. \endlist To check whether a system tray is present on the user's desktop, @@ -399,9 +397,6 @@ bool QSystemTrayIcon::supportsMessages() On Windows, the \a millisecondsTimeoutHint is usually ignored by the system when the application has focus. - On \macos, the Growl notification system must be installed for this function to - display messages. - Has been turned into a slot in Qt 5.2. \sa show(), supportsMessages() -- cgit v1.2.3 From b1a58b20ae109fac2756101fea4dcd8ee0b96531 Mon Sep 17 00:00:00 2001 From: Igor Mironchik Date: Thu, 25 Jan 2018 15:43:40 +0300 Subject: Fix missing update of QTreeView on setTreePosition() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was missing update in setTreePosition() or better to say update was but in not that part of QTreeView that needed. Now QTreeView correctly updates and paints tree decoration in a new place on changing tree position. [ChangeLog][QtWidgets][QTreeView] Fixed missing update of QTreeView on changing tree position. Task-number: QTBUG-65980 Change-Id: Id79ab8fcb39d511245a551068640684dd2a10cb9 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qtreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 4795d9f1b1..8d27305071 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -987,7 +987,7 @@ void QTreeView::setTreePosition(int index) { Q_D(QTreeView); d->treePosition = index; - update(); + d->viewport->update(); } /*! -- cgit v1.2.3 From 6b1ecb1904c3f7281d90e672971f23d54bb76600 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 13 Dec 2017 15:00:36 +0200 Subject: Android: Hide handler(s) if the cursor is not visible anymore On Android if the edit control is bigger than the remaining screen we resize it, this caused the handler(s) to remain outside the control. A better fix will be to ensure that the cursor/selection remains visible when the control is resized but I don't know if this is the desired behavior on all platforms. Task-number: QTBUG-62994 Task-number: QTBUG-58700 Change-Id: If43eb7bc1ecde426697694a8f26118e95fccb80c Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/qandroidinputcontext.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index fe4c5be4cb..fb33ad6e21 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -438,6 +438,16 @@ QAndroidInputContext::QAndroidInputContext() QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QAndroidInputContext::updateSelectionHandles); + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::anchorRectangleChanged, + this, &QAndroidInputContext::updateSelectionHandles); + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::inputItemClipRectangleChanged, this, [this]{ + auto im = qGuiApp->inputMethod(); + if (!im->inputItemClipRectangle().contains(im->anchorRectangle()) || + !im->inputItemClipRectangle().contains(im->cursorRectangle())) { + m_cursorHandleShown = CursorHandleNotShown; + updateSelectionHandles(); + } + }); } QAndroidInputContext::~QAndroidInputContext() -- cgit v1.2.3 From 626b33dca1dc0d95e80bf139c197fbb13d740277 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 15 Dec 2017 10:52:10 +0200 Subject: Do not allow empty selections Allowing empty selections leads to strange behavior, it switches from selection handles to cursor handle. Change-Id: Ida69346e2a47b13c92cfd68a555d6b94422bb580 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qplatforminputcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp index 3f59116e9a..9771e6ba11 100644 --- a/src/gui/kernel/qplatforminputcontext.cpp +++ b/src/gui/kernel/qplatforminputcontext.cpp @@ -287,6 +287,8 @@ void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, if (success) { int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, cursorPos * mapToLocal).toInt(&success); if (success) { + if (anchor == cursor && anchorPos != cursorPos) + return; QList imAttributes; imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant())); QInputMethodEvent event(QString(), imAttributes); -- cgit v1.2.3 From b1fb4f8261abe6372d446ee93846310191c070ce Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 15 Dec 2017 10:58:51 +0200 Subject: Move selection handles 1mm down This way the user will not cover with his finger the text with the cursor/selection. Set the tolerance to 0.5mm which is less then the width of the thinnest letters (e.g. i, I, l) Change-Id: Ia5d50bd3f4fe79c89d01b3d7f5e5c22e94e8158b Reviewed-by: Paul Olav Tvete --- .../org/qtproject/qt5/android/CursorHandle.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java index e6814c202d..abeab12f37 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java +++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java @@ -51,6 +51,7 @@ import android.graphics.drawable.Drawable; import android.view.MotionEvent; import android.widget.PopupWindow; import android.app.Activity; +import android.util.TypedValue; import android.view.ViewTreeObserver; /* This view represents one of the handle (selection or cursor handle) */ @@ -58,8 +59,8 @@ class CursorView extends ImageView { private CursorHandle mHandle; // The coordinare which where clicked - private int m_offsetX; - private int m_offsetY; + private float m_offsetX; + private float m_offsetY; CursorView (Context context, CursorHandle handle) { super(context); @@ -76,20 +77,18 @@ class CursorView extends ImageView public boolean onTouchEvent(MotionEvent ev) { switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: { - m_offsetX = Math.round(ev.getRawX()); - m_offsetY = Math.round(ev.getRawY()); + m_offsetX = ev.getRawX(); + m_offsetY = ev.getRawY() + getHeight() / 2; break; } case MotionEvent.ACTION_MOVE: { - mHandle.updatePosition(Math.round(ev.getRawX()) - m_offsetX, - Math.round(ev.getRawY()) - m_offsetY); + mHandle.updatePosition(Math.round(ev.getRawX() - m_offsetX), + Math.round(ev.getRawY() - m_offsetY)); break; } case MotionEvent.ACTION_UP: - break; - case MotionEvent.ACTION_CANCEL: break; } @@ -113,6 +112,7 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener private int m_lastY; int tolerance; private boolean m_rtl; + int m_yShift; public CursorHandle(Activity activity, View layout, int id, int attr, boolean rtl) { m_activity = activity; @@ -121,7 +121,8 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener m_layout = layout; DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); - tolerance = Math.round(2 * metrics.density); + m_yShift = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 1f, metrics); + tolerance = Math.min(1, (int)(m_yShift / 2f)); m_lastX = m_lastY = -1 - tolerance; m_rtl = rtl; } @@ -158,7 +159,7 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener m_layout.getLocationOnScreen(location); int x2 = x + location[0]; - int y2 = y + location[1]; + int y2 = y + location[1] + m_yShift; if (m_id == QtNative.IdCursorHandle) { x2 -= m_cursorView.getWidth() / 2 ; @@ -187,6 +188,7 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener // The handle was dragged by a given relative position public void updatePosition(int x, int y) { + y -= m_yShift; if (Math.abs(m_lastX - x) > tolerance || Math.abs(m_lastY - y) > tolerance) { QtNative.handleLocationChanged(m_id, x + m_posX, y + m_posY); m_lastX = x; -- cgit v1.2.3 From 5f924134ff48bc89defe4d6c2ccabeaea6b4450d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 15 Dec 2017 11:08:16 +0200 Subject: Check selection handles position This patch fixes the strange behavior when selecting text. This patch (on a Left To Right text) makes sure that: - the left handle will select text only on the left & above of the right handle - the right handle will select text only on the right & below of the left handle For RTL is way more complicated: - the left handle is acuatually the right handle but on the left side and it acts as a right handle - the right handle is acuatually the left handle but on the right side and it acts as a left handle Change-Id: Ifca591398103199d5aef479f0a080161c9f44c0e Reviewed-by: Paul Olav Tvete --- .../platforms/android/qandroidinputcontext.cpp | 48 +++++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index fb33ad6e21..f548a1fa96 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -605,27 +605,63 @@ void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y) double pixelDensity = window ? QHighDpiScaling::factor(window) : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); - QPoint point(x / pixelDensity, y / pixelDensity); - y -= leftRect.width() / 2; + QPointF point(x / pixelDensity, y / pixelDensity); + point.setY(point.y() - leftRect.width() / 2); if (handleId == 1) { setSelectionOnFocusObject(point, point); return; } - QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition); + QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImCurrentSelection); QCoreApplication::sendEvent(m_focusObject, &query); int cpos = query.value(Qt::ImCursorPosition).toInt(); int anchor = query.value(Qt::ImAnchorPosition).toInt(); - + bool rtl = query.value(Qt::ImCurrentSelection).toString().isRightToLeft(); auto rightRect = im->anchorRectangle(); if (cpos > anchor) std::swap(leftRect, rightRect); + auto checkLeftHandle = [&rightRect](QPointF &handlePos) { + if (handlePos.y() > rightRect.center().y()) + handlePos.setY(rightRect.center().y()); // adjust Y handle pos + if (handlePos.y() >= rightRect.y() && handlePos.y() <= rightRect.bottom() && handlePos.x() >= rightRect.x()) + return false; // same line and wrong X pos ? + return true; + }; + + auto checkRtlRightHandle = [&rightRect](QPointF &handlePos) { + if (handlePos.y() > rightRect.center().y()) + handlePos.setY(rightRect.center().y()); // adjust Y handle pos + if (handlePos.y() >= rightRect.y() && handlePos.y() <= rightRect.bottom() && rightRect.x() >= handlePos.x()) + return false; // same line and wrong X pos ? + return true; + }; + + auto checkRightHandle = [&leftRect](QPointF &handlePos) { + if (handlePos.y() < leftRect.center().y()) + handlePos.setY(leftRect.center().y()); // adjust Y handle pos + if (handlePos.y() >= leftRect.y() && handlePos.y() <= leftRect.bottom() && leftRect.x() >= handlePos.x()) + return false; // same line and wrong X pos ? + return true; + }; + + auto checkRtlLeftHandle = [&leftRect](QPointF &handlePos) { + if (handlePos.y() < leftRect.center().y()) + handlePos.setY(leftRect.center().y()); // adjust Y handle pos + if (handlePos.y() >= leftRect.y() && handlePos.y() <= leftRect.bottom() && handlePos.x() >= leftRect.x()) + return false; // same line and wrong X pos ? + return true; + }; + if (handleId == 2) { - QPoint rightPoint(rightRect.center().toPoint()); + QPointF rightPoint(rightRect.center()); + if ((!rtl && !checkLeftHandle(point)) || (rtl && !checkRtlRightHandle(point))) + return; setSelectionOnFocusObject(point, rightPoint); } else if (handleId == 3) { - QPoint leftPoint(leftRect.center().toPoint()); + QPointF leftPoint(leftRect.center()); + if ((!rtl && !checkRightHandle(point)) || (rtl && !checkRtlLeftHandle(point))) + return; setSelectionOnFocusObject(leftPoint, point); } } -- cgit v1.2.3 From f3397ec659bc1288bebcb0dec11cc48cdd2c17bb Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 15 Dec 2017 14:30:14 +0200 Subject: Don't update the position if the handle was not first pressed Change-Id: If09a2ca954a3bfca00b5a0839fea2899e7576c1d Reviewed-by: Paul Olav Tvete --- src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java index abeab12f37..4f2c06644d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java +++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java @@ -61,6 +61,7 @@ class CursorView extends ImageView // The coordinare which where clicked private float m_offsetX; private float m_offsetY; + private boolean m_pressed = false; CursorView (Context context, CursorHandle handle) { super(context); @@ -79,10 +80,13 @@ class CursorView extends ImageView case MotionEvent.ACTION_DOWN: { m_offsetX = ev.getRawX(); m_offsetY = ev.getRawY() + getHeight() / 2; + m_pressed = true; break; } case MotionEvent.ACTION_MOVE: { + if (!m_pressed) + return false; mHandle.updatePosition(Math.round(ev.getRawX() - m_offsetX), Math.round(ev.getRawY() - m_offsetY)); break; @@ -90,6 +94,7 @@ class CursorView extends ImageView case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: + m_pressed = false; break; } return true; -- cgit v1.2.3 From 5a05348fb6c3940449a9c2950bb65bdea2112a15 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Tue, 23 Jan 2018 14:06:53 +0100 Subject: examples: Add localserver feature check for localfortune examples Change-Id: I536645ddf0a5ead31a2658d03984c1226a7c39c8 Reviewed-by: Oswald Buddenhagen --- examples/corelib/ipc/ipc.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/corelib/ipc/ipc.pro b/examples/corelib/ipc/ipc.pro index 101552cea9..68c88d75aa 100644 --- a/examples/corelib/ipc/ipc.pro +++ b/examples/corelib/ipc/ipc.pro @@ -3,4 +3,8 @@ requires(qtHaveModule(widgets)) TEMPLATE = subdirs qtConfig(sharedmemory): SUBDIRS = sharedmemory -qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient +qtHaveModule(network) { + QT_FOR_CONFIG += network + + qtConfig(localserver): SUBDIRS += localfortuneserver localfortuneclient +} -- cgit v1.2.3 From 3adfcbf1ed9b63c3ce41d7417658db3836fd3530 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 21 Jan 2018 19:55:40 +0100 Subject: QHeaderView: properly restore section data after layoutChanged() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QHeaderView is doing a complete rebuild of the sections when the layout changed because everything could have happened. But since layoutChanged is also called during e.g. sorting, the old data must be restored when possible. Task-number: QTBUG-65478 Change-Id: I088d4d843cad362b97df6dc5e0dcb9819b13547f Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qheaderview.cpp | 88 ++++++++++++++++------ src/widgets/itemviews/qheaderview_p.h | 11 +-- .../itemviews/qheaderview/tst_qheaderview.cpp | 13 +++- 3 files changed, 82 insertions(+), 30 deletions(-) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 0905a20812..e1aec3f4bd 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -351,7 +351,7 @@ void QHeaderView::setModel(QAbstractItemModel *model) if (model == this->model()) return; Q_D(QHeaderView); - d->persistentHiddenSections.clear(); + d->layoutChangePersistentSections.clear(); if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { if (d->orientation == Qt::Horizontal) { QObject::disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)), @@ -2072,14 +2072,28 @@ void QHeaderViewPrivate::_q_layoutAboutToBeChanged() || model->columnCount(root) == 0) return; - if (hiddenSectionSize.count() == 0) - return; + layoutChangePersistentSections.clear(); + layoutChangePersistentSections.reserve(std::min(10, sectionItems.count())); + // after layoutChanged another section can be last stretched section + if (stretchLastSection) { + const int visual = visualIndex(lastSectionLogicalIdx); + sectionItems[visual].size = lastSectionSize; + } + for (int i = 0; i < sectionItems.size(); ++i) { + const auto &s = sectionItems.at(i); + // only add if the section is not default and not visually moved + if (s.size == defaultSectionSize && !s.isHidden && s.resizeMode == globalResizeMode) + continue; - for (int i = 0; i < sectionItems.count(); ++i) - if (isVisualIndexHidden(i)) // ### note that we are using column or row 0 - persistentHiddenSections.append(orientation == Qt::Horizontal - ? model->index(0, logicalIndex(i), root) - : model->index(logicalIndex(i), 0, root)); + // ### note that we are using column or row 0 + layoutChangePersistentSections.append({orientation == Qt::Horizontal + ? model->index(0, logicalIndex(i), root) + : model->index(logicalIndex(i), 0, root), + s}); + + if (layoutChangePersistentSections.size() > 1000) + break; + } } void QHeaderViewPrivate::_q_layoutChanged() @@ -2087,25 +2101,57 @@ void QHeaderViewPrivate::_q_layoutChanged() Q_Q(QHeaderView); viewport->update(); - const auto hiddenSections = persistentHiddenSections; - persistentHiddenSections.clear(); - - clear(); - q->initializeSections(); - invalidateCachedSizeHint(); + const auto oldPersistentSections = layoutChangePersistentSections; + layoutChangePersistentSections.clear(); - if (modelIsEmpty()) { + const int newCount = modelSectionCount(); + const int oldCount = sectionItems.size(); + if (newCount == 0) { + clear(); + if (oldCount != 0) + emit q->sectionCountChanged(oldCount, 0); return; } - for (const auto &index : hiddenSections) { - if (index.isValid()) { - const int logical = (orientation == Qt::Horizontal - ? index.column() - : index.row()); - q->setSectionHidden(logical, true); + // adjust section size + if (newCount != oldCount) { + const int min = qBound(0, oldCount, newCount - 1); + q->initializeSections(min, newCount - 1); + } + // reset sections + sectionItems.fill(SectionItem(defaultSectionSize, globalResizeMode), newCount); + + // all hidden sections are in oldPersistentSections + hiddenSectionSize.clear(); + + for (const auto &item : oldPersistentSections) { + const auto &index = item.index; + if (!index.isValid()) + continue; + + const int newLogicalIndex = (orientation == Qt::Horizontal + ? index.column() + : index.row()); + // the new visualIndices are already adjusted / reset by initializeSections() + const int newVisualIndex = visualIndex(newLogicalIndex); + auto &newSection = sectionItems[newVisualIndex]; + newSection = item.section; + + if (newSection.isHidden) { + // otherwise setSectionHidden will return without doing anything + newSection.isHidden = false; + q->setSectionHidden(newLogicalIndex, true); } } + + recalcSectionStartPos(); + length = headerLength(); + + if (stretchLastSection) { + // force rebuild of stretched section later on + lastSectionLogicalIdx = -1; + maybeRestorePrevLastSectionAndStretchLast(); + } } /*! diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 8fc8b88aa5..c9c2cf8493 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -231,10 +231,6 @@ public: : model->rowCount(root)); } - inline bool modelIsEmpty() const { - return (model->rowCount(root) == 0 || model->columnCount(root) == 0); - } - inline void doDelayedResizeSections() { if (!delayedResize.isActive()) delayedResize.start(0, q_func()); @@ -304,7 +300,6 @@ public: QLabel *sectionIndicator; #endif QHeaderView::ResizeMode globalResizeMode; - QList persistentHiddenSections; mutable bool sectionStartposRecalc; int resizeContentsPrecision; // header sections @@ -335,6 +330,11 @@ public: }; QVector sectionItems; + struct LayoutChangeItem { + QPersistentModelIndex index; + SectionItem section; + }; + QVector layoutChangePersistentSections; void createSectionItems(int start, int end, int size, QHeaderView::ResizeMode mode); void removeSectionsFromSectionItems(int start, int end); @@ -388,6 +388,7 @@ public: }; Q_DECLARE_TYPEINFO(QHeaderViewPrivate::SectionItem, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QHeaderViewPrivate::LayoutChangeItem, Q_MOVABLE_TYPE); QT_END_NAMESPACE diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 90019a1798..6dae2cf8e4 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2251,10 +2251,6 @@ void tst_QHeaderView::QTBUG6058_reset() void tst_QHeaderView::QTBUG7833_sectionClicked() { - - - - QTableView tv; QStandardItemModel *sim = new QStandardItemModel(&tv); QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(&tv); @@ -2278,11 +2274,20 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() tv.horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); tv.setModel(proxyModel); + const int section4Size = tv.horizontalHeader()->sectionSize(4) + 1; + tv.horizontalHeader()->resizeSection(4, section4Size); tv.setColumnHidden(5, true); tv.setColumnHidden(6, true); tv.horizontalHeader()->swapSections(8, 10); tv.sortByColumn(1, Qt::AscendingOrder); + QCOMPARE(tv.isColumnHidden(5), true); + QCOMPARE(tv.isColumnHidden(6), true); + QCOMPARE(tv.horizontalHeader()->sectionsMoved(), true); + QCOMPARE(tv.horizontalHeader()->logicalIndex(8), 10); + QCOMPARE(tv.horizontalHeader()->logicalIndex(10), 8); + QCOMPARE(tv.horizontalHeader()->sectionSize(4), section4Size); + QSignalSpy clickedSpy(tv.horizontalHeader(), SIGNAL(sectionClicked(int))); QSignalSpy pressedSpy(tv.horizontalHeader(), SIGNAL(sectionPressed(int))); -- cgit v1.2.3 From 4a7771f206d4b29be549d3827c36a46679d90de6 Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Sun, 7 Jan 2018 13:02:01 +0900 Subject: QSimpleDrag: Fix mouse release coords for delayed event transmission On platforms such as XCB, the drag cursor pixmap is shown via a window (a QShapedPixmapWindow) under the cursor. The mouse button release event at the end of the drag is received in this QXcbWindow, but intercepted by an event filter that QSimpleDrag installs on the QApplication. It then resends it unmodified(!) after the drag has ended and the drag pixmap window destroyed, causing it to be delivered to the new top-level window. The local coordinates in the unmodified QMouseEvent are local to the drag pixmap window and don't match the window it is delayed-transmitted to. This ends up having fatal, user-visible effects particularly in Qt Quick: QQuickWindow synthesizes a hover event once per frame using the last received mouse coordinates, here: the release posted by QSimpleDrag. This is done to update the hover event state for items under the cursor when the mouse hasn't moved (e.g. QQuickMouseArea:: containsMouse). The bogus event coordinates in the release event then usually end up causing an item near the top-left of the QQuickWindow to assume it is hovered (because drag pixmap windows tend to be small), even when the mouse cursor is actually far away from it at the end of the drag. This shows up e.g. in the Plasma 5 desktop, where dragging an icon on the desktop will cause the icon at the top-left of the screen (if any) to switch to hovered state, as the release coordinates on the drag pixmap window (showing a dragged icon) fall into the geometry of the top-left icon. QSimpleDrag contains a topLevelAt() function to find the top-level window under the global cursor coordinates that is not the drag pixmap window. This is used by the drop event delivery code. This patch uses this function to find the relevant top-level window, then asks it to map the global cusor coordinates to its local coordinate system, then synthesizes a new QMouseEvent with local coordinates computed in this fashion. As a result the window now gets a release event with coordinates that make sense and are correct. Task-number: QTBUG-66103 Change-Id: I04ebe6ccd4a991fdd4b540ff0227973ea8896a9d Reviewed-by: Eike Hein Reviewed-by: Shawn Rutledge --- src/gui/kernel/qsimpledrag.cpp | 32 +++++++++++++++++++++++++++----- src/gui/kernel/qsimpledrag_p.h | 6 +++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index a1e25dc53c..87d3ba5915 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -58,6 +58,7 @@ #include #include +#include #include #include @@ -69,6 +70,8 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_DRAGANDDROP +Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") + static QWindow* topLevelAt(const QPoint &pos) { QWindowList list = QGuiApplication::topLevelWindows(); @@ -94,10 +97,10 @@ static QWindow* topLevelAt(const QPoint &pos) */ QBasicDrag::QBasicDrag() : - m_restoreCursor(false), m_eventLoop(0), + m_current_window(nullptr), m_restoreCursor(false), m_eventLoop(nullptr), m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false), - m_drag(0), m_drag_icon_window(0), m_useCompositing(true), - m_screen(Q_NULLPTR) + m_drag(nullptr), m_drag_icon_window(nullptr), m_useCompositing(true), + m_screen(nullptr) { } @@ -161,6 +164,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: + { disableEventFilter(); if (canDrop()) { QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); @@ -169,8 +173,25 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) cancel(); } exitDndEventLoop(); - QCoreApplication::postEvent(o, new QMouseEvent(*static_cast(e))); + + // If a QShapedPixmapWindow (drag feedback) is being dragged along, the + // mouse event's localPos() will be relative to that, which is useless. + // We want a position relative to the window where the drag ends, if possible (?). + // If there is no such window (belonging to this Qt application), + // make the event relative to the window where the drag started. (QTBUG-66103) + const QMouseEvent *release = static_cast(e); + const QWindow *releaseWindow = topLevelAt(release->globalPos()); + qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_current_window << "globalPos" << release->globalPos(); + if (!releaseWindow) + releaseWindow = m_current_window; + QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos()); + QMouseEvent *newRelease = new QMouseEvent(release->type(), + releaseWindowPos, releaseWindowPos, release->screenPos(), + release->button(), release->buttons(), + release->modifiers(), release->source()); + QCoreApplication::postEvent(o, newRelease); return true; // defer mouse release events until drag event loop has returned + } case QEvent::MouseButtonDblClick: case QEvent::Wheel: return true; @@ -349,7 +370,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point) into account. */ -QSimpleDrag::QSimpleDrag() : m_current_window(0) +QSimpleDrag::QSimpleDrag() { } @@ -373,6 +394,7 @@ void QSimpleDrag::startDrag() updateCursor(Qt::IgnoreAction); } setExecutedDropAction(Qt::IgnoreAction); + qCDebug(lcDnd) << "drag began from" << m_current_window<< "cursor pos" << QCursor::pos() << "can drop?" << canDrop(); } void QSimpleDrag::cancel() diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h index 0b8a0bc703..bbd7f7f4bb 100644 --- a/src/gui/kernel/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -105,6 +105,9 @@ protected: QDrag *drag() const { return m_drag; } +protected: + QWindow *m_current_window; + private: void enableEventFilter(); void disableEventFilter(); @@ -132,9 +135,6 @@ protected: virtual void cancel() Q_DECL_OVERRIDE; virtual void move(const QPoint &globalPos) Q_DECL_OVERRIDE; virtual void drop(const QPoint &globalPos) Q_DECL_OVERRIDE; - -private: - QWindow *m_current_window; }; #endif // QT_NO_DRAGANDDROP -- cgit v1.2.3 From 4cd90a3579986ae7441c3e982a5f34cdfd92c152 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 17 Jan 2017 22:31:04 +0000 Subject: Fix native QFileDialog initial selection for remote URLs When using QFileDialog::getOpenFileUrl() with dir set to e.g. "sftp://foo/bar.cpp" we call q->selectDirectoryUrl("sftp://foo") followed by q->selectFile("bar.cpp"). Inside QFileDialog::selectFile() we unconditionally convert "bar.cpp" to an absolute URL and then call d->selectFile_sys("$CWD/bar.cpp") This then calls platform integration that detects that an absolute URL is being passed to selectFile() and therefore overrides the initial directory. Initially reported as https://bugs.kde.org/show_bug.cgi?id=374913 This is a regression that appeared some time between Qt 5.7.0 and 5.7.1. I have not had time to bisect this but the only commit that may have change behavior in that time range appears to be 007f92c6eef6191c48da0c44916591d48813ae62. Change-Id: I6968abe9ed5c5b9de067c453a7e9d2c5cdb3a190 Reviewed-by: Christoph Resch Reviewed-by: David Faure --- src/widgets/dialogs/qfiledialog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 8d37969be4..cb2c534b24 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2830,7 +2830,10 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, if (!nameFilter.isEmpty()) q->setNameFilter(nameFilter); q->setDirectoryUrl(workingDirectory(directory)); - q->selectFile(initialSelection(directory)); + if (directory.isLocalFile()) + q->selectFile(initialSelection(directory)); + else + q->selectUrl(directory); #ifndef QT_NO_SETTINGS // Try to restore from the FileDialog settings group; if it fails, fall back -- cgit v1.2.3 From 9b2913377807b3dae107befeec0bc488f4a2cbad Mon Sep 17 00:00:00 2001 From: Nathan Collins Date: Mon, 29 Jan 2018 14:37:57 +0000 Subject: Fix QFileDialog::defaultSuffix on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't prepend the default suffix to the NSSavePanel allowedFileTypes. "If no extension is given by the user, the first item in the allowedFileTypes array will be used as the extension for the save panel." The user expects to get the suffix displayed to them in the drop down filter, not the default suffix set by the developer. Apply the default suffix if neither the user or the NSSavePanel provide a suffix. Task-number: QTBUG-66066 Change-Id: I64093b9f3178bd2377a7b65d6f23aed6214a4119 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 74148b7cbf..c1c7903766 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -418,6 +418,13 @@ static QString strippedText(QString s) } else { QList result; QString filename = QString::fromNSString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C); + const QString defaultSuffix = mOptions->defaultSuffix(); + const QFileInfo fileInfo(filename); + // If neither the user or the NSSavePanel have provided a suffix, use + // the default suffix (if it exists). + if (fileInfo.suffix().isEmpty() && !defaultSuffix.isEmpty()) { + filename.append('.').append(defaultSuffix); + } result << QUrl::fromLocalFile(filename.remove(QLatin1String("___qt_very_unlikely_prefix_"))); return result; } @@ -445,10 +452,7 @@ static QString strippedText(QString s) [mPopUpButton setHidden:chooseDirsOnly]; // TODO hide the whole sunken pane instead? if (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) { - QStringList ext = [self acceptableExtensionsForSave]; - const QString defaultSuffix = mOptions->defaultSuffix(); - if (!ext.isEmpty() && !defaultSuffix.isEmpty()) - ext.prepend(defaultSuffix); + const QStringList ext = [self acceptableExtensionsForSave]; [mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : qt_mac_QStringListToNSMutableArray(ext)]; } else { [mOpenPanel setAllowedFileTypes:nil]; // delegate panel:shouldEnableURL: does the file filtering for NSOpenPanel -- cgit v1.2.3 From b44df9937e4b15596b994f8e20822b83ac4bed29 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 30 Jan 2018 21:02:10 +0100 Subject: Clean-up in QDateTime's parsing of ISODate{,WithMs} Actually check that there's a T where ISO 8601 wants it (instead of just skipping over whatever's there), with something after it; move some declarations later; add some comments; and use the QStringRef API more cleanly (so that it's easier to see what's going on). Simplify a loop condition to avoid the need for a post-loop fix-up. This incidentally prevents an assertion failure (which brought the mess to my attention) parsing a short string as an ISO date-time; if there's a T with nothing after it, we won't try to read at index -1 in the following text. (The actual fail seen had a Z where the T should have been, with nothing after it.) Add tests for invalid ISOdate cases that triggered the assertion. Task-number: QTBUG-66076 Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd Reviewed-by: Israel Lins Albuquerque Reviewed-by: Thiago Macieira (cherry picked from commit a9c111ed8c30a5a8fec3f02244f0d5a4bd08e931) --- src/corelib/tools/qdatetime.cpp | 23 +++++++++++++++------- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 4 ++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9d26207a0f..045ad10755 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4720,25 +4720,35 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) if (size < 10) return QDateTime(); - QStringRef isoString(&string); - Qt::TimeSpec spec = Qt::LocalTime; - QDate date = QDate::fromString(string.left(10), Qt::ISODate); if (!date.isValid()) return QDateTime(); if (size == 10) return QDateTime(date); - isoString = isoString.right(isoString.length() - 11); + Qt::TimeSpec spec = Qt::LocalTime; + QStringRef isoString(&string); + isoString = isoString.mid(10); // trim "yyyy-MM-dd" + + // Must be left with T and at least one digit for the hour: + if (isoString.size() < 2 + || !(isoString.startsWith(QLatin1Char('T')) + // FIXME: QSql relies on QVariant::toDateTime() accepting a space here: + || isoString.startsWith(QLatin1Char(' ')))) { + return QDateTime(); + } + isoString = isoString.mid(1); // trim 'T' (or space) + int offset = 0; // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:mm for Offset if (isoString.endsWith(QLatin1Char('Z'))) { spec = Qt::UTC; - isoString = isoString.left(isoString.size() - 1); + isoString.chop(1); // trim 'Z' } else { // the loop below is faster but functionally equal to: // const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]"))); int signIndex = isoString.size() - 1; + Q_ASSERT(signIndex >= 0); bool found = false; { const QChar plus = QLatin1Char('+'); @@ -4746,8 +4756,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) do { QChar character(isoString.at(signIndex)); found = character == plus || character == minus; - } while (--signIndex >= 0 && !found); - ++signIndex; + } while (!found && --signIndex >= 0); } if (found) { diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 28ad2d193c..91b5966fa8 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2277,6 +2277,10 @@ void tst_QDateTime::fromStringDateFormat_data() QTest::newRow("ISO .99999 of a minute (comma)") << QString::fromLatin1("2012-01-01T08:00,99999") << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999), Qt::LocalTime); QTest::newRow("ISO empty") << QString::fromLatin1("") << Qt::ISODate << invalidDateTime(); + QTest::newRow("ISO short") << QString::fromLatin1("2017-07-01T") << Qt::ISODate << invalidDateTime(); + QTest::newRow("ISO zoned date") << QString::fromLatin1("2017-07-01Z") << Qt::ISODate << invalidDateTime(); + QTest::newRow("ISO zoned empty time") << QString::fromLatin1("2017-07-01TZ") << Qt::ISODate << invalidDateTime(); + QTest::newRow("ISO mis-punctuated") << QString::fromLatin1("2018/01/30 ") << Qt::ISODate << invalidDateTime(); // Test Qt::RFC2822Date format (RFC 2822). QTest::newRow("RFC 2822 +0100") << QString::fromLatin1("13 Feb 1987 13:24:51 +0100") -- cgit v1.2.3 From 1f0c22844811d71fae69ee6b103bbfc5e750ca90 Mon Sep 17 00:00:00 2001 From: Dominik Haumann Date: Mon, 29 Jan 2018 19:38:49 +0100 Subject: Fix window activation in QWindowsWindow::setCustomMargins() Currently, code paths that call QWindowsWindow:setCustomMargins() automatically also activate the window (=give the window focus). The reason for this is the call of SetWindowPos (Windows API) without the flag SWP_NOACTIVATE. From the Windows API documentation about SetWindowPos() about the flag SWP_NOACTIVATE: Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter). It seems the flag SWP_NOACTIVATE is accidentally missing in the call of SetWindowPos() in setCustomMargins(), especially since the flag is present in pretty much all other calls of SetWindowPos(). The obvious fix is to add the flag SWP_NOACTIVATE to the call of SetWindowPos() in setCustomMargins(). So far, this issue exists for a long time, an was possibly introduced with commit f5fd5346038, where setCustomMargins() was initially added. Change-Id: Id3f058f8762df17eb3f033ab0b3e1791283937fc Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 402009c70d..c1aeecf0ab 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2401,7 +2401,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) newFrame.moveTo(topLeft); qCDebug(lcQpaWindows) << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins << currentFrameGeometry << "->" << newFrame; - SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE); } } -- cgit v1.2.3 From b7e436738756b1d5d7a45201b7a7204d7fe128a1 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Mon, 22 Jan 2018 18:51:57 +0200 Subject: Fix some cases of scaled text disappearing with freetype Commit a56ee60791538e5442b3d97b75270b25dc4986db changed type of advance to short, restoring this fixes at least some cases where glyphs were disappearing. Task-number: QTBUG-65838 Change-Id: I33b252d91fb7541eaea3275b1950a048941869a6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 4 +--- src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 2c5850b6ad..3f543755b6 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -994,9 +994,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, static inline bool areMetricsTooLarge(const QFontEngineFT::GlyphInfo &info) { // false if exceeds QFontEngineFT::Glyph metrics - return (short)(info.linearAdvance) != info.linearAdvance - || (uchar)(info.width) != info.width - || (uchar)(info.height) != info.height; + return info.width > 0xFF || info.height > 0xFF; } static inline void transformBoundingBox(int *left, int *top, int *right, int *bottom, FT_Matrix *matrix) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h index c063f5df30..e98268ae4b 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h @@ -133,7 +133,7 @@ public: /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ struct Glyph { ~Glyph(); - short linearAdvance; + int linearAdvance : 22; unsigned char width; unsigned char height; short x; -- cgit v1.2.3 From 1514b4e85336245ef130deca5839267dba7b2e32 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 21:46:40 -0800 Subject: Silence GCC 8 warning on memcpy of class Value to to class offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From GCC 8: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of type ‘QJsonPrivate::offset’ {aka ‘class QSpecialInteger >’} with ‘private’ member ‘QSpecialInteger >::val’ from an array of ‘const value_type’ {aka ‘const class QJsonPrivate::Value’}; use assignment or copy-initialization instead [-Werror=class-memaccess] Both types are standard layout and have the same initial sequence (one uint member), so this is a valid copy. The only difference between the two is that QSpecialInteger has a private member, whereas in the bitfield it's public. Change-Id: I41d006aac5bc48529845fffd150e80585fd24db7 Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonarray.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index d4cc4b81df..255dc2ee4e 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -297,7 +297,8 @@ QJsonArray QJsonArray::fromVariantList(const QVariantList &list) array.a->tableOffset = currentOffset; if (!array.detach2(sizeof(QJsonPrivate::offset)*values.size())) return QJsonArray(); - memcpy(array.a->table(), values.constData(), values.size()*sizeof(uint)); + memcpy(static_cast(array.a->table()), + static_cast(values.constData()), values.size()*sizeof(uint)); array.a->length = values.size(); array.a->size = currentOffset + sizeof(QJsonPrivate::offset)*values.size(); -- cgit v1.2.3 From c26c5b7d0dc4607b7cdd5569c5180b94b4563b73 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 21:46:40 -0800 Subject: Silence GCC 8 warning on memcpy of movable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is similar to commit 342bb5b03a76d1428fafb8e1532d66e172bd1c0b. From GCC 8: qarraydataops.h:84:17: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QStringRef’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] [etc.] Change-Id: I41d006aac5bc48529845fffd150e817e64973bec Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydataops.h | 3 ++- src/corelib/tools/qvarlengtharray.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index b7c3bc1287..d0f83d2b6a 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -76,7 +76,8 @@ struct QPodArrayOps Q_ASSERT(b < e); Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size)); - ::memcpy(this->end(), b, (e - b) * sizeof(T)); + ::memcpy(static_cast(this->end()), static_cast(b), + (e - b) * sizeof(T)); this->size += e - b; } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index d99eebd4b9..58bb5e75c4 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -344,7 +344,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::append(const T *abuf, in while (s < asize) new (ptr+(s++)) T(*abuf++); } else { - memcpy(&ptr[s], abuf, increment * sizeof(T)); + memcpy(static_cast(&ptr[s]), static_cast(abuf), increment * sizeof(T)); s = asize; } } @@ -392,7 +392,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::realloc(int asize, int a QT_RETHROW; } } else { - memcpy(ptr, oldPtr, copySize * sizeof(T)); + memcpy(static_cast(ptr), static_cast(oldPtr), copySize * sizeof(T)); } } s = copySize; -- cgit v1.2.3 From 403343039d07812c0beee9260b291f86e14d8ac4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 22:00:46 -0800 Subject: Suppress GCC 8 warning about realloc() non-trivially-copyable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit But they are movable. qxmlstream_p.h:654:32: error: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘struct QXmlStreamPrivateTagStack::Tag’; use ‘new’ and ‘delete’ instead [-Werror=class-memaccess] Change-Id: I41d006aac5bc48529845fffd150e8115eb852034 Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/xml/qxmlstream_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 9ef95c1fbe..e6c89e40cd 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -651,7 +651,8 @@ public: inline void reserve(int extraCapacity) { if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); - data = reinterpret_cast(realloc(data, cap * sizeof(T))); + void *ptr = realloc(static_cast(data), cap * sizeof(T)); + data = reinterpret_cast(ptr); Q_CHECK_PTR(data); } } -- cgit v1.2.3 From 756ebcd93a028bd9c731acddbea09de67c2410e3 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Feb 2018 14:37:32 +0100 Subject: QGtk3Menu::showPopup(): fix off by one error in the y-coordinate QRect::bottom() != QRect::y() + QRect::height() Change-Id: I83ae19ab588fb9651354999679f5d3c9e294a97e Reviewed-by: Friedemann Kleint --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index f48e00ab8e..99407a21de 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -448,7 +448,8 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, if (index != -1) gtk_menu_set_active(GTK_MENU(m_menu), index); - m_targetPos = targetRect.bottomLeft(); + m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); + if (parentWindow) m_targetPos = parentWindow->mapToGlobal(m_targetPos); -- cgit v1.2.3 From 57f4521c99df1e4e2c1fd321a41019ae4e0c17b1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 08:06:04 +0100 Subject: Fix QXcbWindow::mapFrom/ToGlobal() Call the base class implementations to avoid returning an unmapped values for non-embedded windows. Task-number: QTBUG-55251 Change-Id: Ib05fd530498dd4d72d3d4ef37caf4e2f0ebcd2e4 Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c4649ac818..37d6336a72 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2157,7 +2157,7 @@ bool QXcbWindow::isEmbedded() const QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const { if (!m_embedded) - return pos; + return QPlatformWindow::mapToGlobal(pos); QPoint ret; xcb_translate_coordinates_cookie_t cookie = @@ -2177,7 +2177,7 @@ QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const QPoint QXcbWindow::mapFromGlobal(const QPoint &pos) const { if (!m_embedded) - return pos; + return QPlatformWindow::mapFromGlobal(pos); QPoint ret; xcb_translate_coordinates_cookie_t cookie = -- cgit v1.2.3 From 1ffc6ba402114a3443df5309dec186fd337e5b66 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 08:50:15 +0100 Subject: macOS: fix menu positioning on high-DPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The target position is passed in physical native pixels, so call QPlatformScreen::availableGeometry() and QPlatformWindow::mapToGlobal() instead of QScreen::availableSize() and QWindow::mapToGlobal(). The latter two operate on logical pixels. Task-number: QTBUG-55251 Change-Id: I281f47baee727bc0f4738fd6d6cdf12c9f462b0f Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoamenu.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 8bdd0512de..e41c70b8ca 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -46,6 +46,7 @@ #include #include #include "qcocoaapplication.h" +#include "qcocoaintegration.h" #include "qcocoamenuloader.h" #include "qcocoamenubar.h" #include "qcocoawindow.h" @@ -573,8 +574,9 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, [popupCell setMenu:m_nativeMenu]; [popupCell selectItem:nsItem]; - int availableHeight = screen->availableSize().height(); - const QPoint &globalPos = parentWindow->mapToGlobal(pos); + QCocoaScreen *cocoaScreen = static_cast(screen->handle()); + int availableHeight = cocoaScreen->availableGeometry().height(); + const QPoint &globalPos = cocoaWindow->mapToGlobal(pos); int menuHeight = m_nativeMenu.size.height; if (globalPos.y() + menuHeight > availableHeight) { // Maybe we need to fix the vertical popup position but we don't know the -- cgit v1.2.3 From 1cc15c4b6d65a22ab4018226a96baf843feb1f00 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 10:00:27 +0100 Subject: QComboBoxPrivate::showNativePopup(): Scale target rectangle The QPlatform* classes operate in native pixels. Task-number: QTBUG-55251 Change-Id: I80490fa802fbc77a1e02c176528cc047630f9a7d Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qcombobox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index e0bc198d2e..7ab3565a00 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -2550,7 +2551,8 @@ bool QComboBoxPrivate::showNativePopup() else if (q->testAttribute(Qt::WA_MacMiniSize)) offset = QPoint(-2, 6); - m_platformMenu->showPopup(tlw, QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize()), currentItem); + const QRect targetRect = QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize()); + m_platformMenu->showPopup(tlw, QHighDpi::toNativePixels(targetRect, tlw), currentItem); #ifdef Q_OS_OSX // The Cocoa popup will swallow any mouse release event. -- cgit v1.2.3 From 0307bfea31782512939aa4f97425b57cf35c080c Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 29 Jan 2018 14:54:19 +0100 Subject: ANGLE: Remove workaround for files having the same name (Debug.h/.cpp) With object_parallel_to_source the workaround of making copies of the files and using these is no longer needed. Debug2.h and .cpp were added to the repository by mistake and should not have been there in the first place. Task-number: QTBUG-66059 Change-Id: Ib9dbd15be1dee1cb5190762fe06bad56dd40dd47 Reviewed-by: Joerg Bornemann --- src/3rdparty/angle/src/libANGLE/Debug2.cpp | 303 ----------------------------- src/3rdparty/angle/src/libANGLE/Debug2.h | 120 ------------ src/angle/src/common/gles_common.pri | 12 +- 3 files changed, 3 insertions(+), 432 deletions(-) delete mode 100644 src/3rdparty/angle/src/libANGLE/Debug2.cpp delete mode 100644 src/3rdparty/angle/src/libANGLE/Debug2.h diff --git a/src/3rdparty/angle/src/libANGLE/Debug2.cpp b/src/3rdparty/angle/src/libANGLE/Debug2.cpp deleted file mode 100644 index 30321f4160..0000000000 --- a/src/3rdparty/angle/src/libANGLE/Debug2.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// -// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -// Debug.cpp: Defines debug state used for GL_KHR_debug - -#include "libANGLE/Debug.h" - -#include "common/debug.h" - -#include -#include - -namespace gl -{ - -Debug::Debug() - : mOutputEnabled(false), - mCallbackFunction(nullptr), - mCallbackUserParam(nullptr), - mMessages(), - mMaxLoggedMessages(0), - mOutputSynchronous(false), - mGroups() -{ - pushDefaultGroup(); -} - -void Debug::setMaxLoggedMessages(GLuint maxLoggedMessages) -{ - mMaxLoggedMessages = maxLoggedMessages; -} - -void Debug::setOutputEnabled(bool enabled) -{ - mOutputEnabled = enabled; -} - -bool Debug::isOutputEnabled() const -{ - return mOutputEnabled; -} - -void Debug::setOutputSynchronous(bool synchronous) -{ - mOutputSynchronous = synchronous; -} - -bool Debug::isOutputSynchronous() const -{ - return mOutputSynchronous; -} - -void Debug::setCallback(GLDEBUGPROCKHR callback, const void *userParam) -{ - mCallbackFunction = callback; - mCallbackUserParam = userParam; -} - -GLDEBUGPROCKHR Debug::getCallback() const -{ - return mCallbackFunction; -} - -const void *Debug::getUserParam() const -{ - return mCallbackUserParam; -} - -void Debug::insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - const std::string &message) -{ - std::string messageCopy(message); - insertMessage(source, type, id, severity, std::move(messageCopy)); -} - -void Debug::insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - std::string &&message) -{ - if (!isMessageEnabled(source, type, id, severity)) - { - return; - } - - if (mCallbackFunction != nullptr) - { - // TODO(geofflang) Check the synchronous flag and potentially flush messages from another - // thread. - mCallbackFunction(source, type, id, severity, static_cast(message.length()), - message.c_str(), mCallbackUserParam); - } - else - { - if (mMessages.size() >= mMaxLoggedMessages) - { - // Drop messages over the limit - return; - } - - Message m; - m.source = source; - m.type = type; - m.id = id; - m.severity = severity; - m.message = std::move(message); - - mMessages.push_back(std::move(m)); - } -} - -size_t Debug::getMessages(GLuint count, - GLsizei bufSize, - GLenum *sources, - GLenum *types, - GLuint *ids, - GLenum *severities, - GLsizei *lengths, - GLchar *messageLog) -{ - size_t messageCount = 0; - size_t messageStringIndex = 0; - while (messageCount <= count && !mMessages.empty()) - { - const Message &m = mMessages.front(); - - if (messageLog != nullptr) - { - // Check that this message can fit in the message buffer - if (messageStringIndex + m.message.length() + 1 > static_cast(bufSize)) - { - break; - } - - std::copy(m.message.begin(), m.message.end(), messageLog + messageStringIndex); - messageStringIndex += m.message.length(); - - messageLog[messageStringIndex] = '\0'; - messageStringIndex += 1; - } - - if (sources != nullptr) - { - sources[messageCount] = m.source; - } - - if (types != nullptr) - { - types[messageCount] = m.type; - } - - if (ids != nullptr) - { - ids[messageCount] = m.id; - } - - if (severities != nullptr) - { - severities[messageCount] = m.severity; - } - - if (lengths != nullptr) - { - lengths[messageCount] = static_cast(m.message.length()); - } - - mMessages.pop_front(); - - messageCount++; - } - - return messageCount; -} - -size_t Debug::getNextMessageLength() const -{ - return mMessages.empty() ? 0 : mMessages.front().message.length(); -} - -size_t Debug::getMessageCount() const -{ - return mMessages.size(); -} - -void Debug::setMessageControl(GLenum source, - GLenum type, - GLenum severity, - std::vector &&ids, - bool enabled) -{ - Control c; - c.source = source; - c.type = type; - c.severity = severity; - c.ids = std::move(ids); - c.enabled = enabled; - - auto &controls = mGroups.back().controls; - controls.push_back(std::move(c)); -} - -void Debug::pushGroup(GLenum source, GLuint id, std::string &&message) -{ - insertMessage(source, GL_DEBUG_TYPE_PUSH_GROUP, id, GL_DEBUG_SEVERITY_NOTIFICATION, - std::string(message)); - - Group g; - g.source = source; - g.id = id; - g.message = std::move(message); - mGroups.push_back(std::move(g)); -} - -void Debug::popGroup() -{ - // Make sure the default group is not about to be popped - ASSERT(mGroups.size() > 1); - - Group g = mGroups.back(); - mGroups.pop_back(); - - insertMessage(g.source, GL_DEBUG_TYPE_POP_GROUP, g.id, GL_DEBUG_SEVERITY_NOTIFICATION, - g.message); -} - -size_t Debug::getGroupStackDepth() const -{ - return mGroups.size(); -} - -bool Debug::isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const -{ - if (!mOutputEnabled) - { - return false; - } - - for (auto groupIter = mGroups.rbegin(); groupIter != mGroups.rend(); groupIter++) - { - const auto &controls = groupIter->controls; - for (auto controlIter = controls.rbegin(); controlIter != controls.rend(); controlIter++) - { - const auto &control = *controlIter; - - if (control.source != GL_DONT_CARE && control.source != source) - { - continue; - } - - if (control.type != GL_DONT_CARE && control.type != type) - { - continue; - } - - if (control.severity != GL_DONT_CARE && control.severity != severity) - { - continue; - } - - if (!control.ids.empty() && - std::find(control.ids.begin(), control.ids.end(), id) == control.ids.end()) - { - continue; - } - - return control.enabled; - } - } - - return true; -} - -void Debug::pushDefaultGroup() -{ - Group g; - g.source = GL_NONE; - g.id = 0; - g.message = ""; - - Control c0; - c0.source = GL_DONT_CARE; - c0.type = GL_DONT_CARE; - c0.severity = GL_DONT_CARE; - c0.enabled = true; - g.controls.push_back(std::move(c0)); - - Control c1; - c1.source = GL_DONT_CARE; - c1.type = GL_DONT_CARE; - c1.severity = GL_DEBUG_SEVERITY_LOW; - c1.enabled = false; - g.controls.push_back(std::move(c1)); - - mGroups.push_back(std::move(g)); -} -} // namespace gl diff --git a/src/3rdparty/angle/src/libANGLE/Debug2.h b/src/3rdparty/angle/src/libANGLE/Debug2.h deleted file mode 100644 index f545b815e4..0000000000 --- a/src/3rdparty/angle/src/libANGLE/Debug2.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -// Debug.h: Defines debug state used for GL_KHR_debug - -#ifndef LIBANGLE_DEBUG_H_ -#define LIBANGLE_DEBUG_H_ - -#include "angle_gl.h" -#include "common/angleutils.h" - -#include -#include -#include - -namespace gl -{ - -class LabeledObject -{ - public: - virtual ~LabeledObject() {} - virtual void setLabel(const std::string &label) = 0; - virtual const std::string &getLabel() const = 0; -}; - -class Debug : angle::NonCopyable -{ - public: - Debug(); - - void setMaxLoggedMessages(GLuint maxLoggedMessages); - - void setOutputEnabled(bool enabled); - bool isOutputEnabled() const; - - void setOutputSynchronous(bool synchronous); - bool isOutputSynchronous() const; - - void setCallback(GLDEBUGPROCKHR callback, const void *userParam); - GLDEBUGPROCKHR getCallback() const; - const void *getUserParam() const; - - void insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - const std::string &message); - void insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - std::string &&message); - - void setMessageControl(GLenum source, - GLenum type, - GLenum severity, - std::vector &&ids, - bool enabled); - size_t getMessages(GLuint count, - GLsizei bufSize, - GLenum *sources, - GLenum *types, - GLuint *ids, - GLenum *severities, - GLsizei *lengths, - GLchar *messageLog); - size_t getNextMessageLength() const; - size_t getMessageCount() const; - - void pushGroup(GLenum source, GLuint id, std::string &&message); - void popGroup(); - size_t getGroupStackDepth() const; - - private: - bool isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const; - - void pushDefaultGroup(); - - struct Message - { - GLenum source; - GLenum type; - GLuint id; - GLenum severity; - std::string message; - }; - - struct Control - { - GLenum source; - GLenum type; - GLenum severity; - std::vector ids; - bool enabled; - }; - - struct Group - { - GLenum source; - GLuint id; - std::string message; - - std::vector controls; - }; - - bool mOutputEnabled; - GLDEBUGPROCKHR mCallbackFunction; - const void *mCallbackUserParam; - std::deque mMessages; - GLuint mMaxLoggedMessages; - bool mOutputSynchronous; - std::vector mGroups; -}; -} // namespace gl - -#endif // LIBANGLE_DEBUG_H_ diff --git a/src/angle/src/common/gles_common.pri b/src/angle/src/common/gles_common.pri index 5d5682a1df..82d38a62e6 100644 --- a/src/angle/src/common/gles_common.pri +++ b/src/angle/src/common/gles_common.pri @@ -1,4 +1,4 @@ -CONFIG += simd no_batch +CONFIG += simd no_batch object_parallel_to_source include(common.pri) INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libANGLE @@ -48,6 +48,7 @@ HEADERS += \ $$ANGLE_DIR/src/libANGLE/Constants.h \ $$ANGLE_DIR/src/libANGLE/Context.h \ $$ANGLE_DIR/src/libANGLE/Data.h \ + $$ANGLE_DIR/src/libANGLE/Debug.h \ $$ANGLE_DIR/src/libANGLE/Device.h \ $$ANGLE_DIR/src/libANGLE/Display.h \ $$ANGLE_DIR/src/libANGLE/Error.h \ @@ -169,6 +170,7 @@ SOURCES += \ $$ANGLE_DIR/src/libANGLE/Config.cpp \ $$ANGLE_DIR/src/libANGLE/Context.cpp \ $$ANGLE_DIR/src/libANGLE/Data.cpp \ + $$ANGLE_DIR/src/libANGLE/Debug.cpp \ $$ANGLE_DIR/src/libANGLE/Device.cpp \ $$ANGLE_DIR/src/libANGLE/Display.cpp \ $$ANGLE_DIR/src/libANGLE/Error.cpp \ @@ -241,14 +243,6 @@ SOURCES += \ SSE2_SOURCES += $$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimageSSE2.cpp -DEBUG_SOURCE = $$ANGLE_DIR/src/libANGLE/Debug.cpp -debug_copy.input = DEBUG_SOURCE -debug_copy.output = $$ANGLE_DIR/src/libANGLE/Debug2.cpp -debug_copy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -debug_copy.variable_out = GENERATED_SOURCES -debug_copy.CONFIG = target_predeps -QMAKE_EXTRA_COMPILERS += debug_copy - angle_d3d11 { HEADERS += \ $$ANGLE_DIR/src/libANGLE/renderer/d3d/d3d11/Blit11.h \ -- cgit v1.2.3 From fef6b31b994befac0ee14391572ebc2b9b33e104 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Feb 2018 14:40:46 +0100 Subject: GTK: fix menu positioning on high-DPI The target position is passed in physical native pixels, so call QPlatformWindow::mapToGlobal() instead of QWindow::mapToGlobal(). The latter operates on logical pixels. Task-number: QTBUG-55251 Change-Id: I789128a0a345d4113fced82ed1b215fe14044634 Reviewed-by: Friedemann Kleint --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 99407a21de..cdd1abaf7d 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -41,6 +41,7 @@ #include #include +#include #undef signals #include @@ -450,8 +451,9 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); - if (parentWindow) - m_targetPos = parentWindow->mapToGlobal(m_targetPos); + QPlatformWindow *pw = parentWindow ? parentWindow->handle() : nullptr; + if (pw) + m_targetPos = pw->mapToGlobal(m_targetPos); gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); } -- cgit v1.2.3 From efd5d7a837e7aa51ec64d9636932c0c83189f399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 5 Feb 2018 13:41:37 +0100 Subject: CoreText: Make sure to keep reference to data when cloning raw font engine QFontEngine::cloneWithSize() is used by QRawFont internally when switching a raw-font from one size to another using setPixelSize. For CoreText, we use a subclass of QCoreTextFontEngine to keep track of the QByteArray data of a raw-font, but failed to overload cloneWithSize, so we would lose the data whenever setPixelSize was called, resulting in missing text rendering in QtWebKit. We now retain the data as we should. Task-number: QTBUG-65923 Change-Id: I7d4186a3c32a61d48d1e9388e43f2792e8e46081 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/mac/qfontengine_coretext.mm | 8 +++++ .../fontdatabases/mac/qfontengine_coretext_p.h | 2 +- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 39 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 66baf162d9..d96158d8f6 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -192,6 +192,14 @@ public: : QCoreTextFontEngine(font, def) , m_fontData(fontData) {} + QFontEngine *cloneWithSize(qreal pixelSize) const + { + QFontDef newFontDef = fontDef; + newFontDef.pixelSize = pixelSize; + newFontDef.pointSize = pixelSize * 72.0 / qt_defaultDpi(); + + return new QCoreTextRawFontEngine(cgFont, newFontDef, m_fontData); + } QByteArray m_fontData; }; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 2986f0aaec..d4c5e70cc1 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -125,7 +125,7 @@ public: static QFontEngine::GlyphFormat defaultGlyphFormat; static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); -private: +protected: void init(); QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool colorful, const QTransform &m); CTFontRef ctfont; diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index 37f94d0278..373ad7fef9 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -93,6 +93,9 @@ private slots: void fallbackFontsOrder(); + void qtbug65923_partal_clone_data(); + void qtbug65923_partal_clone(); + private: QString testFont; QString testFontBoldItalic; @@ -1044,6 +1047,42 @@ void tst_QRawFont::fallbackFontsOrder() fontDatabase.removeApplicationFont(id); } +void tst_QRawFont::qtbug65923_partal_clone_data() +{ + QTest::addColumn("shouldClone"); + + QTest::newRow("Without cloning font engine") << false; + QTest::newRow("Cloning font engine") << true; +} + +void tst_QRawFont::qtbug65923_partal_clone() +{ + QFile file(testFont); + file.open(QIODevice::ReadOnly); + QByteArray fontData = file.readAll(); + + QRawFont outerFont; + + { + QRawFont innerFont(fontData, 16, QFont::PreferDefaultHinting); + + QFETCH(bool, shouldClone); + if (shouldClone) { + // This will trigger QFontEngine::cloneWithSize + innerFont.setPixelSize(innerFont.pixelSize() + 1); + } + + outerFont = innerFont; + } + + // This will detach if data is shared with the raw font. If the raw font has + // a naked reference to the data, without informing Qt of it via the ref count + // of the byte array, this will result in clearing 'live' data. + fontData.fill('\0'); + + QVERIFY(!outerFont.boundingRect(42).isEmpty()); +} + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QRawFont) -- cgit v1.2.3 From ce8e72d04012620d8243bfa38db087b5194b68c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 1 Feb 2018 12:17:48 +0100 Subject: Android: Defer initialization of logging rules until qApp construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Android, we load the application library, and its dependencies (Qt), on Android's main thread (thread 0), and then spin up a secondary thread (thread 1), that we call main() on. If any QObject is constructed during loading of the application library or any of Qt's libraries, via static initializers or constructor functions, we will set QCoreApplicationPrivate::theMainThread to thread 0, which will confuse Qt later on when it's being run on thread 1, and will result in a warning during QCoreApplication construction: QApplication was not created in the main() thread This situation can easily lead to a crash as well. Unfortunately logging via qDebug/qCDebug and friends will trigger this too, as they internally use QObject. Fixing the root cause of this is under investigation, but for now we will partially revert fa2a653b3b934783 for Android. The effect is that any qCDebug with a "qt.*" category before qApp construction will turn into a no-op, like it was before fa2a653b3b934783. This patch does not cover the case of a regular qDebug, or a qCDebug with a non-Qt category. Those will still produce the same symptom, as before fa2a653b3b934783. Task-number: QTBUG-65863 Change-Id: I95675731d233244530d0a2a1c82a9578d5599775 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø (cherry picked from commit 538b1b50764fb3a1898d425a7155319afbcf3b25) --- src/corelib/io/qloggingregistry.cpp | 10 ++++++++++ src/corelib/kernel/qcoreapplication.cpp | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index b5f8e30b80..cd97268d71 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -44,6 +44,7 @@ #include #include #include +#include // We can't use the default macros because this would lead to recursion. // Instead let's define our own one that unconditionally logs... @@ -255,6 +256,15 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line) QLoggingRegistry::QLoggingRegistry() : categoryFilter(defaultCategoryFilter) { +#if defined(Q_OS_ANDROID) + // Unless QCoreApplication has been constructed we can't be sure that + // we are on Qt's main thread. If we did allow logging here, we would + // potentially set Qt's main thread to Android's thread 0, which would + // confuse Qt later when running main(). + if (!qApp) + return; +#endif + initializeRules(); // Init on first use } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 12c2669f36..c8b130bbb9 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -776,6 +776,14 @@ void QCoreApplicationPrivate::init() if (!coreappdata()->applicationVersionSet) coreappdata()->applicationVersion = appVersion(); +#if defined(Q_OS_ANDROID) + // We've deferred initializing the logging registry due to not being + // able to guarantee that logging happened on the same thread as the + // Qt main thread, but now that the Qt main thread is set up, we can + // enable categorized logging. + QLoggingRegistry::instance()->initializeRules(); +#endif + #if QT_CONFIG(library) // Reset the lib paths, so that they will be recomputed, taking the availability of argv[0] // into account. If necessary, recompute right away and replay the manual changes on top of the -- cgit v1.2.3 From 36171af399e24095a0836e05a519a19e161a278e Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Sat, 2 Dec 2017 10:36:12 -0500 Subject: Make use of our egl convenience code for QNX QPA This fixes various problems that occur because the current egl context assumes OpenGL ES 2.0 and does not support newer versions of ES. Task-number: QTBUG-64306 Change-Id: I81466ba5cf028b47ca5a2ebcdc702167aff655a2 Reviewed-by: James McDonnell --- src/plugins/platforms/qnx/qnx.pro | 4 +- src/plugins/platforms/qnx/qqnxeglwindow.cpp | 130 +++++++------- src/plugins/platforms/qnx/qqnxeglwindow.h | 16 +- src/plugins/platforms/qnx/qqnxglcontext.cpp | 206 ++-------------------- src/plugins/platforms/qnx/qqnxglcontext.h | 30 +--- src/plugins/platforms/qnx/qqnxintegration.cpp | 53 +++++- src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 2 +- src/plugins/platforms/qnx/qqnxscreen.h | 10 +- src/plugins/platforms/qnx/qqnxwindow.h | 3 +- 9 files changed, 159 insertions(+), 295 deletions(-) diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 15d33200e5..96bfa1dd19 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -71,14 +71,14 @@ HEADERS = main.h \ LIBS += -lscreen -qtConfig(opengles2) { +qtConfig(egl) { SOURCES += qqnxglcontext.cpp \ qqnxeglwindow.cpp HEADERS += qqnxglcontext.h \ qqnxeglwindow.h - QMAKE_USE += opengl_es2 egl + QMAKE_USE += egl } qtConfig(qqnx_pps) { diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp index 33ce0f924c..48766fc435 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp @@ -56,18 +56,12 @@ QT_BEGIN_NAMESPACE QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow) : QQnxWindow(window, context, needRootWindow), - m_platformOpenGLContext(0), m_newSurfaceRequested(true), + m_eglDisplay(EGL_NO_DISPLAY), m_eglSurface(EGL_NO_SURFACE) { initWindow(); - // Set window usage - const int val = SCREEN_USAGE_OPENGL_ES2; - const int result = screen_set_window_property_iv(nativeHandle(), SCREEN_PROPERTY_USAGE, &val); - if (Q_UNLIKELY(result != 0)) - qFatal("QQnxEglWindow: failed to set window alpha usage, errno=%d", errno); - m_requestedBufferSize = shouldMakeFullScreen() ? screen()->geometry().size() : window->geometry().size(); } @@ -77,14 +71,58 @@ QQnxEglWindow::~QQnxEglWindow() destroyEGLSurface(); } -void QQnxEglWindow::createEGLSurface() +bool QQnxEglWindow::isInitialized() const { + return m_eglSurface != EGL_NO_SURFACE; +} + +void QQnxEglWindow::ensureInitialized(QQnxGLContext* context) +{ + if (m_newSurfaceRequested.testAndSetOrdered(true, false)) { + const QMutexLocker locker(&m_mutex); // Set geomety must not reset the requestedBufferSize till + // the surface is created + + if (m_requestedBufferSize != bufferSize() || m_eglSurface == EGL_NO_SURFACE) { + if (m_eglSurface != EGL_NO_SURFACE) { + context->doneCurrent(); + destroyEGLSurface(); + } + createEGLSurface(context); + } else { + // Must've been a sequence of unprocessed changes returning us to the original size. + resetBuffers(); + } + } +} + +void QQnxEglWindow::createEGLSurface(QQnxGLContext *context) +{ + if (context->format().renderableType() != QSurfaceFormat::OpenGLES) { + qFatal("QQnxEglWindow: renderable type is not OpenGLES"); + return; + } + + // Set window usage + int usage = SCREEN_USAGE_OPENGL_ES2; +#if _SCREEN_VERSION >= _SCREEN_MAKE_VERSION(1, 0, 0) + if (context->format().majorVersion() == 3) + usage |= SCREEN_USAGE_OPENGL_ES3; +#endif + + const int result = screen_set_window_property_iv(nativeHandle(), SCREEN_PROPERTY_USAGE, &usage); + if (Q_UNLIKELY(result != 0)) + qFatal("QQnxEglWindow: failed to set window usage, errno=%d", errno); + if (!m_requestedBufferSize.isValid()) { qWarning("QQNX: Trying to create 0 size EGL surface. " "Please set a valid window size before calling QOpenGLContext::makeCurrent()"); return; } + m_eglDisplay = context->eglDisplay(); + m_eglConfig = context->eglConfig(); + m_format = context->format(); + // update the window's buffers before we create the EGL surface setBufferSize(m_requestedBufferSize); @@ -94,24 +132,27 @@ void QQnxEglWindow::createEGLSurface() EGL_NONE }; - qEglWindowDebug() << "Creating EGL surface" << platformOpenGLContext()->getEglDisplay() - << platformOpenGLContext()->getEglConfig(); + qEglWindowDebug() << "Creating EGL surface from" << this << context + << window()->surfaceType() << window()->type(); // Create EGL surface - m_eglSurface = eglCreateWindowSurface(platformOpenGLContext()->getEglDisplay(), - platformOpenGLContext()->getEglConfig(), - (EGLNativeWindowType) nativeHandle(), eglSurfaceAttrs); - if (m_eglSurface == EGL_NO_SURFACE) { - const EGLenum error = QQnxGLContext::checkEGLError("eglCreateWindowSurface"); - qWarning("QQNX: failed to create EGL surface, err=%d", error); - } + EGLSurface eglSurface = eglCreateWindowSurface( + m_eglDisplay, + m_eglConfig, + (EGLNativeWindowType) nativeHandle(), + eglSurfaceAttrs); + + if (eglSurface == EGL_NO_SURFACE) + qWarning("QQNX: failed to create EGL surface, err=%d", eglGetError()); + + m_eglSurface = eglSurface; } void QQnxEglWindow::destroyEGLSurface() { // Destroy EGL surface if it exists if (m_eglSurface != EGL_NO_SURFACE) { - EGLBoolean eglResult = eglDestroySurface(platformOpenGLContext()->getEglDisplay(), m_eglSurface); + EGLBoolean eglResult = eglDestroySurface(m_eglDisplay, m_eglSurface); if (Q_UNLIKELY(eglResult != EGL_TRUE)) qFatal("QQNX: failed to destroy EGL surface, err=%d", eglGetError()); } @@ -119,40 +160,8 @@ void QQnxEglWindow::destroyEGLSurface() m_eglSurface = EGL_NO_SURFACE; } -void QQnxEglWindow::swapEGLBuffers() +EGLSurface QQnxEglWindow::surface() const { - qEglWindowDebug(); - // Set current rendering API - EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to set EGL API, err=%d", eglGetError()); - - // Post EGL surface to window - eglResult = eglSwapBuffers(m_platformOpenGLContext->getEglDisplay(), m_eglSurface); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to swap EGL buffers, err=%d", eglGetError()); - - windowPosted(); -} - -EGLSurface QQnxEglWindow::getSurface() -{ - if (m_newSurfaceRequested.testAndSetOrdered(true, false)) { - const QMutexLocker locker(&m_mutex); //Set geomety must not reset the requestedBufferSize till - //the surface is created - - if ((m_requestedBufferSize != bufferSize()) || (m_eglSurface == EGL_NO_SURFACE)) { - if (m_eglSurface != EGL_NO_SURFACE) { - platformOpenGLContext()->doneCurrent(); - destroyEGLSurface(); - } - createEGLSurface(); - } else { - // Must've been a sequence of unprocessed changes returning us to the original size. - resetBuffers(); - } - } - return m_eglSurface; } @@ -169,35 +178,24 @@ void QQnxEglWindow::setGeometry(const QRect &rect) // that test. const QMutexLocker locker(&m_mutex); m_requestedBufferSize = newGeometry.size(); - if (m_platformOpenGLContext != 0 && bufferSize() != newGeometry.size()) + if (isInitialized() && bufferSize() != newGeometry.size()) m_newSurfaceRequested.testAndSetRelease(false, true); } QQnxWindow::setGeometry(newGeometry); } -void QQnxEglWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext) -{ - // This function does not take ownership of the platform gl context. - // It is owned by the frontend QOpenGLContext - m_platformOpenGLContext = platformOpenGLContext; -} - int QQnxEglWindow::pixelFormat() const { - if (!m_platformOpenGLContext) //The platform GL context was not set yet - return -1; - - const QSurfaceFormat format = m_platformOpenGLContext->format(); // Extract size of color channels from window format - const int redSize = format.redBufferSize(); + const int redSize = m_format.redBufferSize(); if (Q_UNLIKELY(redSize == -1)) qFatal("QQnxWindow: red size not defined"); - const int greenSize = format.greenBufferSize(); + const int greenSize = m_format.greenBufferSize(); if (Q_UNLIKELY(greenSize == -1)) qFatal("QQnxWindow: green size not defined"); - const int blueSize = format.blueBufferSize(); + const int blueSize = m_format.blueBufferSize(); if (Q_UNLIKELY(blueSize == -1)) qFatal("QQnxWindow: blue size not defined"); diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h index 183be11ddc..3a3840f13c 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.h +++ b/src/plugins/platforms/qnx/qqnxeglwindow.h @@ -53,13 +53,10 @@ public: QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow); ~QQnxEglWindow(); - void createEGLSurface(); - void destroyEGLSurface(); - void swapEGLBuffers(); - EGLSurface getSurface(); + EGLSurface surface() const; - void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext); - QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; } + bool isInitialized() const; + void ensureInitialized(QQnxGLContext *context); void setGeometry(const QRect &rect) override; @@ -68,6 +65,9 @@ protected: void resetBuffers() override; private: + void createEGLSurface(QQnxGLContext *context); + void destroyEGLSurface(); + QSize m_requestedBufferSize; // This mutex is used to protect access to the m_requestedBufferSize @@ -78,9 +78,11 @@ private: // QQnxGLContext::makeCurrent() mutable QMutex m_mutex; - QQnxGLContext *m_platformOpenGLContext; QAtomicInt m_newSurfaceRequested; + EGLDisplay m_eglDisplay; + EGLConfig m_eglConfig; EGLSurface m_eglSurface; + QSurfaceFormat m_format; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index d35a4f0bba..d4493943e2 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -59,117 +59,13 @@ QT_BEGIN_NAMESPACE EGLDisplay QQnxGLContext::ms_eglDisplay = EGL_NO_DISPLAY; -QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) - : QPlatformOpenGLContext(), - m_glContext(glContext), - m_currentEglSurface(EGL_NO_SURFACE) +QQnxGLContext::QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : QEGLPlatformContext(format, share, ms_eglDisplay) { - qGLContextDebug(); - QSurfaceFormat format = m_glContext->format(); - - // Set current rendering API - EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to set EGL API, err=%d", eglGetError()); - - // Get colour channel sizes from window format - int alphaSize = format.alphaBufferSize(); - int redSize = format.redBufferSize(); - int greenSize = format.greenBufferSize(); - int blueSize = format.blueBufferSize(); - - // Check if all channels are don't care - if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) { - // Set colour channels based on depth of window's screen - QQnxScreen *screen = static_cast(glContext->screen()->handle()); - int depth = screen->depth(); - if (depth == 32) { - // SCREEN_FORMAT_RGBA8888 - alphaSize = 8; - redSize = 8; - greenSize = 8; - blueSize = 8; - } else { - // SCREEN_FORMAT_RGB565 - alphaSize = 0; - redSize = 5; - greenSize = 6; - blueSize = 5; - } - } else { - // Choose best match based on supported pixel formats - if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) { - // SCREEN_FORMAT_RGB565 - alphaSize = 0; - redSize = 5; - greenSize = 6; - blueSize = 5; - } else { - // SCREEN_FORMAT_RGBA8888 - alphaSize = 8; - redSize = 8; - greenSize = 8; - blueSize = 8; - } - } - - // Update colour channel sizes in window format - format.setAlphaBufferSize(alphaSize); - format.setRedBufferSize(redSize); - format.setGreenBufferSize(greenSize); - format.setBlueBufferSize(blueSize); - - // Select EGL config based on requested window format - m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format); - if (Q_UNLIKELY(m_eglConfig == 0)) - qFatal("QQnxGLContext: failed to find EGL config"); - - QQnxGLContext *glShareContext = static_cast(m_glContext->shareHandle()); - m_eglShareContext = glShareContext ? glShareContext->m_eglContext : EGL_NO_CONTEXT; - - m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, m_eglShareContext, - contextAttrs(format)); - if (Q_UNLIKELY(m_eglContext == EGL_NO_CONTEXT)) { - checkEGLError("eglCreateContext"); - qFatal("QQnxGLContext: failed to create EGL context, err=%d", eglGetError()); - } - - // Query/cache window format of selected EGL config - m_windowFormat = q_glFormatFromConfig(ms_eglDisplay, m_eglConfig); } QQnxGLContext::~QQnxGLContext() { - qGLContextDebug(); - - // Cleanup EGL context if it exists - if (m_eglContext != EGL_NO_CONTEXT) - eglDestroyContext(ms_eglDisplay, m_eglContext); -} - -EGLenum QQnxGLContext::checkEGLError(const char *msg) -{ - static const char *errmsg[] = - { - "EGL function succeeded", - "EGL is not initialized, or could not be initialized, for the specified display", - "EGL cannot access a requested resource", - "EGL failed to allocate resources for the requested operation", - "EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list", - "EGLConfig argument does not name a valid EGLConfig", - "EGLContext argument does not name a valid EGLContext", - "EGL current surface of the calling thread is no longer valid", - "EGLDisplay argument does not name a valid EGLDisplay", - "EGL arguments are inconsistent", - "EGLNativePixmapType argument does not refer to a valid native pixmap", - "EGLNativeWindowType argument does not refer to a valid native window", - "EGL one or more argument values are invalid", - "EGLSurface argument does not name a valid surface configured for rendering", - "EGL power management event has occurred", - }; - EGLenum error = eglGetError(); - fprintf(stderr, "%s: %s\n", msg, errmsg[error - EGL_SUCCESS]); - return error; } void QQnxGLContext::initializeContext() @@ -178,16 +74,12 @@ void QQnxGLContext::initializeContext() // Initialize connection to EGL ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (Q_UNLIKELY(ms_eglDisplay == EGL_NO_DISPLAY)) { - checkEGLError("eglGetDisplay"); - qFatal("QQnxGLContext: failed to obtain EGL display"); - } + if (Q_UNLIKELY(ms_eglDisplay == EGL_NO_DISPLAY)) + qFatal("QQnxGLContext: failed to obtain EGL display: %x", eglGetError()); EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) { - checkEGLError("eglInitialize"); + if (Q_UNLIKELY(eglResult != EGL_TRUE)) qFatal("QQnxGLContext: failed to initialize EGL display, err=%d", eglGetError()); - } } void QQnxGLContext::shutdownContext() @@ -198,98 +90,32 @@ void QQnxGLContext::shutdownContext() eglTerminate(ms_eglDisplay); } -bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) +EGLSurface QQnxGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) { - qGLContextDebug(); - - Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface); - - // Set current rendering API - EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQnxGLContext: failed to set EGL API, err=%d", eglGetError()); - - QQnxEglWindow *platformWindow = dynamic_cast(surface); - if (!platformWindow) - return false; - - platformWindow->setPlatformOpenGLContext(this); - - if (m_currentEglSurface == EGL_NO_SURFACE || m_currentEglSurface != platformWindow->getSurface()) { - m_currentEglSurface = platformWindow->getSurface(); - doneCurrent(); - } - - eglResult = eglMakeCurrent(ms_eglDisplay, m_currentEglSurface, m_currentEglSurface, m_eglContext); - if (eglResult != EGL_TRUE) { - checkEGLError("eglMakeCurrent"); - qWarning("QQNX: failed to set current EGL context, err=%d", eglGetError()); - return false; - } - return (eglResult == EGL_TRUE); + QQnxEglWindow *window = static_cast(surface); + window->ensureInitialized(this); + return window->surface(); } -void QQnxGLContext::doneCurrent() +bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) { qGLContextDebug(); - - // set current rendering API - EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to set EGL API, err=%d", eglGetError()); - - // clear curent EGL context and unbind EGL surface - eglResult = eglMakeCurrent(ms_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to clear current EGL context, err=%d", eglGetError()); + return QEGLPlatformContext::makeCurrent(surface); } void QQnxGLContext::swapBuffers(QPlatformSurface *surface) { qGLContextDebug(); - QQnxEglWindow *platformWindow = dynamic_cast(surface); - if (!platformWindow) - return; - - platformWindow->swapEGLBuffers(); -} -QFunctionPointer QQnxGLContext::getProcAddress(const char *procName) -{ - qGLContextDebug(); + QEGLPlatformContext::swapBuffers(surface); - // Set current rendering API - EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQNX: failed to set EGL API, err=%d", eglGetError()); - - // Lookup EGL extension function pointer - QFunctionPointer result = static_cast(eglGetProcAddress(procName)); - if (!result) - result = reinterpret_cast(dlsym(RTLD_DEFAULT, procName)); - return result; -} - -bool QQnxGLContext::isSharing() const -{ - return m_eglShareContext != EGL_NO_CONTEXT; -} - -EGLDisplay QQnxGLContext::getEglDisplay() { - return ms_eglDisplay; + QQnxEglWindow *platformWindow = static_cast(surface); + platformWindow->windowPosted(); } -EGLint *QQnxGLContext::contextAttrs(const QSurfaceFormat &format) +void QQnxGLContext::doneCurrent() { - qGLContextDebug(); - - // Choose EGL settings based on OpenGL version -#if defined(QT_OPENGL_ES_2) - static EGLint attrs[] = { EGL_CONTEXT_CLIENT_VERSION, format.version().first, EGL_NONE }; - return attrs; -#else - return 0; -#endif + QEGLPlatformContext::doneCurrent(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index 6e5408e8bf..19179a80e2 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -46,49 +46,31 @@ #include #include +#include QT_BEGIN_NAMESPACE class QQnxWindow; -class QQnxGLContext : public QPlatformOpenGLContext +class QQnxGLContext : public QEGLPlatformContext { public: - QQnxGLContext(QOpenGLContext *glContext); + QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share); virtual ~QQnxGLContext(); - static EGLenum checkEGLError(const char *msg); - static void initializeContext(); static void shutdownContext(); - void requestSurfaceChange(); - bool makeCurrent(QPlatformSurface *surface) override; - void doneCurrent() override; void swapBuffers(QPlatformSurface *surface) override; - QFunctionPointer getProcAddress(const char *procName) override; - - virtual QSurfaceFormat format() const override { return m_windowFormat; } - bool isSharing() const override; + void doneCurrent() override; - static EGLDisplay getEglDisplay(); - EGLConfig getEglConfig() const { return m_eglConfig;} - EGLContext getEglContext() const { return m_eglContext; } +protected: + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; private: //Can be static because different displays returne the same handle static EGLDisplay ms_eglDisplay; - - QSurfaceFormat m_windowFormat; - QOpenGLContext *m_glContext; - - EGLConfig m_eglConfig; - EGLContext m_eglContext; - EGLContext m_eglShareContext; - EGLSurface m_currentEglSurface; - - static EGLint *contextAttrs(const QSurfaceFormat &format); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 072510e052..bffe7ee34b 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -313,7 +313,58 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { qIntegrationDebug(); - return new QQnxGLContext(context); + + // Get color channel sizes from window format + QSurfaceFormat format = context->format(); + int alphaSize = format.alphaBufferSize(); + int redSize = format.redBufferSize(); + int greenSize = format.greenBufferSize(); + int blueSize = format.blueBufferSize(); + + // Check if all channels are don't care + if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) { + // Set color channels based on depth of window's screen + QQnxScreen *screen = static_cast(context->screen()->handle()); + int depth = screen->depth(); + if (depth == 32) { + // SCREEN_FORMAT_RGBA8888 + alphaSize = 8; + redSize = 8; + greenSize = 8; + blueSize = 8; + } else { + // SCREEN_FORMAT_RGB565 + alphaSize = 0; + redSize = 5; + greenSize = 6; + blueSize = 5; + } + } else { + // Choose best match based on supported pixel formats + if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) { + // SCREEN_FORMAT_RGB565 + alphaSize = 0; + redSize = 5; + greenSize = 6; + blueSize = 5; + } else { + // SCREEN_FORMAT_RGBA8888 + alphaSize = 8; + redSize = 8; + greenSize = 8; + blueSize = 8; + } + } + + // Update color channel sizes in window format + format.setAlphaBufferSize(alphaSize); + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + context->setFormat(format); + + QQnxGLContext *ctx = new QQnxGLContext(context->format(), context->shareHandle()); + return ctx; } #endif diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 468fe9cd91..3eebb9c742 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -98,7 +98,7 @@ void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resour void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { if (resource == "eglcontext" && context) - return static_cast(context->handle())->getEglContext(); + return static_cast(context->handle())->eglContext(); return 0; } diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 8a498434aa..a6d5623d04 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -49,10 +49,14 @@ #include -// For pre-7.0 SDPs, map some screen property names to the old +#if !defined(_SCREEN_VERSION) +#define _SCREEN_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch)) +#define _SCREEN_VERSION _SCREEN_MAKE_VERSION(0, 0, 0) +#endif + +// For pre-1.0.0 screen, map some screen property names to the old // names. -#include -#if _NTO_VERSION < 700 +#if _SCREEN_VERSION < _SCREEN_MAKE_VERSION(1, 0, 0) const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS; const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS; const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS; diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index e248e04462..223ea6e349 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -112,12 +112,13 @@ public: bool shouldMakeFullScreen() const; + void windowPosted(); + protected: virtual int pixelFormat() const = 0; virtual void resetBuffers() = 0; void initWindow(); - void windowPosted(); screen_context_t m_screenContext; -- cgit v1.2.3 From f1d227bceb5cbf58adbc107aa2e2f83df401d71e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 7 Feb 2018 20:20:34 +0100 Subject: Bump version Change-Id: I668f25fddaf597db4b3b5537379acd3a2f4c4f8f --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 135d1f7de1..57938d9989 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.9.4 +MODULE_VERSION = 5.9.5 -- cgit v1.2.3 From b624cdac21c7fd673c5c9e73be158f3b5fb79bc5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 8 Feb 2018 17:14:38 +0100 Subject: tst_QSharedPointer: Fix termination of external processes on Windows Timeouts with subsequent failures to delete the temporary directories have been observed in COIN. Previously, QProcess:terminate() was used to end the processes, which does not have any effect on console processes on Windows. Add a helper function which resorts to kill() on failure to terminate(). Change-Id: I05539d1703280d34b392f2e8ff8565b9a04d703c Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qsharedpointer/externaltests.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index 62dd33131b..3e1668522e 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef DEFAULT_MAKESPEC # error DEFAULT_MAKESPEC not defined @@ -69,6 +70,16 @@ static QString makespec() QT_BEGIN_NAMESPACE namespace QTest { #if QT_CONFIG(process) + static void ensureStopped(QProcess &process) + { + if (process.state() == QProcess::Running) { + process.terminate(); + QThread::msleep(20); + if (process.state() == QProcess::Running) + process.kill(); + } + } + class QExternalProcess: public QProcess { protected: @@ -594,7 +605,7 @@ namespace QTest { ok = qmake.waitForFinished(); exitCode = qmake.exitCode(); if (!ok) - qmake.terminate(); + QTest::ensureStopped(qmake); std_out += qmake.readAllStandardOutput(); std_err += qmake.readAllStandardError(); @@ -661,7 +672,7 @@ namespace QTest { make.closeWriteChannel(); bool ok = make.waitForFinished(channelMode == QProcess::ForwardedChannels ? -1 : 60000); if (!ok) - make.terminate(); + QTest::ensureStopped(make); exitCode = make.exitCode(); std_out += make.readAllStandardOutput(); std_err += make.readAllStandardError(); -- cgit v1.2.3 From 44402f50754e9ca260f9cbe8d5e68d899342544d Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Tue, 6 Feb 2018 15:12:22 +0200 Subject: Skip tst_QDBusAbstractAdaptor peer tests The peer Tests for QDBusAbstractAdaptor are so flaky that it's very difficult to get any commits through to qtbase. Task-number: QTBUG-66216 Change-Id: I8da80f71aa832e683f72129cb2d4785425d39c00 Reviewed-by: Ville Voutilainen Reviewed-by: Sami Nurmenniemi Reviewed-by: Friedemann Kleint --- .../dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index 20cd8caad3..80f22ad867 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -1083,6 +1083,7 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer_data() void tst_QDBusAbstractAdaptor::methodCallsPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); if (QSysInfo::productType().compare("opensuse", Qt::CaseInsensitive) == 0 && QSysInfo::productVersion() == QLatin1String("42.1") && qgetenv("QTEST_ENVIRONMENT").split(' ').contains("ci")) { @@ -1150,6 +1151,7 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer() void tst_QDBusAbstractAdaptor::methodCallScriptablePeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1169,6 +1171,7 @@ void tst_QDBusAbstractAdaptor::signalEmissionsPeer_data() void tst_QDBusAbstractAdaptor::signalEmissionsPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QFETCH(QString, interface); QFETCH(QString, name); QFETCH(QVariant, parameter); @@ -1233,6 +1236,7 @@ void tst_QDBusAbstractAdaptor::signalEmissionsPeer() void tst_QDBusAbstractAdaptor::sameSignalDifferentPathsPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1261,6 +1265,7 @@ void tst_QDBusAbstractAdaptor::sameSignalDifferentPathsPeer() void tst_QDBusAbstractAdaptor::sameObjectDifferentPathsPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1283,6 +1288,7 @@ void tst_QDBusAbstractAdaptor::sameObjectDifferentPathsPeer() void tst_QDBusAbstractAdaptor::scriptableSignalOrNotPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer");; QVERIFY(con.isConnected()); @@ -1356,6 +1362,7 @@ void tst_QDBusAbstractAdaptor::overloadedSignalEmissionPeer_data() void tst_QDBusAbstractAdaptor::overloadedSignalEmissionPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1407,6 +1414,7 @@ void tst_QDBusAbstractAdaptor::overloadedSignalEmissionPeer() void tst_QDBusAbstractAdaptor::readPropertiesPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1431,6 +1439,7 @@ void tst_QDBusAbstractAdaptor::readPropertiesPeer() void tst_QDBusAbstractAdaptor::readPropertiesInvalidInterfacePeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1451,6 +1460,7 @@ void tst_QDBusAbstractAdaptor::readPropertiesEmptyInterfacePeer_data() void tst_QDBusAbstractAdaptor::readPropertiesEmptyInterfacePeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1481,6 +1491,7 @@ void tst_QDBusAbstractAdaptor::readPropertiesEmptyInterfacePeer() void tst_QDBusAbstractAdaptor::readAllPropertiesPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1507,6 +1518,7 @@ void tst_QDBusAbstractAdaptor::readAllPropertiesPeer() void tst_QDBusAbstractAdaptor::readAllPropertiesInvalidInterfacePeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1572,6 +1584,7 @@ void tst_QDBusAbstractAdaptor::readAllPropertiesEmptyInterfacePeer() void tst_QDBusAbstractAdaptor::writePropertiesPeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); @@ -1883,6 +1896,7 @@ void tst_QDBusAbstractAdaptor::methodWithMoreThanOneReturnValue() void tst_QDBusAbstractAdaptor::methodWithMoreThanOneReturnValuePeer() { + QSKIP("Test is currently too flaky (QTBUG-66223)"); QDBusConnection con("peer"); QVERIFY(con.isConnected()); -- cgit v1.2.3 From 9ac09dcc6848ef04698ec1ec33c176c433309c68 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Tue, 6 Feb 2018 13:05:15 +0200 Subject: Blacklist flaky cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-66216 Change-Id: Iae973c1224c940752e2c3162d8c64539966ff7ac Reviewed-by: Tony Sarajärvi Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/BLACKLIST | 3 +++ tests/auto/network/socket/qtcpsocket/BLACKLIST | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index d4c83bc40b..f546f38b9e 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -22,6 +22,9 @@ windows windows [ioPostToHttpFromSocket] windows +# QTBUG-66247 +[ioHttpRedirect] +windows [ioHttpRedirectMultipartPost] linux [ioHttpRedirectPolicy] diff --git a/tests/auto/network/socket/qtcpsocket/BLACKLIST b/tests/auto/network/socket/qtcpsocket/BLACKLIST index 96e59e5678..d724897b74 100644 --- a/tests/auto/network/socket/qtcpsocket/BLACKLIST +++ b/tests/auto/network/socket/qtcpsocket/BLACKLIST @@ -8,4 +8,6 @@ windows windows [timeoutConnect:ip] windows -] +# QTBUG-66247 +[taskQtBug5799ConnectionErrorEventLoop] +windows -- cgit v1.2.3 From c19d532393f54229173fd6c0adcce041fa4fd635 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 2 Feb 2018 16:46:03 +0200 Subject: Fix tst_QTcpServer::maxPendingConnections flakiness Task-number: QTBUG-63152 Change-Id: I5ccd07f31d47048d81e85f69e1327f4f7c760257 Reviewed-by: Timur Pocheptsov --- tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 31f82539aa..161d94d642 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -420,13 +420,20 @@ void tst_QTcpServer::maxPendingConnections() QTcpSocket socket2; QTcpSocket socket3; + QSignalSpy spy(&server, SIGNAL(newConnection())); QVERIFY(server.listen()); socket1.connectToHost(QHostAddress::LocalHost, server.serverPort()); socket2.connectToHost(QHostAddress::LocalHost, server.serverPort()); socket3.connectToHost(QHostAddress::LocalHost, server.serverPort()); - QVERIFY(server.waitForNewConnection(5000)); + // We must have two and only two connections. First compare waits until + // two connections have been made. The second compare makes sure no + // more are accepted. Creating connections happens multithreaded so + // qWait must be used for that. + QTRY_COMPARE(spy.count(), 2); + QTest::qWait(100); + QCOMPARE(spy.count(), 2); QVERIFY(server.hasPendingConnections()); QVERIFY(server.nextPendingConnection()); -- cgit v1.2.3 From a72b6fe67685aad93062ca491e4e4cde7a87158c Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 8 Feb 2018 13:00:52 +0100 Subject: Blacklist tst_QtConcurrentMap::qFutureAssignmentLeak This test was blacklisted in 5.10 on opensuse, but it fails a lot on ubuntu as well. While we are discussing a real fix for this, temporarily get this out of the way. Task-number: QTBUG-63152 Change-Id: I4f1d3b261013052636ee13eda30f94b647a43a38 Reviewed-by: Sami Nurmenniemi Reviewed-by: Simon Hausmann --- tests/auto/concurrent/qtconcurrentmap/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/concurrent/qtconcurrentmap/BLACKLIST diff --git a/tests/auto/concurrent/qtconcurrentmap/BLACKLIST b/tests/auto/concurrent/qtconcurrentmap/BLACKLIST new file mode 100644 index 0000000000..c92cc3e0f1 --- /dev/null +++ b/tests/auto/concurrent/qtconcurrentmap/BLACKLIST @@ -0,0 +1,3 @@ +[qFutureAssignmentLeak] +ci opensuse-42.3 +ci ubuntu-16.04 -- cgit v1.2.3 From a0da6df87be550eb3cd69e7c8de77ae781d8488b Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 14:09:38 +0200 Subject: Blacklist a flaky menubar test Task-number: QTBUG-66255 Change-Id: Ia7c493496c3fbd551e724853e4f70e3500a1bb74 Reviewed-by: Simon Hausmann --- tests/auto/widgets/widgets/qmenubar/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST index e2194e69ca..3bfd34782e 100644 --- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST @@ -1,3 +1,6 @@ [check_menuPosition] ubuntu-14.04 ubuntu-16.04 +#QTBUG-66255 +[activatedCount] +* -- cgit v1.2.3 From 72918d196c3617fb1cb9aee2c5f1a88e3bc30041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 30 Jan 2018 16:40:26 +0100 Subject: Android: Don't rely on QDir::homePath() to get the application directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the QLoggingRegistry gets called as part of the static initialization phase, it would call into Android's QStandarPaths implementation, which assumed that the HOME env. variable was already set. Since the variable isn't set before main is called, QDir::homePath() returns the root path, which would be cached and always returned. With this fix we now call Android's getFilesDir() directly, which will always return the right path. Since the font locations are also relying on an environment variable being set, we no longer cache that either. Task-number: QTBUG-65820 Change-Id: If45f3d5f0e87b808a62118ae95c31b492885646a Reviewed-by: Tor Arne Vestbø Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit eadf9e542fcc42597bfe02df065fc4cefa94cd56) --- src/corelib/io/qstandardpaths_android.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qstandardpaths_android.cpp b/src/corelib/io/qstandardpaths_android.cpp index 2a44daf8b5..0667d170c7 100644 --- a/src/corelib/io/qstandardpaths_android.cpp +++ b/src/corelib/io/qstandardpaths_android.cpp @@ -217,7 +217,16 @@ static QString getFilesDir() if (!path.isEmpty()) return path; - return (path = QDir::homePath()); + QJNIObjectPrivate appCtx = applicationContext(); + if (!appCtx.isValid()) + return QString(); + + QJNIObjectPrivate file = appCtx.callObjectMethod("getFilesDir", + "()Ljava/io/File;"); + if (!file.isValid()) + return QString(); + + return (path = getAbsolutePath(file)); } QString QStandardPaths::writableLocation(StandardLocation type) @@ -319,7 +328,9 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) if (!ba.isEmpty()) return QStringList((fontLocation = QDir::cleanPath(QString::fromLocal8Bit(ba)))); - return QStringList((fontLocation = QLatin1String("/system/fonts"))); + // Don't cache the fallback, as we might just have been called before + // QT_ANDROID_FONT_LOCATION has been set. + return QStringList(QLatin1String("/system/fonts")); } return QStringList(writableLocation(type)); -- cgit v1.2.3 From 38b6ac6544f2afb54466088a0e1e3cc771a2fd94 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Fri, 9 Feb 2018 16:59:36 +0200 Subject: Skip tst_QFile::largeUncFileSupport If more than one VM tries to run the test at the same time, it times out. These sharing violations were attempted to be worked around in 1c3dc8cfb, but the workaround just leads to timeout, not success. Task-number: QTQAINFRA-1727 Task-number: QTBUG-66216 Change-Id: If8bfd60dbb6575843680971d45b1c82e5beff534 Reviewed-by: Friedemann Kleint Reviewed-by: Sami Nurmenniemi --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 5f0eae6fc3..e92f6df419 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1642,6 +1642,15 @@ static bool fOpen(const QByteArray &fileName, const char *mode, FILE **file) void tst_QFile::largeUncFileSupport() { + // Currently there is a single network test server that is used by all VMs running tests in + // the CI. This test accesses a file shared with Samba on that server. Unfortunately many + // clients accessing the file at the same time is a sharing violation. This test already + // attempted to deal with the problem with retries, but that has led to the test timing out, + // not eventually succeeding. Due to the timeouts blacklisting the test wouldn't help. + // See https://bugreports.qt.io/browse/QTQAINFRA-1727 which will be resolved by the new + // test server architecture where the server is no longer shared. + QSKIP("Multiple instances of running this test at the same time fail due to QTQAINFRA-1727"); + qint64 size = Q_INT64_C(8589934592); qint64 dataOffset = Q_INT64_C(8589914592); QByteArray knownData("LargeFile content at offset 8589914592"); -- cgit v1.2.3 From a211d5379bba700766b5f626e4ab795a641a3eb3 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Sat, 10 Feb 2018 14:08:17 +0200 Subject: Blacklist a flaky scrollbar test on macos Task-number: QTBUG-66321 Change-Id: Ib632ffad993e178305884170fdfe17809ea1e1e6 Reviewed-by: Sami Nurmenniemi Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qscrollbar/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/widgets/widgets/qscrollbar/BLACKLIST diff --git a/tests/auto/widgets/widgets/qscrollbar/BLACKLIST b/tests/auto/widgets/widgets/qscrollbar/BLACKLIST new file mode 100644 index 0000000000..277ae4d260 --- /dev/null +++ b/tests/auto/widgets/widgets/qscrollbar/BLACKLIST @@ -0,0 +1,3 @@ +#QTBUG-66321 +[QTBUG_42871] +macos -- cgit v1.2.3 From da1ca1be51213d73565984aa2f5a29a19d0c2926 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 7 Feb 2018 20:44:19 +0300 Subject: Remove QLibrary code path specific to HP-UX on PA-RISC The only mkspecs that enabled QT_HPUX_LD were removed in ab44ac021de. Change-Id: I9f27f0b487b69c11d19ba76801e3926b7894e6e7 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/plugin/qlibrary_unix.cpp | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 3c4fbaf348..23b9ad6434 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -44,25 +44,17 @@ #include #include +#include + #ifdef Q_OS_MAC # include #endif QT_BEGIN_NAMESPACE -#if !defined(QT_HPUX_LD) -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE -#endif - static QString qdlerror() { -#if !defined(QT_HPUX_LD) const char *err = dlerror(); -#else - const char *err = strerror(errno); -#endif return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString(); } @@ -139,14 +131,6 @@ bool QLibraryPrivate::load_sys() suffixes = suffixes_sys(fullVersion); } int dlFlags = 0; -#if defined(QT_HPUX_LD) - dlFlags = DYNAMIC_PATH | BIND_NONFATAL; - if (loadHints & QLibrary::ResolveAllSymbolsHint) { - dlFlags |= BIND_IMMEDIATE; - } else { - dlFlags |= BIND_DEFERRED; - } -#else int loadHints = this->loadHints(); if (loadHints & QLibrary::ResolveAllSymbolsHint) { dlFlags |= RTLD_NOW; @@ -182,7 +166,6 @@ bool QLibraryPrivate::load_sys() dlFlags |= RTLD_MEMBER; } #endif -#endif // QT_HPUX_LD // If the filename is an absolute path then we want to try that first as it is most likely // what the callee wants. If we have been given a non-absolute path then lets try the @@ -211,11 +194,7 @@ bool QLibraryPrivate::load_sys() } else { attempt = path + prefixes.at(prefix) + name + suffixes.at(suffix); } -#if defined(QT_HPUX_LD) - pHnd = (void*)shl_load(QFile::encodeName(attempt), dlFlags, 0); -#else pHnd = dlopen(QFile::encodeName(attempt), dlFlags); -#endif if (!pHnd && fileName.startsWith(QLatin1Char('/')) && QFile::exists(attempt)) { // We only want to continue if dlopen failed due to that the shared library did not exist. @@ -253,11 +232,7 @@ bool QLibraryPrivate::load_sys() bool QLibraryPrivate::unload_sys() { -#if defined(QT_HPUX_LD) - if (shl_unload((shl_t)pHnd)) { -#else if (dlclose(pHnd)) { -#endif #if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative" @@ -289,13 +264,7 @@ Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symb QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) { -#if defined(QT_HPUX_LD) - QFunctionPointer address = 0; - if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0) - address = 0; -#else QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol)); -#endif if (!address) { errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( QString::fromLatin1(symbol), fileName, qdlerror()); -- cgit v1.2.3 From af18215a955040b7a56a2eb9281ba57dcb459f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 12 Feb 2018 13:36:45 +0200 Subject: Fix build failure when QtNetwork module is not build Affected plugins: tuiotouch, vnc Change-Id: Iabf72e3da0a25de0de2a861c69a29b3887ca81c3 Reviewed-by: Jesus Fernandez --- src/plugins/generic/generic.pro | 2 +- src/plugins/platforms/platforms.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro index e323f32d2c..70e433f89d 100644 --- a/src/plugins/generic/generic.pro +++ b/src/plugins/generic/generic.pro @@ -11,7 +11,7 @@ qtConfig(tslib) { SUBDIRS += tslib } -qtConfig(udpsocket) { +qtHaveModule(network):qtConfig(udpsocket) { SUBDIRS += tuiotouch } diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 9414f01ef0..e61887618f 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -36,7 +36,7 @@ qtConfig(directfb) { qtConfig(linuxfb): SUBDIRS += linuxfb -qtConfig(vnc): SUBDIRS += vnc +qtHaveModule(network):qtConfig(vnc): SUBDIRS += vnc freebsd { SUBDIRS += bsdfb -- cgit v1.2.3 From c7913f3a1f56ce34e3bd4b96cbe1ffef346a5305 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 13 Feb 2018 14:54:34 +0200 Subject: Blacklist a flaky messagebox test Task-number: QTBUG-66371 Change-Id: I95fff726167d9fad2e2fb47891ce357d7025d254 Reviewed-by: Sami Nurmenniemi Reviewed-by: Simon Hausmann --- tests/auto/widgets/dialogs/qmessagebox/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/widgets/dialogs/qmessagebox/BLACKLIST diff --git a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST new file mode 100644 index 0000000000..da52809aad --- /dev/null +++ b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST @@ -0,0 +1,2 @@ +[defaultButton] +* -- cgit v1.2.3 From 3024fd60ae13990e2032bb7ced61c7fbadf50ad8 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 13 Feb 2018 15:38:15 +0200 Subject: Blacklist the positioning test on all linuxes, it fails on opensuse too Task-Id: QTQAINFRA-1332 Change-Id: I38a36c42f88671430452cdde8098961b67854ae7 Reviewed-by: Friedemann Kleint --- tests/auto/gui/kernel/qwindow/BLACKLIST | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index f86388345b..cb18651091 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,6 +1,5 @@ [positioning:default] -ubuntu-14.04 -ubuntu-16.04 +linux osx-10.12 ci [positioning:fake] osx-10.12 ci -- cgit v1.2.3 From b34942710cf4e40bd9a3091032cb14baed741862 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 16:31:40 +0200 Subject: Silence a GCC 8 warning in QIODevice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtbase/src/corelib/io/qiodevice.cpp:688:60: required from here ../../../include/QtCore/../../../../qtbase/src/corelib/tools/qvector.h:727:20: error: ‘void* memmove(void*, const void*, size_t)’ writing to an object of type ‘class QRingBuffer’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] memmove(i, b, (d->size - offset) * sizeof(T)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I9dc9a17c281b71bf2eb3e89116600ec3ba345d74 Reviewed-by: Simon Hausmann --- src/corelib/tools/qvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 74c37faad0..e225ce1ecb 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -724,7 +724,7 @@ typename QVector::iterator QVector::insert(iterator before, size_type n, c } else { T *b = d->begin() + offset; T *i = b + n; - memmove(i, b, (d->size - offset) * sizeof(T)); + memmove(static_cast(i), static_cast(b), (d->size - offset) * sizeof(T)); while (i != b) new (--i) T(copy); } -- cgit v1.2.3 From 77582f1f103b4f86423aa29fc7233678a399938c Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 17:58:38 +0200 Subject: Silence GCC 8 warnings in QString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtbase/src/corelib/tools/qstring.cpp:3539:67: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class QChar’ from an array of ‘short unsigned int’ [-Werror=class-memaccess] memcpy(uc, d->data() + copystart, size * sizeof(QChar)); Change-Id: Ic601bed1a1f9e1b6f0ac1f9e58f1dcadb50ad724 Reviewed-by: Simon Hausmann --- src/corelib/tools/qstring.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index aff384a257..2c96a8d33c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3536,14 +3536,14 @@ QString& QString::replace(const QRegExp &rx, const QString &after) while (i < pos) { int copyend = replacements[i].pos; int size = copyend - copystart; - memcpy(uc, d->data() + copystart, size * sizeof(QChar)); + memcpy(static_cast(uc), static_cast(d->data() + copystart), size * sizeof(QChar)); uc += size; - memcpy(uc, after.d->data(), al * sizeof(QChar)); + memcpy(static_cast(uc), static_cast(after.d->data()), al * sizeof(QChar)); uc += al; copystart = copyend + replacements[i].length; i++; } - memcpy(uc, d->data() + copystart, (d->size - copystart) * sizeof(QChar)); + memcpy(static_cast(uc), static_cast(d->data() + copystart), (d->size - copystart) * sizeof(QChar)); newstring.resize(newlen); *this = newstring; caretMode = QRegExp::CaretWontMatch; @@ -5766,7 +5766,7 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const while (padlen--) * uc++ = fill; if (len) - memcpy(uc, d->data(), sizeof(QChar)*len); + memcpy(static_cast(uc), static_cast(d->data()), sizeof(QChar)*len); } else { if (truncate) result = left(width); -- cgit v1.2.3 From c97632385ec178d34f57062ca834b9908d92f327 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 18:06:55 +0200 Subject: Fix GCC 8 warning in qurlrecode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtbase/src/corelib/io/qurlrecode.cpp:514:86: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class QChar’ from an array of ‘const ushort’ {aka ‘const short unsigned int’} [-Werror=class-memaccess] memcpy(appendTo.begin() + origSize, begin, (end - begin) * sizeof(ushort)); Change-Id: Ide78a4144d6bc63342c3c4334cc97fe73c5167bd Reviewed-by: Simon Hausmann --- src/corelib/io/qurlrecode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index ce90ab49d3..a9b23babc0 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -511,7 +511,7 @@ static int decode(QString &appendTo, const ushort *begin, const ushort *end) if (Q_UNLIKELY(end - input < 3 || !isHex(input[1]) || !isHex(input[2]))) { // badly-encoded data appendTo.resize(origSize + (end - begin)); - memcpy(appendTo.begin() + origSize, begin, (end - begin) * sizeof(ushort)); + memcpy(static_cast(appendTo.begin() + origSize), static_cast(begin), (end - begin) * sizeof(ushort)); return end - begin; } @@ -519,7 +519,7 @@ static int decode(QString &appendTo, const ushort *begin, const ushort *end) // detach appendTo.resize(origSize + (end - begin)); output = reinterpret_cast(appendTo.begin()) + origSize; - memcpy(output, begin, (input - begin) * sizeof(ushort)); + memcpy(static_cast(output), static_cast(begin), (input - begin) * sizeof(ushort)); output += input - begin; } -- cgit v1.2.3 From 517daa6e73fe6fd098741282bfb01cdac36c048a Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 18:25:05 +0200 Subject: Fix GCC 8 warning in qvariantanimation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qtbase/src/corelib/animation/qvariantanimation.cpp:451:13: error: cast between incompatible function types from ‘QVariant (*)(const QRectF&, const QRectF&, qreal)’ {aka ‘QVariant (*)(const QRectF&, const QRectF&, double)’} to ‘QVariantAnimation::Interpolator’ {aka ‘QVariant (*)(const void*, const void*, double)’} [-Werror=cast-function-type] Change-Id: I5398316adaa0f12fbbdfdb200fd796de284821ef Reviewed-by: Simon Hausmann --- src/corelib/animation/qvariantanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 7117092c54..e0d7db144a 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -448,7 +448,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun template static inline QVariantAnimation::Interpolator castToInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) { - return reinterpret_cast(func); + return reinterpret_cast(reinterpret_cast(func)); } QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType) -- cgit v1.2.3 From dfffb5299bf83b87607f28f55afaf3c404910f9f Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 7 Feb 2018 22:13:54 +0200 Subject: Fix build failure of qftp tests Without this fix, a fresh clean build of 5.9 will fail. Change-Id: I69e4da382b07cc6e5e280e99478cbc3d44aa3f27 Reviewed-by: Jesus Fernandez Reviewed-by: Simon Hausmann --- tests/auto/network/access/qftp/tst_qftp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 44ae125d37..b58e9bf558 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "../../../network-settings.h" -- cgit v1.2.3