summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/link_pkgconfig.prf2
-rw-r--r--mkspecs/macx-ios-clang/features/qt.prf7
-rwxr-xr-xmkspecs/macx-ios-clang/rename_main.sh63
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp6
-rw-r--r--qmake/library/qmakeevaluator.cpp21
-rw-r--r--src/3rdparty/zlib/zconf.h1
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java76
-rw-r--r--src/corelib/codecs/cp949codetbl_p.h4
-rw-r--r--src/corelib/global/qglobal.h12
-rw-r--r--src/corelib/global/qsystemdetection.h17
-rw-r--r--src/corelib/global/qtypeinfo.h2
-rw-r--r--src/corelib/plugin/qlibrary.cpp3
-rw-r--r--src/gui/kernel/qkeysequence.cpp3
-rw-r--r--src/gui/opengl/qtriangulator.cpp9
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp6
-rw-r--r--src/gui/painting/qpdf_p.h1
-rw-r--r--src/gui/painting/qpdfwriter.cpp2
-rw-r--r--src/opengl/qgl.cpp103
-rw-r--r--src/opengl/qgl_p.h1
-rw-r--r--src/opengl/qgl_qpa.cpp3
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp7
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp4
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h1
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp3
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch_p.h7
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp6
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp6
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp7
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix.cpp82
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix_p.h2
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp2
-rw-r--r--src/printsupport/kernel/qprinter.cpp4
-rw-r--r--src/testlib/qbenchmarkperfevents.cpp20
-rw-r--r--src/testlib/qtestlog.cpp7
-rw-r--r--src/tools/qdoc/qdoc.pro5
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
-rw-r--r--src/widgets/kernel/qshortcut.cpp7
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp7
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp9
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/xml/sax/qxml.cpp85
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp6
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp44
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp5
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp4
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp7
50 files changed, 422 insertions, 283 deletions
diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf
index 4e36b7c83c..44d1a4c045 100644
--- a/mkspecs/features/link_pkgconfig.prf
+++ b/mkspecs/features/link_pkgconfig.prf
@@ -7,7 +7,7 @@ for(ever) {
libvar = LIBS$$pkgsfx
for(PKGCONFIG_LIB, $$list($$unique($$pkgvar))) {
# don't proceed if the .pro asks for a package we don't have!
- !packagesExist($$PKGCONFIG_LIB):error("Package $$PKGCONFIG_LIB not found")
+ !packagesExist($$PKGCONFIG_LIB): error("$$PKGCONFIG_LIB development package not found")
PKGCONFIG_CFLAGS = $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/macx-ios-clang/features/qt.prf
index 9202a70a5a..04ebb1208a 100644
--- a/mkspecs/macx-ios-clang/features/qt.prf
+++ b/mkspecs/macx-ios-clang/features/qt.prf
@@ -42,12 +42,7 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) {
!isEmpty(QMAKE_PRE_LINK): \
QMAKE_PRE_LINK += ";"
- QMAKE_PRE_LINK += \
- "for f in $(find $${objects_dir} -name '*.o'); do" \
- "(nm $f | grep -q 'T _main' && cp $f $f.original" \
- "&& ld -r -alias _main _qt_main -unexported_symbol _main $f.original -o $f)" \
- "|| true" \
- "; done"
+ QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir}
}
}
diff --git a/mkspecs/macx-ios-clang/rename_main.sh b/mkspecs/macx-ios-clang/rename_main.sh
new file mode 100755
index 0000000000..b30eb160d0
--- /dev/null
+++ b/mkspecs/macx-ios-clang/rename_main.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+#############################################################################
+##
+## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
+if [ $# -eq 0 ]; then
+ echo "usage: $0 <path to object files>"
+else
+ for f in $(find $1 -name '*.o'); do
+ # Skip object files without the _main symbol
+ nm $f | grep -q 'T _main$' || continue
+
+ echo "Found main() in ${f#$1/}"
+
+ strings -t d - $f | grep '_main\(\.eh\)\?$' | while read match; do
+ offset=$(echo $match | cut -d ' ' -f 1)
+ symbol=$(echo $match | cut -d ' ' -f 2)
+
+ echo " Renaming '$symbol' at offset $offset to '${symbol/main/qtmn}'"
+
+ # In-place rename the string (keeping the same length)
+ printf '_qtmn' | dd of=$f bs=1 seek=$offset conv=notrunc >/dev/null 2>&1
+ done
+ done
+fi \ No newline at end of file
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index d2ce3306fb..829be89097 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -154,8 +154,10 @@ DotNET which_dotnet_version(const QByteArray &preferredVersion = QByteArray())
const QString productPath = installPaths.value(dotNetCombo[i].version);
if (productPath.isEmpty())
continue;
- if (path.startsWith(productPath, Qt::CaseInsensitive))
- return dotNetCombo[i].version;
+ if (path.startsWith(productPath, Qt::CaseInsensitive)) {
+ current_version = dotNetCombo[i].version;
+ return current_version;
+ }
}
}
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index f46eb75670..e17ac16e96 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1118,28 +1118,7 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
}
no_cache:
- // Look for mkspecs/ in source and build. First to win determines the root.
- QString sdir = inDir;
QString dir = m_outputDir;
- while (dir != m_buildRoot) {
- if ((dir != sdir && QFileInfo(sdir, QLatin1String("mkspecs")).isDir())
- || QFileInfo(dir, QLatin1String("mkspecs")).isDir()) {
- if (dir != sdir)
- m_sourceRoot = sdir;
- m_buildRoot = dir;
- break;
- }
- if (dir == superdir)
- break;
- QFileInfo qsdfi(sdir);
- QFileInfo qdfi(dir);
- if (qsdfi.isRoot() || qdfi.isRoot())
- break;
- sdir = qsdfi.path();
- dir = qdfi.path();
- }
-
- dir = m_outputDir;
forever {
QString stashfile = dir + QLatin1String("/.qmake.stash");
if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) {
diff --git a/src/3rdparty/zlib/zconf.h b/src/3rdparty/zlib/zconf.h
index dc52489bc2..d01f20bc07 100644
--- a/src/3rdparty/zlib/zconf.h
+++ b/src/3rdparty/zlib/zconf.h
@@ -107,6 +107,7 @@
# define zcfree z_zcfree
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
+# define z_errmsg z_z_errmsg
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 07b517d3d0..d8c560933f 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -242,50 +242,56 @@ public class QtActivityDelegate
int imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_DONE;
int inputType = android.text.InputType.TYPE_CLASS_TEXT;
- if ((inputHints & ImhMultiLine) != 0) {
- inputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE;
- imeOptions = android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION;
- }
-
- if (((inputHints & ImhNoAutoUppercase) != 0 || (inputHints & ImhPreferUppercase) != 0)
- && (inputHints & ImhLowercaseOnly) == 0) {
- initialCapsMode = android.text.TextUtils.CAP_MODE_SENTENCES;
- }
-
- if ((inputHints & ImhUppercaseOnly) != 0)
- initialCapsMode = android.text.TextUtils.CAP_MODE_CHARACTERS;
-
- if ((inputHints & ImhHiddenText) != 0)
- inputType = android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
-
- if ((inputHints & ImhPreferNumbers) != 0)
+ if ((inputHints & (ImhPreferNumbers | ImhDigitsOnly | ImhFormattedNumbersOnly)) != 0) {
inputType = android.text.InputType.TYPE_CLASS_NUMBER;
+ if ((inputHints & ImhFormattedNumbersOnly) != 0) {
+ inputType |= (android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL
+ | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED);
+ }
- if ((inputHints & ImhDigitsOnly) != 0)
- inputType = android.text.InputType.TYPE_CLASS_NUMBER;
+ if (Build.VERSION.SDK_INT > 10 && (inputHints & ImhHiddenText) != 0)
+ inputType |= 0x10;
+ } else if ((inputHints & ImhDialableCharactersOnly) != 0) {
+ inputType = android.text.InputType.TYPE_CLASS_PHONE;
+ } else if ((inputHints & (ImhDate | ImhTime)) != 0) {
+ inputType = android.text.InputType.TYPE_CLASS_DATETIME;
+ if ((inputHints & ImhDate) != 0)
+ inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_DATE;
+ if ((inputHints & ImhTime) != 0)
+ inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_TIME;
+ } else { // CLASS_TEXT
+ if ((inputHints & ImhHiddenText) != 0) {
+ inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
+ } else if ((inputHints & (ImhNoAutoUppercase | ImhNoPredictiveText | ImhSensitiveData)) != 0) {
+ inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
+ }
- if ((inputHints & ImhFormattedNumbersOnly) != 0) {
- inputType = android.text.InputType.TYPE_CLASS_NUMBER
- | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL
- | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED;
- }
+ if ((inputHints & ImhEmailCharactersOnly) != 0)
+ inputType |= android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
- if ((inputHints & ImhDialableCharactersOnly) != 0)
- inputType = android.text.InputType.TYPE_CLASS_PHONE;
+ if ((inputHints & ImhUrlCharactersOnly) != 0) {
+ inputType |= android.text.InputType.TYPE_TEXT_VARIATION_URI;
+ imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO;
+ }
- if ((inputHints & ImhEmailCharactersOnly) != 0)
- inputType = android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+ if ((inputHints & ImhMultiLine) != 0)
+ inputType |= android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE;
- if ((inputHints & ImhUrlCharactersOnly) != 0) {
- inputType = android.text.InputType.TYPE_TEXT_VARIATION_URI;
- imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO;
- }
+ if ((inputHints & ImhUppercaseOnly) != 0) {
+ initialCapsMode |= android.text.TextUtils.CAP_MODE_CHARACTERS;
+ inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
+ } else if ((inputHints & ImhLowercaseOnly) == 0 && (inputHints & ImhNoAutoUppercase) == 0) {
+ initialCapsMode |= android.text.TextUtils.CAP_MODE_SENTENCES;
+ inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
+ }
- if ((inputHints & ImhNoPredictiveText) != 0) {
- //android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | android.text.InputType.TYPE_CLASS_TEXT;
- inputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
+ if ((inputHints & ImhNoPredictiveText) != 0 || (inputHints & ImhSensitiveData) != 0)
+ inputType |= android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
+ if ((inputHints & ImhMultiLine) != 0)
+ imeOptions = android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION;
+
m_editText.setInitialCapsMode(initialCapsMode);
m_editText.setImeOptions(imeOptions);
m_editText.setInputType(inputType);
diff --git a/src/corelib/codecs/cp949codetbl_p.h b/src/corelib/codecs/cp949codetbl_p.h
index 336b0b75a1..2a62b3c6c7 100644
--- a/src/corelib/codecs/cp949codetbl_p.h
+++ b/src/corelib/codecs/cp949codetbl_p.h
@@ -40,7 +40,7 @@
****************************************************************************/
#ifndef CP949CODETBL_P_H
-#define CP494CODETBL_P_H
+#define CP949CODETBL_P_H
//
// W A R N I N G
@@ -645,4 +645,4 @@ static const unsigned short cp949_icode_to_unicode[] = {
0xd7a2, 0xd7a3
};
-#endif // CP494CODETBL_P_H
+#endif // CP949CODETBL_P_H
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 8b91545c9b..8a86dc158e 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -716,13 +716,13 @@ typedef void (*QFunctionPointer)();
# define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
#endif
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT;
+Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
{
return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT;
+Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
{
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
@@ -731,7 +731,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
/*!
\internal
*/
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT;
+Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
@@ -740,7 +740,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
/*!
\internal
*/
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT;
+Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
{
return qAbs(f) <= 0.00001f;
@@ -751,7 +751,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(double d) Q_REQUIRED_RESULT;
+static inline bool qIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
static inline bool qIsNull(double d)
{
union U {
@@ -768,7 +768,7 @@ static inline bool qIsNull(double d)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(float f) Q_REQUIRED_RESULT;
+static inline bool qIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
static inline bool qIsNull(float f)
{
union U {
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 7b1c32663b..0431e10133 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -210,14 +210,17 @@
#ifdef Q_OS_DARWIN
# include <Availability.h>
-# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
-# undef __MAC_OS_X_VERSION_MIN_REQUIRED
-# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
-# endif
# include <AvailabilityMacros.h>
-# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
-# undef MAC_OS_X_VERSION_MIN_REQUIRED
-# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
+#
+# ifdef Q_OS_OSX
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
+# undef __MAC_OS_X_VERSION_MIN_REQUIRED
+# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
+# endif
+# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+# undef MAC_OS_X_VERSION_MIN_REQUIRED
+# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
+# endif
# endif
#
# // Numerical checks are preferred to named checks, but to be safe
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 7c97909971..114e11345a 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -214,7 +214,7 @@ Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
#define Q_DECLARE_SHARED_STL(TYPE) \
QT_END_NAMESPACE \
namespace std { \
- template<> inline void swap<QT_PREPEND_NAMESPACE(TYPE)>(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \
+ template<> inline void swap< QT_PREPEND_NAMESPACE(TYPE) >(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \
{ value1.swap(value2); } \
} \
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 77de4d594e..468f759189 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -256,7 +256,8 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
*/
bool hasMetaData = false;
long pos = 0;
- const char pattern[] = "QTMETADATA ";
+ char pattern[] = "qTMETADATA ";
+ pattern[0] = 'Q'; // Ensure the pattern "QTMETADATA" is not found in this library should QPluginLoader ever encounter it.
const ulong plen = qstrlen(pattern);
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
int r = QElfParser().parse(filedata, fdlen, library, lib, &pos, &fdlen);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index ead248074e..5770b76f1f 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1075,7 +1075,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
sl = accel;
}
}
-#else
+#endif
int i = 0;
int lastI = 0;
while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
@@ -1110,7 +1110,6 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
}
lastI = i + 1;
}
-#endif
int p = accel.lastIndexOf(QLatin1Char('+'), str.length() - 2); // -2 so that Ctrl++ works
if(p > 0)
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index 77da009bf5..839ec9e96f 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -201,10 +201,12 @@ static inline qint64 qCross(const QPodPoint &u, const QPodPoint &v)
return qint64(u.x) * qint64(v.y) - qint64(u.y) * qint64(v.x);
}
+#ifdef Q_TRIANGULATOR_DEBUG
static inline qint64 qDot(const QPodPoint &u, const QPodPoint &v)
{
return qint64(u.x) * qint64(v.x) + qint64(u.y) * qint64(v.y);
}
+#endif
// Return positive value if 'p' is to the right of the line 'v1'->'v2', negative if left of the
// line and zero if exactly on the line.
@@ -249,13 +251,6 @@ static inline QIntersectionPoint qIntersectionPoint(const QPodPoint &point)
return p;
}
-static inline QIntersectionPoint qIntersectionPoint(int x, int y)
-{
- // upperLeft = (x, y), xOffset = 0/1, yOffset = 0/1.
- QIntersectionPoint p = {{x, y}, {0, 1}, {0, 1}};
- return p;
-}
-
static QIntersectionPoint qIntersectionPoint(const QPodPoint &u1, const QPodPoint &u2, const QPodPoint &v1, const QPodPoint &v2)
{
QIntersectionPoint result = {{0, 0}, {0, 0}, {0, 0}};
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index f41d1830fd..b95b3e3503 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -71,7 +71,7 @@ static const struct {
{125, 176}, // B6
{88, 125}, // B7
{62, 88}, // B8
- {33, 62}, // B9
+ {44, 62}, // B9
{163, 229}, // C5E
{105, 241}, // US Common
{110, 220}, // DLE
@@ -133,7 +133,7 @@ QPagedPaintDevice::~QPagedPaintDevice()
\value B6 125 x 176 mm
\value B7 88 x 125 mm
\value B8 62 x 88 mm
- \value B9 33 x 62 mm
+ \value B9 44 x 62 mm
\value B10 31 x 44 mm
\value C5E 163 x 229 mm
\value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index c05f47c59d..147fa3f561 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1486,7 +1486,6 @@ QPdfEnginePrivate::QPdfEnginePrivate()
leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm
{
resolution = 1200;
- postscript = false;
currentObject = 1;
currentPage = 0;
stroker.stream = 0;
@@ -1520,7 +1519,6 @@ bool QPdfEngine::begin(QPaintDevice *pdev)
d->ownsDevice = true;
}
- d->postscript = false;
d->currentObject = 1;
d->currentPage = new QPdfPage;
@@ -2506,8 +2504,8 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
QFontEngine::FaceId face_id = fe->faceId();
bool noEmbed = false;
if (face_id.filename.isEmpty()
- || (!postscript && ((fe->fsType & 0x200) /* bitmap embedding only */
- || (fe->fsType == 2) /* no embedding allowed */))) {
+ || fe->fsType & 0x200 /* bitmap embedding only */
+ || fe->fsType == 2 /* no embedding allowed */) {
*currentPage << "Q\n";
q->QPaintEngine::drawTextItem(p, ti);
*currentPage << "q\n";
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 54530d0f78..ae2d4b00ac 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -250,7 +250,6 @@ public:
void newPage();
- bool postscript;
int currentObject;
QPdfPage* currentPage;
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index a783aad66a..27fb8b1646 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -209,6 +209,8 @@ void QPdfWriter::setMargins(const Margins &m)
{
Q_D(QPdfWriter);
+ QPagedPaintDevice::setMargins(m);
+
const qreal multiplier = 72./25.4;
d->engine->d_func()->leftMargin = m.left*multiplier;
d->engine->d_func()->rightMargin = m.right*multiplier;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b1fbe2ac71..40a8b1921c 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2975,6 +2975,10 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex
Returns \c true if the paint device of this context is a pixmap;
otherwise returns \c false.
+
+ Since Qt 5 the paint device is never actually a pixmap. renderPixmap() is
+ however still simulated using framebuffer objects and readbacks, and this
+ function will return \c true in this case.
*/
/*!
@@ -3143,7 +3147,7 @@ QGLFormat QGLContext::requestedFormat() const
bool QGLContext::deviceIsPixmap() const
{
Q_D(const QGLContext);
- return d->paintDevice->devType() == QInternal::Pixmap;
+ return !d->readback_target_size.isEmpty();
}
@@ -3885,7 +3889,9 @@ void QGLWidget::setFormat(const QGLFormat &format)
void QGLWidget::updateGL()
{
- if (updatesEnabled() && testAttribute(Qt::WA_Mapped))
+ Q_D(QGLWidget);
+ const bool targetIsOffscreen = !d->glcx->d_ptr->readback_target_size.isEmpty();
+ if (updatesEnabled() && (testAttribute(Qt::WA_Mapped) || targetIsOffscreen))
glDraw();
}
@@ -4041,20 +4047,28 @@ void QGLWidget::paintEvent(QPaintEvent *)
You can use this method on both visible and invisible QGLWidget objects.
- This method will create a pixmap and a temporary QGLContext to
- render on the pixmap. It will then call initializeGL(),
- resizeGL(), and paintGL() on this context. Finally, the widget's
- original GL context is restored.
+ Internally the function renders into a framebuffer object and performs pixel
+ readback. This has a performance penalty, meaning that this function is not
+ suitable to be called at a high frequency.
+
+ After creating and binding the framebuffer object, the function will call
+ initializeGL(), resizeGL(), and paintGL(). On the next normal update
+ initializeGL() and resizeGL() will be triggered again since the size of the
+ destination pixmap and the QGLWidget's size may differ.
- The size of the pixmap will be \a w pixels wide and \a h pixels
- high unless one of these parameters is 0 (the default), in which
- case the pixmap will have the same size as the widget.
+ The size of the pixmap will be \a w pixels wide and \a h pixels high unless
+ one of these parameters is 0 (the default), in which case the pixmap will
+ have the same size as the widget.
- If \a useContext is true, this method will try to be more
- efficient by using the existing GL context to render the pixmap.
- The default is false. Only use true if you understand the risks.
- Note that under Windows a temporary context has to be created
- and usage of the \e useContext parameter is not supported.
+ Care must be taken when using framebuffer objects in paintGL() in
+ combination with this function. To switch back to the default framebuffer,
+ use QGLFramebufferObject::bindDefault(). Binding FBO 0 is wrong since
+ renderPixmap() uses a custom framebuffer instead of the one provided by the
+ windowing system.
+
+ \a useContext is ignored. Historically this parameter enabled the usage of
+ the existing GL context. This is not supported anymore since additional
+ contexts are never created.
Overlays are not rendered onto the pixmap.
@@ -4069,43 +4083,31 @@ void QGLWidget::paintEvent(QPaintEvent *)
QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext)
{
+ Q_UNUSED(useContext);
Q_D(QGLWidget);
+
QSize sz = size();
if ((w > 0) && (h > 0))
sz = QSize(w, h);
- QPixmap pm(sz);
-
- d->glcx->doneCurrent();
-
- bool success = true;
-
- if (useContext && isValid() && d->renderCxPm(&pm))
- return pm;
-
- QGLFormat fmt = d->glcx->requestedFormat();
- fmt.setDirectRendering(false); // Direct is unlikely to work
- fmt.setDoubleBuffer(false); // We don't need dbl buf
-
- QGLContext* ocx = d->glcx;
- ocx->doneCurrent();
- d->glcx = new QGLContext(fmt, &pm);
- d->glcx->create();
-
- if (d->glcx->isValid())
+ QPixmap pm;
+ if (d->glcx->isValid()) {
+ d->glcx->makeCurrent();
+ QGLFramebufferObject fbo(sz, QGLFramebufferObject::CombinedDepthStencil);
+ fbo.bind();
+ d->glcx->setInitialized(false);
+ uint prevDefaultFbo = d->glcx->d_ptr->default_fbo;
+ d->glcx->d_ptr->default_fbo = fbo.handle();
+ d->glcx->d_ptr->readback_target_size = sz;
updateGL();
- else
- success = false;
-
- delete d->glcx;
- d->glcx = ocx;
-
- ocx->makeCurrent();
-
- if (success) {
- return pm;
+ fbo.release();
+ pm = QPixmap::fromImage(fbo.toImage());
+ d->glcx->d_ptr->default_fbo = prevDefaultFbo;
+ d->glcx->setInitialized(false);
+ d->glcx->d_ptr->readback_target_size = QSize();
}
- return QPixmap();
+
+ return pm;
}
/*!
@@ -4164,14 +4166,23 @@ void QGLWidget::glDraw()
if (d->glcx->deviceIsPixmap())
glDrawBuffer(GL_FRONT);
#endif
+ QSize readback_target_size = d->glcx->d_ptr->readback_target_size;
if (!d->glcx->initialized()) {
glInit();
const qreal scaleFactor = (window() && window()->windowHandle()) ?
window()->windowHandle()->devicePixelRatio() : 1.0;
- resizeGL(d->glcx->device()->width() * scaleFactor, d->glcx->device()->height() * scaleFactor); // New context needs this "resize"
+ int w, h;
+ if (readback_target_size.isEmpty()) {
+ w = d->glcx->device()->width() * scaleFactor;
+ h = d->glcx->device()->height() * scaleFactor;
+ } else {
+ w = readback_target_size.width();
+ h = readback_target_size.height();
+ }
+ resizeGL(w, h); // New context needs this "resize"
}
paintGL();
- if (doubleBuffer()) {
+ if (doubleBuffer() && readback_target_size.isEmpty()) {
if (d->autoSwap)
swapBuffers();
} else {
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 484c3ea2d9..22fc3f4ad0 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -270,6 +270,7 @@ public:
uint workaround_brokenAlphaTexSubImage_init : 1;
QPaintDevice *paintDevice;
+ QSize readback_target_size;
QColor transpColor;
QGLContext *q_ptr;
QGLFormat::OpenGLVersionFlags version_flags;
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 6e698bf939..8b66c891bb 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -138,6 +138,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
{
Q_D(QGLContext);
if(!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) {
+ // Unlike in Qt 4, the only possible target is a widget backed by an OpenGL-based
+ // QWindow. Pixmaps in particular are not supported anymore as paint devices since
+ // starting from Qt 5 QPixmap is raster-backed on almost all platforms.
d->valid = false;
}else {
QWidget *widget = static_cast<QWidget *>(d->paintDevice);
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
index ac902b4140..8a0a0f43ac 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
@@ -130,8 +130,10 @@ QStringList QDeviceDiscovery::scanConnectedDevices()
udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHPAD", "1");
if (m_types & Device_Touchscreen)
udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHSCREEN", "1");
- if (m_types & Device_Keyboard)
+ if (m_types & Device_Keyboard) {
udev_enumerate_add_match_property(ue, "ID_INPUT_KEYBOARD", "1");
+ udev_enumerate_add_match_property(ue, "ID_INPUT_KEY", "1");
+ }
if (m_types & Device_Tablet)
udev_enumerate_add_match_property(ue, "ID_INPUT_TABLET", "1");
@@ -242,6 +244,9 @@ bool QDeviceDiscovery::checkDeviceType(udev_device *dev)
}
}
+ if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEY"), "1") == 0 ))
+ return true;
+
if ((m_types & Device_Mouse) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0))
return true;
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index ec740b87db..1a7eb9d92f 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -71,22 +71,22 @@ static inline void bindApi(const QSurfaceFormat &format)
QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
EGLenum eglApi)
: m_eglDisplay(display)
- , m_eglApi(eglApi)
, m_eglConfig(q_configFromGLFormat(display, format))
, m_swapInterval(-1)
, m_swapIntervalEnvChecked(false)
, m_swapIntervalFromEnv(-1)
{
init(format, share);
+ Q_UNUSED(eglApi);
}
QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
EGLConfig config, EGLenum eglApi)
: m_eglDisplay(display)
- , m_eglApi(eglApi)
, m_eglConfig(config)
{
init(format, share);
+ Q_UNUSED(eglApi);
}
void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 3d81a1c56e..a976aff271 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -77,7 +77,6 @@ private:
EGLContext m_eglContext;
EGLContext m_shareContext;
EGLDisplay m_eglDisplay;
- EGLenum m_eglApi;
EGLConfig m_eglConfig;
QSurfaceFormat m_format;
int m_swapInterval;
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
index be0164d8eb..33f3601b97 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
@@ -103,7 +103,8 @@ void QBasicFontDatabase::populateFontDatabase()
QDir dir(fontpath);
dir.setNameFilters(QStringList() << QLatin1String("*.ttf")
<< QLatin1String("*.ttc") << QLatin1String("*.pfa")
- << QLatin1String("*.pfb"));
+ << QLatin1String("*.pfb")
+ << QLatin1String("*.otf"));
dir.refresh();
for (int i = 0; i < int(dir.count()); ++i) {
const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
index dbd401c297..d0ea839f51 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h
@@ -48,13 +48,14 @@
#include <QThread>
#include <qpa/qwindowsysteminterface.h>
+#if !defined(QT_NO_MTDEV)
+struct mtdev;
+#endif
+
QT_BEGIN_NAMESPACE
class QSocketNotifier;
class QEvdevTouchScreenData;
-#if !defined(QT_NO_MTDEV)
-struct mtdev;
-#endif
class QEvdevTouchScreenHandler : public QObject
{
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 3d1b281620..692372c3a9 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -228,8 +228,7 @@ QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale)
{
QFile aliases(systemComposeDir() + QLatin1String("/locale.alias"));
QByteArray fullLocaleName;
- if (aliases.exists()) {
- aliases.open(QIODevice::ReadOnly);
+ if (aliases.open(QIODevice::ReadOnly)) {
while (!aliases.atEnd()) {
char l[1024];
int read = aliases.readLine(l, sizeof(l));
@@ -268,8 +267,7 @@ QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale)
bool TableGenerator::processFile(QString composeFileName)
{
QFile composeFile(composeFileName);
- if (composeFile.exists()) {
- composeFile.open(QIODevice::ReadOnly);
+ if (composeFile.open(QIODevice::ReadOnly)) {
parseComposeFile(&composeFile);
return true;
}
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index f93c6cc3a7..821599d113 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -246,7 +246,7 @@ enum SetJumpResult
// user our main wrapper. Since the symbol is weak, it will not
// get used or cause a clash in the normal Qt application usecase,
// where we rename main to qt_main.
-extern "C" int __attribute__((weak)) qt_main(int argc, char *argv[])
+extern "C" int __attribute__((weak)) qtmn(int argc, char *argv[])
{
Q_UNUSED(argc);
Q_UNUSED(argv);
@@ -265,7 +265,7 @@ static void __attribute__((noinline, noreturn)) user_main_trampoline()
strcpy(argv[i], [arg cStringUsingEncoding:[NSString defaultCStringEncoding]]);
}
- int exitCode = qt_main(argc, argv);
+ int exitCode = qtmn(argc, argv);
delete[] argv;
qEventDispatcherDebug() << "Returned from main with exit code " << exitCode;
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 7ba48fe0cb..497d0975af 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -1633,8 +1633,8 @@ void QWindowsFileDialogHelper::selectFile(const QUrl &fileName)
if (QWindowsContext::verboseDialogs)
qDebug("%s %s" , __FUNCTION__, qPrintable(fileName.toString()));
- if (QWindowsNativeFileDialogBase *nfd = nativeFileDialog())
- nfd->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists
+ if (hasNativeDialog()) // Might be invoked from the QFileDialog constructor.
+ nativeFileDialog()->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists
}
QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 407adc29ee..63894373b8 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -280,8 +280,12 @@ void QXcbWindow::create()
if (parent()) {
xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
m_embedded = parent()->window()->type() == Qt::ForeignWindow;
- }
+ QSurfaceFormat parentFormat = parent()->window()->requestedFormat();
+ if (window()->surfaceType() != QSurface::OpenGLSurface && parentFormat.hasAlpha()) {
+ window()->setFormat(parentFormat);
+ }
+ }
m_format = window()->requestedFormat();
#if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB)
diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
index e8758da1c7..f85fe0839f 100644
--- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
@@ -419,12 +419,11 @@ void QGtk2FileDialogHelper::applyOptions()
if (!nameFilters.isEmpty())
setNameFilters(nameFilters);
- const QString initialDirectory = opts->initialDirectory().toLocalFile();
- if (!initialDirectory.isEmpty())
- setDirectory(initialDirectory);
+ if (opts->initialDirectory().isLocalFile())
+ setDirectory(opts->initialDirectory());
foreach (const QUrl &filename, opts->initiallySelectedFiles())
- selectFile(filename.toLocalFile());
+ selectFile(filename);
const QString initialNameFilter = opts->initiallySelectedNameFilter();
if (!initialNameFilter.isEmpty())
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
index c1b9828a23..6801863a3a 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
@@ -472,58 +472,68 @@ void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p)
// Updates size/preview after the combobox has been changed.
void QPageSetupWidget::_q_paperSizeChanged()
{
- QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex());
- int index = m_printer->pageSize();
- if (val.type() == QVariant::Int) {
- index = val.toInt();
- }
-
if (m_blockSignals) return;
m_blockSignals = true;
- QPrinter::PaperSize size = QPrinter::PaperSize(index);
- QPrinter::Orientation orientation = widget.portrait->isChecked()
- ? QPrinter::Portrait
- : QPrinter::Landscape;
-
- bool custom = size == QPrinter::Custom;
-
-#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
- custom = custom && m_cups && (m_printer->paperName() == QLatin1String("Custom"));
-#endif
-
- widget.paperWidth->setEnabled(custom);
- widget.paperHeight->setEnabled(custom);
- widget.widthLabel->setEnabled(custom);
- widget.heightLabel->setEnabled(custom);
- if (custom) {
- m_paperSize.setWidth( widget.paperWidth->value() * m_currentMultiplier);
- m_paperSize.setHeight( widget.paperHeight->value() * m_currentMultiplier);
- m_pagePreview->setPaperSize(m_paperSize);
- } else {
- Q_ASSERT(m_printer);
-#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
- if (m_cups && QCUPSSupport::isAvailable()) { // combobox is filled with cups based data
+ bool custom = false;
+ QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex());
+ QPrinter::Orientation orientation = widget.portrait->isChecked() ? QPrinter::Portrait : QPrinter::Landscape;
+
+ if (m_cups) {
+ // OutputFormat == NativeFormat, data is QString Cups paper name
+ QByteArray cupsPageSize = val.toByteArray();
+ custom = (cupsPageSize == QByteArrayLiteral("Custom"));
+#ifndef QT_NO_CUPS
+ if (!custom) {
QCUPSSupport cups;
- QByteArray cupsPageSize = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray();
- m_paperSize = cups.paperRect(cupsPageSize).size();
- if (orientation == QPrinter::Landscape)
- m_paperSize = QSizeF(m_paperSize.height(), m_paperSize.width()); // swap
+ cups.setCurrentPrinter(m_printer->printerName());
+ m_paperSize = sizeForOrientation(orientation, cups.paperRect(cupsPageSize).size());
}
- else
#endif
+ } else {
+ // OutputFormat == PdfFormat, data is QPrinter::PageSize
+ QPrinter::PaperSize size = QPrinter::PaperSize(val.toInt());
+ custom = size == QPrinter::Custom;
+ if (!custom)
m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1);
+ }
- m_pagePreview->setPaperSize(m_paperSize);
+ if (custom) {
+ // Convert input custom size Units to Points
+ m_paperSize = QSizeF(widget.paperWidth->value() * m_currentMultiplier,
+ widget.paperHeight->value() * m_currentMultiplier);
+ } else {
+ // Display standard size Points as Units
widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier);
widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier);
}
+
+ m_pagePreview->setPaperSize(m_paperSize);
+
+ widget.paperWidth->setEnabled(custom);
+ widget.paperHeight->setEnabled(custom);
+ widget.widthLabel->setEnabled(custom);
+ widget.heightLabel->setEnabled(custom);
+
m_blockSignals = false;
}
void QPageSetupWidget::_q_pageOrientationChanged()
{
- if (QPrinter::PaperSize(widget.paperSize->currentIndex()) == QPrinter::Custom) {
+ bool custom = false;
+ QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex());
+
+ if (m_cups) {
+ // OutputFormat == NativeFormat, data is QString Cups paper name
+ QByteArray cupsPageSize = val.toByteArray();
+ custom = (cupsPageSize == QByteArrayLiteral("Custom"));
+ } else {
+ // OutputFormat == PdfFormat, data is QPrinter::PageSize
+ QPrinter::PaperSize size = QPrinter::PaperSize(val.toInt());
+ custom = size == QPrinter::Custom;
+ }
+
+ if (custom) {
double tmp = widget.paperWidth->value();
widget.paperWidth->setValue(widget.paperHeight->value());
widget.paperHeight->setValue(tmp);
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
index b96d300ab9..4245c3ae5f 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
@@ -94,7 +94,7 @@ private:
qreal m_topMargin;
qreal m_rightMargin;
qreal m_bottomMargin;
- QSizeF m_paperSize;
+ QSizeF m_paperSize; // In QPrinter::Point
qreal m_currentMultiplier;
bool m_blockSignals;
bool m_cups;
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index a903d170f2..2ec1088bb4 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -929,7 +929,7 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked()
if (!propertiesDialog)
setupPrinterProperties();
propertiesDialog->exec();
- if (propertiesDialog->result() == QDialog::Rejected) {
+ if (!propertiesDialogShown && propertiesDialog->result() == QDialog::Rejected) {
// If properties dialog was rejected the dialog is deleted and
// the properties are set to defaults when printer is setup
delete propertiesDialog;
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 5eb840c52a..f23708045d 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -92,7 +92,7 @@ static const float qt_paperSizes[][2] = {
{125, 176}, // B6
{88, 125}, // B7
{62, 88}, // B8
- {33, 62}, // B9
+ {44, 62}, // B9
{163, 229}, // C5E
{105, 241}, // US Common
{110, 220}, // DLE
@@ -448,7 +448,7 @@ void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, cons
\value B6 125 x 176 mm
\value B7 88 x 125 mm
\value B8 62 x 88 mm
- \value B9 33 x 62 mm
+ \value B9 44 x 62 mm
\value B10 31 x 44 mm
\value C5E 163 x 229 mm
\value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp
index acc11b09ac..30a0d3ea9c 100644
--- a/src/testlib/qbenchmarkperfevents.cpp
+++ b/src/testlib/qbenchmarkperfevents.cpp
@@ -515,16 +515,18 @@ void QBenchmarkPerfEventsMeasurer::start()
{
initPerf();
- // pid == 0 -> attach to the current process
- // cpu == -1 -> monitor on all CPUs
- // group_fd == -1 -> this is the group leader
- // flags == 0 -> reserved, must be zero
- fd = perf_event_open(&attr, 0, -1, -1, 0);
if (fd == -1) {
- perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
- exit(1);
- } else {
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ // pid == 0 -> attach to the current process
+ // cpu == -1 -> monitor on all CPUs
+ // group_fd == -1 -> this is the group leader
+ // flags == 0 -> reserved, must be zero
+ fd = perf_event_open(&attr, 0, -1, -1, 0);
+ if (fd == -1) {
+ perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
+ exit(1);
+ } else {
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
}
// enable the counter
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index b2efa1ac9c..037bed643d 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE
+Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context, const QString& msg);
+
static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage)
{
#ifdef __COVERAGESCANNER__
@@ -267,7 +269,7 @@ namespace QTest {
return false;
}
- static void messageHandler(QtMsgType type, const QMessageLogContext & /*context*/, const QString &message)
+ static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message)
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
@@ -282,6 +284,9 @@ namespace QTest {
// the message is expected, so just swallow it.
return;
+ msg = qMessageFormatString(type, context, message).toLocal8Bit();
+ msg.chop(1); // remove trailing newline
+
if (type != QtFatalMsg) {
if (counter.load() <= 0)
return;
diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro
index 55e32dd4a3..b020bfe9a4 100644
--- a/src/tools/qdoc/qdoc.pro
+++ b/src/tools/qdoc/qdoc.pro
@@ -1,3 +1,8 @@
+!force_bootstrap {
+ load(qfeatures)
+ requires(!contains(QT_DISABLED_FEATURES, xmlstreamwriter))
+}
+
option(host_build)
QT = core xml
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 1c3a793234..804331b1cd 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1004,7 +1004,11 @@ void QFileDialog::setDirectory(const QString &directory)
QDir QFileDialog::directory() const
{
Q_D(const QFileDialog);
- return QDir(d->nativeDialogInUse ? d->directory_sys().toLocalFile() : d->rootPath());
+ if (d->nativeDialogInUse) {
+ QString dir = d->directory_sys().toLocalFile();
+ return QDir(dir.isEmpty() ? d->options->initialDirectory().toLocalFile() : dir);
+ }
+ return d->rootPath();
}
/*!
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index f7f7cf1039..dcf6aed591 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -279,13 +279,12 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
// (and reaches this point), then the menu item itself has been disabled.
// This occurs at the QPA level on Mac, were we disable all the Cocoa menus
// when showing a modal window.
- Q_UNUSED(menu);
- continue;
-#else
+ if (a->shortcut().count() <= 1)
+ continue;
+#endif
QAction *a = menu->menuAction();
if (correctActionContext(context, a, active_window))
return true;
-#endif
} else
#endif
if (correctWidgetContext(context, w, active_window))
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 3281e0c6f7..0fd794cc02 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -118,11 +118,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
- if (q->testAttribute(Qt::WA_TranslucentBackground)) {
- QSurfaceFormat format;
+ QSurfaceFormat format = win->requestedFormat();
+ if ((flags & Qt::Window) && win->surfaceType() != QSurface::OpenGLSurface
+ && q->testAttribute(Qt::WA_TranslucentBackground)) {
format.setAlphaBufferSize(8);
- win->setFormat(format);
}
+ win->setFormat(format);
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 9fcd14e813..8e3e2a00b0 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -66,15 +66,6 @@ QT_BEGIN_NAMESPACE
extern QRegion qt_dirtyRegion(QWidget *);
-/*
- A version of QRect::intersects() that does not normalize the rects.
-*/
-static inline bool qRectIntersects(const QRect &r1, const QRect &r2)
-{
- return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right())
- && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
-}
-
/**
* Flushes the contents of the \a backingStore into the screen area of \a widget.
* \a tlwOffset is the position of the top level widget relative to the window surface.
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 112a9b66cd..ea58d45e46 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -86,7 +86,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const
return;
option->initFrom(this);
option->shape = d_func()->shape;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
option->opaque = true;
#else
option->opaque = windowFlags() & RUBBERBAND_WINDOW_TYPE;
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index f3a1e479f2..1b05e049f1 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -44,6 +44,7 @@
#include "qbuffer.h"
#include "qregexp.h"
#include "qmap.h"
+#include "qhash.h"
#include "qstack.h"
#include <qdebug.h>
@@ -424,6 +425,10 @@ private:
int stringValueLen;
QString emptyStr;
+ QHash<QString, int> literalEntitySizes;
+ // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
+ QHash<QString, QHash<QString, int> > referencesToOtherEntities;
+ QHash<QString, int> expandedSizes;
// The limit to the amount of times the DTD parsing functions can be called
// for the DTD currently being parsed.
static const int dtdRecursionLimit = 2;
@@ -3444,6 +3449,10 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
{
Q_D(QXmlSimpleReader);
+ d->literalEntitySizes.clear();
+ d->referencesToOtherEntities.clear();
+ d->expandedSizes.clear();
+
if (incremental) {
d->initIncrementalParsing();
} else {
@@ -6659,43 +6668,63 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq()
bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage)
{
- QMap<QString, int> literalEntitySizes;
- // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
- QMap<QString, QMap<QString, int> > referencesToOtherEntities;
- QMap<QString, int> expandedSizes;
+ QString entityNameBuffer;
// For every entity, check how many times all entity names were referenced in its value.
- foreach (QString toSearch, entities.keys()) {
- // The amount of characters that weren't entity names, but literals, like 'X'.
- QString leftOvers = entities.value(toSearch);
- // How many times was entityName referenced by toSearch?
- foreach (QString entityName, entities.keys()) {
- for (int i = 0; i < leftOvers.size() && i != -1; ) {
- i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i);
- if (i != -1) {
- leftOvers.remove(i, entityName.size() + 2);
- // The entityName we're currently trying to find was matched in this string; increase our count.
- ++referencesToOtherEntities[toSearch][entityName];
+ for (QMap<QString,QString>::const_iterator toSearchIt = entities.constBegin();
+ toSearchIt != entities.constEnd();
+ ++toSearchIt) {
+ const QString &toSearch = toSearchIt.key();
+
+ // Don't check the same entities twice.
+ if (!literalEntitySizes.contains(toSearch)) {
+ // The amount of characters that weren't entity names, but literals, like 'X'.
+ QString leftOvers = entities.value(toSearch);
+ // How many times was entityName referenced by toSearch?
+ for (QMap<QString,QString>::const_iterator referencedIt = entities.constBegin();
+ referencedIt != entities.constEnd();
+ ++referencedIt) {
+ const QString &entityName = referencedIt.key();
+
+ for (int i = 0; i < leftOvers.size() && i != -1; ) {
+ entityNameBuffer = QLatin1Char('&') + entityName + QLatin1Char(';');
+
+ i = leftOvers.indexOf(entityNameBuffer, i);
+ if (i != -1) {
+ leftOvers.remove(i, entityName.size() + 2);
+ // The entityName we're currently trying to find was matched in this string; increase our count.
+ ++referencesToOtherEntities[toSearch][entityName];
+ }
}
}
+ literalEntitySizes[toSearch] = leftOvers.size();
}
- literalEntitySizes[toSearch] = leftOvers.size();
}
- foreach (QString entity, referencesToOtherEntities.keys()) {
- expandedSizes[entity] = literalEntitySizes[entity];
- foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) {
- const int references = referencesToOtherEntities.value(entity).value(referenceTo);
- // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size.
- expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references;
- }
+ for (QHash<QString, QHash<QString, int> >::const_iterator entityIt = referencesToOtherEntities.constBegin();
+ entityIt != referencesToOtherEntities.constEnd();
+ ++entityIt) {
+ const QString &entity = entityIt.key();
+
+ QHash<QString, int>::iterator expandedIt = expandedSizes.find(entity);
+ if (expandedIt == expandedSizes.end()) {
+ expandedIt = expandedSizes.insert(entity, literalEntitySizes.value(entity));
+ for (QHash<QString, int>::const_iterator referenceIt = entityIt->constBegin();
+ referenceIt != entityIt->constEnd();
+ ++referenceIt) {
+ const QString &referenceTo = referenceIt.key();
+ const int references = referencesToOtherEntities.value(entity).value(referenceTo);
+ // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size.
+ *expandedIt += expandedSizes.value(referenceTo) * references + literalEntitySizes.value(referenceTo) * references;
+ }
- if (expandedSizes[entity] > entityCharacterLimit) {
- if (errorMessage) {
- *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3).");
- *errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit);
+ if (*expandedIt > entityCharacterLimit) {
+ if (errorMessage) {
+ *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands to a string that is too large to process (%2 characters > %3).")
+ .arg(entity, *expandedIt, entityCharacterLimit);
+ }
+ return true;
}
- return true;
}
}
return false;
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index 55a2bc7882..529069552b 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -259,14 +259,14 @@ void tst_QPauseAnimation::pauseResume()
animation.pause();
QVERIFY(animation.state() == QAbstractAnimation::Paused);
animation.start();
- QTest::qWait(300);
- QVERIFY(animation.state() == QAbstractAnimation::Stopped);
+ QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped);
#ifdef Q_OS_WIN
if (animation.m_updateCurrentTimeCount != 3)
QEXPECT_FAIL("", winTimerError, Abort);
#endif
- QCOMPARE(animation.m_updateCurrentTimeCount, 3);
+ QVERIFY2(animation.m_updateCurrentTimeCount >= 3, qPrintable(
+ QString::fromLatin1("animation.m_updateCurrentTimeCount = %1").arg(animation.m_updateCurrentTimeCount)));
}
void tst_QPauseAnimation::sequentialPauseGroup()
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 7d51696fe3..0e7ac54a86 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -64,6 +64,7 @@ public:
static QString str( int y, int month, int d, int h, int min, int s );
static QDateTime dt( const QString& str );
public slots:
+ void initTestCase();
void init();
private slots:
void ctor();
@@ -153,6 +154,7 @@ private slots:
void invalid() const;
private:
+ enum { LocalTimeIsUtc = 0, LocalTimeAheadOfUtc = 1, LocalTimeBehindUtc = -1} localTimeType;
bool europeanTimeZone;
QDate defDate() const { return QDate(1900, 1, 1); }
QTime defTime() const { return QTime(0, 0, 0); }
@@ -172,6 +174,42 @@ tst_QDateTime::tst_QDateTime()
uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
+
+ QDateTime dt1 = QDateTime::fromTime_t(0);
+ QDateTime dt2 = QDateTime::fromTime_t(181 * 86400); // six months later, Jul 1
+ if (dt1.date().year() < 1970 || dt2.date().month() < 7) {
+ localTimeType = LocalTimeBehindUtc;
+ } else if (dt1.time().hour() > 0 || dt1.date().day() > 1) {
+ localTimeType = LocalTimeAheadOfUtc;
+ } else if (dt2.time().hour() > 0 || dt2.date().day() > 1) {
+ localTimeType = LocalTimeAheadOfUtc;
+ } else {
+ localTimeType = LocalTimeIsUtc;
+ }
+}
+
+void tst_QDateTime::initTestCase()
+{
+ // Never construct a message like this in an i18n context...
+ const char *typemsg1, *typemsg2 = "and therefore not";
+ switch (localTimeType) {
+ case LocalTimeIsUtc:
+ typemsg1 = "exactly";
+ break;
+ case LocalTimeBehindUtc:
+ typemsg1 = "behind";
+ break;
+ case LocalTimeAheadOfUtc:
+ typemsg1 = "ahead of";
+ typemsg2 = europeanTimeZone ? "and is" : "but isn't";
+ break;
+ }
+
+ qDebug() << "Current local time detected to be"
+ << typemsg1
+ << "UTC"
+ << typemsg2
+ << "the Central European timezone";
}
void tst_QDateTime::init()
@@ -613,8 +651,10 @@ void tst_QDateTime::fromMSecsSinceEpoch()
QDateTime dtUtc = QDateTime::fromMSecsSinceEpoch(msecs, Qt::UTC);
QDateTime dtOffset = QDateTime::fromMSecsSinceEpoch(msecs, Qt::OffsetFromUTC, 60*60);
- // LocalTime will overflow for max
- if (msecs != std::numeric_limits<qint64>::max())
+ // LocalTime will overflow for min or max, depending on whether you're
+ // East or West of Greenwich. The test passes at GMT.
+ if (localTimeType == LocalTimeIsUtc
+ || msecs != std::numeric_limits<qint64>::max() * localTimeType)
QCOMPARE(dtLocal, utc);
QCOMPARE(dtUtc, utc);
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 19fcb6ea9f..bd7bd3a464 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -606,11 +606,6 @@ void tst_QKeySequence::parseString()
QFETCH( QString, strSequence );
QFETCH( QKeySequence, keycode );
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("Win+A", "QTBUG-24406 - This test fails on OSX", Abort);
- QEXPECT_FAIL("Simon+G", "QTBUG-24406 - This test fails on OSX", Abort);
-#endif
-
QCOMPARE( QKeySequence(strSequence).toString(), keycode.toString() );
QVERIFY( QKeySequence(strSequence) == keycode );
}
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 38c92c7610..1ec1d88802 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -1380,12 +1380,13 @@ void tst_QGL::glWidgetRenderPixmap()
{
RenderPixmapWidget *w = new RenderPixmapWidget;
- QPixmap pm = w->renderPixmap(100, 100, false);
+ QSize pmSize = QSize(100, 100);
+ QPixmap pm = w->renderPixmap(pmSize.width(), pmSize.height(), false);
delete w;
QImage fb = pm.toImage().convertToFormat(QImage::Format_RGB32);
- QImage reference(fb.size(), QImage::Format_RGB32);
+ QImage reference(pmSize, QImage::Format_RGB32);
reference.fill(0xffff0000);
QFUZZY_COMPARE_IMAGES(fb, reference);
@@ -2011,6 +2012,7 @@ void tst_QGL::textureCleanup()
QGLWidget w;
w.resize(200,200);
w.show();
+ QTest::qWaitForWindowExposed(&w);
w.makeCurrent();
// Test pixmaps which have been loaded via QPixmapCache are removed from the texture cache
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 9e181c0676..f7dff7bc57 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -1019,10 +1019,6 @@ private:
void tst_QMenu::QTBUG_10735_crashWithDialog()
{
-#ifdef Q_OS_MAC
- QSKIP("Test currently hangs on Mac OS X, see QTBUG-23677");
-#endif
-
MyMenu menu;
QTimer::singleShot(1000, &menu, SLOT(activateLastAction()));
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 75c826c4cc..d336d00b3e 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -566,7 +566,7 @@ void tst_QPushButton::sizeHint_data()
QTest::newRow("gtk") << QString::fromLatin1("gtk");
#endif
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- QTest::newRow("mac") << QString::fromLatin1("mac");
+ QTest::newRow("macintosh") << QString::fromLatin1("macintosh");
#endif
#if !defined(QT_NO_STYLE_FUSION)
QTest::newRow("fusion") << QString::fromLatin1("fusion");
@@ -589,11 +589,6 @@ void tst_QPushButton::sizeHint()
{
QFETCH(QString, stylename);
-#ifdef Q_OS_MAC
- if (stylename == "mac")
- QSKIP("QStyleFactory cannot create the Mac style, see QTBUG-23680");
-#endif
-
QStyle *style = QStyleFactory::create(stylename);
if (!style)
QFAIL(qPrintable(QString::fromLatin1("Cannot create style: %1").arg(stylename)));