diff options
35 files changed, 523 insertions, 245 deletions
diff --git a/examples/widgets/itemviews/addressbook/addresswidget.cpp b/examples/widgets/itemviews/addressbook/addresswidget.cpp index cd6f4a5534..5db470a39b 100644 --- a/examples/widgets/itemviews/addressbook/addresswidget.cpp +++ b/examples/widgets/itemviews/addressbook/addresswidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Toolkit. @@ -163,24 +163,23 @@ void AddressWidget::setupTabs() for (int i = 0; i < groups.size(); ++i) { QString str = groups.at(i); + QString regExp = QString("^[%1].*").arg(str); proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(table); + proxyModel->setFilterRegExp(QRegExp(regExp, Qt::CaseInsensitive)); + proxyModel->setFilterKeyColumn(0); QTableView *tableView = new QTableView; tableView->setModel(proxyModel); - tableView->setSortingEnabled(true); + tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->horizontalHeader()->setStretchLastSection(true); tableView->verticalHeader()->hide(); tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); tableView->setSelectionMode(QAbstractItemView::SingleSelection); - QString newStr = QString("^[%1].*").arg(str); - - proxyModel->setFilterRegExp(QRegExp(newStr, Qt::CaseInsensitive)); - proxyModel->setFilterKeyColumn(0); - proxyModel->sort(0, Qt::AscendingOrder); + tableView->setSortingEnabled(true); connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp new file mode 100644 index 0000000000..a148a30adf --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qeglfshooks_hix5hd2.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfshooks.h" +#include <EGL/fbdev_window.h> + +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/fb.h> + +#include <private/qcore_unix_p.h> + +QT_BEGIN_NAMESPACE + +class QEglFSHiX5Hd2Hooks : public QEglFSHooks +{ +private: + void fbInit(); +public: + void platformInit() Q_DECL_OVERRIDE; + EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) Q_DECL_OVERRIDE; + void destroyNativeWindow(EGLNativeWindowType window) Q_DECL_OVERRIDE; +}; + +void QEglFSHiX5Hd2Hooks::fbInit() +{ + int fd = qt_safe_open("/dev/fb0", O_RDWR, 0); + if (fd == -1) + qWarning("Failed to open fb to detect screen resolution!"); + + struct fb_var_screeninfo vinfo; + memset(&vinfo, 0, sizeof(vinfo)); + if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) + qWarning("Could not get variable screen info"); + + vinfo.bits_per_pixel = 32; + vinfo.red.length = 8; + vinfo.green.length = 8; + vinfo.blue.length = 8; + vinfo.transp.length = 8; + vinfo.blue.offset = 0; + vinfo.green.offset = 8; + vinfo.red.offset = 16; + vinfo.transp.offset = 24; + vinfo.yres_virtual = 2 * vinfo.yres; + + if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) == -1) + qErrnoWarning(errno, "Unable to set double buffer mode!"); + + qt_safe_close(fd); + return; +} + +void QEglFSHiX5Hd2Hooks::platformInit() +{ + QEglFSHooks::platformInit(); + fbInit(); +} + +EGLNativeWindowType QEglFSHiX5Hd2Hooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) +{ + fbdev_window *fbwin = reinterpret_cast<fbdev_window *>(malloc(sizeof(fbdev_window))); + if (NULL == fbwin) + return 0; + + fbwin->width = size.width(); + fbwin->height = size.height(); + return (EGLNativeWindowType)fbwin; +} + +void QEglFSHiX5Hd2Hooks::destroyNativeWindow(EGLNativeWindowType window) +{ + free(window); +} + +QEglFSHiX5Hd2Hooks eglFSHiX5Hd2Hooks; +QEglFSHooks *platformHooks = &eglFSHiX5Hd2Hooks; + +QT_END_NAMESPACE diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf new file mode 100644 index 0000000000..851d08600f --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf @@ -0,0 +1,44 @@ +# +# qmake configuration for linux-arm-hisilicon-hix5hd2-g++ using the arm-linux-gnueabihf-g++ crosscompiler +# +# A typical configure line looks like this: +# <path-to-qt-src>/configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake +# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- +# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng +# -no-icu -no-nis -sysroot <path-to-rootfs> -extprefix <path-to-targetinstall> -hostprefix <path-to-hostinstall> +# -prefix <path-to-prefix> +# +# such as +# ./configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake +# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- +# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng +# -no-icu -no-nis -sysroot /home/abc/project/sysbase +# -extprefix /home/abc/project/sysbase/qt_install +# -hostprefix /home/abc/project/qtdir/qtbase_hostinstall +# -prefix /home/abc/project/sysbase/qt_install + +include(../common/linux_device_pre.conf) +EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_hix5hd2.cpp + +QMAKE_INCDIR += /usr/arm-linux-gnueabihf/include +QMAKE_LIBDIR += /usr/arm-linux-gnueabihf/lib + +QMAKE_LIBS += -lrt + +QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/egl/include +QMAKE_LIBDIR_EGL += $$[QT_SYSROOT]/egl/lib +QMAKE_INCDIR_OPENGL_ES2 += $$QMAKE_INCDIR_EGL +QMAKE_LIBDIR_OPENGL_ES2 += $$QMAKE_LIBDIR_EGL + +QMAKE_LIBS_EGL += -lMali +QMAKE_LIBS_OPENGL_ES2 += $$QMAKE_LIBS_EGL +QMAKE_LIBS_OPENVG += $$QMAKE_LIBS_EGL + +DISTRO_OPTS += hard-float + +QMAKE_CFLAGS +=-march=armv7-a -mcpu=cortex-a9 -mfpu=vfpv3-d16 +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS + +include(../common/linux_arm_device_post.conf) + +load(qt_config) diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h new file mode 100644 index 0000000000..9236ebd657 --- /dev/null +++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qdirectfbeglhooks_bcm97425.cpp b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qdirectfbeglhooks_bcm97425.cpp index 8c59d1cfa3..b07e4ab217 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qdirectfbeglhooks_bcm97425.cpp +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qdirectfbeglhooks_bcm97425.cpp @@ -57,7 +57,7 @@ void QDirectFBEGLHooks::platformInit() void QDirectFBEGLHooks::platformDestroy() { - DBPL_UnregisterDirectFBDisplayPlatform(&dbpl_handle); + DBPL_UnregisterDirectFBDisplayPlatform(dbpl_handle); dbpl_handle = 0; } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 2bc52c6150..5210d80953 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Copyright (C) 2012 Intel Corporation. +** Copyright (C) 2014 Intel Corporation. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -59,7 +59,7 @@ #include <QtCore/qconfig.h> #include <QtCore/qfeatures.h> #endif -#if defined(Q_CC_MSVC) && _MSC_VER <= 1500 /* VS2008 */ +#ifdef _MSC_VER # define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE) #else # define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index c3a4909932..63dd4c1387 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1100,8 +1100,13 @@ typedef void (*QtMsgHandler)(QtMsgType, const char *); Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); #endif -static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context) -static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context) +static void qDefaultMsgHandler(QtMsgType type, const char *buf); +static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &buf); + +// pointer to QtMsgHandler debug handler (without context) +static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMsgHandler); +// pointer to QtMessageHandler debug handler (with context) +static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler); #if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) static void systemd_default_message_handler(QtMsgType type, @@ -1267,20 +1272,15 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex } #endif - if (!msgHandler) - msgHandler = qDefaultMsgHandler; - if (!messageHandler) - messageHandler = qDefaultMessageHandler; - // prevent recursion in case the message handler generates messages // itself, e.g. by using Qt API if (grabMessageHandler()) { // prefer new message handler over the old one - if (msgHandler == qDefaultMsgHandler - || messageHandler != qDefaultMessageHandler) { - (*messageHandler)(msgType, context, message); + if (msgHandler.load() == qDefaultMsgHandler + || messageHandler.load() != qDefaultMessageHandler) { + (*messageHandler.load())(msgType, context, message); } else { - (*msgHandler)(msgType, message.toLocal8Bit().constData()); + (*msgHandler.load())(msgType, message.toLocal8Bit().constData()); } ungrabMessageHandler(); } else { @@ -1485,22 +1485,18 @@ void qErrnoWarning(int code, const char *msg, ...) QtMessageHandler qInstallMessageHandler(QtMessageHandler h) { - if (!messageHandler) - messageHandler = qDefaultMessageHandler; - QtMessageHandler old = messageHandler; - messageHandler = h; - return old; + if (!h) + h = qDefaultMessageHandler; + //set 'h' and return old message handler + return messageHandler.fetchAndStoreRelaxed(h); } QtMsgHandler qInstallMsgHandler(QtMsgHandler h) { - //if handler is 0, set it to the - //default message handler - if (!msgHandler) - msgHandler = qDefaultMsgHandler; - QtMsgHandler old = msgHandler; - msgHandler = h; - return old; + if (!h) + h = qDefaultMsgHandler; + //set 'h' and return old message handler + return msgHandler.fetchAndStoreRelaxed(h); } void qSetMessagePattern(const QString &pattern) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 873c1bf0cc..e5c708e29a 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. @@ -306,7 +306,7 @@ This enum provides shorter names for the keyboard modifier keys supported by Qt. - \b{Note:} On Mac OS X, the \c CTRL value corresponds to + \note On Mac OS X, the \c CTRL value corresponds to the Command keys on the Macintosh keyboard, and the \c META value corresponds to the Control keys. @@ -986,7 +986,7 @@ \value WA_NoSystemBackground Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not - automatically repainted. \note Unlike WA_OpaquePaintEvent, newly exposed + automatically repainted. \b Note: Unlike WA_OpaquePaintEvent, newly exposed areas are \b never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the @@ -998,7 +998,7 @@ before generating paint events. The use of WA_OpaquePaintEvent provides a small optimization by helping to reduce flicker on systems that do not support double buffering and avoiding computational cycles necessary to - erase the background prior to painting. \note Unlike + erase the background prior to painting. \b Note: Unlike WA_NoSystemBackground, WA_OpaquePaintEvent makes an effort to avoid transparent window backgrounds. This flag is set or cleared by the widget's author. @@ -1011,7 +1011,7 @@ \value WA_PaintOnScreen Indicates that the widget wants to draw directly onto the screen. Widgets with this attribute set do not participate in composition management, i.e. they cannot be semi-transparent or shine - through semi-transparent overlapping widgets. \note This flag is only + through semi-transparent overlapping widgets. \b Note: This flag is only supported on X11 and it disables double buffering. On Qt for Embedded Linux, the flag only works when set on a top-level widget and it relies on support from the active screen driver. This flag is set or cleared by the @@ -1082,7 +1082,7 @@ \value WA_UpdatesDisabled Indicates that updates are blocked (including the system background). This flag is set or cleared by the Qt kernel. - \warning This flag must \e never be set or cleared by the widget's author. + \b Warning: This flag must \e never be set or cleared by the widget's author. \value WA_WindowModified Indicates that the window is marked as modified. On some platforms this flag will do nothing, on others (including Mac OS X @@ -1124,50 +1124,50 @@ \value WA_X11NetWmWindowTypeToolBar Adds _NET_WM_WINDOW_TYPE_TOOLBAR to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for QToolBar. \value WA_X11NetWmWindowTypeMenu Adds _NET_WM_WINDOW_TYPE_MENU to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for QMenu when torn-off. \value WA_X11NetWmWindowTypeUtility Adds _NET_WM_WINDOW_TYPE_UTILITY to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for the Qt::Tool window type. \value WA_X11NetWmWindowTypeSplash Adds _NET_WM_WINDOW_TYPE_SPLASH to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for the Qt::SplashScreen window type. \value WA_X11NetWmWindowTypeDialog Adds _NET_WM_WINDOW_TYPE_DIALOG to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This - attribute has no effect on non-X11 platforms. \note Qt automatically sets + attribute has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for the Qt::Dialog and Qt::Sheet window types. \value WA_X11NetWmWindowTypeDropDownMenu Adds _NET_WM_WINDOW_TYPE_DROPDOWN_MENU to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This - attribute has no effect on non-X11 platforms. \note Qt + attribute has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for QMenus added to a QMenuBar. \value WA_X11NetWmWindowTypePopupMenu Adds _NET_WM_WINDOW_TYPE_POPUP_MENU to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for QMenu. \value WA_X11NetWmWindowTypeToolTip Adds _NET_WM_WINDOW_TYPE_TOOLTIP to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for the Qt::ToolTip window type. \value WA_X11NetWmWindowTypeNotification Adds @@ -1178,13 +1178,13 @@ \value WA_X11NetWmWindowTypeCombo Adds _NET_WM_WINDOW_TYPE_COMBO to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute for the QComboBox pop-up. \value WA_X11NetWmWindowTypeDND Adds _NET_WM_WINDOW_TYPE_DND to the window's _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute - has no effect on non-X11 platforms. \note Qt automatically sets this + has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute on the feedback widget used during a drag. \value WA_MacFrameworkScaled Enables resolution independence aware mode @@ -1255,7 +1255,7 @@ \value Key_Enter Typically located on the keypad. \value Key_Insert \value Key_Delete - \value Key_Pause The Pause/Break key (\note Not anything to do with pausing media) + \value Key_Pause The Pause/Break key (\b Note: Not related to pausing media) \value Key_Print \value Key_SysReq \value Key_Clear @@ -1526,7 +1526,7 @@ \value Key_MediaPrevious \value Key_MediaNext \value Key_MediaRecord - \value Key_MediaPause A key setting the state of the media player to pause (\note not the pause/break key) + \value Key_MediaPause A key setting the state of the media player to pause (\b Note: not the pause/break key) \value Key_MediaTogglePlayPause A key to toggle the play/pause state in the media player (rather than setting an absolute state) \value Key_HomePage \value Key_Favorites @@ -2868,7 +2868,7 @@ The keypad is used to implement a virtual cursor, unless the device has an analog mouse type of input device (e.g. touchpad) - \note: in 4.6, cursor navigation is only implemented for Symbian OS. + \note In 4.6, cursor navigation is only implemented for Symbian OS. On other platforms, it behaves as NavigationModeNone. \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() diff --git a/src/gui/accessible/qaccessiblecache_mac.mm b/src/gui/accessible/qaccessiblecache_mac.mm index bc6d0712d6..97c0c7e097 100644 --- a/src/gui/accessible/qaccessiblecache_mac.mm +++ b/src/gui/accessible/qaccessiblecache_mac.mm @@ -43,19 +43,19 @@ QT_BEGIN_NAMESPACE -void QAccessibleCache::insertElement(QAccessible::Id axid, QMacAccessibilityElement *element) const +void QAccessibleCache::insertElement(QAccessible::Id axid, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element) const { cocoaElements[axid] = element; } void QAccessibleCache::removeCocoaElement(QAccessible::Id axid) { - QMacAccessibilityElement *element = elementForId(axid); + QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element = elementForId(axid); [element invalidate]; cocoaElements.remove(axid); } -QMacAccessibilityElement *QAccessibleCache::elementForId(QAccessible::Id axid) const +QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *QAccessibleCache::elementForId(QAccessible::Id axid) const { return cocoaElements.value(axid); } diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h index 3ca62709b1..643cbe5667 100644 --- a/src/gui/accessible/qaccessiblecache_p.h +++ b/src/gui/accessible/qaccessiblecache_p.h @@ -59,9 +59,7 @@ #include "qaccessible.h" -#ifdef Q_OS_MAC - Q_FORWARD_DECLARE_OBJC_CLASS(QMacAccessibilityElement); -#endif +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QMacAccessibilityElement)); QT_BEGIN_NAMESPACE @@ -76,8 +74,8 @@ public: void deleteInterface(QAccessible::Id id, QObject *obj = 0); #ifdef Q_OS_MAC - QMacAccessibilityElement *elementForId(QAccessible::Id axid) const; - void insertElement(QAccessible::Id axid, QMacAccessibilityElement *element) const; + QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *elementForId(QAccessible::Id axid) const; + void insertElement(QAccessible::Id axid, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element) const; #endif private Q_SLOTS: @@ -91,7 +89,7 @@ private: #ifdef Q_OS_MAC void removeCocoaElement(QAccessible::Id axid); - mutable QHash<QAccessible::Id, QMacAccessibilityElement *> cocoaElements; + mutable QHash<QAccessible::Id, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *> cocoaElements; #endif friend class QAccessible; diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index b64956c65c..06a71af552 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -2812,9 +2812,8 @@ bool QOpenGLTexture::hasFeature(Feature feature) break; case TextureBuffer: - supported = f.version() >= qMakePair(4, 3) - || (ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object")) - && ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_range"))); + supported = f.version() >= qMakePair(3, 0) + || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object")); break; case StencilTexturing: diff --git a/src/network/kernel/qdnslookup_winrt.cpp b/src/network/kernel/qdnslookup_winrt.cpp index 3a84279af6..52a8c3a530 100644 --- a/src/network/kernel/qdnslookup_winrt.cpp +++ b/src/network/kernel/qdnslookup_winrt.cpp @@ -116,6 +116,8 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN unsigned int size; endpointPairs->get_Size(&size); + // endpoint pairs might contain duplicates so we temporarily store addresses in a QSet + QSet<QHostAddress> addresses; for (unsigned int i = 0; i < size; ++i) { ComPtr<IEndpointPair> endpointpair; endpointPairs->GetAt(i, &endpointpair); @@ -133,9 +135,12 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN remoteHost->get_CanonicalName(name.GetAddressOf()); UINT32 length; PCWSTR rawString = name.GetRawBuffer(&length); + addresses.insert(QHostAddress(QString::fromWCharArray(rawString, length))); + } + foreach (const QHostAddress &address, addresses) { QDnsHostAddressRecord record; record.d->name = aceHostname; - record.d->value = QHostAddress(QString::fromWCharArray(rawString, length)); + record.d->value = address; reply->hostAddressRecords.append(record); } } diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h index ca34deceef..4a5baefbc5 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h @@ -43,22 +43,25 @@ #include <QtCore/qglobal.h> +#include "qt_mac_p.h" + #import <Cocoa/Cocoa.h> #import <AppKit/NSAccessibility.h> #import <qaccessible.h> -Q_FORWARD_DECLARE_OBJC_CLASS(QMacAccessibilityElement); +@class QT_MANGLE_NAMESPACE(QMacAccessibilityElement); -@interface QMacAccessibilityElement : NSObject { +@interface QT_MANGLE_NAMESPACE(QMacAccessibilityElement) : NSObject { NSString *role; QAccessible::Id axid; } - (id)initWithId:(QAccessible::Id)anId; -+ (QMacAccessibilityElement *)elementWithId:(QAccessible::Id)anId; ++ (QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *)elementWithId:(QAccessible::Id)anId; @end -#endif +QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAccessibilityElement); +#endif diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 2f5355b180..efe3269d42 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -433,7 +433,7 @@ static void cleanupCocoaApplicationDelegate() { Q_UNUSED(replyEvent); NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; - QWindowSystemInterface::handleFileOpenEvent(QCFString::toQString(urlString)); + QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString))); } - (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 32692edde4..4b9a0146a9 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -329,12 +329,13 @@ NSMenuItem *QCocoaMenuItem::sync() [m_native setKeyEquivalentModifierMask:NSCommandKeyMask]; } + NSImage *img = nil; if (!m_icon.isNull()) { - NSImage *img = qt_mac_create_nsimage(m_icon); + img = qt_mac_create_nsimage(m_icon); [img setSize:NSMakeSize(16, 16)]; - [m_native setImage: img]; - [img release]; } + [m_native setImage:img]; + [img release]; [m_native setState:m_checked ? NSOnState : NSOffState]; return m_native; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 66a81b0d9f..8f885ab5f3 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -51,14 +51,15 @@ #include "qcocoaglcontext.h" #endif #include "qnsview.h" +#include "qt_mac_p.h" QT_FORWARD_DECLARE_CLASS(QCocoaWindow) -@class QNSWindowHelper; +@class QT_MANGLE_NAMESPACE(QNSWindowHelper); @protocol QNSWindowProtocol -@property (nonatomic, readonly) QNSWindowHelper *helper; +@property (nonatomic, readonly) QT_MANGLE_NAMESPACE(QNSWindowHelper) *helper; - (void)superSendEvent:(NSEvent *)theEvent; - (void)closeAndRelease; @@ -67,7 +68,7 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow) typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; -@interface QNSWindowHelper : NSObject +@interface QT_MANGLE_NAMESPACE(QNSWindowHelper) : NSObject { QCocoaNSWindow *_window; QCocoaWindow *_platformWindow; @@ -86,7 +87,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; @end -@interface QNSWindow : NSWindow<QNSWindowProtocol> +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowHelper); + +@interface QT_MANGLE_NAMESPACE(QNSWindow) : NSWindow<QNSWindowProtocol> { QNSWindowHelper *_helper; } @@ -99,7 +102,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; @end -@interface QNSPanel : NSPanel<QNSWindowProtocol> +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindow); + +@interface QT_MANGLE_NAMESPACE(QNSPanel) : NSPanel<QNSWindowProtocol> { QNSWindowHelper *_helper; } @@ -112,7 +117,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; @end -@class QNSWindowDelegate; +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSPanel); + +@class QT_MANGLE_NAMESPACE(QNSWindowDelegate); QT_BEGIN_NAMESPACE // QCocoaWindow @@ -227,6 +234,7 @@ public: void obscureWindow(); void updateExposedGeometry(); QWindow *childWindowAt(QPoint windowPoint); + bool shouldRefuseKeyWindowAndFirstResponder(); protected: void recreateWindow(const QPlatformWindow *parentWindow); QCocoaNSWindow *createNSWindow(); @@ -267,6 +275,7 @@ public: // for QNSView bool m_windowUnderMouse; bool m_inConstructor; + bool m_inSetVisible; #ifndef QT_NO_OPENGL QCocoaGLContext *m_glContext; #endif diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a7ebf4148c..29b983cd89 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -239,6 +239,9 @@ static bool isMouseEvent(NSEvent *ev) if (!pw || pw->m_isNSWindowChild) return NO; + if (pw->shouldRefuseKeyWindowAndFirstResponder()) + return NO; + // The default implementation returns NO for title-bar less windows, // override and return yes here to make sure popup windows such as // the combobox popup can become the key window. @@ -316,6 +319,9 @@ static bool isMouseEvent(NSEvent *ev) if (!pw) return NO; + if (pw->shouldRefuseKeyWindowAndFirstResponder()) + return NO; + // Only tool or dialog windows should become key: Qt::WindowType type = pw->window()->type(); if (type == Qt::Tool || type == Qt::Dialog) @@ -368,6 +374,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_windowModality(Qt::NonModal) , m_windowUnderMouse(false) , m_inConstructor(true) + , m_inSetVisible(false) #ifndef QT_NO_OPENGL , m_glContext(0) #endif @@ -616,6 +623,8 @@ void QCocoaWindow::setVisible(bool visible) if (m_isNSWindowChild && m_hiddenByClipping) return; + m_inSetVisible = true; + QCocoaAutoReleasePool pool; QCocoaWindow *parentCocoaWindow = 0; if (window()->transientParent()) @@ -755,6 +764,8 @@ void QCocoaWindow::setVisible(bool visible) [parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask]; } } + + m_inSetVisible = false; } NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags) @@ -1784,6 +1795,23 @@ QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint) return targetWindow; } +bool QCocoaWindow::shouldRefuseKeyWindowAndFirstResponder() +{ + // This function speaks up if there's any reason + // to refuse key window or first responder state. + + if (window()->flags() & Qt::WindowDoesNotAcceptFocus) + return true; + + if (m_inSetVisible) { + QVariant showWithoutActivating = window()->property("_q_showWithoutActivating"); + if (showWithoutActivating.isValid() && showWithoutActivating.toBool()) + return true; + } + + return false; +} + QMargins QCocoaWindow::frameMargins() const { NSRect frameW = [m_nsWindow frame]; diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 53eee4a95d..a75e366a73 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -65,6 +65,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); QWindow *m_window; QCocoaWindow *m_platformWindow; Qt::MouseButtons m_buttons; + Qt::MouseButtons m_frameStrutButtons; QString m_composingText; bool m_sendKeyEvent; QStringList *currentCustomDragTypes; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4a562f8a4e..cc8fe51e0f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -142,6 +142,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; m_shouldInvalidateWindowShadow = false; m_window = 0; m_buttons = Qt::NoButton; + m_frameStrutButtons = Qt::NoButton; m_sendKeyEvent = false; m_subscribesForGlobalFrameNotifications = false; #ifndef QT_NO_OPENGL @@ -603,7 +604,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (BOOL)acceptsFirstResponder { - if (m_window->flags() & Qt::WindowDoesNotAcceptFocus) + if (m_platformWindow->shouldRefuseKeyWindowAndFirstResponder()) return NO; if (m_window->flags() & Qt::WindowTransparentForInput) return NO; @@ -661,6 +662,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (void)resetMouseButtons { m_buttons = Qt::NoButton; + m_frameStrutButtons = Qt::NoButton; } - (void)handleMouseEvent:(NSEvent *)theEvent @@ -693,22 +695,22 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; NSEventType ty = [theEvent type]; switch (ty) { case NSLeftMouseDown: - m_buttons |= Qt::LeftButton; + m_frameStrutButtons |= Qt::LeftButton; break; case NSLeftMouseUp: - m_buttons &= ~Qt::LeftButton; + m_frameStrutButtons &= ~Qt::LeftButton; break; case NSRightMouseDown: - m_buttons |= Qt::RightButton; + m_frameStrutButtons |= Qt::RightButton; break; case NSRightMouseUp: - m_buttons &= ~Qt::RightButton; + m_frameStrutButtons &= ~Qt::RightButton; break; case NSOtherMouseDown: - m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]); + m_frameStrutButtons |= cocoaButton2QtButton([theEvent buttonNumber]); break; case NSOtherMouseUp: - m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]); + m_frameStrutButtons &= ~cocoaButton2QtButton([theEvent buttonNumber]); default: break; } @@ -726,7 +728,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y)); ulong timestamp = [theEvent timestamp] * 1000; - QWindowSystemInterface::handleFrameStrutMouseEvent(m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons); + QWindowSystemInterface::handleFrameStrutMouseEvent(m_window, timestamp, qtWindowPoint, qtScreenPoint, m_frameStrutButtons); } - (void)mouseDown:(NSEvent *)theEvent diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 5717551cc3..083466861b 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -46,7 +46,7 @@ #include "qcocoawindow.h" -@interface QNSWindowDelegate : NSObject <NSWindowDelegate> +@interface QT_MANGLE_NAMESPACE(QNSWindowDelegate) : NSObject <NSWindowDelegate> { QCocoaWindow *m_cocoaWindow; } @@ -62,4 +62,6 @@ @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate); + #endif // QNSWINDOWDELEGATE_H diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 9ba0f5cd2e..add45ecbe5 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -286,6 +286,18 @@ Qt::ScreenOrientation QQnxScreen::orientation() const return orient; } +QWindow *QQnxScreen::topLevelAt(const QPoint &point) const +{ + QListIterator<QQnxWindow*> it(m_childWindows); + it.toBack(); + while (it.hasPrevious()) { + QWindow *win = it.previous()->window(); + if (win->geometry().contains(point)) + return win; + } + return 0; +} + /*! Check if the supplied angles are perpendicular to each other. */ @@ -767,17 +779,4 @@ void QQnxScreen::setRootWindow(QQnxWindow *window) m_rootWindow = window; } -QWindow * QQnxScreen::topMostChildWindow() const -{ - if (!m_childWindows.isEmpty()) { - - // We're picking up the last window of the list here - // because this list is ordered by stacking order. - // Last window is effectively the one on top. - return m_childWindows.last()->window(); - } - - return 0; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index a0b760135f..6b2281f7b9 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -73,6 +73,8 @@ public: Qt::ScreenOrientation nativeOrientation() const; Qt::ScreenOrientation orientation() const; + QWindow *topLevelAt(const QPoint &point) const; + bool isPrimaryScreen() const { return m_primaryScreen; } int rotation() const { return m_currentRotation; } @@ -124,8 +126,6 @@ private: void addMultimediaWindow(const QByteArray &id, screen_window_t window); void removeOverlayOrUnderlayWindow(screen_window_t window); - QWindow *topMostChildWindow() const; - screen_context_t m_screenContext; screen_display_t m_display; QQnxWindow *m_rootWindow; diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 743f1394aa..64a2891e49 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -502,13 +502,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexIn if (!indexInParent) return E_INVALIDARG; QAccessibleInterface *par = accessible->parent(); - if (!par) { - *indexInParent = -1; + *indexInParent = par ? par->indexOfChild(accessible) : -1; + if (*indexInParent < 0) { + qCWarning(lcQpaAccessibility) << "index in parent invalid:" << accessible << "parent:" << par; return S_FALSE; } - int indexOfChild = par->indexOfChild(accessible); - Q_ASSERT(indexOfChild >= 0); - *indexInParent = indexOfChild; return S_OK; } diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h index 921e64d64c..47b03b29cc 100644 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h @@ -86,8 +86,10 @@ #define HWND_MESSAGE 0 #endif +// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact +// he blits it wrongly, so lets not do any harm and define it to 0 #ifndef CAPTUREBLT -#define CAPTUREBLT (DWORD)0x40000000 +#define CAPTUREBLT (DWORD)0x0 #endif #define SW_SHOWMINIMIZED SW_MINIMIZE diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index a574dcae6c..cf809b37e5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -251,14 +251,13 @@ void QXcbConnection::xi2Select(xcb_window_t window) XIEventMask mask; mask.mask_len = sizeof(bitMask); mask.mask = xiBitMask; - // Enable each touchscreen - foreach (XInput2DeviceData *dev, m_touchDevices) { - mask.deviceid = dev->xiDeviceInfo->deviceid; + if (!m_touchDevices.isEmpty()) { + mask.deviceid = XIAllMasterDevices; Status result = XISelectEvents(xDisplay, window, &mask, 1); - // If we have XInput >= 2.2 and successfully enable a touchscreen, then - // it will provide touch only. In most other cases, there will be - // emulated mouse events from the driver. If not, then Qt must do its - // own mouse emulation to enable interaction with mouse-oriented QWidgets. + // If we select for touch events on the master pointer, XInput2 + // will not synthesize mouse events. This means Qt must do it, + // which is also preferable, since Qt can control better when + // to do so. if (m_xi2Minor >= 2 && result == Success) has_touch_without_mouse_emulation = true; } @@ -272,10 +271,10 @@ void QXcbConnection::xi2Select(xcb_window_t window) // similar handlers useless and we have no intention to infect // all the pure xcb code with Xlib-based XI2. if (!m_tabletData.isEmpty()) { - unsigned int tabletBitMask = bitMask; + unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask); QVector<XIEventMask> xiEventMask(m_tabletData.count()); - tabletBitMask |= XI_ButtonPressMask; + tabletBitMask = XI_ButtonPressMask; tabletBitMask |= XI_ButtonReleaseMask; tabletBitMask |= XI_MotionMask; tabletBitMask |= XI_PropertyEventMask; @@ -294,24 +293,18 @@ void QXcbConnection::xi2Select(xcb_window_t window) // Enable each scroll device if (!m_scrollingDevices.isEmpty()) { QVector<XIEventMask> xiEventMask(m_scrollingDevices.size()); - unsigned int scrollBitMask = 0; + unsigned int scrollBitMask; unsigned char *xiScrollBitMask = reinterpret_cast<unsigned char *>(&scrollBitMask); + scrollBitMask = XI_MotionMask; scrollBitMask |= XI_ButtonReleaseMask; - bitMask |= XI_MotionMask; - bitMask |= XI_ButtonReleaseMask; int i=0; Q_FOREACH (const ScrollingDevice& scrollingDevice, m_scrollingDevices) { if (tabletDevices.contains(scrollingDevice.deviceId)) continue; // All necessary events are already captured. xiEventMask[i].deviceid = scrollingDevice.deviceId; - if (m_touchDevices.contains(scrollingDevice.deviceId)) { - xiEventMask[i].mask_len = sizeof(bitMask); - xiEventMask[i].mask = xiBitMask; - } else { - xiEventMask[i].mask_len = sizeof(scrollBitMask); - xiEventMask[i].mask = xiScrollBitMask; - } + xiEventMask[i].mask_len = sizeof(scrollBitMask); + xiEventMask[i].mask = xiScrollBitMask; i++; } XISelectEvents(xDisplay, window, xiEventMask.data(), i); @@ -458,7 +451,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y) ); if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) { - XInput2DeviceData *dev = deviceForId(xiEvent->deviceid); + XInput2DeviceData *dev = deviceForId(xiDeviceEvent->sourceid); Q_ASSERT(dev); const bool firstTouch = m_touchPoints.isEmpty(); if (xiEvent->evtype == XI_TouchBegin) { @@ -563,22 +556,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) qDebug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition << " area " << touchPoint.area << " pressure " << touchPoint.pressure; QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values()); - if (has_touch_without_mouse_emulation) { - // We need to grab the touch event to prevent mouse emulation. - if (xiEvent->evtype == XI_TouchBegin) { - XIEventMask xieventmask; - unsigned int bitMask = 0; - unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask); - xieventmask.deviceid = xiEvent->deviceid; - xieventmask.mask = xiBitMask; - xieventmask.mask_len = sizeof(bitMask); - bitMask |= XI_TouchBeginMask; - bitMask |= XI_TouchUpdateMask; - bitMask |= XI_TouchEndMask; - XIGrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, platformWindow->winId(), xiEvent->time, None, GrabModeAsync, GrabModeAsync, true, &xieventmask); - } else if (xiEvent->evtype == XI_TouchEnd) - XIUngrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, xiEvent->time); - } if (touchPoint.state == Qt::TouchPointReleased) // If a touchpoint was released, we can forget it, because the ID won't be reused. m_touchPoints.remove(touchPoint.id); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 908e03cd7c..0cc8c8dbfe 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1370,6 +1370,7 @@ void QXcbWindow::setWindowTitle(const QString &title) 8, ba.length(), ba.constData())); + xcb_flush(xcb_connection()); } void QXcbWindow::setWindowIcon(const QIcon &icon) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index fbf6958923..f53bafcc5f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1411,6 +1411,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setProperty(propertyName, q->property(propertyName)); } +#ifdef Q_OS_OSX + if (q->testAttribute(Qt::WA_ShowWithoutActivating)) + win->setProperty("_q_showWithoutActivating", QVariant(true)); +#endif win->setFlags(data.window_flags); fixPosIncludesFrame(); if (q->testAttribute(Qt::WA_Moved) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index f03a7796d9..531f538820 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -100,13 +100,14 @@ QT_USE_NAMESPACE -@interface NotificationReceiver : NSObject { +@interface QT_MANGLE_NAMESPACE(NotificationReceiver) : NSObject { QMacStylePrivate *mPrivate; } - (id)initWithPrivate:(QMacStylePrivate *)priv; - (void)scrollBarStyleDidChange:(NSNotification *)notification; @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(NotificationReceiver); @implementation NotificationReceiver - (id)initWithPrivate:(QMacStylePrivate *)priv @@ -4045,11 +4046,20 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_FocusFrame: { - int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1; - int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1; - HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff, - opt->rect.height() - 2 * yOff); - HIThemeDrawFocusRect(&hirect, true, QMacCGContext(p), kHIThemeOrientationNormal); + int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w); + int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w); + NSRect rect = NSMakeRect(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff, + opt->rect.height() - 2 * yOff); + CGContextSaveGState(cg); + [NSGraphicsContext setCurrentContext:[NSGraphicsContext + graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]]; + [NSGraphicsContext saveGraphicsState]; + NSSetFocusRingStyle(NSFocusRingOnly); + NSBezierPath *focusFramePath = [NSBezierPath bezierPathWithRect:rect]; + [focusFramePath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos + [focusFramePath fill]; + [NSGraphicsContext restoreGraphicsState]; + CGContextRestoreGState(cg); break; } case CE_MenuItem: case CE_MenuEmptyArea: diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 3f53ab5f0a..38b6e9ab50 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -309,12 +309,13 @@ void tst_QDebug::textStreamModifiers() const void tst_QDebug::defaultMessagehandler() const { - MessageHandlerSetter mhs(0); - QtMessageHandler defaultMessageHandler1 = qInstallMessageHandler((QtMessageHandler)0); - QtMessageHandler defaultMessageHandler2 = qInstallMessageHandler(myMessageHandler); + MessageHandlerSetter mhs(0); // set 0, should set default handler + QtMessageHandler defaultMessageHandler1 = qInstallMessageHandler((QtMessageHandler)0); // set 0, should set and return default handler + QVERIFY(defaultMessageHandler1); + QtMessageHandler defaultMessageHandler2 = qInstallMessageHandler(myMessageHandler); // set myMessageHandler and return default handler bool same = (*defaultMessageHandler1 == *defaultMessageHandler2); QVERIFY(same); - QtMessageHandler messageHandler = qInstallMessageHandler((QtMessageHandler)0); + QtMessageHandler messageHandler = qInstallMessageHandler((QtMessageHandler)0); // set 0, should set default and return myMessageHandler same = (*messageHandler == *myMessageHandler); QVERIFY(same); } diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 13f8ced842..19f4549706 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -194,6 +194,9 @@ void tst_QIODevice::unget() #if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) QSKIP("Networking tests in a WinCE emulator are unstable"); #endif +#if defined(Q_OS_MAC) + QSKIP("The unget network test is unstable on Mac. See QTBUG-39983."); +#endif QBuffer buffer; buffer.open(QBuffer::ReadWrite); buffer.write("ZXCV"); diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 0c91c419cc..3bf25da5ee 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -371,6 +371,9 @@ void tst_QThreadPool::expiryTimeout() void tst_QThreadPool::expiryTimeoutRace() // QTBUG-3786 { +#ifdef Q_OS_WIN + QSKIP("This test is unstable on Windows. See QTBUG-3786."); +#endif ExpiryTimeoutTask task; QThreadPool threadPool; diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 211fbca330..da65ea105e 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1389,10 +1389,23 @@ void tst_QLocale::toDateTime() } #ifdef Q_OS_MAC -void tst_QLocale::macDefaultLocale() + +// Format number string according to system locale settings. +// Expected in format is US "1,234.56". +QString systemLocaleFormatNumber(const QString &numberString) { + QLocale locale = QLocale::system(); + QString numberStringCopy = numberString; + return numberStringCopy.replace(QChar(','), QChar('G')) + .replace(QChar('.'), QChar('D')) + .replace(QChar('G'), locale.groupSeparator()) + .replace(QChar('D'), locale.decimalPoint()); +} +void tst_QLocale::macDefaultLocale() +{ QLocale locale = QLocale::system(); + if (locale.name() != QLatin1String("en_US")) QSKIP("This test only tests for en_US"); @@ -1404,20 +1417,20 @@ void tst_QLocale::macDefaultLocale() QCOMPARE(locale.toString(invalidDate, QLocale::NarrowFormat), QString()); QCOMPARE(locale.toString(invalidTime, QLocale::LongFormat), QString()); QCOMPARE(locale.toString(invalidDate, QLocale::LongFormat), QString()); - QCOMPARE(locale.decimalPoint(), QChar('.')); - QCOMPARE(locale.groupSeparator(), QChar(',')); - QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy")); - QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy")); - QCOMPARE(locale.timeFormat(QLocale::ShortFormat), QString("h:mm AP")); - QCOMPARE(locale.timeFormat(QLocale::LongFormat), QString("h:mm:ss AP t")); + + // On OS X the decimal point and group separator are configurable + // independently of the locale. Verify that they have one of the + // allowed values and are not the same. + QVERIFY(locale.decimalPoint() == QChar('.') || locale.decimalPoint() == QChar(',')); + QVERIFY(locale.groupSeparator() == QChar(',') + || locale.groupSeparator() == QChar('.') + || locale.groupSeparator() == QChar('\xA0') // no-breaking space + || locale.groupSeparator() == QChar('\'') + || locale.groupSeparator() == QChar()); + QVERIFY(locale.decimalPoint() != locale.groupSeparator()); // make sure we are using the system to parse them - QCOMPARE(locale.toString(1234.56), QString("1,234.56")); - QCOMPARE(locale.toString(QDate(1974, 12, 1), QLocale::ShortFormat), QString("12/1/74")); - QCOMPARE(locale.toString(QDate(1974, 12, 1), QLocale::NarrowFormat), locale.toString(QDate(1974, 12, 1), QLocale::ShortFormat)); - QCOMPARE(locale.toString(QDate(1974, 12, 1), QLocale::LongFormat), QString("December 1, 1974")); - QCOMPARE(locale.toString(QTime(1,2,3), QLocale::ShortFormat), QString("1:02 AM")); - QCOMPARE(locale.toString(QTime(1,2,3), QLocale::NarrowFormat), locale.toString(QTime(1,2,3), QLocale::ShortFormat)); + QCOMPARE(locale.toString(1234.56), systemLocaleFormatNumber(QString("1,234.56"))); QTime currentTime = QTime::currentTime(); QTime utcTime = QDateTime::currentDateTime().toUTC().time(); @@ -1433,35 +1446,38 @@ void tst_QLocale::macDefaultLocale() const QString timeString = locale.toString(QTime(1,2,3), QLocale::LongFormat); QVERIFY(timeString.contains(QString("1:02:03"))); - // System Preferences->Language & Text, Region Tab, should choose "United States" for Region field - QCOMPARE(locale.toCurrencyString(qulonglong(1234)), QString("$1,234.00")); - QCOMPARE(locale.toCurrencyString(qlonglong(-1234)), QString("($1,234.00)")); - QCOMPARE(locale.toCurrencyString(double(1234.56)), QString("$1,234.56")); - QCOMPARE(locale.toCurrencyString(double(-1234.56)), QString("($1,234.56)")); + // To run this test make sure "Curreny" is US Dollar in System Preferences->Language & Region->Advanced. + if (locale.currencySymbol() == QString("$")) { + QCOMPARE(locale.toCurrencyString(qulonglong(1234)), systemLocaleFormatNumber(QString("$1,234.00"))); + QCOMPARE(locale.toCurrencyString(qlonglong(-1234)), systemLocaleFormatNumber(QString("($1,234.00)"))); + QCOMPARE(locale.toCurrencyString(double(1234.56)), systemLocaleFormatNumber(QString("$1,234.56"))); + QCOMPARE(locale.toCurrencyString(double(-1234.56)), systemLocaleFormatNumber(QString("($1,234.56)"))); + } // Depending on the configured time zone, the time string might not // contain a GMT specifier. (Sometimes it just names the zone, like "CEST") if (timeString.contains(QString("GMT"))) { - QString expectedGMTSpecifier("GMT"); + QString expectedGMTSpecifierBase("GMT"); if (diff >= 0) - expectedGMTSpecifier.append("+"); + expectedGMTSpecifierBase.append("+"); else - expectedGMTSpecifier.append("-"); - if (qAbs(diff) < 10) - expectedGMTSpecifier.append(QString("0%1").arg(qAbs(diff))); - else - expectedGMTSpecifier.append(QString("%1").arg(qAbs(diff))); - QVERIFY2(timeString.contains(expectedGMTSpecifier), qPrintable( - QString("timeString `%1', expectedGMTSpecifier `%2'") + expectedGMTSpecifierBase.append("-"); + + QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); + QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); + + QVERIFY2(timeString.contains(expectedGMTSpecifier) + || timeString.contains(expectedGMTSpecifierZeroExtended), + qPrintable(QString("timeString `%1', expectedGMTSpecifier `%2' or `%3'") .arg(timeString) .arg(expectedGMTSpecifier) + .arg(expectedGMTSpecifierZeroExtended) )); } QCOMPARE(locale.dayName(1), QString("Monday")); QCOMPARE(locale.dayName(7), QString("Sunday")); QCOMPARE(locale.monthName(1), QString("January")); QCOMPARE(locale.monthName(12), QString("December")); - QCOMPARE(locale.firstDayOfWeek(), Qt::Sunday); QCOMPARE(locale.quoteString("string"), QString::fromUtf8("\xe2\x80\x9c" "string" "\xe2\x80\x9d")); QCOMPARE(locale.quoteString("string", QLocale::AlternateQuotation), QString::fromUtf8("\xe2\x80\x98" "string" "\xe2\x80\x99")); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 6053021cf4..b70fa5c881 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -829,6 +829,10 @@ private: */ void tst_QLocalSocket::processConnection() { +#ifdef Q_OS_MAC + QSKIP("The processConnection test is unstable on Mac. See QTBUG-39986."); +#endif + #ifdef Q_OS_WIN const QString exeSuffix = QStringLiteral(".exe"); #else diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index f01d79d9bc..23a1455571 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -576,6 +576,9 @@ protected: #ifndef QT_NO_PROCESS void tst_QTcpServer::addressReusable() { +#ifdef Q_OS_LINUX + QSKIP("The addressReusable test is unstable on Linux. See QTBUG-39985."); +#endif QFETCH_GLOBAL(bool, setProxy); if (setProxy) { #ifndef QT_NO_NETWORKPROXY diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index eac8ab2236..4252fb673b 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1470,7 +1470,8 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined (Q_OS_WINCE) //still no proper minimizing +#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) \ + || (defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET)) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -1833,17 +1834,19 @@ void tst_QWidget::windowState() { if (m_platform == QStringLiteral("xcb")) QSKIP("X11: Many window managers do not support window state properly, which causes this test to fail."); -#ifdef Q_OS_WINCE_WM - QPoint pos(500, 500); + + QPoint pos; QSize size(200, 200); - if (qt_wince_is_smartphone()) { //small screen - pos = QPoint(10,10); - size = QSize(100,100); - } -#else - const QPoint pos(500, 500); - const QSize size(200, 200); + if (QGuiApplicationPrivate::platformIntegration()->defaultWindowState(Qt::Widget) + == Qt::WindowFullScreen) { + size = QGuiApplication::primaryScreen()->size(); + } else { + pos = QPoint(10, 10); +#ifdef Q_OS_WINCE_WM + if (qt_wince_is_smartphone()) { //small screen + size = QSize(100,100); #endif + } QWidget widget1; widget1.move(pos); @@ -1865,7 +1868,7 @@ void tst_QWidget::windowState() VERIFY_STATE(Qt::WindowMaximized); QCOMPARE(widget1.windowHandle()->windowState(), Qt::WindowMaximized); - widget1.show(); + widget1.setVisible(true); QTest::qWait(100); VERIFY_STATE(Qt::WindowMaximized); QCOMPARE(widget1.windowHandle()->windowState(), Qt::WindowMaximized); @@ -2444,7 +2447,7 @@ void tst_QWidget::normalGeometry() QCOMPARE(child->normalGeometry(), QRect()); parent.setGeometry(100, 100, 200, 200); - parent.show(); + parent.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&parent)); QApplication::processEvents(); @@ -2547,7 +2550,7 @@ void tst_QWidget::setGeometry() QRect cr(50,50,50,50); tlw.setGeometry(tr); child.setGeometry(cr); - tlw.show(); + tlw.showNormal(); QTest::qWait(50); QCOMPARE(tlw.geometry().size(), tr.size()); QCOMPARE(child.geometry(), cr); @@ -2557,7 +2560,7 @@ void tst_QWidget::setGeometry() tr.moveTopLeft(QApplication::desktop()->availableGeometry().topLeft()); tlw.setGeometry(tr); QCOMPARE(tlw.geometry(), tr); - tlw.show(); + tlw.showNormal(); QTest::qWait(50); if (tlw.frameGeometry() != tlw.geometry()) QSKIP("Your window manager is too broken for this test"); @@ -3015,7 +3018,7 @@ void tst_QWidget::saveRestoreGeometry() QWidget widget; widget.move(position); widget.resize(size); - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QApplication::processEvents(); @@ -3042,7 +3045,7 @@ void tst_QWidget::saveRestoreGeometry() QVERIFY(widget.restoreGeometry(garbage) == false); QVERIFY(widget.restoreGeometry(savedGeometry)); - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QApplication::processEvents(); @@ -3057,7 +3060,7 @@ void tst_QWidget::saveRestoreGeometry() QWidget widget; widget.move(position); widget.resize(size); - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTRY_COMPARE(widget.geometry().size(), size); @@ -3179,7 +3182,7 @@ void tst_QWidget::restoreVersion1Geometry() QCOMPARE(widget.pos(), expectedPosition); QCOMPARE(widget.size(), expectedSize); } - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(100); @@ -3237,14 +3240,14 @@ void tst_QWidget::widgetAt() w2->setGeometry(50,50, 160, 100); w2->setObjectName(QLatin1String("w2")); w2->setWindowTitle(w2->objectName()); - w1->show(); + w1->showNormal(); QVERIFY(QTest::qWaitForWindowExposed(w1.data())); qApp->processEvents(); QWidget *wr; QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); QCOMPARE(wr->objectName(), QString("w1")); - w2->show(); + w2->showNormal(); QVERIFY(QTest::qWaitForWindowExposed(w2.data())); qApp->processEvents(); qApp->processEvents(); @@ -3263,7 +3266,7 @@ void tst_QWidget::widgetAt() QWidget *w3 = new QWidget(w2.data()); w3->setGeometry(10,10,50,50); w3->setObjectName("w3"); - w3->show(); + w3->showNormal(); qApp->processEvents(); QTRY_VERIFY((wr = QApplication::widgetAt(100,100)) && wr->objectName() == QString("w3")); @@ -3271,6 +3274,11 @@ void tst_QWidget::widgetAt() qApp->processEvents(); QTRY_VERIFY((wr = QApplication::widgetAt(100, 100)) && wr->objectName() == QString("w2")); + if (!QGuiApplicationPrivate::platformIntegration() + ->hasCapability(QPlatformIntegration::WindowMasks)) { + QSKIP("Platform does not support WindowMasks"); + } + QRegion rgn = QRect(QPoint(0,0), w2->size()); QPoint point = w2->mapFromGlobal(QPoint(100,100)); rgn -= QRect(point, QSize(1,1)); @@ -3708,7 +3716,7 @@ void tst_QWidget::setMinimumSize() #ifndef Q_OS_WINCE QSize nonDefaultSize = defaultSize + QSize(5,5); w.setMinimumSize(nonDefaultSize); - w.show(); + w.showNormal(); QTest::qWait(50); QVERIFY(w.height() >= nonDefaultSize.height()); QVERIFY(w.width() >= nonDefaultSize.width()); @@ -3759,7 +3767,7 @@ void tst_QWidget::setFixedSize() QVERIFY(!w.testAttribute(Qt::WA_Resized)); w.setFixedSize(defaultSize + QSize(150, 150)); - w.show(); + w.showNormal(); QTest::qWait(50); if (m_platform == QStringLiteral("xcb")) QSKIP("QTBUG-26424"); @@ -4292,7 +4300,7 @@ void tst_QWidget::scroll() updateWidget.resize(w, h); updateWidget.reset(); updateWidget.move(QGuiApplication::primaryScreen()->geometry().center() - QPoint(250, 250)); - updateWidget.show(); + updateWidget.showNormal(); qApp->setActiveWindow(&updateWidget); QVERIFY(QTest::qWaitForWindowActive(&updateWidget)); QVERIFY(updateWidget.numPaintEvents > 0); @@ -4495,7 +4503,7 @@ void tst_QWidget::setWindowGeometry() widget.setWindowFlags(Qt::WindowFlags(windowFlags)); widget.setGeometry(rect); - widget.show(); + widget.showNormal(); if (rect.isValid()) QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTRY_COMPARE(widget.geometry(), rect); @@ -4543,7 +4551,7 @@ void tst_QWidget::setWindowGeometry() if (windowFlags != 0) widget.setWindowFlags(Qt::WindowFlags(windowFlags)); - widget.show(); + widget.showNormal(); if (rect.isValid()) QVERIFY(QTest::qWaitForWindowExposed(&widget)); widget.setGeometry(rect); @@ -4657,7 +4665,7 @@ void tst_QWidget::windowMoveResize() widget.move(rect.topLeft()); widget.resize(rect.size()); - widget.show(); + widget.showNormal(); QTest::qWait(10); QTRY_COMPARE(widget.pos(), rect.topLeft()); @@ -4737,7 +4745,7 @@ void tst_QWidget::windowMoveResize() if (windowFlags != 0) widget.setWindowFlags(Qt::WindowFlags(windowFlags)); - widget.show(); + widget.showNormal(); if (rect.isValid()) QVERIFY(QTest::qWaitForWindowExposed(&widget)); QApplication::processEvents(); @@ -4981,7 +4989,7 @@ void tst_QWidget::moveChild() #ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting QCursor::setPos(parent.geometry().topRight() + QPoint(50 , 50)); #endif - parent.show(); + parent.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&parent)); QTest::qWait(30); @@ -5136,6 +5144,7 @@ void tst_QWidget::multipleToplevelFocusCheck() w2.resize(200,200); w2.show(); QVERIFY(QTest::qWaitForWindowExposed(&w2)); + QTest::qWait(50); QApplication::setActiveWindow(&w1); w1.activateWindow(); @@ -5922,16 +5931,15 @@ void tst_QWidget::childEvents() QCoreApplication::postEvent(&widget, new QEvent(QEvent::Type(QEvent::User + 1))); - widget.show(); + widget.showNormal(); expected = EventRecorder::EventList() - << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) - << qMakePair(&widget, QEvent::Show); - - expected << qMakePair(&widget, QEvent::ShowToParent); + << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); @@ -5941,12 +5949,11 @@ void tst_QWidget::childEvents() expected = EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) - << qMakePair(&widget, QEvent::Type(QEvent::User + 1)); - -#ifdef Q_OS_MAC - expected << qMakePair(&widget, QEvent::UpdateLater); + << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) +#if defined(Q_OS_OSX) || defined(Q_OS_QNX) + << qMakePair(&widget, QEvent::UpdateLater) #endif - expected << qMakePair(&widget, QEvent::UpdateRequest); + << qMakePair(&widget, QEvent::UpdateRequest); if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); @@ -6012,18 +6019,17 @@ void tst_QWidget::childEvents() QCOMPARE(spy.eventList(), expected); spy.clear(); - widget.show(); + widget.showNormal(); expected = EventRecorder::EventList() - << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) << qMakePair(&widget, QEvent::ChildPolished) + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) - << qMakePair(&widget, QEvent::Show); - - expected << qMakePair(&widget, QEvent::ShowToParent); + << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); @@ -6034,12 +6040,11 @@ void tst_QWidget::childEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) - << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); - -#ifdef Q_OS_MAC - expected << qMakePair(&widget, QEvent::UpdateLater); + << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) +#if defined(Q_OS_OSX) || defined(Q_OS_QNX) + << qMakePair(&widget, QEvent::UpdateLater) #endif - expected << qMakePair(&widget, QEvent::UpdateRequest); + << qMakePair(&widget, QEvent::UpdateRequest); if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); @@ -6108,17 +6113,17 @@ void tst_QWidget::childEvents() QCOMPARE(spy.eventList(), expected); spy.clear(); - widget.show(); + widget.showNormal(); expected = EventRecorder::EventList() - << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) + << qMakePair(&widget, QEvent::WinIdChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) - << qMakePair(&widget, QEvent::Show); + << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::ShowToParent); - expected << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); spy.clear(); @@ -6128,12 +6133,11 @@ void tst_QWidget::childEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) - << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); - -#ifdef Q_OS_MAC - expected << qMakePair(&widget, QEvent::UpdateLater); + << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) +#if defined(Q_OS_OSX) || defined(Q_OS_QNX) + << qMakePair(&widget, QEvent::UpdateLater) #endif - expected << qMakePair(&widget, QEvent::UpdateRequest); + << qMakePair(&widget, QEvent::UpdateRequest); if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); @@ -6296,7 +6300,7 @@ void tst_QWidget::renderInvisible() QFont f; f.setStyleStrategy(QFont::NoAntialias); calendar->setFont(f); - calendar->show(); + calendar->showNormal(); QVERIFY(QTest::qWaitForWindowExposed(calendar.data())); // Create a dummy focus widget to get rid of focus rect in reference image. @@ -7161,7 +7165,7 @@ void tst_QWidget::moveWindowInShowEvent() QCOMPARE(widget.pos(), initial); // show it - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(100); // it should have moved @@ -7246,6 +7250,9 @@ void tst_QWidget::hideOpaqueChildWhileHidden() #if !defined(Q_OS_WINCE) void tst_QWidget::updateWhileMinimized() { +#if defined(Q_OS_QNX) && (!defined(Q_OS_BLACKBERRY) || defined(Q_OS_BLACKBERRY_TABLET)) + QSKIP("Platform does not support showMinimized()"); +#endif UpdateWidget widget; // Filter out activation change and focus events to avoid update() calls in QWidget. widget.updateOnActivationChangeAndFocusIn = false; @@ -7796,6 +7803,9 @@ void tst_QWidget::doubleRepaint() // Minmize: Should not trigger a repaint. widget.showMinimized(); QTest::qWait(10); +#if defined(Q_OS_QNX) && (!defined(Q_OS_BLACKBERRY) || defined(Q_OS_BLACKBERRY_TABLET)) + QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue); +#endif QCOMPARE(widget.numPaintEvents, 0); widget.numPaintEvents = 0; @@ -9062,7 +9072,7 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() bigWidget->setPalette(palette); bigWidget->setAutoFillBackground(true); - main.show(); + main.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&main)); QPixmap correct(main.size()); @@ -10258,7 +10268,7 @@ void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282() childWidget.setAttribute(Qt::WA_OpaquePaintEvent); childWidget.setGeometry(250, 250, 500, 500); - widget.show(); + widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QVERIFY(childWidget.numPaintEvents == 0); childWidget.reset(); |