summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure34
-rw-r--r--qtbase.pro2
-rwxr-xr-xsrc/3rdparty/sha3/KeccakF-1600-opt64.c8
-rwxr-xr-xsrc/3rdparty/sha3/KeccakSponge.h8
-rw-r--r--src/corelib/global/qfeatures.txt6
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp49
-rw-r--r--src/corelib/tools/qlocale_blackberry.cpp17
-rw-r--r--src/gui/accessible/accessible.pri1
-rw-r--r--src/gui/accessible/qaccessible2_p.h45
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qplatformtheme.cpp28
-rw-r--r--src/plugins/platforms/android/src/androidjniaccessibility.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm12
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.cpp1
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfscompositor.cpp7
-rw-r--r--src/plugins/platforms/eglfs/qeglfscompositor.h6
-rw-r--r--src/plugins/platforms/eglfs/qeglfscursor.cpp5
-rw-r--r--src/plugins/platforms/eglfs/qeglfscursor.h7
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.cpp6
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.h4
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.h3
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.cpp10
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.h1
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp1
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp5
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp10
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp4
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp5
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp18
-rw-r--r--src/widgets/widgets/qkeysequenceedit_p.h5
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp11
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp49
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp68
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp30
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp154
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp58
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp14
-rw-r--r--tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp24
-rw-r--r--util/accessibilityinspector/screenreader.cpp1
54 files changed, 534 insertions, 234 deletions
diff --git a/configure b/configure
index b6e14a0cf3..4eb0dda8c8 100755
--- a/configure
+++ b/configure
@@ -2410,7 +2410,7 @@ Additional options:
* -xcb ............... Compile Xcb support.
-no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
- * -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support).
+ * -eglfs ............. Compile EGLFS support.
-no-directfb ....... Do not compile DirectFB support.
* -directfb .......... Compile DirectFB support.
@@ -2419,7 +2419,7 @@ Additional options:
* -linuxfb ........... Compile Linux Framebuffer support.
-no-kms ............ Do not compile KMS support.
- * -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support).
+ * -kms ............... Compile KMS support (Requires EGL).
-qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
@@ -4402,11 +4402,6 @@ if [ "$CFG_EGLFS" = "yes" ]; then
echo "The EGLFS plugin requires EGL support and cannot be built"
exit 101
fi
- if [ "$CFG_OPENGL" != "es2" ]; then
- echo "The EGLFS plugin requires OpenGL ES 2 support and cannot be built"
- exit 101
- fi
- CFG_OPENGL="es2"
CFG_EGL=yes
fi
@@ -4415,10 +4410,6 @@ if [ "$CFG_KMS" = "yes" ]; then
echo "The KMS plugin requires EGL support and cannot be built"
exit 101
fi
- if [ "$CFG_OPENGL" != "es2" ]; then
- echo "The KMS plugin requires OpenGL ES 2 support and cannot be built"
- exit 101
- fi
fi
# auto-detect SQL-modules support
@@ -5254,17 +5245,10 @@ elif [ "$CFG_XKBCOMMON" = "no" ]; then
fi
# EGL Support
-if [ "$CFG_OPENGL" != "es2" ]; then
- if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "desktop" ]; then
- echo "EGL support was requested but Qt is being configured for desktop OpenGL."
- echo "Either disable EGL support or enable OpenGL ES support."
- exit 101
- elif [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
- echo "EGL support was requested but OpenGL ES support is disabled."
+if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
+ echo "EGL support was requested but OpenGL support is disabled."
echo "Either disable EGL support or enable OpenGL ES support."
exit 101
- fi
- CFG_EGL=no
elif [ "$CFG_EGL" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
@@ -5287,7 +5271,7 @@ elif [ "$CFG_EGL" != "no" ]; then
fi
if [ "$CFG_EGLFS" != "no" ]; then
- if [ "$CFG_OPENGL" = "es2" ] && [ "$XPLATFORM_QNX" = "no" ]; then
+ if [ "$XPLATFORM_QNX" = "no" ]; then
CFG_EGLFS="$CFG_EGL"
else
CFG_EGLFS="no"
@@ -5295,7 +5279,7 @@ if [ "$CFG_EGLFS" != "no" ]; then
fi
if [ "$CFG_KMS" = "yes" ]; then
- if [ "$CFG_OPENGL" = "es2" ] && [ "$CFG_EGL" = "yes" ]; then
+ if [ "$CFG_EGL" = "yes" ]; then
CFG_KMS="yes"
else
CFG_KMS="no"
@@ -5679,11 +5663,7 @@ else
fi
if [ "$CFG_OPENGL" = "es2" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
-fi
-
-if [ "$CFG_OPENGL" = "es2" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES QT_OPENGL_ES_2"
QT_CONFIG="$QT_CONFIG opengles2"
fi
diff --git a/qtbase.pro b/qtbase.pro
index 8da34c5023..9091fba4e0 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -179,7 +179,7 @@ write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.")
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \
- $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri \
+ $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qfeatures.pri \
$$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules
INSTALLS += mkspecs
diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c
index 0432f1ab18..7bd442ef69 100755
--- a/src/3rdparty/sha3/KeccakF-1600-opt64.c
+++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c
@@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/
typedef unsigned char UINT8;
typedef unsigned long long int UINT64;
+#if defined(UseSSE) || defined(UseXOP)
#if defined(__GNUC__)
#define ALIGN __attribute__ ((aligned(32)))
#elif defined(_MSC_VER)
#define ALIGN __declspec(align(32))
-#else
-#define ALIGN
+#endif
+#endif
+
+#ifndef ALIGN
+# define ALIGN
#endif
#if defined(UseSSE)
diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h
index a545cacb30..8bb11a8a1d 100755
--- a/src/3rdparty/sha3/KeccakSponge.h
+++ b/src/3rdparty/sha3/KeccakSponge.h
@@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/
#define KeccakMaximumRate 1536
#define KeccakMaximumRateInBytes (KeccakMaximumRate/8)
+#if defined(UseSSE) || defined(UseXOP)
#if defined(__GNUC__)
#define ALIGN __attribute__ ((aligned(32)))
#elif defined(_MSC_VER)
#define ALIGN __declspec(align(32))
-#else
-#define ALIGN
+#endif
+#endif
+
+#ifndef ALIGN
+# define ALIGN
#endif
ALIGN typedef struct spongeStateStruct {
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 3e9fc88eba..84c9379bbc 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -476,6 +476,12 @@ Section: Widgets
Requires: GRAPHICSVIEW PRINTER MAINWINDOW
Name: QPrintPreviewWidget
+Feature: KEYSEQUENCEEDIT
+Description: Provides a widget for editing QKeySequences
+Section: Widgets
+Requires: LINEEDIT SHORTCUT
+Name: QKeySequenceEdit
+
# Dialogs
Feature: MESSAGEBOX
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1629339fd1..c2bb7173ba 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -45,11 +45,11 @@
#include <stddef.h>
-#define QT_VERSION_STR "5.2.0"
+#define QT_VERSION_STR "5.2.1"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x050200
+#define QT_VERSION 0x050201
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c19c3fcbb5..6fb22054cc 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4140,7 +4140,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
\macro Q_INVOKABLE
\relates QObject
- Apply this macro to definitions of member functions to allow them to
+ Apply this macro to declarations of member functions to allow them to
be invoked via the meta-object system. The macro is written before
the return type, as shown in the following example:
@@ -4157,7 +4157,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
\macro Q_REVISION
\relates QObject
- Apply this macro to definitions of member functions to tag them with a
+ Apply this macro to declarations of member functions to tag them with a
revision number in the meta-object system. The macro is written before
the return type, as shown in the following example:
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 8054542333..5463e4f0c1 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -845,11 +845,50 @@ static QString wrapText(const QString &names, int longestOptionNameString, const
{
const QLatin1Char nl('\n');
QString text = QStringLiteral(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' ');
- const int leftColumnWidth = text.length();
- const int rightColumnWidth = 79 - leftColumnWidth;
- text += description.left(rightColumnWidth) + nl;
- for (int n = rightColumnWidth; n < description.length(); n += rightColumnWidth)
- text += QStringLiteral(" ").repeated(leftColumnWidth) + description.mid(n, rightColumnWidth) + nl;
+ const int indent = text.length();
+ int lineStart = 0;
+ int lastBreakable = -1;
+ const int max = 79 - indent;
+ int x = 0;
+ const int len = description.length();
+
+ for (int i = 0; i < len; ++i) {
+ ++x;
+ const QChar c = description.at(i);
+ if (c.isSpace())
+ lastBreakable = i;
+
+ int breakAt = -1;
+ int nextLineStart = -1;
+ if (x > max && lastBreakable != -1) {
+ // time to break and we know where
+ breakAt = lastBreakable;
+ nextLineStart = lastBreakable + 1;
+ } else if ((x > max - 1 && lastBreakable == -1) || i == len - 1) {
+ // time to break but found nowhere [-> break here], or end of last line
+ breakAt = i + 1;
+ nextLineStart = breakAt;
+ } else if (c == nl) {
+ // forced break
+ breakAt = i;
+ nextLineStart = i + 1;
+ }
+
+ if (breakAt != -1) {
+ const int numChars = breakAt - lineStart;
+ //qDebug() << "breakAt=" << description.at(breakAt) << "breakAtSpace=" << breakAtSpace << lineStart << "to" << breakAt << description.mid(lineStart, numChars);
+ if (lineStart > 0)
+ text += QString(indent, QLatin1Char(' '));
+ text += description.midRef(lineStart, numChars) + nl;
+ x = 0;
+ lastBreakable = -1;
+ lineStart = nextLineStart;
+ if (lineStart < len && description.at(lineStart).isSpace())
+ ++lineStart; // don't start a line with a space
+ i = lineStart;
+ }
+ }
+
return text;
}
diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp
index e2dfa6c801..48faa73070 100644
--- a/src/corelib/tools/qlocale_blackberry.cpp
+++ b/src/corelib/tools/qlocale_blackberry.cpp
@@ -68,17 +68,20 @@ QBBSystemLocaleData::QBBSystemLocaleData()
, measurementNotifier(0)
, hourNotifier(0)
{
+ // Do not use qWarning to log warnings if qt_safe_open fails to open the pps file
+ // since the user code may install a message handler that invokes QLocale API again
+ // (i.e QDate, QDateTime, ...) which will cause a deadlock.
if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1)
- qWarning("Failed to open uom pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open uom pps, errno=%d\n", errno);
if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1)
- qWarning("Failed to open region pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open region pps, errno=%d\n", errno);
if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1)
- qWarning("Failed to open language pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open language pps, errno=%d\n", errno);
if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1)
- qWarning("Failed to open hour format pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open hour format pps, errno=%d\n", errno);
// we cannot call this directly, because by the time this constructor is
// called, the event dispatcher has not yet been created, causing the
@@ -186,8 +189,12 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd)
char buffer[ppsBufferSize];
int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1);
+ // This method is called in the ctor(), so do not use qWarning to log warnings
+ // if qt_safe_read fails to read the pps file
+ // since the user code may install a message handler that invokes QLocale API again
+ // (i.e QDate, QDateTime, ...) which will cause a deadlock.
if (bytes == -1) {
- qWarning("Failed to read Locale pps, errno=%d", errno);
+ fprintf(stderr, "Failed to read pps object:%s, errno=%d\n", ppsObject, errno);
return result;
}
// ensure data is null terminated
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index 9453ac20d0..615323dbec 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -4,7 +4,6 @@ contains(QT_CONFIG, accessibility) {
HEADERS += \
accessible/qaccessible.h \
accessible/qaccessiblecache_p.h \
- accessible/qaccessible2_p.h \
accessible/qaccessibleobject.h \
accessible/qaccessibleplugin.h \
accessible/qplatformaccessibility.h
diff --git a/src/gui/accessible/qaccessible2_p.h b/src/gui/accessible/qaccessible2_p.h
deleted file mode 100644
index bb5ddf6edf..0000000000
--- a/src/gui/accessible/qaccessible2_p.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module 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$
-**
-****************************************************************************/
-
-#ifndef QACCESSIBLE2_H
-#define QACCESSIBLE2_H
-
-#endif
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index eac0d4b0a6..3751660500 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -69,6 +69,7 @@ struct Q_AUTOTEST_EXPORT QKeyBinding
class Q_AUTOTEST_EXPORT QKeySequencePrivate
{
public:
+ enum { MaxKeyCount = 4 }; // used in QKeySequenceEdit
inline QKeySequencePrivate() : ref(1)
{
key[0] = key[1] = key[2] = key[3] = 0;
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 562df1c913..1844232efe 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -50,6 +50,7 @@
#include <qtextformat.h>
#include <private/qiconloader_p.h>
#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
@@ -399,7 +400,32 @@ QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
- return QPlatformTheme::defaultThemeHint(hint);
+ // For theme hints which mirror platform integration style hints, query
+ // the platform integration. The base QPlatformIntegration::styleHint()
+ // function will in turn query QPlatformTheme::defaultThemeHint() if there
+ // is no custom value.
+ switch (hint) {
+ case QPlatformTheme::CursorFlashTime:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime);
+ case QPlatformTheme::KeyboardInputInterval:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval);
+ case QPlatformTheme::KeyboardAutoRepeatRate:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate);
+ case QPlatformTheme::MouseDoubleClickInterval:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval);
+ case QPlatformTheme::StartDragDistance:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance);
+ case QPlatformTheme::StartDragTime:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime);
+ case QPlatformTheme::StartDragVelocity:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity);
+ case QPlatformTheme::PasswordMaskDelay:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay);
+ case QPlatformTheme::PasswordMaskCharacter:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
+ default:
+ return QPlatformTheme::defaultThemeHint(hint);
+ }
}
QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
diff --git a/src/plugins/platforms/android/src/androidjniaccessibility.cpp b/src/plugins/platforms/android/src/androidjniaccessibility.cpp
index a27d9f5aed..b987c49c9c 100644
--- a/src/plugins/platforms/android/src/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/src/androidjniaccessibility.cpp
@@ -46,7 +46,7 @@
#include "qguiapplication.h"
#include "qwindow.h"
#include "qrect.h"
-#include "private/qaccessible2_p.h"
+#include "QtGui/qaccessible.h"
#include "qdebug.h"
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index f43beb1bb5..1371eb3658 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -40,8 +40,7 @@
****************************************************************************/
#include "qcocoaaccessibility.h"
#include "qcocoaaccessibilityelement.h"
-#include <qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <private/qcore_mac_p.h>
QCocoaAccessibility::QCocoaAccessibility()
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 7eae22f720..8e20a96a48 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -42,8 +42,7 @@
#include "qcocoaaccessibility.h"
#include "qcocoahelpers.h"
-#include <QAccessible>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#import <AppKit/NSAccessibility.h>
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 197a2058af..4a5696b35e 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -599,7 +599,17 @@ NSRect qt_mac_flipRect(const QRect &rect, QWindow *window)
{
QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window);
int flippedY = onScreen->geometry().height() - (rect.y() + rect.height());
-
+ QList<QScreen *> screens = QGuiApplication::screens();
+ if (screens.size() > 1) {
+ int height = 0;
+ foreach (QScreen *scr, screens)
+ height = qMax(height, scr->size().height());
+ int difference = height - onScreen->geometry().height();
+ if (difference > 0)
+ flippedY += difference;
+ else
+ flippedY -= difference;
+ }
// In case of automatic positioning, try to put as much of the window onscreen as possible.
if (window->isTopLevel() && qt_window_private(const_cast<QWindow*>(window))->positionAutomatic && flippedY < 0)
flippedY = onScreen->geometry().height() - onScreen->availableGeometry().height() - onScreen->availableGeometry().y();
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 86e5066fbb..e8f26aa8c4 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -47,7 +47,7 @@
#include "qcocoaaccessibilityelement.h"
#include <qpa/qplatformintegration.h>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <QtCore/QDebug>
#import <AppKit/NSAccessibility.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
index 9de5960fdb..03531916cf 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
@@ -139,6 +139,7 @@ void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents
m_window->create();
rootWin->screen()->rootContext()->makeCurrent(rootWin->window());
+ initializeOpenGLFunctions();
if (m_texture)
glDeleteTextures(1, &m_texture);
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
index 535428aac1..9af856e8e7 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
@@ -43,6 +43,7 @@
#define QEGLFSBACKINGSTORE_H
#include <qpa/qplatformbackingstore.h>
+#include <QtGui/QOpenGLFunctions>
#include <QImage>
#include <QRegion>
@@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLPaintDevice;
class QEglFSWindow;
-class QEglFSBackingStore : public QPlatformBackingStore
+class QEglFSBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QEglFSBackingStore(QWindow *window);
diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.cpp b/src/plugins/platforms/eglfs/qeglfscompositor.cpp
index 9db43a57a1..845bb5b3b5 100644
--- a/src/plugins/platforms/eglfs/qeglfscompositor.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscompositor.cpp
@@ -53,7 +53,8 @@ static QEglFSCompositor *compositor = 0;
QEglFSCompositor::QEglFSCompositor()
: m_screen(0),
- m_program(0)
+ m_program(0),
+ m_initialized(false)
{
Q_ASSERT(!compositor);
m_updateTimer.setSingleShot(true);
@@ -86,6 +87,10 @@ void QEglFSCompositor::renderAll()
Q_ASSERT(context);
context->makeCurrent(rootWin->window());
+ if (!m_initialized) {
+ initializeOpenGLFunctions();
+ m_initialized = true;
+ }
ensureProgram();
m_program->bind();
diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.h b/src/plugins/platforms/eglfs/qeglfscompositor.h
index ade2e06031..0d5daafa2c 100644
--- a/src/plugins/platforms/eglfs/qeglfscompositor.h
+++ b/src/plugins/platforms/eglfs/qeglfscompositor.h
@@ -42,7 +42,8 @@
#ifndef QEGLFSCOMPOSITOR_H
#define QEGLFSCOMPOSITOR_H
-#include <QTimer>
+#include <QtCore/QTimer>
+#include <QtGui/QOpenGLFunctions>
QT_BEGIN_NAMESPACE
@@ -50,7 +51,7 @@ class QEglFSScreen;
class QEglFSWindow;
class QOpenGLShaderProgram;
-class QEglFSCompositor : public QObject
+class QEglFSCompositor : public QObject, public QOpenGLFunctions
{
Q_OBJECT
@@ -76,6 +77,7 @@ private:
int m_vertexCoordEntry;
int m_textureCoordEntry;
int m_isRasterEntry;
+ bool m_initialized;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp
index c00e86de35..0066426769 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp
@@ -79,7 +79,7 @@ void QEglFSCursor::resetResources()
m_cursorAtlas.texture = 0;
}
-static GLuint createShader(GLenum shaderType, const char *program)
+GLuint QEglFSCursor::createShader(GLenum shaderType, const char *program)
{
GLuint shader = glCreateShader(shaderType);
glShaderSource(shader, 1 /* count */, &program, NULL /* lengths */);
@@ -98,7 +98,7 @@ static GLuint createShader(GLenum shaderType, const char *program)
return 0;
}
-static GLuint createProgram(GLuint vshader, GLuint fshader)
+GLuint QEglFSCursor::createProgram(GLuint vshader, GLuint fshader)
{
GLuint program = glCreateProgram();
glAttachShader(program, vshader);
@@ -286,6 +286,7 @@ void QEglFSCursor::draw(const QRectF &r)
{
if (!m_program) {
// one time initialization
+ initializeOpenGLFunctions();
createShaderPrograms();
if (!m_cursorAtlas.texture) {
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/qeglfscursor.h
index 51a34e041d..71ff73b8f3 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.h
+++ b/src/plugins/platforms/eglfs/qeglfscursor.h
@@ -43,15 +43,15 @@
#define QEGLFSCURSOR_H
#include <qpa/qplatformcursor.h>
+#include <QtGui/QOpenGLFunctions>
#include "qeglfsscreen.h"
-#include <GLES2/gl2.h>
QT_BEGIN_NAMESPACE
class QOpenGLShaderProgram;
class QEglFSScreen;
-class QEglFSCursor : public QPlatformCursor
+class QEglFSCursor : public QPlatformCursor, public QOpenGLFunctions
{
public:
QEglFSCursor(QEglFSScreen *screen);
@@ -78,6 +78,9 @@ protected:
void draw(const QRectF &rect);
void update(const QRegion &region);
+ GLuint createShader(GLenum shaderType, const char *program);
+ GLuint createProgram(GLuint vshader, GLuint fshader);
+
QEglFSScreen *m_screen;
// current cursor information
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp
index 29395f3b4f..fa4ef847cd 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.cpp
+++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp
@@ -52,6 +52,7 @@ QKmsBackingStore::QKmsBackingStore(QWindow *window)
, m_context(new QOpenGLContext)
, m_texture(0)
, m_program(0)
+ , m_initialized(false)
{
m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen());
@@ -85,6 +86,11 @@ void QKmsBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
m_context->makeCurrent(window);
+ if (!m_initialized) {
+ initializeOpenGLFunctions();
+ m_initialized = true;
+ }
+
if (!m_program) {
static const char *textureVertexProgram =
"attribute highp vec2 vertexCoordEntry;\n"
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.h b/src/plugins/platforms/kms/qkmsbackingstore.h
index 34ea49a346..c5f6c81d18 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.h
+++ b/src/plugins/platforms/kms/qkmsbackingstore.h
@@ -43,6 +43,7 @@
#define QBACKINGSTORE_KMS_H
#include <qpa/qplatformbackingstore.h>
+#include <QtGui/QOpenGLFunctions>
#include <QImage>
QT_BEGIN_NAMESPACE
@@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOpenGLShaderProgram;
-class QKmsBackingStore : public QPlatformBackingStore
+class QKmsBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QKmsBackingStore(QWindow *window);
@@ -69,6 +70,7 @@ private:
uint m_texture;
QOpenGLShaderProgram *m_program;
QRegion m_dirty;
+ bool m_initialized;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/kms/qkmsscreen.h b/src/plugins/platforms/kms/qkmsscreen.h
index a90d6fa051..f0c49ad11c 100644
--- a/src/plugins/platforms/kms/qkmsscreen.h
+++ b/src/plugins/platforms/kms/qkmsscreen.h
@@ -55,8 +55,7 @@ extern "C" {
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+#include <QtGui/qopengl.h>
#include <qpa/qplatformscreen.h>
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h
index ff57861498..2b12657da9 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.h
+++ b/src/plugins/platforms/qnx/qqnxglcontext.h
@@ -75,6 +75,8 @@ public:
static EGLDisplay getEglDisplay();
EGLConfig getEglConfig() const { return m_eglConfig;}
+ EGLContext getEglContext() const { return m_eglContext; }
+
private:
//Can be static because different displays returne the same handle
static EGLDisplay ms_eglDisplay;
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
index 8958a5c1e2..6e7fc35a82 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
@@ -41,9 +41,11 @@
#include "qqnxnativeinterface.h"
+#include "qqnxglcontext.h"
#include "qqnxscreen.h"
#include "qqnxwindow.h"
+#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
#include <QtGui/QWindow>
@@ -71,6 +73,14 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
return 0;
}
+void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
+{
+ if (resource == "eglcontext" && context)
+ return static_cast<QQnxGLContext*>(context->handle())->getEglContext();
+
+ return 0;
+}
+
void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
{
if (name == QStringLiteral("mmRendererWindowName")) {
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h
index b61f6a56cc..dfd386214e 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.h
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h
@@ -51,6 +51,7 @@ class QQnxNativeInterface : public QPlatformNativeInterface
public:
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen);
+ void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
};
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 9170c774b4..66ed9d85dc 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -44,7 +44,7 @@
#include "iaccessible2.h"
#include "qwindowsaccessibility.h"
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <QtGui/qclipboard.h>
#include <QtWidgets/qapplication.h>
#include <QtCore/qdebug.h>
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 63b4370dc2..885bc37cff 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -51,7 +51,6 @@
#include <QtCore/qpointer.h>
#include <QtCore/qsettings.h>
#include <QtGui/qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformintegration.h>
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 93592eb969..8bb7646258 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -54,7 +54,6 @@
#include <QtCore/qpair.h>
#include <QtCore/qsettings.h>
#include <QtGui/qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
#include <QtGui/qguiapplication.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtGui/qwindow.h>
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index d2fb481824..58047124a1 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1500,6 +1500,8 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
handleHidden();
QWindowSystemInterface::flushWindowSystemEvents(); // Tell QQuickWindow to stop rendering now.
break;
+ case Qt::WindowMaximized:
+ case Qt::WindowFullScreen:
case Qt::WindowNoState: {
// QTBUG-17548: We send expose events when receiving WM_Paint, but for
// layered windows and transient children, we won't receive any WM_Paint.
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index dd404d044d..e2c6932992 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -154,7 +154,7 @@ enum QX11EmbedMessageType {
XEMBED_ACTIVATE_ACCELERATOR = 14
};
-const long XEMBED_VERSION = 0;
+const quint32 XEMBED_VERSION = 0;
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
static inline bool isTransient(const QWindow *w)
@@ -403,7 +403,7 @@ void QXcbWindow::create()
}
// set the PID to let the WM kill the application if unresponsive
- long pid = getpid();
+ quint32 pid = getpid();
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32,
1, &pid));
@@ -422,7 +422,7 @@ void QXcbWindow::create()
1, &leader));
/* Add XEMBED info; this operation doesn't initiate the embedding. */
- long data[] = { XEMBED_VERSION, XEMBED_MAPPED };
+ quint32 data[] = { XEMBED_VERSION, XEMBED_MAPPED };
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
atom(QXcbAtom::_XEMBED_INFO),
atom(QXcbAtom::_XEMBED_INFO),
@@ -1824,7 +1824,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
if (reply && reply->format == 32 && reply->type == wmStateAtom) {
- const long *data = (const long *)xcb_get_property_value(reply);
+ const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
newState = Qt::WindowMinimized;
}
@@ -1995,8 +1995,8 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
}
// Sends an XEmbed message.
-void QXcbWindow::sendXEmbedMessage(xcb_window_t window, long message,
- long detail, long data1, long data2)
+void QXcbWindow::sendXEmbedMessage(xcb_window_t window, quint32 message,
+ quint32 detail, quint32 data1, quint32 data2)
{
xcb_client_message_event_t event;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 5601a115e9..45d44b213f 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -169,8 +169,8 @@ private:
void updateDoesNotAcceptFocus(bool doesNotAcceptFocus);
QRect windowToWmGeometry(QRect r) const;
- void sendXEmbedMessage(xcb_window_t window, long message,
- long detail = 0, long data1 = 0, long data2 = 0);
+ void sendXEmbedMessage(xcb_window_t window, quint32 message,
+ quint32 detail = 0, quint32 data1 = 0, quint32 data2 = 0);
void handleXEmbedMessage(const xcb_client_message_event_t *event);
void create();
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index ad7a82518e..41d4fc925a 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4147,8 +4147,9 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->widget()));
wheelEvent->accept();
bool isPanel = item->isPanel();
- d->sendEvent(item, wheelEvent);
- if (isPanel || wheelEvent->isAccepted())
+ bool ret = d->sendEvent(item, wheelEvent);
+
+ if (ret && (isPanel || wheelEvent->isAccepted()))
break;
}
}
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index c2bcc1585f..75a513fb67 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1599,7 +1599,7 @@ int QHeaderView::minimumSectionSize() const
void QHeaderView::setMinimumSectionSize(int size)
{
Q_D(QHeaderView);
- if (size < 0 || size > maxSizeSection)
+ if (size < -1 || size > maxSizeSection)
return;
d->minimumSectionSize = size;
if (d->minimumSectionSize > maximumSectionSize())
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 4e3ecf144a..9056ffe461 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3761,6 +3761,16 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven
}
if (focusWidget->isWindow())
break;
+
+ // find out whether this widget (or its proxy) already has focus
+ QWidget *f = focusWidget;
+ if (focusWidget->d_func()->extra && focusWidget->d_func()->extra->focus_proxy)
+ f = focusWidget->d_func()->extra->focus_proxy;
+ // if it has, stop here.
+ // otherwise a click on the focused widget would remove its focus if ClickFocus isn't set
+ if (f->hasFocus())
+ break;
+
localPos += focusWidget->pos();
focusWidget = focusWidget->parentWidget();
}
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index e1376c754f..c1d3e95e7a 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -641,7 +641,7 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing
spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() );
}
}
- return spacing;
+ return qMax(spacing, 0);
}
static inline void initLayoutStruct(QLayoutStruct& sl, QFormLayoutItem* item)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 22e15e23fe..edcbb08d1c 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -251,7 +251,9 @@ bool QWidgetWindow::event(QEvent *event)
case QEvent::Show:
case QEvent::Hide:
return QWindow::event(event);
-
+ case QEvent::WindowBlocked:
+ qt_button_down = 0;
+ break;
default:
break;
}
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 7c319c5095..399f089e0f 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -222,6 +222,11 @@ void QWindowContainer::focusWindowChanged(QWindow *focusWindow)
{
Q_D(QWindowContainer);
d->oldFocusWindow = focusWindow;
+ if (focusWindow == d->window) {
+ QWidget *widget = QApplication::focusWidget();
+ if (widget)
+ widget->clearFocus();
+ }
}
/*!
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index db39ceb08a..c056967cf7 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_KEYSEQUENCEEDIT
+Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here
+
void QKeySequenceEditPrivate::init()
{
Q_Q(QKeySequenceEdit);
@@ -222,15 +224,7 @@ void QKeySequenceEdit::setKeySequence(const QKeySequence &keySequence)
*/
void QKeySequenceEdit::clear()
{
- Q_D(QKeySequenceEdit);
-
- d->resetState();
-
- d->lineEdit->clear();
- d->keySequence = QKeySequence();
- d->keyNum = d->key[0] = d->key[1] = d->key[2] = d->key[3] = 0;
- d->prevKey = -1;
- emit keySequenceChanged(d->keySequence);
+ setKeySequence(QKeySequence());
}
/*!
@@ -280,7 +274,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
return;
}
- if (d->keyNum >= QKeySequenceEditPrivate::MaxKeyCount)
+ if (d->keyNum >= QKeySequencePrivate::MaxKeyCount)
return;
nextKey |= d->translateModifiers(e->modifiers(), e->text());
@@ -291,7 +285,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
QKeySequence key(d->key[0], d->key[1], d->key[2], d->key[3]);
d->keySequence = key;
QString text = key.toString(QKeySequence::NativeText);
- if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount) {
+ if (d->keyNum < QKeySequencePrivate::MaxKeyCount) {
//: This text is an "unfinished" shortcut, expands like "Ctrl+A, ..."
text = tr("%1, ...").arg(text);
}
@@ -307,7 +301,7 @@ void QKeySequenceEdit::keyReleaseEvent(QKeyEvent *e)
Q_D(QKeySequenceEdit);
if (d->prevKey == e->key()) {
- if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount)
+ if (d->keyNum < QKeySequencePrivate::MaxKeyCount)
d->releaseTimer = startTimer(1000);
else
d->finishEditing();
diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h
index 58c9699059..f74433bb71 100644
--- a/src/widgets/widgets/qkeysequenceedit_p.h
+++ b/src/widgets/widgets/qkeysequenceedit_p.h
@@ -46,6 +46,7 @@
#include "qkeysequenceedit.h"
#include <private/qwidget_p.h>
+#include <private/qkeysequence_p.h>
QT_BEGIN_NAMESPACE
@@ -57,8 +58,6 @@ class QKeySequenceEditPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QKeySequenceEdit)
public:
- enum { MaxKeyCount = 4 };
-
void init();
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
void resetState();
@@ -67,7 +66,7 @@ public:
QLineEdit *lineEdit;
QKeySequence keySequence;
int keyNum;
- int key[MaxKeyCount];
+ int key[QKeySequencePrivate::MaxKeyCount];
int prevKey;
int releaseTimer;
};
diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
index 07f8ddfc8e..2b30b0486b 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
@@ -69,9 +69,18 @@ int main(int argc, char *argv[])
// An option with a longer description, to test wrapping
QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes"));
- noImplicitIncludesOption.setDescription(QStringLiteral("Disable automatic generation of implicit #include-directives."));
+ noImplicitIncludesOption.setDescription(QStringLiteral("Disable magic generation of implicit #include-directives."));
parser.addOption(noImplicitIncludesOption);
+ QCommandLineOption newlineOption(QStringList() << QStringLiteral("newline"));
+ newlineOption.setDescription(QString::fromLatin1("This is an option with a rather long\n"
+ "description using explicit newline characters "
+ "(but testing automatic wrapping too). In addition, "
+ "here, we test breaking after a comma. Testing -option. "
+ "Long URL: http://qt-project.org/wiki/How_to_create_a_library_with_Qt_and_use_it_in_an_application "
+ "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ parser.addOption(newlineOption);
+
// This program supports different options depending on the "command" (first argument).
// Call parse() to find out the positional arguments.
parser.parse(QCoreApplication::arguments());
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index d8965dee5d..f37e192ad3 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -459,27 +459,40 @@ void tst_QCommandLineParser::testVersionOption()
#endif // !QT_NO_PROCESS
}
+static const char expectedOptionsHelp[] =
+ "Options:\n"
+ " -h, --help Displays this help.\n"
+ " -v, --version Displays version information.\n"
+ " --load <url> Load file from URL.\n"
+ " -o, --output <file> Set output file.\n"
+ " -D <key=value> Define macro.\n"
+ " -n, --no-implicit-includes Disable magic generation of implicit\n"
+ " #include-directives.\n"
+ " --newline This is an option with a rather long\n"
+ " description using explicit newline characters (but\n"
+ " testing automatic wrapping too). In addition,\n"
+ " here, we test breaking after a comma. Testing\n"
+ " -option. Long URL:\n"
+ " http://qt-project.org/wiki/How_to_create_a_library\n"
+ " _with_Qt_and_use_it_in_an_application\n"
+ " abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx\n"
+ " yzabcdefghijklmnopqrstuvwxyz\n";
+
void tst_QCommandLineParser::testHelpOption_data()
{
QTest::addColumn<QCommandLineParser::SingleDashWordOptionMode>("parsingMode");
QTest::addColumn<QString>("expectedHelpOutput");
- QString expectedOutput =
+ QString expectedOutput = QString::fromLatin1(
"Usage: testhelper/qcommandlineparser_test_helper [options] parsingMode command\n"
"Test helper\n"
- "\n"
- "Options:\n"
- " -h, --help Displays this help.\n"
- " -v, --version Displays version information.\n"
- " --load <url> Load file from URL.\n"
- " -o, --output <file> Set output file.\n"
- " -D <key=value> Define macro.\n"
- " -n, --no-implicit-includes Disable automatic generation of implicit #include\n"
- " -directives.\n"
+ "\n")
+ + QString::fromLatin1(expectedOptionsHelp) +
+ QString::fromLatin1(
"\n"
"Arguments:\n"
" parsingMode The parsing mode to test.\n"
- " command The command to execute.\n";
+ " command The command to execute.\n");
#ifdef Q_OS_WIN
expectedOutput.replace(" -h, --help Displays this help.\n",
" -?, -h, --help Displays this help.\n");
@@ -510,6 +523,7 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WIN
output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
+ QCOMPARE(output.split('\n'), expectedHelpOutput.split('\n')); // easier to debug than the next line, on failure
QCOMPARE(output, expectedHelpOutput);
process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "resize" << "--help");
@@ -519,18 +533,11 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WIN
output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
- QByteArray expectedResizeHelp =
+ QByteArray expectedResizeHelp = QByteArrayLiteral(
"Usage: testhelper/qcommandlineparser_test_helper [options] resize [resize_options]\n"
"Test helper\n"
- "\n"
- "Options:\n"
- " -h, --help Displays this help.\n"
- " -v, --version Displays version information.\n"
- " --load <url> Load file from URL.\n"
- " -o, --output <file> Set output file.\n"
- " -D <key=value> Define macro.\n"
- " -n, --no-implicit-includes Disable automatic generation of implicit #include\n"
- " -directives.\n"
+ "\n")
+ + expectedOptionsHelp +
" --size <size> New size.\n"
"\n"
"Arguments:\n"
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index b737f823c8..e332f01861 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -63,7 +63,7 @@ private slots:
void cleanup();
private:
- void doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments);
+ void doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes);
QString logName(const QString &logger) const;
QList<LoggerSet> allLoggerSets() const;
@@ -324,6 +324,7 @@ void tst_Selftests::runSubTest_data()
QTest::addColumn<QString>("subdir");
QTest::addColumn<QStringList>("loggers");
QTest::addColumn<QStringList>("arguments");
+ QTest::addColumn<bool>("crashes");
QStringList tests = QStringList()
// << "alive" // timer dependent
@@ -479,11 +480,14 @@ void tst_Selftests::runSubTest_data()
continue;
}
}
-
+ const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow")
+ || subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate")
+ || subtest == QLatin1String("crashes") || subtest == QLatin1String("silent");
QTest::newRow(qPrintable(QString("%1 %2").arg(subtest).arg(loggerSet.name)))
<< subtest
<< loggers
<< arguments
+ << crashes
;
}
}
@@ -491,30 +495,41 @@ void tst_Selftests::runSubTest_data()
#ifndef QT_NO_PROCESS
-static void insertEnvironmentVariable(QString const& name, QProcessEnvironment &result)
-{
- const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
- const QString value = systemEnvironment.value(name);
- if (!value.isEmpty())
- result.insert(name, value);
-}
-
-static inline QProcessEnvironment processEnvironment()
+static QProcessEnvironment processEnvironment()
{
- QProcessEnvironment result;
- insertEnvironmentVariable(QStringLiteral("PATH"), result);
- // Preserve DISPLAY for X11 as some tests use Qt GUI.
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
- insertEnvironmentVariable(QStringLiteral("DISPLAY"), result);
-#endif
- insertEnvironmentVariable(QStringLiteral("QT_QPA_PLATFORM"), result);
+ static QProcessEnvironment result;
+ if (result.isEmpty()) {
+ const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
+ foreach (const QString &key, systemEnvironment.keys()) {
+ const bool useVariable = key == QLatin1String("PATH") || key == QLatin1String("QT_QPA_PLATFORM")
+#ifdef Q_OS_UNIX
+ || key == QLatin1String("HOME") || key == QLatin1String("USER") // Required for X11 on openSUSE
+# ifndef Q_OS_MAC
+ || key == QLatin1String("DISPLAY") || key == QLatin1String("XAUTHLOCALHOSTNAME")
+ || key.startsWith(QLatin1String("XDG_"))
+# endif // !Q_OS_MAC
+#endif // Q_OS_UNIX
#ifdef __COVERAGESCANNER__
- insertEnvironmentVariable(QStringLiteral("QT_TESTCOCOON_ACTIVE"), result);
+ || key == QLatin1String("QT_TESTCOCOON_ACTIVE")
#endif
+ ;
+ if (useVariable)
+ result.insert(key, systemEnvironment.value(key));
+ }
+ }
return result;
}
-void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments)
+static inline QByteArray msgProcessError(const QString &binary, const QStringList &args,
+ const QProcessEnvironment &e, const QString &what)
+{
+ QString result;
+ QTextStream(&result) <<"Error running " << binary << ' ' << args.join(' ')
+ << " with environment " << e.toStringList().join(' ') << ": " << what;
+ return result.toLocal8Bit();
+}
+
+void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes)
{
#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
if (arguments.contains("-callgrind")) {
@@ -532,8 +547,14 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
proc.setProcessEnvironment(environment);
const QString path = subdir + QLatin1Char('/') + subdir;
proc.start(path, arguments);
- QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString())));
- QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString()));
+ QVERIFY2(proc.waitForStarted(), msgProcessError(path, arguments, environment, QStringLiteral("Cannot start: ") + proc.errorString()));
+ QVERIFY2(proc.waitForFinished(), msgProcessError(path, arguments, environment, QStringLiteral("Timed out: ") + proc.errorString()));
+ if (!crashes) {
+ QVERIFY2(proc.exitStatus() == QProcess::NormalExit,
+ msgProcessError(path, arguments, environment,
+ QStringLiteral("Crashed: ") + proc.errorString()
+ + QStringLiteral(": ") + QString::fromLocal8Bit(proc.readAllStandardError())));
+ }
QList<QByteArray> actualOutputs;
for (int i = 0; i < loggers.count(); ++i) {
@@ -700,8 +721,9 @@ void tst_Selftests::runSubTest()
QFETCH(QString, subdir);
QFETCH(QStringList, loggers);
QFETCH(QStringList, arguments);
+ QFETCH(bool, crashes);
- doRunSubTest(subdir, loggers, arguments);
+ doRunSubTest(subdir, loggers, arguments, crashes);
#endif // !QT_NO_PROCESS
}
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 68502f0d8d..060fa51293 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -57,6 +57,8 @@ public:
virtual ~tst_QProgressDialog();
private slots:
+ void autoShow_data();
+ void autoShow();
void getSetCheck();
void task198202();
void QTBUG_31046();
@@ -70,6 +72,34 @@ tst_QProgressDialog::~tst_QProgressDialog()
{
}
+void tst_QProgressDialog::autoShow_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("delay");
+ QTest::addColumn<bool>("expectedAutoShow");
+
+ QTest::newRow("50_to_100_long") << 50 << 100 << 100 << true; // 50*100ms = 5s
+ QTest::newRow("50_to_100_short") << 50 << 1 << 100 << false; // 50*1ms = 50ms
+
+ QTest::newRow("0_to_100_long") << 0 << 100 << 100 << true; // 100*100ms = 10s
+ QTest::newRow("0_to_10_short") << 0 << 10 << 100 << false; // 10*100ms = 1s
+}
+
+void tst_QProgressDialog::autoShow()
+{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, delay);
+ QFETCH(bool, expectedAutoShow);
+
+ QProgressDialog dlg("", "", min, max);
+ dlg.setValue(0);
+ QThread::msleep(delay);
+ dlg.setValue(min+1);
+ QCOMPARE(dlg.isVisible(), expectedAutoShow);
+}
+
// Testing get/set functions
void tst_QProgressDialog::getSetCheck()
{
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 0c6d369254..36bf76564f 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -58,17 +58,8 @@
#include <qscrollbar.h>
#include <qboxlayout.h>
#include <qlineedit.h>
-
-// Will try to wait for the condition while allowing event processing
-// for a maximum of 5 seconds.
-#define TRY_COMPARE(expr, expected) \
- do { \
- const int step = 50; \
- for (int q = 0; q < 5000 && ((expr) != (expected)); q+=step) { \
- QTest::qWait(step); \
- } \
- QCOMPARE(expr, expected); \
- } while(0)
+#include <qscreen.h>
+#include <qscopedpointer.h>
static inline void setFrameless(QWidget *w)
{
@@ -78,6 +69,22 @@ static inline void setFrameless(QWidget *w)
w->setWindowFlags(flags);
}
+static inline void centerOnScreen(QWidget *w)
+{
+ const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
+ w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
+}
+
+// Move cursor out of widget area to avoid undesired interaction on Mac.
+static inline void moveCursorAway(const QWidget *topLevel)
+{
+#ifndef QT_NO_CURSOR
+ QCursor::setPos(topLevel->geometry().topRight() + QPoint(100, 0));
+#else
+ Q_UNUSED(topLevel)
+#endif
+}
+
class TestView : public QAbstractItemView
{
Q_OBJECT
@@ -374,25 +381,27 @@ void tst_QAbstractItemView::emptyModels()
{
QFETCH(QString, viewType);
- TestView *view = 0;
+ QScopedPointer<QAbstractItemView> view;
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QVERIFY(!view->model());
QVERIFY(!view->selectionModel());
//QVERIFY(view->itemDelegate() != 0);
- basic_tests(view);
- delete view;
+ basic_tests(reinterpret_cast<TestView*>(view.data()));
}
void tst_QAbstractItemView::setModel_data()
@@ -408,24 +417,28 @@ void tst_QAbstractItemView::setModel_data()
void tst_QAbstractItemView::setModel()
{
QFETCH(QString, viewType);
- TestView *view = 0;
+
+ QScopedPointer<QAbstractItemView> view;
+
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QStandardItemModel model(20,20);
view->setModel(0);
view->setModel(&model);
- basic_tests(view);
- delete view;
+ basic_tests(reinterpret_cast<TestView*>(view.data()));
}
void tst_QAbstractItemView::basic_tests(TestView *view)
@@ -636,7 +649,10 @@ void tst_QAbstractItemView::noModel()
view.setModel(&model);
// Make the viewport smaller than the contents, so that we can scroll
view.resize(100,100);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
// make sure that the scrollbars are not at value 0
view.scrollTo(view.model()->index(10,10));
@@ -656,7 +672,10 @@ void tst_QAbstractItemView::dragSelect()
QTableView view;
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.setVisible(true);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
const int delay = 2;
for (int i = 0; i < 2; ++i) {
@@ -677,7 +696,10 @@ void tst_QAbstractItemView::rowDelegate()
QTableView view;
view.setModel(&model);
view.setItemDelegateForRow(3, &delegate);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(3, 0);
view.openPersistentEditor(index);
@@ -694,7 +716,10 @@ void tst_QAbstractItemView::columnDelegate()
QTableView view;
view.setModel(&model);
view.setItemDelegateForColumn(3, &delegate);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(0, 3);
view.openPersistentEditor(index);
@@ -747,11 +772,13 @@ void tst_QAbstractItemView::persistentEditorFocus()
view.setCurrentIndex(model.index(0, 0));
QCOMPARE(view.currentIndex(), model.index(0, 0));
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTRY_VERIFY(view.isVisible());
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
for (int i = 0; i < list.count(); ++i) {
- TRY_COMPARE(list.at(i)->isVisible(), true);
+ QTRY_VERIFY(list.at(i)->isVisible());
QPoint p = QPoint(5, 5);
QMouseEvent mouseEvent(QEvent::MouseButtonPress, p, Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
@@ -1045,6 +1072,8 @@ void tst_QAbstractItemView::setItemDelegate()
}
}
}
+ centerOnScreen(&v);
+ moveCursorAway(&v);
v.show();
#ifdef Q_WS_X11
QCursor::setPos(v.geometry().center());
@@ -1056,7 +1085,7 @@ void tst_QAbstractItemView::setItemDelegate()
v.edit(index);
// This will close the editor
- TRY_COMPARE(QApplication::focusWidget() == 0, false);
+ QTRY_VERIFY(QApplication::focusWidget());
QWidget *editor = QApplication::focusWidget();
QVERIFY(editor);
editor->hide();
@@ -1122,20 +1151,25 @@ void tst_QAbstractItemView::setCurrentIndex()
QFETCH(int, itemFlags);
QFETCH(bool, result);
- TestView *view = 0;
+ QScopedPointer<QAbstractItemView> view;
+
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
- QStandardItemModel *model = new QStandardItemModel(view);
+ QStandardItemModel *model = new QStandardItemModel(view.data());
QStandardItem *item = new QStandardItem("first item");
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
model->appendRow(item);
@@ -1150,8 +1184,6 @@ void tst_QAbstractItemView::setCurrentIndex()
QVERIFY(view->currentIndex() == model->index(0,0));
view->setCurrentIndex(model->index(1,0));
QVERIFY(view->currentIndex() == model->index(result ? 1 : 0,0));
-
- delete view;
}
void tst_QAbstractItemView::task221955_selectedEditor()
@@ -1170,11 +1202,13 @@ void tst_QAbstractItemView::task221955_selectedEditor()
tree.setItemWidget(dummy, 0, button = new QPushButton("More..."));
button->setAutoFillBackground(true); // as recommended in doc
+ centerOnScreen(&tree);
+ moveCursorAway(&tree);
tree.show();
tree.setFocus();
tree.setCurrentIndex(tree.model()->index(1,0));
- QTest::qWait(100);
QApplication::setActiveWindow(&tree);
+ QVERIFY(QTest::qWaitForWindowActive(&tree));
QVERIFY(! tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0)));
@@ -1218,9 +1252,11 @@ void tst_QAbstractItemView::task250754_fontChange()
}
tree.setModel(m);
+ w.resize(160, 240); // Minimum width for windows with frame on Windows 8
+ centerOnScreen(&w);
+ moveCursorAway(&w);
w.show();
- w.resize(150,240);
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QFont font = tree.font();
font.setPixelSize(10);
tree.setFont(font);
@@ -1244,8 +1280,10 @@ void tst_QAbstractItemView::task200665_itemEntered()
QStandardItemModel model(1000,1);
QListView view;
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QRect rect = view.visualRect(model.index(0,0));
QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) );
QSignalSpy spy(&view, SIGNAL(entered(QModelIndex)));
@@ -1267,7 +1305,10 @@ void tst_QAbstractItemView::task257481_emptyEditor()
QTreeView treeView;
treeView.setRootIsDecorated(false);
treeView.setModel(&model);
+ centerOnScreen(&treeView);
+ moveCursorAway(&treeView);
treeView.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&treeView));
treeView.edit(model.index(0,0));
QList<QLineEdit *> lineEditors = treeView.viewport()->findChildren<QLineEdit *>();
@@ -1298,14 +1339,16 @@ void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling()
}
QListView view;
- view.setFixedSize(150, 250);
+ view.setFixedSize(160, 250); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index0 = model.index(0, 0);
QModelIndex index1 = model.index(1, 0);
@@ -1333,14 +1376,16 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection()
}
QListView view;
- view.setFixedSize(150, 450);
+ view.setFixedSize(160, 450); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index0 = model.index(0, 0);
QModelIndex index1 = model.index(1, 0);
@@ -1408,14 +1453,16 @@ void tst_QAbstractItemView::ctrlRubberbandSelection()
}
QListView view;
- view.setFixedSize(150, 450);
+ view.setFixedSize(160, 450); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index1 = model.index(1, 0);
QModelIndex index2 = model.index(2, 0);
@@ -1454,6 +1501,8 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
font.setPixelSize(10);
view.setFont(font);
view.resize(200,240);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
@@ -1493,7 +1542,11 @@ void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
for (int j = 0; j < table.columnCount(); ++j)
table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah"));
+ centerOnScreen(&table);
+ moveCursorAway(&table);
table.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&table));
+
table.setSelectionMode(QAbstractItemView::ExtendedSelection);
table.selectAll();
QVERIFY(QTest::qWaitForWindowExposed(&table));
@@ -1523,6 +1576,8 @@ void tst_QAbstractItemView::testClickedSignal()
{
QTableWidget view(5, 5);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1591,6 +1646,8 @@ void tst_QAbstractItemView::testChangeEditorState()
view.setEditTriggers(QAbstractItemView::CurrentChanged);
view.setItemDelegate(new StateChangeDelegate);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1607,7 +1664,10 @@ void tst_QAbstractItemView::deselectInSingleSelection()
s.setRowCount(10);
s.setColumnCount(10);
view.setModel(&s);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.setSelectionMode(QAbstractItemView::SingleSelection);
view.setEditTriggers(QAbstractItemView::NoEditTriggers);
QApplication::setActiveWindow(&view);
@@ -1650,6 +1710,8 @@ void tst_QAbstractItemView::testNoActivateOnDisabledItem()
model.setItem(0, 0, item);
item->setFlags(Qt::NoItemFlags);
treeView.setModel(&model);
+ centerOnScreen(&treeView);
+ moveCursorAway(&treeView);
treeView.show();
QApplication::setActiveWindow(&treeView);
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 398b1b4d98..3e6df0f136 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -368,6 +368,8 @@ void tst_QHeaderView::getSetCheck()
QCOMPARE(0, obj1.minimumSectionSize());
obj1.setMinimumSectionSize(99999);
QCOMPARE(99999, obj1.minimumSectionSize());
+ obj1.setMinimumSectionSize(-1);
+ QVERIFY(obj1.minimumSectionSize() < 100);
// int QHeaderView::offset()
// void QHeaderView::setOffset(int)
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 8d75298673..091927abe4 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -153,6 +153,7 @@ private slots:
void focusChanged();
void focusOut();
+ void focusMouseClick();
void execAfterExit();
@@ -1771,6 +1772,63 @@ void tst_QApplication::focusOut()
QTest::qWait(2000);
}
+class SpontaneousEvent
+{
+ Q_GADGET
+ QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+ Q_ENUMS(Type)
+public:
+ enum Type {
+ Void
+ };
+
+ virtual ~SpontaneousEvent() {}
+
+ QEventPrivate *d;
+ ushort t;
+
+ ushort posted : 1;
+ ushort spont : 1;
+};
+
+void tst_QApplication::focusMouseClick()
+{
+ int argc = 1;
+ QApplication app(argc, &argv0);
+
+ QWidget w;
+ w.setFocusPolicy(Qt::StrongFocus);
+ QWidget w2(&w);
+ w2.setFocusPolicy(Qt::TabFocus);
+ w.show();
+ w.setFocus();
+ QTRY_COMPARE(QApplication::focusWidget(), &w);
+
+ // front most widget has Qt::TabFocus, parent widget accepts clicks as well
+ // now send a mouse button press event and check what happens with the focus
+ // it should be given to the parent widget
+ QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QCOMPARE(QApplication::focusWidget(), &w);
+
+ // then we give the inner widget strong focus -> it should get focus
+ w2.setFocusPolicy(Qt::StrongFocus);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QTRY_COMPARE(QApplication::focusWidget(), &w2);
+
+ // now back to tab focus and click again (it already had focus) -> focus should stay
+ // (focus was revoked as of QTBUG-34042)
+ w2.setFocusPolicy(Qt::TabFocus);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QCOMPARE(QApplication::focusWidget(), &w2);
+}
+
void tst_QApplication::execAfterExit()
{
int argc = 1;
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index 135605f185..d04b812878 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -47,6 +47,7 @@
#include <qproxystyle.h>
#include <qsizepolicy.h>
+#include <QtWidgets/QCheckBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
@@ -347,6 +348,19 @@ void tst_QFormLayout::spacing()
style->hspacing = 20;
//QCOMPARE(fl->spacing(), 20);
+
+
+ // Do not assert if spacings are negative (QTBUG-34731)
+ style->vspacing = -1;
+ style->hspacing = -1;
+ QLabel *label = new QLabel(tr("Asserts"));
+ QCheckBox *checkBox = new QCheckBox(tr("Yes"));
+ fl->setWidget(0, QFormLayout::LabelRole, label);
+ fl->setWidget(1, QFormLayout::FieldRole, checkBox);
+ w->resize(200, 100);
+ w->show();
+ QVERIFY(QTest::qWaitForWindowExposed(w));
+
delete w;
delete style;
}
diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
index 8c010abfe6..1434d98e59 100644
--- a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
+++ b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
@@ -43,6 +43,8 @@
#include <QtTest/QtTest>
#include <QKeySequenceEdit>
+#include <QLineEdit>
+#include <QString>
Q_DECLARE_METATYPE(Qt::Key)
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
@@ -55,6 +57,7 @@ private slots:
void testSetters();
void testKeys_data();
void testKeys();
+ void testLineEditContents();
};
void tst_QKeySequenceEdit::testSetters()
@@ -100,5 +103,26 @@ void tst_QKeySequenceEdit::testKeys()
QTRY_COMPARE(spy.count(), 1);
}
+void tst_QKeySequenceEdit::testLineEditContents()
+{
+ QKeySequenceEdit edit;
+ QLineEdit *le = edit.findChild<QLineEdit*>();
+ QVERIFY(le);
+
+ QCOMPARE(le->text(), QString());
+
+ edit.setKeySequence(QKeySequence::New);
+ QCOMPARE(edit.keySequence(), QKeySequence(QKeySequence::New));
+
+ edit.clear();
+ QCOMPARE(le->text(), QString());
+
+ edit.setKeySequence(QKeySequence::New);
+ QVERIFY(le->text() != QString());
+
+ edit.setKeySequence(QKeySequence());
+ QCOMPARE(le->text(), QString());
+}
+
QTEST_MAIN(tst_QKeySequenceEdit)
#include "tst_qkeysequenceedit.moc"
diff --git a/util/accessibilityinspector/screenreader.cpp b/util/accessibilityinspector/screenreader.cpp
index 5dcf52ef09..e5953637a1 100644
--- a/util/accessibilityinspector/screenreader.cpp
+++ b/util/accessibilityinspector/screenreader.cpp
@@ -42,7 +42,6 @@
#include "screenreader.h"
#include "optionswidget.h"
#include "accessibilityscenemanager.h"
-#include <private/qaccessible2_p.h>
#include <QtGui>
ScreenReader::ScreenReader(QObject *parent) :