From 2c9dcfa00468c349375b63b92c55d161eee2289d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 2 Feb 2018 15:20:51 +0200 Subject: [PATCH 01/21] Load Qt libs from Qt thread [ChangeLog][Android] The application and dependent Qt libraries are now loaded on the same thread as main() is run on, ensuring that global static initializers, constructor functions, and main() are all run on the same thread. The same applies during application shutdown, for destructors of global objects, and destructor functions. Change-Id: Id4bfece1ed2a0532ed2e8fb7d8ffd6e55d5a10dc Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/jar/jar.pro | 3 +- .../qt5/android/QtActivityDelegate.java | 4 +- .../org/qtproject/qt5/android/QtNative.java | 134 +++++++++++------- .../qt5/android/QtServiceDelegate.java | 4 + .../org/qtproject/qt5/android/QtThread.java | 112 +++++++++++++++ .../qt5/android/bindings/QtLoader.java | 4 - .../platforms/android/androidjnimain.cpp | 107 +++++++------- 7 files changed, 255 insertions(+), 113 deletions(-) create mode 100644 src/android/jar/src/org/qtproject/qt5/android/QtThread.java diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro index 603e28aeee4..683866a3455 100644 --- a/src/android/jar/jar.pro +++ b/src/android/jar/jar.pro @@ -21,7 +21,8 @@ JAVASOURCES += \ $$PATHPREFIX/ExtractStyle.java \ $$PATHPREFIX/EditMenu.java \ $$PATHPREFIX/EditPopupMenu.java \ - $$PATHPREFIX/CursorHandle.java + $$PATHPREFIX/CursorHandle.java \ + $$PATHPREFIX/QtThread.java # install target.path = $$[QT_INSTALL_PREFIX]/jar diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 0e28b964e89..6b8577116ea 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -921,6 +921,7 @@ public class QtActivityDelegate public void onTerminate() { QtNative.terminateQt(); + QtNative.m_qtThread.exit(); } public void onCreate(Bundle savedInstanceState) @@ -1076,7 +1077,8 @@ public class QtActivityDelegate QtNative.setActivity(null, null); if (m_debuggerProcess != null) m_debuggerProcess.destroy(); - System.exit(0);// FIXME remove it or find a better way + QtNative.m_qtThread.exit(); + System.exit(0); } } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 1cf3bca5f75..3db34532630 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -98,6 +98,7 @@ public class QtNative private static ClipboardManager m_clipboardManager = null; private static Method m_checkSelfPermissionMethod = null; private static Boolean m_tabletEventSupported = null; + public static QtThread m_qtThread = new QtThread(); private static final Runnable runPendingCppRunnablesRunnable = new Runnable() { @Override public void run() { @@ -164,55 +165,64 @@ public class QtNative } // this method loads full path libs - public static void loadQtLibraries(ArrayList libraries) + public static void loadQtLibraries(final ArrayList libraries) { - if (libraries == null) - return; - - for (String libName : libraries) { - try { - File f = new File(libName); - if (f.exists()) - System.load(libName); - } catch (SecurityException e) { - Log.i(QtTAG, "Can't load '" + libName + "'", e); - } catch (Exception e) { - Log.i(QtTAG, "Can't load '" + libName + "'", e); + m_qtThread.run(new Runnable() { + @Override + public void run() { + if (libraries == null) + return; + for (String libName : libraries) { + try { + File f = new File(libName); + if (f.exists()) + System.load(libName); + } catch (SecurityException e) { + Log.i(QtTAG, "Can't load '" + libName + "'", e); + } catch (Exception e) { + Log.i(QtTAG, "Can't load '" + libName + "'", e); + } + } } - } + }); } // this method loads bundled libs by name. - public static void loadBundledLibraries(ArrayList libraries, String nativeLibraryDir) + public static void loadBundledLibraries(final ArrayList libraries, final String nativeLibraryDir) { - if (libraries == null) - return; + m_qtThread.run(new Runnable() { + @Override + public void run() { + if (libraries == null) + return; - for (String libName : libraries) { - try { - String libNameTemplate = "lib" + libName + ".so"; - File f = new File(nativeLibraryDir + libNameTemplate); - if (!f.exists()) { - Log.i(QtTAG, "Can't find '" + f.getAbsolutePath()); + for (String libName : libraries) { try { - ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), - PackageManager.GET_META_DATA); - String systemLibraryDir = QtNativeLibrariesDir.systemLibrariesDir; - if (info.metaData.containsKey("android.app.system_libs_prefix")) - systemLibraryDir = info.metaData.getString("android.app.system_libs_prefix"); - f = new File(systemLibraryDir + libNameTemplate); - } catch (Exception e) { + String libNameTemplate = "lib" + libName + ".so"; + File f = new File(nativeLibraryDir + libNameTemplate); + if (!f.exists()) { + Log.i(QtTAG, "Can't find '" + f.getAbsolutePath()); + try { + ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), + PackageManager.GET_META_DATA); + String systemLibraryDir = QtNativeLibrariesDir.systemLibrariesDir; + if (info.metaData.containsKey("android.app.system_libs_prefix")) + systemLibraryDir = info.metaData.getString("android.app.system_libs_prefix"); + f = new File(systemLibraryDir + libNameTemplate); + } catch (Exception e) { + } + } + if (f.exists()) + System.load(f.getAbsolutePath()); + else + Log.i(QtTAG, "Can't find '" + f.getAbsolutePath()); + } catch (Exception e) { + Log.i(QtTAG, "Can't load '" + libName + "'", e); } } - if (f.exists()) - System.load(f.getAbsolutePath()); - else - Log.i(QtTAG, "Can't find '" + f.getAbsolutePath()); - } catch (Exception e) { - Log.i(QtTAG, "Can't load '" + libName + "'", e); } - } + }); } public static void setActivity(Activity qtMainActivity, QtActivityDelegate qtActivityDelegate) @@ -293,7 +303,7 @@ public class QtNative } public static boolean startApplication(String params, - String environment, + final String environment, String mainLibrary, String nativeLibraryDir) throws Exception { @@ -317,23 +327,42 @@ public class QtNative if (params == null) params = "-platform\tandroid"; - boolean res = false; + final String mainLibraryPath = f.getAbsolutePath(); + final boolean[] res = new boolean[1]; + res[0] = false; synchronized (m_mainActivityMutex) { - res = startQtAndroidPlugin(); - setDisplayMetrics(m_displayMetricsScreenWidthPixels, - m_displayMetricsScreenHeightPixels, - m_displayMetricsDesktopWidthPixels, - m_displayMetricsDesktopHeightPixels, - m_displayMetricsXDpi, - m_displayMetricsYDpi, - m_displayMetricsScaledDensity, - m_displayMetricsDensity); if (params.length() > 0 && !params.startsWith("\t")) params = "\t" + params; - startQtApplication(f.getAbsolutePath() + params, environment); + final String qtParams = f.getAbsolutePath() + params; + m_qtThread.run(new Runnable() { + @Override + public void run() { + try { + System.load(mainLibraryPath); + } catch (Exception e) { + Log.i(QtTAG, "Can't load '" + mainLibraryPath + "'", e); + } + res[0] = startQtAndroidPlugin(qtParams, environment); + setDisplayMetrics(m_displayMetricsScreenWidthPixels, + m_displayMetricsScreenHeightPixels, + m_displayMetricsDesktopWidthPixels, + m_displayMetricsDesktopHeightPixels, + m_displayMetricsXDpi, + m_displayMetricsYDpi, + m_displayMetricsScaledDensity, + m_displayMetricsDensity); + } + }); + m_qtThread.post(new Runnable() { + @Override + public void run() { + startQtApplication(); + } + }); + waitForServiceSetup(); m_started = true; } - return res; + return res[0]; } public static void setApplicationDisplayMetrics(int screenWidthPixels, @@ -377,8 +406,9 @@ public class QtNative // application methods - public static native void startQtApplication(String params, String env); - public static native boolean startQtAndroidPlugin(); + public static native boolean startQtAndroidPlugin(String params, String env); + public static native void startQtApplication(); + public static native void waitForServiceSetup(); public static native void quitQtCoreApplication(); public static native void quitQtAndroidPlugin(); public static native void terminateQt(); diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtServiceDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtServiceDelegate.java index 195ec376c9e..ae06fa6268c 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtServiceDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtServiceDelegate.java @@ -187,6 +187,10 @@ public class QtServiceDelegate public void onDestroy() { QtNative.quitQtCoreApplication(); + QtNative.terminateQt(); + QtNative.setService(null, null); + QtNative.m_qtThread.exit(); + System.exit(0); } public IBinder onBind(Intent intent) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtThread.java b/src/android/jar/src/org/qtproject/qt5/android/QtThread.java new file mode 100644 index 00000000000..975e787345d --- /dev/null +++ b/src/android/jar/src/org/qtproject/qt5/android/QtThread.java @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2018 BogDan Vatra +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Android port 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$ +** +****************************************************************************/ + +package org.qtproject.qt5.android; + +import java.util.ArrayList; +import java.util.concurrent.Semaphore; + +public class QtThread { + private ArrayList m_pendingRunnables = new ArrayList(); + private boolean m_exit = false; + private Thread m_qtThread = new Thread(new Runnable() { + @Override + public void run() { + while (!m_exit) { + try { + ArrayList pendingRunnables; + synchronized (m_qtThread) { + if (m_pendingRunnables.size() == 0) + m_qtThread.wait(); + pendingRunnables = new ArrayList(m_pendingRunnables); + m_pendingRunnables.clear(); + } + for (Runnable runnable : pendingRunnables) + runnable.run(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }); + + QtThread() { + m_qtThread.setName("qtMainLoopThread"); + m_qtThread.start(); + } + + public void post(final Runnable runnable) { + synchronized (m_qtThread) { + m_pendingRunnables.add(runnable); + m_qtThread.notify(); + } + } + + public void run(final Runnable runnable) { + final Semaphore sem = new Semaphore(0); + synchronized (m_qtThread) { + m_pendingRunnables.add(new Runnable() { + @Override + public void run() { + runnable.run(); + sem.release(); + } + }); + m_qtThread.notify(); + } + try { + sem.acquire(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public void exit() + { + m_exit = true; + synchronized (m_qtThread) { + m_qtThread.notify(); + } + try { + m_qtThread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java index 6e92e640281..fb6f61e31e4 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java @@ -243,10 +243,6 @@ public abstract class QtLoader { QtApplication.setQtContextDelegate(m_delegateClass, qtLoader); - // now load the application library so it's accessible from this class loader - if (libName != null) - System.loadLibrary(libName); - Method startAppMethod=qtLoader.getClass().getMethod("startApplication"); if (!(Boolean)startAppMethod.invoke(qtLoader)) throw new Exception(""); diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 2bdd49dc509..13d41bea99c 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -59,6 +59,7 @@ #include "qandroideventdispatcher.h" #include +#include #include #include #include @@ -99,7 +100,6 @@ extern "C" typedef int (*Main)(int, char **); //use the standard main method to static Main m_main = nullptr; static void *m_mainLibraryHnd = nullptr; static QList m_applicationParams; -pthread_t m_qtAppThread = 0; static sem_t m_exitSemaphore, m_terminateSemaphore; QHash m_surfaces; @@ -441,57 +441,10 @@ namespace QtAndroid } // namespace QtAndroid -static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobject applicationAssetManager*/) +static jboolean startQtAndroidPlugin(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString) { m_androidPlatformIntegration = nullptr; m_androidAssetsFileEngineHandler = new AndroidAssetsFileEngineHandler(); - return true; -} - -static void *startMainMethod(void */*data*/) -{ - { - JNIEnv* env = nullptr; - JavaVMAttachArgs args; - args.version = JNI_VERSION_1_6; - args.name = "QtMainThread"; - args.group = NULL; - JavaVM *vm = QtAndroidPrivate::javaVM(); - if (vm != 0) - vm->AttachCurrentThread(&env, &args); - } - - QVarLengthArray params(m_applicationParams.size()); - for (int i = 0; i < m_applicationParams.size(); i++) - params[i] = static_cast(m_applicationParams[i].constData()); - - int ret = m_main(m_applicationParams.length(), const_cast(params.data())); - - if (m_mainLibraryHnd) { - int res = dlclose(m_mainLibraryHnd); - if (res < 0) - qWarning() << "dlclose failed:" << dlerror(); - } - - if (m_applicationClass) - QJNIObjectPrivate::callStaticMethod(m_applicationClass, "quitApp", "()V"); - - // All attached threads should be detached before returning from this function. - JavaVM *vm = QtAndroidPrivate::javaVM(); - if (vm != 0) - vm->DetachCurrentThread(); - - sem_post(&m_terminateSemaphore); - sem_wait(&m_exitSemaphore); - sem_destroy(&m_exitSemaphore); - - // We must call exit() to ensure that all global objects will be destructed - exit(ret); - return 0; -} - -static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString) -{ m_mainLibraryHnd = nullptr; { // Set env. vars const char *nativeString = env->GetStringUTFChars(environmentString, 0); @@ -540,14 +493,54 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para if (sem_init(&m_terminateSemaphore, 0, 0) == -1) return false; - jboolean res = pthread_create(&m_qtAppThread, nullptr, startMainMethod, nullptr) == 0; + return true; +} +static void waitForServiceSetup(JNIEnv *env, jclass /*clazz*/) +{ + Q_UNUSED(env); // The service must wait until the QCoreApplication starts otherwise onBind will be // called too early if (m_serviceObject) QtAndroidPrivate::waitForServiceSetup(); +} - return res; +static jboolean startQtApplication(JNIEnv */*env*/, jclass /*clazz*/) +{ + { + JNIEnv* env = nullptr; + JavaVMAttachArgs args; + args.version = JNI_VERSION_1_6; + args.name = "QtMainThread"; + args.group = NULL; + JavaVM *vm = QtAndroidPrivate::javaVM(); + if (vm != 0) + vm->AttachCurrentThread(&env, &args); + } + + QVarLengthArray params(m_applicationParams.size()); + for (int i = 0; i < m_applicationParams.size(); i++) + params[i] = static_cast(m_applicationParams[i].constData()); + + int ret = m_main(m_applicationParams.length(), const_cast(params.data())); + + if (m_mainLibraryHnd) { + int res = dlclose(m_mainLibraryHnd); + if (res < 0) + qWarning() << "dlclose failed:" << dlerror(); + } + + if (m_applicationClass) { + qWarning("exit app 0"); + QJNIObjectPrivate::callStaticMethod(m_applicationClass, "quitApp", "()V"); + } + + sem_post(&m_terminateSemaphore); + sem_wait(&m_exitSemaphore); + sem_destroy(&m_exitSemaphore); + + // We must call exit() to ensure that all global objects will be destructed + exit(ret); } static void quitQtCoreApplication(JNIEnv *env, jclass /*clazz*/) @@ -593,7 +586,6 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/) if (!QAndroidEventDispatcherStopper::instance()->stopped()) { sem_post(&m_exitSemaphore); - pthread_join(m_qtAppThread, nullptr); } } @@ -758,11 +750,12 @@ static jobject onBind(JNIEnv */*env*/, jclass /*cls*/, jobject intent) } static JNINativeMethod methods[] = { - {"startQtAndroidPlugin", "()Z", (void *)startQtAndroidPlugin}, - {"startQtApplication", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApplication}, + {"startQtAndroidPlugin", "(Ljava/lang/String;Ljava/lang/String;)Z", (void *)startQtAndroidPlugin}, + {"startQtApplication", "()V", (void *)startQtApplication}, {"quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin}, {"quitQtCoreApplication", "()V", (void *)quitQtCoreApplication}, {"terminateQt", "()V", (void *)terminateQt}, + {"waitForServiceSetup", "()V", (void *)waitForServiceSetup}, {"setDisplayMetrics", "(IIIIDDDD)V", (void *)setDisplayMetrics}, {"setSurface", "(ILjava/lang/Object;II)V", (void *)setSurface}, {"updateWindow", "()V", (void *)updateWindow}, @@ -884,7 +877,6 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) void *venv; } UnionJNIEnvToVoid; - __android_log_print(ANDROID_LOG_INFO, "Qt", "qt start"); UnionJNIEnvToVoid uenv; uenv.venv = nullptr; m_javaVM = nullptr; @@ -906,5 +898,10 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); m_javaVM = vm; + // attach qt main thread data to this thread + QObject threadSetter; + if (threadSetter.thread()) + threadSetter.thread()->setObjectName("QtMainLoopThread"); + __android_log_print(ANDROID_LOG_INFO, "Qt", "qt started"); return JNI_VERSION_1_4; } From 138a65e0cfa80b13fd018a01e7d8b33341a3cfd3 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 8 Feb 2018 11:05:42 -0800 Subject: [PATCH 02/21] Remove code paths for macOS < 10.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5ae02d88aa3dcd97d1f2ebf6255a68643e5d6daa Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich Reviewed-by: Konstantin Ritt --- .../fontdatabases/mac/qfontengine_coretext.mm | 16 +++------------- .../platforms/cocoa/qcocoafiledialoghelper.mm | 6 +----- src/plugins/platforms/cocoa/qnswindowdelegate.mm | 16 ---------------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index d388e33daef..675f689aceb 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -47,28 +47,18 @@ #include -#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11) +#if defined(Q_OS_MACOS) #import #endif -#if defined(QT_PLATFORM_UIKIT) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2) +#if defined(QT_PLATFORM_UIKIT) #import #endif // These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework, // but they are not documented and are not in public headers so are private API and exposed // only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857) -#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2) -#define kCTFontWeightUltraLight -0.8 -#define kCTFontWeightThin -0.6 -#define kCTFontWeightLight -0.4 -#define kCTFontWeightRegular 0 -#define kCTFontWeightMedium 0.23 -#define kCTFontWeightSemibold 0.3 -#define kCTFontWeightBold 0.4 -#define kCTFontWeightHeavy 0.56 -#define kCTFontWeightBlack 0.62 -#elif defined(Q_OS_OSX) +#if defined(Q_OS_MACOS) #define kCTFontWeightUltraLight NSFontWeightUltraLight #define kCTFontWeightThin NSFontWeightThin #define kCTFontWeightLight NSFontWeightLight diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 98b9f7c9bae..00bfc8bef5f 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -162,11 +162,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); // resetting our mCurrentDir, set the delegate // here to make sure it gets the correct value. [mSavePanel setDelegate:self]; - -#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11) - if (__builtin_available(macOS 10.11, *)) - mOpenPanel.accessoryViewDisclosed = YES; -#endif + mOpenPanel.accessoryViewDisclosed = YES; if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept)) [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]]; diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index cdecd86dfb2..6e5623d679f 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -80,22 +80,6 @@ static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*")); return NSRectFromCGRect(m_cocoaWindow->screen()->availableGeometry().toCGRect()); } -#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11) -/* - AppKit on OS X 10.10 wrongly calls windowWillUseStandardFrame:defaultFrame - from -[NSWindow _frameForFullScreenMode] when going into fullscreen, resulting - in black bars on top and bottom of the window. By implementing the following - method, AppKit will choose that instead, and resolve the right fullscreen - geometry. -*/ -- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize -{ - Q_UNUSED(proposedSize); - Q_ASSERT(window == m_cocoaWindow->nativeWindow()); - return NSSizeFromCGSize(m_cocoaWindow->screen()->geometry().size().toCGSize()); -} -#endif - - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu { Q_UNUSED(window); From be73b00bc2db6082a38657601bb93449b6999475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 23 Jan 2018 14:48:09 +0100 Subject: [PATCH 03/21] macOS: Bump deployment target to 10.11 Qt 5.11 requires macOS 10.11. Change-Id: Iebbde845805a5ca382c34d0fe9176e8a9f7a2783 Reviewed-by: Gabriel de Dietrich Reviewed-by: Jake Petroules --- mkspecs/macx-clang/qmake.conf | 2 +- mkspecs/macx-g++/qmake.conf | 2 +- mkspecs/macx-icc/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf index 259595221f7..170464d08fc 100644 --- a/mkspecs/macx-clang/qmake.conf +++ b/mkspecs/macx-clang/qmake.conf @@ -2,7 +2,7 @@ # qmake configuration for Clang on OS X # -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11 QMAKE_APPLE_DEVICE_ARCHS = x86_64 diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index 4209c9a62c2..5686610b17c 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -10,7 +10,7 @@ MAKEFILE_GENERATOR = UNIX CONFIG += app_bundle incremental global_init_link_order lib_version_first QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11 QMAKE_APPLE_DEVICE_ARCHS = x86_64 diff --git a/mkspecs/macx-icc/qmake.conf b/mkspecs/macx-icc/qmake.conf index 80cffbf9dc8..fa3944f843f 100644 --- a/mkspecs/macx-icc/qmake.conf +++ b/mkspecs/macx-icc/qmake.conf @@ -98,7 +98,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_ QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11 QMAKE_APPLE_DEVICE_ARCHS = x86_64 From abc891ee7cf12ae3b359811883d674c61793cc1d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 8 Feb 2018 08:32:45 -0800 Subject: [PATCH 04/21] Documentation: don't suggest abort() in qInstallMessageHandler() The backend will do the aborting. The handler doesn't need to do it. Task-number: QTBUG-66295 Change-Id: I3debfc11127e4516b505fffd151166d4a8e9ec53 Reviewed-by: Martin Smith Reviewed-by: Friedemann Kleint --- src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index 8d4bd36bebd..ceb3f8adf3c 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -294,7 +294,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS break; case QtFatalMsg: fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); - abort(); + break; } } From fcad1c762b6eb50f241c4208eea39ef495e49b05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jan 2018 15:02:45 -0800 Subject: [PATCH 05/21] QVariant: Add missing conversion from QJsonValue to double & float Change-Id: I56b444f9d6274221a3b7fffd150d2ff1df5228bc Reviewed-by: Lars Knoll --- src/corelib/kernel/qvariant.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 7ccacd883f3..96299b9eafd 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -256,6 +256,10 @@ static qreal qConvertToRealNumber(const QVariant::Private *d, bool *ok) case QMetaType::UShort: case QMetaType::ULong: return qreal(qMetaTypeUNumber(d)); +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + return v_cast(d)->toDouble(); +#endif default: // includes enum conversion as well as invalid types return qreal(qConvertToNumber(d, ok)); From 9d293e24a0a196a1da5eb32bc3db805c4f14a09d Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 30 Jan 2018 12:51:19 +0300 Subject: [PATCH 06/21] Windows QPA: Implement QPlatformWindow::startSystemMove() Task-number: QTBUG-58044 Change-Id: I15639d505683159b4cc31d762cb0bebbfc57e594 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/windows/qwindowswindow.cpp | 10 ++++++++++ src/plugins/platforms/windows/qwindowswindow.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 854c19ccf88..ada124b5af0 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2277,6 +2277,16 @@ bool QWindowsWindow::startSystemResize(const QPoint &, Qt::Corner corner) return true; } +bool QWindowsWindow::startSystemMove(const QPoint &) +{ + if (!GetSystemMenu(m_data.hwnd, FALSE)) + return false; + + ReleaseCapture(); + PostMessage(m_data.hwnd, WM_SYSCOMMAND, 0xF012 /*SC_DRAGMOVE*/, 0); + return true; +} + void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled) { if (enabled) { diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 414d4a92f82..37322557387 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -269,6 +269,7 @@ public: inline bool hasMouseCapture() const { return GetCapture() == m_data.hwnd; } bool startSystemResize(const QPoint &pos, Qt::Corner corner) override; + bool startSystemMove(const QPoint &pos) override; void setFrameStrutEventsEnabled(bool enabled) override; bool frameStrutEventsEnabled() const override { return testFlag(FrameStrutEventsEnabled); } From 675603a853d7159592b1e120be15309ebceda4ad Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 09:05:24 +0100 Subject: [PATCH 07/21] winrt: mouse handling: Fix detection of affected window With the previous implementation the detection of the affected window (windowAt which uses QWindow::geometry) only worked for the upper left quarter of the window, when used on a High DPI screen. As QWindow does not use native positions, the mouse cursor's position has to be mapped before checking the window under the mouse. Change-Id: I1a30b9669ec3e4c573cf83aed57c20d65675ff16 Reviewed-by: Andre de la Rocha Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 7b9502f9abd..1a5af228144 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -47,6 +47,7 @@ #endif #include "qwinrtwindow.h" #include +#include #include #include @@ -1126,11 +1127,11 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) // Common traits - point, modifiers, properties Point point; pointerPoint->get_Position(&point); - QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); + const QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); QPointF localPos = pos; const QPoint posPoint = pos.toPoint(); - QWindow *windowUnderPointer = windowAt(posPoint); + QWindow *windowUnderPointer = windowAt(QHighDpiScaling::mapPositionFromNative(posPoint, this)); QWindow *targetWindow = windowUnderPointer; if (d->mouseGrabWindow) From 4ea42798750f409f701b97a25bb0c4a2c6248ba3 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 09:07:32 +0100 Subject: [PATCH 08/21] winrt: Fix mouse releases that happen outside a window If the mouse button is released outside of a window, we did not trigger a mouse release event. Task-number: QTBUG-66088 Change-Id: I3ef6234cc922c8c59ac3aa6350783fae4ba36bda Reviewed-by: Andre de la Rocha Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 1a5af228144..97e54d496a4 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -1215,6 +1215,12 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) QWindowSystemInterface::handleMouseEvent(d->currentPressWindow, localPressPos, pos, buttons, mods); d->currentPressWindow = nullptr; } + // If the mouse button is released outside of a window, targetWindow is 0, but the event + // has to be delivered to the window, that initially received the mouse press. + if (buttons == Qt::NoButton && d->currentPressWindow && !targetWindow) { + targetWindow = d->currentPressWindow; + d->currentPressWindow = nullptr; + } QWindowSystemInterface::handleMouseEvent(targetWindow, localPos, pos, buttons, mods); From c4f0908f78619889dc69f969b578493edc0017d6 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 09:58:08 +0100 Subject: [PATCH 09/21] winrt: Keep track of affected window for mouse events With the previous implementation mouseLeave events were broken as we did not remember, which window was initially affected by events and naturally there was no window under the mouse for these events. Now we save the currently affected window and use this information for leave events. Change-Id: I4036ce5e6621b507232d258dbb54c7f40a345899 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 38 ++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 97e54d496a4..e5b412a8756 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -488,7 +488,8 @@ public: #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) QAtomicPointer mouseGrabWindow; QAtomicPointer keyboardGrabWindow; - QWindow *currentPressWindow = 0; + QWindow *currentPressWindow = nullptr; + QWindow *currentTargetWindow = nullptr; }; // To be called from the XAML thread @@ -1082,11 +1083,11 @@ HRESULT QWinRTScreen::onPointerEntered(ICoreWindow *, IPointerEventArgs *args) pointerPoint->get_Position(&point); QPoint pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); - QWindow *targetWindow = topWindow(); + d->currentTargetWindow = topWindow(); if (d->mouseGrabWindow) - targetWindow = d->mouseGrabWindow.load()->window(); + d->currentTargetWindow = d->mouseGrabWindow.load()->window(); - QWindowSystemInterface::handleEnterEvent(targetWindow, pos, pos); + QWindowSystemInterface::handleEnterEvent(d->currentTargetWindow, pos, pos); } return S_OK; } @@ -1105,11 +1106,11 @@ HRESULT QWinRTScreen::onPointerExited(ICoreWindow *, IPointerEventArgs *args) d->touchPoints.remove(id); - QWindow *targetWindow = nullptr; if (d->mouseGrabWindow) - targetWindow = d->mouseGrabWindow.load()->window(); + d->currentTargetWindow = d->mouseGrabWindow.load()->window(); - QWindowSystemInterface::handleLeaveEvent(targetWindow); + QWindowSystemInterface::handleLeaveEvent(d->currentTargetWindow); + d->currentTargetWindow = nullptr; return S_OK; } @@ -1132,14 +1133,14 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) const QPoint posPoint = pos.toPoint(); QWindow *windowUnderPointer = windowAt(QHighDpiScaling::mapPositionFromNative(posPoint, this)); - QWindow *targetWindow = windowUnderPointer; + d->currentTargetWindow = windowUnderPointer; if (d->mouseGrabWindow) - targetWindow = d->mouseGrabWindow.load()->window(); + d->currentTargetWindow = d->mouseGrabWindow.load()->window(); - if (targetWindow) { + if (d->currentTargetWindow) { const QPointF globalPosDelta = pos - posPoint; - localPos = targetWindow->mapFromGlobal(posPoint) + globalPosDelta; + localPos = d->currentTargetWindow->mapFromGlobal(posPoint) + globalPosDelta; } VirtualKeyModifiers modifiers; @@ -1174,7 +1175,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) boolean isHorizontal; properties->get_IsHorizontalMouseWheel(&isHorizontal); QPoint angleDelta(isHorizontal ? delta : 0, isHorizontal ? 0 : delta); - QWindowSystemInterface::handleWheelEvent(targetWindow, localPos, pos, QPoint(), angleDelta, mods); + QWindowSystemInterface::handleWheelEvent(d->currentTargetWindow, localPos, pos, QPoint(), angleDelta, mods); break; } @@ -1216,13 +1217,14 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) d->currentPressWindow = nullptr; } // If the mouse button is released outside of a window, targetWindow is 0, but the event - // has to be delivered to the window, that initially received the mouse press. - if (buttons == Qt::NoButton && d->currentPressWindow && !targetWindow) { - targetWindow = d->currentPressWindow; + // has to be delivered to the window, that initially received the mouse press. Do not reset + // d->currentTargetWindow though, as it is used (and reset) in onPointerExited. + if (buttons == Qt::NoButton && d->currentPressWindow && !d->currentTargetWindow) { + d->currentTargetWindow = d->currentPressWindow; d->currentPressWindow = nullptr; } - QWindowSystemInterface::handleMouseEvent(targetWindow, localPos, pos, buttons, mods); + QWindowSystemInterface::handleMouseEvent(d->currentTargetWindow, localPos, pos, buttons, mods); break; } @@ -1276,7 +1278,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) it.value().normalPosition = QPointF(point.X/d->logicalRect.width(), point.Y/d->logicalRect.height()); it.value().pressure = pressure; - QWindowSystemInterface::handleTouchEvent(targetWindow, d->touchDevice, d->touchPoints.values(), mods); + QWindowSystemInterface::handleTouchEvent(d->currentTargetWindow, d->touchDevice, d->touchPoints.values(), mods); // Fall-through for pen to generate tablet event if (pointerDeviceType != PointerDeviceType_Pen) @@ -1295,7 +1297,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) float rotation; properties->get_Twist(&rotation); - QWindowSystemInterface::handleTabletEvent(targetWindow, isPressed, pos, pos, 0, + QWindowSystemInterface::handleTabletEvent(d->currentTargetWindow, isPressed, pos, pos, 0, pointerType, pressure, xTilt, yTilt, 0, rotation, 0, id, mods); From c168838f7d38b3639c8e7453b9ba697c2b0c5229 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 10:03:53 +0100 Subject: [PATCH 10/21] winrt: Correctly check if mouse button was clicked The idea behind this code was to check, whether no button was pressed. !isPressed only checks, whether XButton2 was pressed though. Change-Id: I358816fa62d230abf82116f0da7bc3a5e43fbaf6 Reviewed-by: Andre de la Rocha Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index e5b412a8756..e37aeb0bc59 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -1209,7 +1209,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) // menus. if (buttons != Qt::NoButton && d->currentPressWindow == nullptr && !d->mouseGrabWindow) d->currentPressWindow = windowUnderPointer; - if (!isPressed && d->currentPressWindow && d->mouseGrabWindow) { + if (buttons == Qt::NoButton && d->currentPressWindow && d->mouseGrabWindow) { const QPointF globalPosDelta = pos - posPoint; const QPointF localPressPos = d->currentPressWindow->mapFromGlobal(posPoint) + globalPosDelta; From 383d2eaab47c6de0d63f0ae79fbc795f28e845d9 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 10 Feb 2018 21:08:00 +0100 Subject: [PATCH 11/21] Fix autotest tst_QAction::setStandardKeys() The possible key sequences for QKeySequence::Copy on X11 is Ctrl+C, then Ctrl+Insert and at last F16. The order is defined in QPlatformThemePrivate::keyBindings. Task-number: QTBUG-46053 Change-Id: I86a0767e268088edfce98cfb07f9fb78f00d0713 Reviewed-by: Gatis Paeglis --- tests/auto/widgets/kernel/qaction/BLACKLIST | 2 -- tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 tests/auto/widgets/kernel/qaction/BLACKLIST diff --git a/tests/auto/widgets/kernel/qaction/BLACKLIST b/tests/auto/widgets/kernel/qaction/BLACKLIST deleted file mode 100644 index 1ad524fdbf4..00000000000 --- a/tests/auto/widgets/kernel/qaction/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[setStandardKeys] -linux diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 272ec6d60bd..ddf9ccb416d 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -240,7 +240,7 @@ void tst_QAction::setStandardKeys() expected << ctrlC << ctrlInsert; break; default: // X11 - expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert; + expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16")); break; } From b2b32682a95401f863e2b71a553c1375136e2595 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 10 Feb 2018 13:59:50 +0100 Subject: [PATCH 12/21] qtbase: Remove BLACKLIST files which are no longer active Remove BLACKLIST files which are no longer valid because the mentioned CI systems are no longer active: - opensuse-13.1 - opensuse-42.1 - rhel-7.1 - rhel-7.2 - rhel-7.3 - ubuntu-14.04 or the testcases are no longer available: - QTBUG_14292_filesystem in qactiongroup Change-Id: I80a4397059fafba169096440fdc07d45c76a1ed8 Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/io/qstorageinfo/BLACKLIST | 2 -- tests/auto/dbus/qdbusmarshall/BLACKLIST | 3 --- tests/auto/gui/text/qtextscriptengine/BLACKLIST | 2 -- tests/auto/widgets/dialogs/qfontdialog/BLACKLIST | 5 ----- .../widgets/graphicsview/qgraphicsproxywidget/BLACKLIST | 6 ------ tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST | 4 ---- tests/auto/widgets/kernel/qactiongroup/BLACKLIST | 2 -- tests/auto/widgets/kernel/qtooltip/BLACKLIST | 4 ---- 8 files changed, 28 deletions(-) delete mode 100644 tests/auto/corelib/io/qstorageinfo/BLACKLIST delete mode 100644 tests/auto/dbus/qdbusmarshall/BLACKLIST delete mode 100644 tests/auto/gui/text/qtextscriptengine/BLACKLIST delete mode 100644 tests/auto/widgets/dialogs/qfontdialog/BLACKLIST delete mode 100644 tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST delete mode 100644 tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST delete mode 100644 tests/auto/widgets/kernel/qactiongroup/BLACKLIST delete mode 100644 tests/auto/widgets/kernel/qtooltip/BLACKLIST diff --git a/tests/auto/corelib/io/qstorageinfo/BLACKLIST b/tests/auto/corelib/io/qstorageinfo/BLACKLIST deleted file mode 100644 index ab4f888dd96..00000000000 --- a/tests/auto/corelib/io/qstorageinfo/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[storageList] -opensuse-42.1 diff --git a/tests/auto/dbus/qdbusmarshall/BLACKLIST b/tests/auto/dbus/qdbusmarshall/BLACKLIST deleted file mode 100644 index 036378d2044..00000000000 --- a/tests/auto/dbus/qdbusmarshall/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[receiveUnknownType] -ubuntu-14.04 -opensuse-13.1 diff --git a/tests/auto/gui/text/qtextscriptengine/BLACKLIST b/tests/auto/gui/text/qtextscriptengine/BLACKLIST deleted file mode 100644 index 52eb9086a97..00000000000 --- a/tests/auto/gui/text/qtextscriptengine/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[thaiWithZWJ] -rhel-7.2 diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST deleted file mode 100644 index 07f3a41df39..00000000000 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ /dev/null @@ -1,5 +0,0 @@ -[task256466_wrongStyle] -opensuse-13.1 -opensuse-42.1 -rhel-7.1 -rhel-7.2 diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST deleted file mode 100644 index 16f3534921b..00000000000 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -[hoverEnterLeaveEvent] -ubuntu-14.04 -rhel-7.1 -rhel-7.2 -[QTBUG_6986_sendMouseEventToAlienWidget] -rhel-7.1 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST deleted file mode 100644 index 13ec840effb..00000000000 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[initialShow2] -ubuntu-14.04 -rhel-7.1 -rhel-7.2 diff --git a/tests/auto/widgets/kernel/qactiongroup/BLACKLIST b/tests/auto/widgets/kernel/qactiongroup/BLACKLIST deleted file mode 100644 index fdc424b6ac1..00000000000 --- a/tests/auto/widgets/kernel/qactiongroup/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[QTBUG_14292_filesystem] -linux diff --git a/tests/auto/widgets/kernel/qtooltip/BLACKLIST b/tests/auto/widgets/kernel/qtooltip/BLACKLIST deleted file mode 100644 index f8d062cc46b..00000000000 --- a/tests/auto/widgets/kernel/qtooltip/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[whatsThis] -ubuntu-14.04 -[task183679] -opensuse-13.1 From 211791d01cf89bb75691f965d3a4ebc42c5ed8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 8 Dec 2017 18:46:44 +0100 Subject: [PATCH 13/21] Add support for Apple Unified Logging If the OS supports it, we will now log to the Apple unified logging system in addition to the normal stderr output. These logs can be inspected via the Console application, or the 'log' command line tool. See https://developer.apple.com/documentation/os/logging [ChangeLog][QtCore] Apple Unified Logging is now supported on Apple platforms. Task-number: QTBUG-38156 Done-with: Jake Petroules Change-Id: I2ab92bd192d5b98aaf77e41501ea7b1ca6ef2425 Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 7 +++ src/corelib/kernel/qcore_mac.cpp | 95 ++++++++++++++++++++++++++++++++ src/corelib/kernel/qcore_mac_p.h | 31 +++++++++++ 3 files changed, 133 insertions(+) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index ba0c1053725..39a5bbf6452 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -71,6 +71,10 @@ #include #endif +#ifdef Q_OS_DARWIN +#include +#endif + #if QT_CONFIG(journald) # define SD_JOURNAL_SUPPRESS_LOCATION # include @@ -1676,6 +1680,9 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con handledStderr |= syslog_default_message_handler(type, context, message); # elif defined(Q_OS_ANDROID) handledStderr |= android_default_message_handler(type, context, message); +# elif defined(QT_USE_APPLE_UNIFIED_LOGGING) + if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) + handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message); # endif #endif diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp index bfb3b2ff07d..b5df0db232b 100644 --- a/src/corelib/kernel/qcore_mac.cpp +++ b/src/corelib/kernel/qcore_mac.cpp @@ -39,6 +39,9 @@ #include #include + +#include "qhash.h" +#include "qpair.h" #include "qvarlengtharray.h" QT_BEGIN_NAMESPACE @@ -57,4 +60,96 @@ QCFString::operator CFStringRef() const return value; } +// -------------------------------------------------------------------------- + +#if defined(QT_USE_APPLE_UNIFIED_LOGGING) + +bool AppleUnifiedLogger::messageHandler(QtMsgType msgType, const QMessageLogContext &context, + const QString &message, const QString &optionalSubsystem) +{ + QString subsystem = optionalSubsystem; + if (subsystem.isNull()) { + static QString bundleIdentifier = []() { + if (CFBundleRef bundle = CFBundleGetMainBundle()) { + if (CFStringRef identifier = CFBundleGetIdentifier(bundle)) + return QString::fromCFString(identifier); + } + return QString(); + }(); + subsystem = bundleIdentifier; + } + + const bool isDefault = !context.category || !strcmp(context.category, "default"); + os_log_t log = isDefault ? OS_LOG_DEFAULT : + cachedLog(subsystem, QString::fromLatin1(context.category)); + os_log_type_t logType = logTypeForMessageType(msgType); + + if (!os_log_type_enabled(log, logType)) + return false; + + // Logging best practices says we should not include symbolication + // information or source file line numbers in messages, as the system + // will automatically captures this information. In our case, what + // the system captures is the call to os_log_with_type below, which + // isn't really useful, but we still don't want to include the context's + // info, as that would clutter the logging output. See rdar://35958308. + + // The format must be a string constant, so we can't pass on the + // message. This means we won't be able to take advantage of the + // unified logging's custom format specifiers such as %{BOOL}d. + // We use the 'public' format specifier to prevent the logging + // system from redacting our log message. + os_log_with_type(log, logType, "%{public}s", qPrintable(message)); + + // When running under Xcode or LLDB, one or more of these variables will + // be set, which triggers libsystem_trace.dyld to log messages to stderr + // as well, via_os_log_impl_mirror_to_stderr. Un-setting these variables + // is not an option, as that would silence normal NSLog or os_log calls, + // so instead we skip our own stderr output. See rdar://36919139. + static bool mirroredToStderr = qEnvironmentVariableIsSet("OS_ACTIVITY_DT_MODE") + || qEnvironmentVariableIsSet("ACTIVITY_LOG_STDERR") + || qEnvironmentVariableIsSet("CFLOG_FORCE_STDERR"); + return mirroredToStderr; +} + +os_log_type_t AppleUnifiedLogger::logTypeForMessageType(QtMsgType msgType) +{ + switch (msgType) { + case QtDebugMsg: return OS_LOG_TYPE_DEBUG; + case QtInfoMsg: return OS_LOG_TYPE_INFO; + case QtWarningMsg: return OS_LOG_TYPE_DEFAULT; + case QtCriticalMsg: return OS_LOG_TYPE_ERROR; + case QtFatalMsg: return OS_LOG_TYPE_FAULT; + } + + return OS_LOG_TYPE_DEFAULT; +} + +os_log_t AppleUnifiedLogger::cachedLog(const QString &subsystem, const QString &category) +{ + static QBasicMutex mutex; + QMutexLocker locker(&mutex); + + static QHash, os_log_t> logs; + const auto cacheKey = qMakePair(subsystem, category); + os_log_t log = logs.value(cacheKey); + + if (!log) { + log = os_log_create(subsystem.toLatin1().constData(), + category.toLatin1().constData()); + logs.insert(cacheKey, log); + + // Technically we should release the os_log_t resource when done + // with it, but since we don't know when a category is disabled + // we keep all cached os_log_t instances until shutdown, where + // the OS will clean them up for us. + } + + return log; +} + +#endif // QT_USE_APPLE_UNIFIED_LOGGING + +// -------------------------------------------------------------------------- + QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 13143a08bb6..9c6cef68b27 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -159,6 +159,37 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); Q_CORE_EXPORT void qt_apple_check_os_version(); +// -------------------------------------------------------------------------- + +#if !defined(QT_BOOTSTRAPPED) && (QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) || !defined(Q_OS_MACOS)) +#define QT_USE_APPLE_UNIFIED_LOGGING + +QT_END_NAMESPACE +#include + +// The compiler isn't smart enough to realize that we're calling these functions +// guarded by __builtin_available, so we need to also tag each function with the +// runtime requirements. +#include +#define OS_LOG_AVAILABILITY API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT AppleUnifiedLogger +{ +public: + static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, + const QString &subsystem = QString()) OS_LOG_AVAILABILITY; +private: + static os_log_type_t logTypeForMessageType(QtMsgType msgType) OS_LOG_AVAILABILITY; + static os_log_t cachedLog(const QString &subsystem, const QString &category) OS_LOG_AVAILABILITY; +}; + +#undef OS_LOG_AVAILABILITY + +#endif + +// -------------------------------------------------------------------------- + QT_END_NAMESPACE #endif // QCORE_MAC_P_H From 0b300c94094412fbf36e942fe00c18da0e5ed62a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 6 Feb 2018 16:18:56 +0100 Subject: [PATCH 14/21] simd.prf: Add support for compiling .c sources with the C compiler Right now we are using the C++ compiler here, which relies on the compilers automatically switching mode. This behavior is also deprecated in newer clang versions and block clang developer builds. Task-number: QTBUG-64822 Done-with: Thiago Macieira Change-Id: I4d3c00ac528a45934c85777f42d243d0fe367c92 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/simd.prf | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mkspecs/features/simd.prf b/mkspecs/features/simd.prf index 8471ce7e7c8..e4bee7107cf 100644 --- a/mkspecs/features/simd.prf +++ b/mkspecs/features/simd.prf @@ -23,6 +23,7 @@ defineTest(addSimdCompiler) { upname = $$upper($$name) headers_var = $${upname}_HEADERS sources_var = $${upname}_SOURCES + csources_var = $${upname}_C_SOURCES asm_var = $${upname}_ASM CONFIG($$1) { @@ -34,6 +35,14 @@ defineTest(addSimdCompiler) { export(SOURCES) } else { # We need special compiler flags + + # Split C and C++ sources + $$csources_var = $$find($$sources_var, ".*\\.c$") + $$sources_var -= $$eval($$csources_var) + export($$csources_var) + export($$sources_var) + + # Add C++ compiler $${name}_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $$cflags $(INCPATH) ${QMAKE_FILE_IN} msvc: $${name}_compiler.commands += -Fo${QMAKE_FILE_OUT} else: $${name}_compiler.commands += -o ${QMAKE_FILE_OUT} @@ -52,6 +61,26 @@ defineTest(addSimdCompiler) { export($${name}_compiler.input) export($${name}_compiler.variable_out) export($${name}_compiler.name) + + # Add a C compiler + $${name}_c_compiler.commands = $$QMAKE_CC -c $(CFLAGS) $$cflags $(INCPATH) ${QMAKE_FILE_IN} + msvc: $${name}_c_compiler.commands += -Fo${QMAKE_FILE_OUT} + else: $${name}_c_compiler.commands += -o ${QMAKE_FILE_OUT} + + $${name}_c_compiler.dependency_type = TYPE_C + $${name}_c_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + $${name}_c_compiler.input = $$csources_var + $${name}_c_compiler.variable_out = OBJECTS + $${name}_c_compiler.name = compiling[$${name}] ${QMAKE_FILE_IN} + silent: $${name}_c_compiler.commands = @echo compiling[$${name}] ${QMAKE_FILE_IN} && $$eval($${name}_c_compiler.commands) + QMAKE_EXTRA_COMPILERS += $${name}_c_compiler + + export($${name}_c_compiler.commands) + export($${name}_c_compiler.dependency_type) + export($${name}_c_compiler.output) + export($${name}_c_compiler.input) + export($${name}_c_compiler.variable_out) + export($${name}_c_compiler.name) } # We always need an assembler (need to run the C compiler and without precompiled headers) From 64b8ddb755b3d596af97f49c60ffd4bcd7e20cfe Mon Sep 17 00:00:00 2001 From: Aaron Linville Date: Fri, 2 Feb 2018 19:34:24 -0500 Subject: [PATCH 15/21] Doc: Fix links to QFontMetrics::width() overloads Links to width(QChar) are incorrectly linking to QChar rather than to the intended QFontMetrics::width method. Task-number: QTBUG-65141 Change-Id: I1647885c735011ec3d99c535fdb8b7fc1bf57f99 Reviewed-by: Leena Miettinen --- src/gui/text/qfontmetrics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 5ad57b064b0..407559ad514 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -452,7 +452,7 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const value is negative if the pixels of the character extend to the left of the logical origin. - See width(QChar) for a graphical description of this metric. + See width() for a graphical description of this metric. \sa rightBearing(), minLeftBearing(), width() */ @@ -1402,7 +1402,7 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const value is negative if the pixels of the character extend to the left of the logical origin. - See width(QChar) for a graphical description of this metric. + See width() for a graphical description of this metric. \sa rightBearing(), minLeftBearing(), width() */ From cdf4261c8fb18d18e3a539e078fcf03ef332fc0c Mon Sep 17 00:00:00 2001 From: Aaron Linville Date: Mon, 5 Feb 2018 21:56:22 -0500 Subject: [PATCH 16/21] Doc: Fix typos in qmake function reference Removed duplicate "for the". Function list was sorted except for sprintf; so sorted it. Also, minor grammatical improvement. Task-number: QTBUG-64362 Task-number: QTBUG-64363 Change-Id: Ia47c5195011a0e578e916897b3a5ddb1d78170ad Reviewed-by: Frederik Schwarzer Reviewed-by: Leena Miettinen Reviewed-by: Oswald Buddenhagen --- qmake/doc/src/qmake-manual.qdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 16b498d36e1..8b7d1b0853f 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -3168,11 +3168,6 @@ \snippet code/doc_src_qmake-manual.pro 70 - \section2 sprintf(string, arguments...) - - Replaces %1-%9 with the arguments passed in the comma-separated list - of function \c arguments and returns the processed string. - \section2 resolve_depends(variablename, prefix) This is an internal function that you will typically not need. @@ -3239,6 +3234,11 @@ \snippet code/doc_src_qmake-manual.pro 168 + \section2 sprintf(string, arguments...) + + Replaces %1-%9 in \c string with the arguments passed in the comma-separated + list of function \c arguments and returns the processed string. + \target str_member() \section2 str_member(arg [, start [, end]]) @@ -3306,7 +3306,7 @@ \section2 system_quote(arg) - Quotes \c arg for the for the shell that is used by the \c{system()} + Quotes \c arg for the shell that is used by the \c{system()} functions. See also \l{shell_quote(arg)}{shell_quote()}. From 93a1d7ce275215987a58bc2731c4dbfd4c841643 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 12 Feb 2018 13:36:51 +0200 Subject: [PATCH 17/21] Blacklist tst_qwidget_window::tst_resize_count It is flaky on Ubuntu 16.04 and openSUSE 42.3. Task-number: QTBUG-66345 Task-number: QTBUG-66216 Change-Id: I06fb88ee65113136309a0faa0336dd11672bfe59 Reviewed-by: Sami Nurmenniemi Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget_window/BLACKLIST | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/auto/widgets/kernel/qwidget_window/BLACKLIST diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST new file mode 100644 index 00000000000..d3bfaba4330 --- /dev/null +++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST @@ -0,0 +1,4 @@ +[tst_resize_count] +# QTBUG-66345 +opensuse-42.3 +ubuntu-16.04 From 92fc338de073b352b9fc0a2aee49761c25f9d803 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 11 Feb 2018 10:56:05 +0100 Subject: [PATCH 18/21] qtbase: cleanup BLACKLIST files Cleanup BLACKLIST files which contain entries for CI-systems which are no longer active: - opensuse-13.1 - opensuse-42.1 - osx-10.8 - osx-10.9 - osx-10.10 - rhel-7.1 - rhel-7.2 - rhel-7.3 - ubuntu-14.04 - windows msvc-2010 Change-Id: I25590b0807a4454f9dc92aa4ea61300f7c9af56b Reviewed-by: Frederik Gladhorn --- .../animation/qpauseanimation/BLACKLIST | 2 -- tests/auto/corelib/io/qsettings/BLACKLIST | 1 - tests/auto/gui/kernel/qwindow/BLACKLIST | 5 ----- tests/auto/gui/text/qfont/BLACKLIST | 4 ---- tests/auto/gui/text/qrawfont/BLACKLIST | 4 ---- tests/auto/network/access/qftp/BLACKLIST | 4 ---- .../network/access/qnetworkreply/BLACKLIST | 4 ---- tests/auto/network/ssl/qsslsocket/BLACKLIST | 4 ---- tests/auto/opengl/qgl/BLACKLIST | 1 - tests/auto/other/gestures/BLACKLIST | 5 ----- .../graphicsview/qgraphicsitem/BLACKLIST | 2 -- .../widgets/itemviews/qtableview/BLACKLIST | 2 -- .../auto/widgets/kernel/qapplication/BLACKLIST | 2 -- .../widgets/kernel/qapplication/test/BLACKLIST | 2 -- tests/auto/widgets/kernel/qwidget/BLACKLIST | 18 ------------------ .../widgets/styles/qstylesheetstyle/BLACKLIST | 5 ----- tests/auto/widgets/widgets/qcombobox/BLACKLIST | 4 ---- tests/auto/widgets/widgets/qmenubar/BLACKLIST | 1 - .../widgets/widgets/qopenglwidget/BLACKLIST | 13 ------------- tests/auto/widgets/widgets/qspinbox/BLACKLIST | 3 --- tests/auto/widgets/widgets/qtabbar/BLACKLIST | 1 - 21 files changed, 87 deletions(-) delete mode 100644 tests/auto/gui/text/qrawfont/BLACKLIST delete mode 100644 tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST delete mode 100644 tests/auto/widgets/kernel/qapplication/BLACKLIST delete mode 100644 tests/auto/widgets/kernel/qapplication/test/BLACKLIST delete mode 100644 tests/auto/widgets/widgets/qspinbox/BLACKLIST diff --git a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST index a49ed2a617b..e223ec82e26 100644 --- a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST +++ b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST @@ -1,5 +1,3 @@ -[multiplePauseAnimations] -osx-10.9 [pauseAndPropertyAnimations] * [multipleSequentialGroups] diff --git a/tests/auto/corelib/io/qsettings/BLACKLIST b/tests/auto/corelib/io/qsettings/BLACKLIST index 317e97730e4..36d68bd918b 100644 --- a/tests/auto/corelib/io/qsettings/BLACKLIST +++ b/tests/auto/corelib/io/qsettings/BLACKLIST @@ -1,3 +1,2 @@ [isWritable:native] -osx-10.10 osx-10.11 diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 9108cf2c1f3..4469b989530 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,19 +1,14 @@ [positioning:default] -ubuntu-14.04 ubuntu-16.04 osx-10.12 ci [positioning:fake] osx-10.12 ci [modalWindowPosition] -ubuntu-14.04 ubuntu-16.04 [modalWithChildWindow] -ubuntu-14.04 ubuntu-16.04 [setVisible] -ubuntu-14.04 [modalWindowEnterEventOnHide_QTBUG35109] -ubuntu-14.04 ubuntu-16.04 osx ci [modalDialogClosingOneOfTwoModal] diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST index 295c61ff121..42cb8408f42 100644 --- a/tests/auto/gui/text/qfont/BLACKLIST +++ b/tests/auto/gui/text/qfont/BLACKLIST @@ -1,6 +1,2 @@ -[exactMatch] -# QTBUG-46054 -opensuse-13.1 -opensuse-42.1 [defaultFamily] b2qt diff --git a/tests/auto/gui/text/qrawfont/BLACKLIST b/tests/auto/gui/text/qrawfont/BLACKLIST deleted file mode 100644 index a6145956897..00000000000 --- a/tests/auto/gui/text/qrawfont/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[correctFontData] -osx-10.8 -[unsupportedWritingSystem] -osx-10.8 diff --git a/tests/auto/network/access/qftp/BLACKLIST b/tests/auto/network/access/qftp/BLACKLIST index 92ad1aee8fa..96d9274653b 100644 --- a/tests/auto/network/access/qftp/BLACKLIST +++ b/tests/auto/network/access/qftp/BLACKLIST @@ -1,14 +1,10 @@ # QTBUG-15111 [activeMode:WithoutProxy] -opensuse-13.1 64bit redhatenterpriselinuxworkstation-6.6 -osx-10.10 [activeMode:WithoutProxyWithSession] -opensuse-13.1 64bit redhatenterpriselinuxworkstation-6.6 -osx-10.10 [list:epsvNotSupported] * diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 1052239797c..4410549f092 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -2,10 +2,6 @@ osx [authenticationCacheAfterCancel] windows -[ioGetFromBuiltinHttp:http+limited] -ubuntu-14.04 -[ioGetFromBuiltinHttp:https+limited] -ubuntu-14.04 [httpAbort] * [backgroundRequestInterruption:ftp, bg, nobg] diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST index a9ecc69f508..8e1a55995ee 100644 --- a/tests/auto/network/ssl/qsslsocket/BLACKLIST +++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST @@ -1,5 +1 @@ windows -[protocolServerSide:ssl3-any] -rhel-7.2 -[protocolServerSide:tls1.0-any] -rhel-7.2 diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST index a83d1272a0b..71be4bf19dc 100644 --- a/tests/auto/opengl/qgl/BLACKLIST +++ b/tests/auto/opengl/qgl/BLACKLIST @@ -16,7 +16,6 @@ winrt [clipTest] windows winrt -opensuse-13.1 [graphicsViewClipping] windows winrt diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index bd43b99d398..1d89178fe5b 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,7 +1,2 @@ [] -rhel-7.1 -rhel-7.2 -rhel-7.3 rhel-7.4 -[customGesture] -opensuse-13.1 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST deleted file mode 100644 index abfa7a33297..00000000000 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[ensureUpdateOnTextItem] -osx-10.10 diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST index 329010a86e3..fc231a4e304 100644 --- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST +++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST @@ -1,4 +1,2 @@ [moveCursorBiggerJump] osx -[resizeColumnsToContents] -ubuntu-14.04 diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST deleted file mode 100644 index f4a9cb61668..00000000000 --- a/tests/auto/widgets/kernel/qapplication/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[quitOnLastWindowClosed] -osx-10.10 diff --git a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST deleted file mode 100644 index f4a9cb61668..00000000000 --- a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[quitOnLastWindowClosed] -osx-10.10 diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 4cef2d57a43..c822539966a 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -1,30 +1,18 @@ # OSX QTBUG-25300 QTBUG-45502 [normalGeometry] -ubuntu-14.04 ubuntu-16.04 [saveRestoreGeometry] -ubuntu-14.04 ubuntu-16.04 b2qt [restoreVersion1Geometry] xcb osx [updateWhileMinimized] -ubuntu-14.04 ubuntu-16.04 -rhel-7.1 -rhel-7.2 -rhel-7.3 rhel-7.4 osx [focusProxyAndInputMethods] linux -[touchEventSynthesizedMouseEvent] -ubuntu-14.04 -[grabMouse] -ubuntu-14.04 -[largerThanScreen_QTBUG30142] -ubuntu-14.04 [showMaximized] osx [setGeometry] @@ -48,7 +36,6 @@ osx [render_systemClip] osx [showMinimizedKeepsFocus] -osx-10.10 osx-10.11 ci osx-10.12 ci [moveWindowInShowEvent:1] @@ -61,10 +48,7 @@ osx osx [maskedUpdate] osx -opensuse-42.1 opensuse-42.3 -[hideWhenFocusWidgetIsChild] -osx-10.10 [hideOpaqueChildWhileHidden] osx [resizeStaticContentsChildWidget_QTBUG35282] @@ -75,8 +59,6 @@ osx osx [setToolTip] osx -[moveInResizeEvent] -ubuntu-14.04 [moveChild:right] osx [activateWindow] diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST index 43c5ca3b059..6b2e4f3fb26 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST +++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST @@ -1,7 +1,2 @@ -[hoverColors] -ubuntu-14.04 -opensuse-13.1 -opensuse-42.1 - [task232085_spinBoxLineEditBg] osx diff --git a/tests/auto/widgets/widgets/qcombobox/BLACKLIST b/tests/auto/widgets/widgets/qcombobox/BLACKLIST index c04351e5ca6..2d6228075a6 100644 --- a/tests/auto/widgets/widgets/qcombobox/BLACKLIST +++ b/tests/auto/widgets/widgets/qcombobox/BLACKLIST @@ -1,7 +1,3 @@ -QTBUG-45531 -[task260974_menuItemRectangleForComboBoxPopup] -osx-10.10 - [task_QTBUG_56693_itemFontFromModel] # Counts draw calls, but we could have multiple expose events QTBUG-62080 osx diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST index e2194e69ca7..b3bf606a087 100644 --- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST @@ -1,3 +1,2 @@ [check_menuPosition] -ubuntu-14.04 ubuntu-16.04 diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST index 7825c33a0a6..b67c8354e8c 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -1,18 +1,5 @@ [clearAndGrab] -opensuse-13.1 ubuntu -#QTBUG-31611 -[painter] -windows msvc-2010 32bit developer-build - -#QTBUG-31611 -[reparentToAlreadyCreated] -windows msvc-2010 32bit developer-build - -#QTBUG-31611 -[reparentToNotYetCreated] -windows msvc-2010 32bit developer-build - [stackWidgetOpaqueChildIsVisible] windows diff --git a/tests/auto/widgets/widgets/qspinbox/BLACKLIST b/tests/auto/widgets/widgets/qspinbox/BLACKLIST deleted file mode 100644 index 5bf6c3beed3..00000000000 --- a/tests/auto/widgets/widgets/qspinbox/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[editingFinished] -osx-10.8 -osx-10.9 diff --git a/tests/auto/widgets/widgets/qtabbar/BLACKLIST b/tests/auto/widgets/widgets/qtabbar/BLACKLIST index 5a3f33e3e4c..735b044d8b0 100644 --- a/tests/auto/widgets/widgets/qtabbar/BLACKLIST +++ b/tests/auto/widgets/widgets/qtabbar/BLACKLIST @@ -1,3 +1,2 @@ [sizeHints] -ubuntu-14.04 redhatenterpriselinuxworkstation-6.6 From c6de55a0bb7cc6bebb5dd896ee8edf806c571b96 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 13 Feb 2018 12:19:01 +0100 Subject: [PATCH 19/21] Fix typos Change-Id: Id625efea998f2b4dce9970b903830dc3b3efcd3d Reviewed-by: Leena Miettinen --- examples/widgets/itemviews/spreadsheet/spreadsheetitem.cpp | 2 +- examples/widgets/tools/completer/fsmodel.h | 2 +- src/corelib/kernel/qabstracteventdispatcher.cpp | 2 +- src/corelib/kernel/qobject.cpp | 2 +- src/corelib/kernel/qtimer.cpp | 2 +- src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/opengl/qopenglpaintdevice.cpp | 2 +- src/gui/painting/qtriangulatingstroker.cpp | 2 +- src/network/access/qhttpnetworkconnection.cpp | 4 ++-- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 2 +- src/sql/doc/src/sql-driver.qdoc | 2 +- src/testlib/qtestcase.qdoc | 2 +- src/widgets/itemviews/qitemdelegate.cpp | 2 +- src/widgets/itemviews/qstyleditemdelegate.cpp | 2 +- src/widgets/kernel/qopenglwidget.cpp | 2 +- src/widgets/styles/qcommonstyle.cpp | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.cpp b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.cpp index e9d5235ddc9..4c18fa82511 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.cpp +++ b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.cpp @@ -117,7 +117,7 @@ QVariant SpreadSheetItem::computeFormula(const QString &formula, const QTableWidget *widget, const QTableWidgetItem *self) { - // check if the s tring is actually a formula or not + // check if the string is actually a formula or not QStringList list = formula.split(' '); if (list.isEmpty() || !widget) return formula; // it is a normal string diff --git a/examples/widgets/tools/completer/fsmodel.h b/examples/widgets/tools/completer/fsmodel.h index a243c48b430..7b2e7b7dab3 100644 --- a/examples/widgets/tools/completer/fsmodel.h +++ b/examples/widgets/tools/completer/fsmodel.h @@ -55,7 +55,7 @@ // With a QFileSystemModel, set on a view, you will see "Program Files" in the view // But with this model, you will see "C:\Program Files" in the view. -// We acheive this, by having the data() return the entire file path for +// We achieve this, by having the data() return the entire file path for // the display role. Note that the Qt::EditRole over which the QCompleter // looks for matches is left unchanged //! [0] diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 67c15d2f2c1..304a7bda082 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -484,7 +484,7 @@ bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, vo This pure virtual method exists on windows only and has to be reimplemented by a Windows specific event dispatcher implementation. \a notifier is the QWinEventNotifier instance to be registered. - The method should return true if the registration of \a notifier was sucessful, otherwise false. + The method should return true if the registration of \a notifier was successful, otherwise false. QWinEventNotifier calls this method in it's constructor and there should never be a need to call this method directly. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5b37945ae05..263c4019f7a 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -516,7 +516,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object) \reentrant - QSignalBlocker can be used whereever you would otherwise use a + QSignalBlocker can be used wherever you would otherwise use a pair of calls to blockSignals(). It blocks signals in its constructor and in the destructor it resets the state to what it was before the constructor ran. diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 27d94e47d30..c3504943c46 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE in many real-world situations. The accuracy also depends on the \l{Qt::TimerType}{timer type}. For - Qt::PreciseTimer, QTimer will try to keep the accurance at 1 millisecond. + Qt::PreciseTimer, QTimer will try to keep the accuracy at 1 millisecond. Precise timers will also never time out earlier than expected. For Qt::CoarseTimer and Qt::VeryCoarseTimer types, QTimer may wake up diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 055347500bd..36c9b1a964d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3459,7 +3459,7 @@ void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled) You should never exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the - context. Futhermore, most session managers will very likely request a saved + context. Furthermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy. diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index e539ee0e310..3a0c02feb01 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE When intermixing QPainter and OpenGL, it is important to notify QPainter that the OpenGL state may have been cluttered so it can - restore its internal state. This is acheived by calling \l + restore its internal state. This is achieved by calling \l QPainter::beginNativePainting() before starting the OpenGL rendering and calling \l QPainter::endNativePainting() after finishing. diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp index 3f7b01ddbe5..b1b07f9699b 100644 --- a/src/gui/painting/qtriangulatingstroker.cpp +++ b/src/gui/painting/qtriangulatingstroker.cpp @@ -261,7 +261,7 @@ void QTriangulatingStroker::moveTo(const qreal *pts) normalVector(m_cx, m_cy, x2, y2, &m_nvx, &m_nvy); - // To acheive jumps we insert zero-area tringles. This is done by + // To achieve jumps we insert zero-area tringles. This is done by // adding two identical points in both the end of previous strip // and beginning of next strip bool invisibleJump = m_vertices.size(); diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index d24927b9221..517af326a89 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -646,8 +646,8 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor #ifndef Q_OS_WINRT // For Happy Eyeballs the networkLayerState is set to Unknown - // untill we have started the first connection attempt. So no - // request will be started untill we know if IPv4 or IPv6 + // until we have started the first connection attempt. So no + // request will be started until we know if IPv4 or IPv6 // should be used. if (networkLayerState == Unknown || networkLayerState == HostLookupPending) { startHostInfoLookup(); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 0ab4c65c459..7b7649bc5c0 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -148,7 +148,7 @@ public: mutable QPointer m_screen; // Touch filtering and prediction are part of the same thing. The default - // prediction is 0ms, but sensible results can be acheived by setting it + // prediction is 0ms, but sensible results can be achieved by setting it // to, for instance, 16ms. // For filtering to work well, the QPA plugin should provide a dead-steady // implementation of QPlatformWindow::requestUpdate(). diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index dc8d52b5725..fd95e898128 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -449,7 +449,7 @@ \target QTDS \section2 QTDS for Sybase Adaptive Server - \note TDS is no longer used by MS Sql Server, and is superceded by + \note TDS is no longer used by MS Sql Server, and is superseded by \l{QODBC}{ODBC}. QTDS is obsolete from Qt 4.7. It is not possible to set the port with QSqlDatabase::setPort() due to limitations in the diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 0fb1cc6a8a8..9a3c770e319 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -103,7 +103,7 @@ to catch an exception thrown from the \a expression. If the \a expression throws an exception and its type is the same as \a exceptiontype or \a exceptiontype is substitutable with the type of thrown exception - (i.e. usually the type of thrown exception is publically derived + (i.e. usually the type of thrown exception is publicly derived from \a exceptiontype) then execution will be continued. If not-substitutable type of exception is thrown or the \a expression doesn't throw an exception at all, then a failure will be recorded in the test log and diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp index 1ff51f9be26..91122283a4b 100644 --- a/src/widgets/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -1090,7 +1090,7 @@ QRect QItemDelegate::textRectangle(QPainter * /*painter*/, const QRect &rect, \endlist In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return - key press events, the \a editor's data is comitted to the model + key press events, the \a editor's data is committed to the model and the editor is closed. If the \a event is a \uicontrol Tab key press the view will open an editor on the next item in the view. Likewise, if the \a event is a \uicontrol Backtab key press the diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index 43b640fd692..0f7566e8ecb 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -571,7 +571,7 @@ void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory) \uicontrol Return keys are \e not handled. In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return - key press events, the \a editor's data is comitted to the model + key press events, the \a editor's data is committed to the model and the editor is closed. If the \a event is a \uicontrol Tab key press the view will open an editor on the next item in the view. Likewise, if the \a event is a \uicontrol Backtab key press the diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index c95be2dfe16..c96b6812c41 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -381,7 +381,7 @@ QT_BEGIN_NAMESPACE QOpenGLContext. By connecting a slot, using direct connection, to this signal, it is possible to perform cleanup whenever the the underlying native context handle, or the entire QOpenGLContext instance, is going to be released. The - following snippet is in principal equivalent to the previous one: + following snippet is in principle equivalent to the previous one: \snippet code/doc_gui_widgets_qopenglwidget.cpp 5 diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 670a23e78f7..557277b9e0a 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -6291,7 +6291,7 @@ QPixmap QCommonStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &p // High intensity colors needs dark shifting in the color table, while // low intensity colors needs light shifting. This is to increase the - // percieved contrast. + // perceived contrast. if ((red - factor > green && red - factor > blue) || (green - factor > red && green - factor > blue) || (blue - factor > red && blue - factor > green)) From cf4a6111150d866424ee07bda80a1d38f24ea02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 9 Feb 2018 15:09:25 +0100 Subject: [PATCH 20/21] testlib: Split out test identifier buildup into standalone function Change-Id: I99aa106d5aab8f299e61835680709e4fd856defe Reviewed-by: Simon Hausmann --- src/testlib/qplaintestlogger.cpp | 47 +++++++++++++++++++------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 77959341cf6..25c9655691a 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -223,38 +223,47 @@ void QPlainTestLogger::outputMessage(const char *str) outputString(str); } +static QTestCharBuffer testIdentifier() +{ + QTestCharBuffer identifier; + + const char *testObject = QTestResult::currentTestObjectName(); + const char *testFunction = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction() : "UnknownTestFunc"; + + const char *dataTag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : ""; + const char *globalDataTag = QTestResult::currentGlobalDataTag() ? QTestResult::currentGlobalDataTag() : ""; + const char *tagFiller = (dataTag[0] && globalDataTag[0]) ? ":" : ""; + + QTest::qt_asprintf(&identifier, "%s::%s(%s%s%s)", testObject, testFunction, globalDataTag, tagFiller, dataTag); + return identifier; +} + void QPlainTestLogger::printMessage(const char *type, const char *msg, const char *file, int line) { QTEST_ASSERT(type); QTEST_ASSERT(msg); - QTestCharBuffer buf; + QTestCharBuffer messagePrefix; - const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction() - : "UnknownTestFunc"; - const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : ""; - const char *gtag = QTestResult::currentGlobalDataTag() - ? QTestResult::currentGlobalDataTag() - : ""; - const char *filler = (tag[0] && gtag[0]) ? ":" : ""; + QTestCharBuffer failureLocation; if (file) { - QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n" #ifdef Q_OS_WIN - "%s(%d) : failure location\n" +#define FAILURE_LOCATION_STR "\n%s(%d) : failure location" #else - " Loc: [%s(%d)]\n" +#define FAILURE_LOCATION_STR "\n Loc: [%s(%d)]" #endif - , type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, - msg[0] ? " " : "", msg, file, line); - } else { - QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n", - type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, - msg[0] ? " " : "", msg); + QTest::qt_asprintf(&failureLocation, FAILURE_LOCATION_STR, file, line); } + + const char *msgFiller = msg[0] ? " " : ""; + QTest::qt_asprintf(&messagePrefix, "%s: %s%s%s%s\n", + type, testIdentifier().data(), msgFiller, msg, failureLocation.data()); + // In colored mode, printf above stripped our nonprintable control characters. // Put them back. - memcpy(buf.data(), type, strlen(type)); - outputMessage(buf.data()); + memcpy(messagePrefix.data(), type, strlen(type)); + + outputMessage(messagePrefix.data()); } void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result) From 76010f4af8c9a59a20c489d70c7f99b802f9721f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 13 Feb 2018 17:51:53 +0100 Subject: [PATCH 21/21] macOS: Add more granular logging categories for window events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I202e2cecfb5438ba9edc82efaf80b6ecebafb835 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoahelpers.h | 2 ++ src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 ++ src/plugins/platforms/cocoa/qcocoawindow.mm | 6 +++--- src/plugins/platforms/cocoa/qnsview.mm | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 2c4783b1e39..84632c1487d 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -63,6 +63,8 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView)); QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQpaCocoaWindow) +Q_DECLARE_LOGGING_CATEGORY(lcQpaCocoaDrawing) +Q_DECLARE_LOGGING_CATEGORY(lcQpaCocoaMouse) class QPixmap; class QString; diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index fdf4733f0ef..b729c7f4c00 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaCocoaWindow, "qt.qpa.cocoa.window"); +Q_LOGGING_CATEGORY(lcQpaCocoaDrawing, "qt.qpa.cocoa.drawing"); +Q_LOGGING_CATEGORY(lcQpaCocoaMouse, "qt.qpa.cocoa.mouse"); // // Conversion Functions diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c000c90a855..562872a3005 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1163,7 +1163,7 @@ void QCocoaWindow::handleExposeEvent(const QRegion ®ion) // rect as a real expose event (including going from non-exposed to // exposed). FIXME: Should this logic live in QGuiApplication? if (isExposed() && m_exposedRect == previouslyExposedRect) { - qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "as update request"; + qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::handleExposeEvent" << window() << region << "as update request"; windowPrivate->deliverUpdateRequest(); return; } else { @@ -1173,7 +1173,7 @@ void QCocoaWindow::handleExposeEvent(const QRegion ®ion) } } - qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "isExposed" << isExposed(); + qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::handleExposeEvent" << window() << region << "isExposed" << isExposed(); QWindowSystemInterface::handleExposeEvent(window(), region); } @@ -1346,7 +1346,7 @@ void QCocoaWindow::recreateWindowIfNeeded() void QCocoaWindow::requestUpdate() { - qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::requestUpdate" << window(); + qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::requestUpdate" << window(); [m_view setNeedsDisplay:YES]; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 32f73759c2f..216b2f1287f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -314,7 +314,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") for (int i = 0; i < numDirtyRects; ++i) exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect(); - qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion; + qCDebug(lcQpaCocoaDrawing) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion; #ifndef QT_NO_OPENGL if (m_glContext && m_shouldSetGLContextinDrawRect) { @@ -331,7 +331,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") // But AppKit will reset the needsDisplay state of the view after completing // the current display cycle, so we need to defer the request to redisplay. // FIXME: Perhaps this should be a trigger to enable CADisplayLink? - qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] issuing deferred setNeedsDisplay due to pending update request"; + qCDebug(lcQpaCocoaDrawing) << "[QNSView drawRect:] issuing deferred setNeedsDisplay due to pending update request"; dispatch_async(dispatch_get_main_queue (), ^{ [self setNeedsDisplay:YES]; }); @@ -348,7 +348,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") if (!m_platformWindow) return; - qCDebug(lcQpaCocoaWindow) << "[QNSView updateLayer]" << m_platformWindow->window(); + qCDebug(lcQpaCocoaDrawing) << "[QNSView updateLayer]" << m_platformWindow->window(); // FIXME: Find out if there's a way to resolve the dirty rect like in drawRect: m_platformWindow->handleExposeEvent(QRectF::fromCGRect(self.bounds).toRect()); @@ -787,7 +787,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") - (void)cursorUpdate:(NSEvent *)theEvent { - qCDebug(lcQpaCocoaWindow) << "[QNSView cursorUpdate:]" << self.cursor; + qCDebug(lcQpaCocoaMouse) << "[QNSView cursorUpdate:]" << self.cursor; // Note: We do not get this callback when moving from a subview that // uses the legacy cursorRect API, so the cursor is reset to the arrow