summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-29 12:58:32 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-29 12:58:41 +0200
commite66d181e659a08d19ab7d144c3ba0619d537de83 (patch)
tree7367e93797cb9a2a331f0741baed5a1cad2c96b6
parent4758555f3e44af3425f0b691dc38fb40f3c9413d (diff)
parent75aea3ff5eec4a5c8f4184e14a90f4a5e3a577b0 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
-rwxr-xr-xbin/syncqt.pl8
-rw-r--r--dist/changes-5.6.247
-rw-r--r--doc/global/macros.qdocconf1
-rw-r--r--mkspecs/features/qt_functions.prf6
-rw-r--r--mkspecs/features/qt_module.prf2
-rw-r--r--mkspecs/features/uikit/xcodebuild.mk8
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp48
-rw-r--r--src/corelib/global/qlogging.cpp1
-rw-r--r--src/corelib/io/qdiriterator.cpp1
-rw-r--r--src/corelib/kernel/qdeadlinetimer.cpp88
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp10
-rw-r--r--src/dbus/qdbusxmlparser.cpp11
-rw-r--r--src/dbus/qdbusxmlparser_p.h3
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qguiapplication.cpp6
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp14
-rw-r--r--src/gui/painting/qbackingstore.cpp1
-rw-r--r--src/gui/painting/qdrawhelper.cpp7
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp19
-rw-r--r--src/gui/painting/qplatformbackingstore.h4
-rw-r--r--src/gui/text/qrawfont.cpp16
-rw-r--r--src/network/doc/src/ssl.qdoc6
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp3
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qeglstreamconvenience_p.h4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp8
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm18
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm27
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp19
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h3
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp14
-rw-r--r--src/sql/configure.json1
-rw-r--r--src/tools/moc/moc.cpp38
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/widgets/kernel/qapplication.cpp16
-rw-r--r--src/widgets/kernel/qlayout.cpp7
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp12
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp24
-rw-r--r--src/widgets/kernel/qtooltip.cpp1
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/kernel/qwidget_p.h1
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp76
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp63
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp26
-rw-r--r--tests/auto/tools/moc/namespace.h72
-rw-r--r--tests/auto/tools/moc/namespace_no_merge.h74
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp13
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp25
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp8
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp10
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp8
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp76
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp7
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp6
68 files changed, 799 insertions, 257 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 0435aead0a..8a49da3891 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -234,7 +234,7 @@ sub classNames {
}
if($line) {
$line =~ s,//.*$,,; #remove c++ comments
- $line .= ";" if($line =~ m/^Q_[A-Z_]*\(.*\)[\r\n]*$/); #qt macro
+ $line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
@@ -366,7 +366,7 @@ sub check_header {
$include = 0;
}
if ($include && $public_header) {
- print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/);
+ print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p\.h$/);
for my $trylib (keys(%modules)) {
if (-e "$out_basedir/include/$trylib/$include") {
print STDERR "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n";
@@ -1012,7 +1012,7 @@ foreach my $lib (@modules_to_sync) {
my $header_dirname = "";
foreach my $header (@headers) {
my $shadow = ($header =~ s/^\*//);
- $header = 0 if($header =~ /^ui_.*.h/);
+ $header = 0 if ($header =~ /^ui_.*\.h$/);
foreach (@ignore_headers) {
$header = 0 if($header eq $_);
}
@@ -1024,7 +1024,7 @@ foreach my $lib (@modules_to_sync) {
if(isQpaHeader($public_header)) {
$public_header = 0;
$qpa_header = 1;
- } elsif($allheadersprivate || $thisprivate || $public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
+ } elsif ($allheadersprivate || $thisprivate || $public_header =~ /_p(ch)?\.h$/) {
$public_header = 0;
} else {
foreach (@ignore_for_master_contents) {
diff --git a/dist/changes-5.6.2 b/dist/changes-5.6.2
index 7b62a018f3..af02f2a6b9 100644
--- a/dist/changes-5.6.2
+++ b/dist/changes-5.6.2
@@ -41,6 +41,11 @@ information about a particular change.
* Library *
******************************************************************************
+General
+-------
+
+ - [QTBUG-45291] Qt headers are now gcc -Wzero-as-null-pointer-constant clean.
+
QtCore
------
@@ -335,5 +340,47 @@ Windows
moc
---
+
- [QTBUG-53441] Fixed crash on file ending with a backslash followed by
carriage return
+
+configure & build system
+------------------------
+
+ - [QTBUG-35886][QTBUG-51417] Fixed Fontconfig vs. system FreeType
+ configuration.
+ - [QTBUG-43784][X11] Fixed detection of GLX with -qt-xcb.
+ - [QTBUG-52951] Fixed dynamic library support detection for platforms
+ without libdl.
+ - [QTBUG-53038] Fixed running of configure tests outside qtbase when
+ cross compiling on Windows (for example for Android).
+ - [QTBUG-53312] The flags supplied by the configure -D/-I/-L/-l options
+ are now applied after Qt's own flags. This helps in some cases when
+ the provided paths contain files which conflict with the Qt build.
+ - [QTBUG-55011][Unix] Fixed -no-pkg-config being ignored by some
+ configure tests, which led to build failures later on.
+ - Fixed configure tests outside qtbase when $MAKEFLAGS contains the
+ -i flag.
+ - [Android] Some unused plugins are not built anymore.
+ - [MinGW] Added support for -separate-debug-info.
+ - [Unix] Added configure -no-opengles3 option.
+ - [Unix] Fixed MySQL detection/use on RHEL 6.6.
+
+qmake
+-----
+
+ - [QTBUG-41830] Fixed nested custom functions inheriting their callers'
+ arguments.
+ - [QTBUG-53895][MSVC] Started using separate PDB files for compiling
+ and linking.
+ - [QTBUG-54036][Darwin] Fixed installation of debug symbols.
+ - [QTBUG-54550] Fixed access to freed memory in $$absolute_path().
+ - [QTBUG-55183][nmake] _WINDLL is now automatically defined when building
+ a DLL, consistently with Visual Studio.
+ - [QTBUG-55649][QTBUG-55915][Xcode] Fixed support for Xcode 8.
+ - Fixed several cases where the error() function would not abort qmake.
+ - Interrupting a command run via system() will now abort qmake as well.
+ - The packagesExist() function will now warn when used when Qt was
+ configured with -no-pkg-config.
+ - [Android] The default compiler flags were adjusted to match newer
+ NDK versions.
diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf
index da583aedcd..1182af14e9 100644
--- a/doc/global/macros.qdocconf
+++ b/doc/global/macros.qdocconf
@@ -31,6 +31,7 @@ macro.mdash.HTML = "&mdash;"
macro.pi.HTML = "&Pi;"
macro.beginqdoc.HTML = "/*!"
macro.endqdoc.HTML = "*/"
+macro.borderedimage = "\\div {class=\"border\"} \\image \1\n\\enddiv"
macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">"
macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">"
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index b1cfcd7499..0f43af10ed 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -185,8 +185,10 @@ defineTest(qtAddTargetEnv) {
deps = $$replace($$2, -private$, _private)
deps = $$resolve_depends(deps, "QT.", ".depends" ".run_depends")
!isEmpty(deps) {
+ libs = libs
deppath.CONFIG = prepend
equals(QMAKE_HOST.os, Windows) {
+ libs = bins
deppath.CONFIG = always_prepend
deppath.name = PATH
} else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) {
@@ -206,9 +208,9 @@ defineTest(qtAddTargetEnv) {
ptypes =
for(dep, deps) {
isEmpty(3): \
- deppath += $$shell_path($$eval(QT.$${dep}.libs))
+ deppath += $$shell_path($$eval(QT.$${dep}.$$libs))
else: \
- deppath += $$system_path($$eval(QT.$${dep}.libs))
+ deppath += $$system_path($$eval(QT.$${dep}.$$libs))
ptypes += $$eval(QT.$${dep}.plugin_types)
}
deppath.value = $$unique(deppath)
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index ed02c597da..168cc47f93 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -74,7 +74,7 @@ header_module {
TEMPLATE = lib
}
DESTDIR = $$MODULE_BASE_OUTDIR/lib
-win32:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
+DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
CONFIG += qmake_cache target_qt
diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk
index 57011eaf01..0b3ad632b6 100644
--- a/mkspecs/features/uikit/xcodebuild.mk
+++ b/mkspecs/features/uikit/xcodebuild.mk
@@ -77,6 +77,12 @@ GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.pl '$(EXPORT
%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION))
%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION))
+XCODE_VERSION_MAJOR := $(shell xcodebuild -version | grep Xcode | sed -e 's/Xcode //' | sed -e 's/\..*//')
+
+ifeq ($(shell test $(XCODE_VERSION_MAJOR) -gt 7; echo $$?),0)
+ XCODEBUILD_FLAGS += $(shell echo "$(MAKEFLAGS)" | sed -e 's/\([^ ]*\).*/\1/' | grep -qv 's' || echo -quiet)
+endif
+
# Xcodebuild
DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
@@ -84,7 +90,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
xcodebuild-%:
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
- xcodebuild $(ACTION) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
+ xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index c0f968e335..e602734155 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -491,6 +491,32 @@ static QString xcodeFiletypeForFilename(const QString &filename)
return QString();
}
+static bool compareProvisioningTeams(const QVariantMap &a, const QVariantMap &b)
+{
+ int aFree = a.value(QLatin1String("isFreeProvisioningTeam")).toBool() ? 1 : 0;
+ int bFree = b.value(QLatin1String("isFreeProvisioningTeam")).toBool() ? 1 : 0;
+ return aFree < bFree;
+}
+
+static QList<QVariantMap> provisioningTeams()
+{
+ const QSettings xcodeSettings(
+ QDir::homePath() + QLatin1String("/Library/Preferences/com.apple.dt.Xcode.plist"),
+ QSettings::NativeFormat);
+ const QVariantMap teamMap = xcodeSettings.value(QLatin1String("IDEProvisioningTeams")).toMap();
+ QList<QVariantMap> flatTeams;
+ for (QVariantMap::const_iterator it = teamMap.begin(), end = teamMap.end(); it != end; ++it) {
+ const QString emailAddress = it.key();
+ QVariantMap team = it.value().toMap();
+ team[QLatin1String("emailAddress")] = emailAddress;
+ flatTeams.append(team);
+ }
+
+ // Sort teams so that Free Provisioning teams come last
+ std::sort(flatTeams.begin(), flatTeams.end(), ::compareProvisioningTeams);
+ return flatTeams;
+}
+
bool
ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
{
@@ -1451,25 +1477,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QMap<QString, QString> settings;
if (!project->isActiveConfig("no_xcode_development_team")) {
- const QSettings xcodeSettings(
- QDir::homePath() + QLatin1String("/Library/Preferences/com.apple.dt.Xcode.plist"),
- QSettings::NativeFormat);
- const QVariantMap teams = xcodeSettings.value(QLatin1String("IDEProvisioningTeams")).toMap();
+ const QList<QVariantMap> teams = provisioningTeams();
if (!teams.isEmpty()) {
- for (QVariantMap::const_iterator it = teams.begin(), end = teams.end(); it != end; ++it) {
- const QVariantMap team = it.value().toMap();
- const QString teamType = team.value(QLatin1String("teamType")).toString();
-
- // Skip Company teams because signing permissions may not be available under all
- // circumstances for users who are not the Team Agent
- if (teamType != QLatin1String("Company")) {
- const QString teamId = team.value(QLatin1String("teamID")).toString();
- settings.insert("DEVELOPMENT_TEAM", teamId);
-
- // first suitable team we found is the one we'll use by default
- break;
- }
- }
+ // first suitable team we find is the one we'll use by default
+ settings.insert("DEVELOPMENT_TEAM",
+ teams.first().value(QLatin1String("teamID")).toString());
}
}
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 6c7cd9c5c6..0ca6829564 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1138,6 +1138,7 @@ void QMessagePattern::setPattern(const QString &pattern)
backtraceArgs.append(backtraceParams);
#else
error += QLatin1String("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n");
+ tokens[i] = "";
#endif
}
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index a6394c16cc..5fd9edc552 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -254,6 +254,7 @@ void QDirIteratorPrivate::advance()
if (entryMatches(nextEntry.fileName(), info))
return;
+ nextMetaData = QFileSystemMetaData();
}
nativeIterators.pop();
diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp
index 957d985c31..17a74b22d7 100644
--- a/src/corelib/kernel/qdeadlinetimer.cpp
+++ b/src/corelib/kernel/qdeadlinetimer.cpp
@@ -87,8 +87,8 @@ Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64
other Qt functions named \c{waitFor} or similar:
\list
- \o 0: no time left, expired
- \o -1: infinite time left, timer never expires
+ \li 0: no time left, expired
+ \li -1: infinite time left, timer never expires
\endlist
\section1 Reference Clocks
@@ -169,20 +169,20 @@ Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64
cannot be used in calculation of how long it is overdue. If that
functionality is required, use QDeadlineTimer::current().
- \sa hasExpired(), remainingTime(), timerType(), current()
+ \sa hasExpired(), remainingTime(), Qt::TimerType, current()
*/
/*!
\fn QDeadlineTimer::QDeadlineTimer(ForeverConstant, Qt::TimerType timerType)
- Constructs a QDeadlineTimer object that never expires. For this object,
- remainingTime() will return -1, deadline() will return the maximum value,
- and isForever() will return true.
+ QDeadlineTimer objects created with parameter \a ForeverConstant never expire.
+ For such objects, remainingTime() will return -1, deadline() will return the
+ maximum value, and isForever() will return true.
The timer type \a timerType may be ignored, since the timer is already
expired.
- \sa hasExpired(), isForever(), remainingTime(), timerType()
+ \sa ForeverConstant, hasExpired(), isForever(), remainingTime(), timerType()
*/
/*!
@@ -194,8 +194,7 @@ Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64
never expire, causing remainingTime() to return -1 and deadline() to return
the maximum value.
- The QDeadlineTimer object will be constructed with a timer type of \a
- timerType.
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
For optimization purposes, if \a msecs is zero, this function may skip
obtaining the current time and may instead use a value known to be in the
@@ -223,10 +222,9 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
object is set to never expire.
- The QDeadlineTimer object will be constructed with a timer type of \a
- timerType.
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
- \sa hasExpired(), isForever(), remainingTime<Duration>(), setDeadline()
+ \sa hasExpired(), isForever(), remainingTime(), setDeadline()
*/
/*!
@@ -237,8 +235,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
mark as expired, whereas if \a remaining is equal to \c{duration::max()},
the object will be set to never expire.
- The QDeadlineTimer object will be constructed with a timer type of \a
- timerType.
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
This constructor can be used with C++14's user-defined literals for time, such as in:
@@ -254,7 +251,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
it is overdue. If that functionality is required, use
QDeadlineTimer::current() and add time to it.
- \sa hasExpired(), isForever(), remainingTime<Duration>(), setRemainingTime()
+ \sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
*/
/*!
@@ -268,9 +265,9 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
object is set to never expire.
- The timer type for this QDeadlineTimer object will be set to \a timerType type.
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
- \sa hasExpired(), isForever(), remainingTime<Duration>(),
+ \sa hasExpired(), isForever(), remainingTime(),
*/
/*!
@@ -279,7 +276,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
zero, this QDeadlineTimer object will be marked as expired, whereas a value
of -1 will set it to never expire.
- The timer type for this QDeadlineTimer object will be set to \a timerType type.
+ The timer type for this QDeadlineTimer object will be set to the specified \a timerType.
\sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime()
*/
@@ -297,7 +294,8 @@ void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_D
secs is -1, this QDeadlineTimer will be set it to never expire. If both
parameters are zero, this QDeadlineTimer will be marked as expired.
- The timer type for this QDeadlineTimer object will be set to \a timerType type.
+ The timer type for this QDeadlineTimer object will be set to the specified
+ \a type.
\sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
*/
@@ -330,7 +328,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
as expired, whereas if \a remaining is equal to \c{duration::max()}, the
object will be set to never expire.
- The timer type for this QDeadlineTimer object will be set to \a timerType type.
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
This function can be used with C++14's user-defined literals for time, such as in:
@@ -339,7 +337,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
deadline.setRemainingTime(250ms);
\endcode
- \sa setDeadline(), remainingTime<Duration>(), hasExpired(), isForever()
+ \sa setDeadline(), remainingTime(), hasExpired(), isForever()
*/
/*!
@@ -353,7 +351,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
If value of \a nsecs is more than 1 billion nanoseconds (1 second), this
function will adjust \a secs accordingly.
- The timer type for this QDeadlineTimer object will be set to \a timerType type.
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
\sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
*/
@@ -422,7 +420,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
remains time left. For objects that have expired, remainingTime() will
return zero and deadline() will return a time point in the past.
- QDeadlineTimer objects created with the \ref{ForeverConstant} never expire
+ QDeadlineTimer objects created with the \l {ForeverConstant} never expire
and this function always returns false for them.
\sa isForever(), remainingTime()
@@ -435,7 +433,7 @@ bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
}
/*!
- \fn Qt::TimerType QDeadlineTimer::timerType() const Q_DECL_NOTHROW
+ \fn Qt::TimerType QDeadlineTimer::timerType() const
Returns the timer type is active for this object.
@@ -451,7 +449,7 @@ bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
will try to use a more coarse timer for Qt::CoarseTimer and
Qt::VeryCoarseTimer.
- \sa timerType()
+ \sa Qt::TimerType
*/
void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
{
@@ -466,13 +464,13 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
returns -1.
This function is suitable for use in Qt APIs that take a millisecond
- timeout, such as the many \ref QIODevice \c waitFor functions or the timed
- lock functions in \ref QMutex, \ref QWaitCondition, \ref QSemaphore, or
- \ref QReadWriteLock. For example:
+ timeout, such as the many \l QIODevice \c waitFor functions or the timed
+ lock functions in \l QMutex, \l QWaitCondition, \l QSemaphore, or
+ \l QReadWriteLock. For example:
\code
mutex.tryLock(deadline.remainingTime());
- \code
+ \endcode
\sa remainingTimeNSecs(), isForever(), hasExpired()
*/
@@ -658,24 +656,12 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
current time. Objects created by this function can participate in the
calculation of how long a timer is overdue, using the deadline() function.
- The QDeadlineTimer object will be constructed with a timer type of \a
- timerType.
-*/
-
-/*!
- \fn qint64 QDeadlineTimer::resolution(Qt::TimerType timerType)
-
- Returns the resolution in nanoseconds of the system clock that backs timers
- of type \a timerType, or 0 if the resolution could not be determined.
-
- The resolution is not a guarantee that applications will get time values
- with an accuracy down to that level. It is only the minimum change value
- that can be expected.
+ The QDeadlineTimer object will be constructed with the specified \a timerType.
*/
/*!
\fn bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 and the deadline in \a d2 are the
same, false otherwise. The timer type used to create the two deadlines is
@@ -691,7 +677,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 and the deadline in \a d2 are
diferent, false otherwise. The timer type used to create the two deadlines
@@ -707,7 +693,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 is earlier than the deadline in \a
d2, false otherwise. The timer type used to create the two deadlines is
@@ -723,7 +709,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 is earlier than or the same as the
deadline in \a d2, false otherwise. The timer type used to create the two
@@ -739,7 +725,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 is later than the deadline in \a
d2, false otherwise. The timer type used to create the two deadlines is
@@ -755,7 +741,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns true if the deadline on \a d1 is later than or the same as the
deadline in \a d2, false otherwise. The timer type used to create the two
@@ -771,7 +757,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns a QDeadlineTimer object whose deadline is \a msecs later than the
deadline stored in \a dt. If \a dt is set to never expire, this function
@@ -782,7 +768,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns a QDeadlineTimer object whose deadline is \a msecs later than the
deadline stored in \a dt. If \a dt is set to never expire, this function
@@ -793,7 +779,7 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_
/*!
\fn QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs)
- \related QDeadlineTimer
+ \relates QDeadlineTimer
Returns a QDeadlineTimer object whose deadline is \a msecs before the
deadline stored in \a dt. If \a dt is set to never expire, this function
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index a798d9eff6..e9996c204d 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -536,11 +536,11 @@ void QMimeBinaryProvider::loadMimeTypeList()
for (const QString &typeFilename : typesFilenames) {
QFile file(typeFilename);
if (file.open(QIODevice::ReadOnly)) {
- while (!file.atEnd()) {
- QByteArray line = file.readLine();
- line.chop(1);
- m_mimetypeNames.insert(QString::fromLatin1(line.constData(), line.size()));
- }
+ QTextStream stream(&file);
+ stream.setCodec("ISO 8859-1");
+ QString line;
+ while (stream.readLineInto(&line))
+ m_mimetypeNames.insert(line);
}
}
}
diff --git a/src/dbus/qdbusxmlparser.cpp b/src/dbus/qdbusxmlparser.cpp
index fa362bc579..3618c76a1d 100644
--- a/src/dbus/qdbusxmlparser.cpp
+++ b/src/dbus/qdbusxmlparser.cpp
@@ -48,15 +48,12 @@
#ifndef QT_NO_DBUS
-//#define QDBUS_PARSER_DEBUG
-#ifdef QDBUS_PARSER_DEBUG
-# define qDBusParserError qDebug
-#else
-# define qDBusParserError if (true) {} else qDebug
-#endif
-
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(dbusParser, "dbus.parser", QtWarningMsg)
+
+#define qDBusParserError(...) qCDebug(dbusParser, ##__VA_ARGS__)
+
static bool parseArg(const QXmlStreamAttributes &attributes, QDBusIntrospection::Argument &argData,
QDBusIntrospection::Interface *ifaceData)
{
diff --git a/src/dbus/qdbusxmlparser_p.h b/src/dbus/qdbusxmlparser_p.h
index 7db2d12df4..d089bae163 100644
--- a/src/dbus/qdbusxmlparser_p.h
+++ b/src/dbus/qdbusxmlparser_p.h
@@ -52,6 +52,7 @@
//
#include <QtDBus/private/qtdbusglobal_p.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qmap.h>
#include "qdbusintrospection_p.h"
@@ -59,6 +60,8 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(dbusParser)
+
/*!
\internal
*/
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index ec6c0bcc36..21127eebbd 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -438,6 +438,10 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
The text(), image(), and pixmap() functions are simpler
wrappers for retrieving text, image, and pixmap data.
+ \note The pointer returned might become invalidated when the contents
+ of the clipboard changes; either by calling one of the setter functions
+ or externally by the system clipboard changing.
+
\sa setMimeData()
*/
const QMimeData* QClipboard::mimeData(Mode mode) const
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 16add8f627..d8457bc041 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1203,12 +1203,6 @@ static void init_plugins(const QList<QByteArray> &pluginList)
void QGuiApplicationPrivate::createPlatformIntegration()
{
- // Use the Qt menus by default. Platform plugins that
- // want to enable a native menu implementation can clear
- // this flag.
- QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
-
-
QHighDpiScaling::initHighDpiScaling();
// Load the platform integration
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 23e783fcb4..edb65a2d4c 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2395,7 +2395,7 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
bool lastWindowClosed = true;
for (int i = 0; i < list.size(); ++i) {
QWindow *w = list.at(i);
- if (!w->isVisible() || w->transientParent())
+ if (!w->isVisible() || w->transientParent() || w->type() == Qt::ToolTip)
continue;
lastWindowClosed = false;
break;
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index c0c0bb0a03..6f5aff14aa 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -584,16 +584,26 @@ bool QOpenGLShader::compileSourceCode(const char *source)
QVarLengthArray<const char *, 5> sourceChunks;
QVarLengthArray<GLint, 5> sourceChunkLengths;
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (versionDirectivePosition.hasPosition()) {
- // Append source up to #version directive
+ // Append source up to and including the #version directive
sourceChunks.append(source);
sourceChunkLengths.append(GLint(versionDirectivePosition.position));
+ } else {
+ // QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always
+ if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) {
+ const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR));
+ if (vendor && !strcmp(vendor, "Intel")) {
+ static const char version110[] = "#version 110\n";
+ sourceChunks.append(version110);
+ sourceChunkLengths.append(GLint(sizeof(version110)) - 1);
+ }
+ }
}
// The precision qualifiers are useful on OpenGL/ES systems,
// but usually not present on desktop systems.
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
const QSurfaceFormat currentSurfaceFormat = ctx->format();
QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index e3d18512dd..ceaad61e13 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -138,6 +138,7 @@ QBackingStore::QBackingStore(QWindow *window)
: d_ptr(new QBackingStorePrivate(window))
{
d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window);
+ d_ptr->platformBackingStore->setBackingStore(this);
}
/*!
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 7685f7f4ca..3e01d34cb2 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5331,15 +5331,16 @@ static void qt_gradient_quint16(int count, const QSpan *spans, void *userData)
int yinc = int((linear.dy * data->m22 * gss) * FIXPT_SIZE);
int off = int((((linear.dy * (data->m22 * qreal(0.5) + data->dy) + linear.off) * gss) * FIXPT_SIZE));
- QRgba64 oldColor = data->solid.color;
+ // Save the fillData since we overwrite it when setting solid.color.
+ QGradientData gradient = data->gradient;
while (count--) {
int y = spans->y;
- data->solid.color = QRgba64::fromArgb32(qt_gradient_pixel_fixed(&data->gradient, yinc * y + off));
+ data->solid.color = QRgba64::fromArgb32(qt_gradient_pixel_fixed(&gradient, yinc * y + off));
blend_color_rgb16(1, spans, userData);
++spans;
}
- data->solid.color = oldColor;
+ data->gradient = gradient;
} else {
blend_src_generic(count, spans, userData);
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 0c5de36981..b8bbdefa37 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -77,6 +77,7 @@ class QPlatformBackingStorePrivate
public:
QPlatformBackingStorePrivate(QWindow *w)
: window(w)
+ , backingStore(0)
#ifndef QT_NO_OPENGL
, textureId(0)
, blitter(0)
@@ -100,6 +101,7 @@ public:
#endif
}
QWindow *window;
+ QBackingStore *backingStore;
#ifndef QT_NO_OPENGL
mutable GLuint textureId;
mutable QSize textureSize;
@@ -623,6 +625,23 @@ QWindow* QPlatformBackingStore::window() const
}
/*!
+ Sets the backing store associated with this surface.
+*/
+void QPlatformBackingStore::setBackingStore(QBackingStore *backingStore)
+{
+ d_ptr->backingStore = backingStore;
+}
+
+/*!
+ Returns a pointer to the backing store associated with this
+ surface.
+*/
+QBackingStore *QPlatformBackingStore::backingStore() const
+{
+ return d_ptr->backingStore;
+}
+
+/*!
This function is called before painting onto the surface begins,
with the \a region in which the painting will occur.
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 8d0e29ad8d..ec56aaa002 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -112,6 +112,7 @@ public:
virtual ~QPlatformBackingStore();
QWindow *window() const;
+ QBackingStore *backingStore() const;
virtual QPaintDevice *paintDevice() = 0;
@@ -145,6 +146,9 @@ public:
private:
QPlatformBackingStorePrivate *d_ptr;
+
+ void setBackingStore(QBackingStore *);
+ friend class QBackingStore;
};
#ifndef QT_NO_OPENGL
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 4d567b26c2..886cf5ef39 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -324,6 +324,13 @@ bool QRawFont::operator==(const QRawFont &other) const
/*!
Returns the ascent of this QRawFont in pixel units.
+ The ascent of a font is the distance from the baseline to the
+ highest position characters extend to. In practice, some font
+ designers break this rule, e.g. when they put more than one accent
+ on top of a character, or to accommodate an unusual character in
+ an exotic language, so it is possible (though rare) that this
+ value will be too small.
+
\sa QFontMetricsF::ascent()
*/
qreal QRawFont::ascent() const
@@ -351,6 +358,11 @@ qreal QRawFont::capHeight() const
/*!
Returns the descent of this QRawFont in pixel units.
+ The descent is the distance from the base line to the lowest point
+ characters extend to. In practice, some font designers break this rule,
+ e.g. to accommodate an unusual character in an exotic language, so
+ it is possible (though rare) that this value will be too small.
+
\sa QFontMetricsF::descent()
*/
qreal QRawFont::descent() const
@@ -361,6 +373,8 @@ qreal QRawFont::descent() const
/*!
Returns the xHeight of this QRawFont in pixel units.
+ This is often but not always the same as the height of the character 'x'.
+
\sa QFontMetricsF::xHeight()
*/
qreal QRawFont::xHeight() const
@@ -371,6 +385,8 @@ qreal QRawFont::xHeight() const
/*!
Returns the leading of this QRawFont in pixel units.
+ This is the natural inter-line spacing.
+
\sa QFontMetricsF::leading()
*/
qreal QRawFont::leading() const
diff --git a/src/network/doc/src/ssl.qdoc b/src/network/doc/src/ssl.qdoc
index 0129673ea2..5ad2cfafc6 100644
--- a/src/network/doc/src/ssl.qdoc
+++ b/src/network/doc/src/ssl.qdoc
@@ -36,10 +36,12 @@
the Secure Sockets Layer (SSL) protocol, using the OpenSSL Toolkit (\l{http://www.openssl.org/})
to perform encryption and protocol handling.
+ From Qt version 5.2 onwards, the officially supported version for OpenSSL
+ is 1.0.0 or later. Versions >= 0.9.7 and < 1.0.0 might work, but are not
+ guaranteed to work.
+
\annotatedlist ssl
- See the \l {openssl-v1later}{OpenSSL Compatibility} page for information about the
- versions of OpenSSL that are known to work with Qt.
\section1 Enabling and Disabling SSL Support
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 2fa98c0e07..4f4615d4d0 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -404,6 +404,9 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
if (seenIndexes.contains(ifindex))
continue;
+ seenInterfaces.insert(name);
+ seenIndexes.append(ifindex);
+
QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
interfaces << iface;
iface->name = name;
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 4c06404415..0548aa3909 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -505,7 +505,7 @@ void QSslSocketBackendPrivate::transmit()
if (connectionEncrypted) {
QVarLengthArray<char, 4096> data;
- while (context) {
+ while (context && (!readBufferMaxSize || buffer.size() < readBufferMaxSize)) {
size_t readBytes = 0;
data.resize(4096);
const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes);
diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
index f535afbc55..a4c8245280 100644
--- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
@@ -140,6 +140,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay
#define EGL_DRM_PLANE_EXT 0x3235
#endif
+#ifndef EGL_PLATFORM_X11_KHR
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#endif
+
QT_BEGIN_NAMESPACE
class QEGLStreamConvenience
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 5847c601a8..d92b87c6da 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -362,6 +362,12 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
return stylehint;
}
+static inline bool requiresOpenType(int writingSystem)
+{
+ return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala)
+ || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko);
+}
+
static void populateFromPattern(FcPattern *pattern)
{
QString familyName;
@@ -430,7 +436,7 @@ static void populateFromPattern(FcPattern *pattern)
FcLangResult langRes = FcLangSetHasLang(langset, lang);
if (langRes != FcLangDifferentLang) {
#if FC_VERSION >= 20297
- if (capabilityForWritingSystem[j] != Q_NULLPTR) {
+ if (capabilityForWritingSystem[j] != Q_NULLPTR && requiresOpenType(j)) {
if (cap == Q_NULLPTR)
capRes = FcPatternGetString(pattern, FC_CAPABILITY, 0, &cap);
if (capRes == FcResultMatch && strstr(reinterpret_cast<const char *>(cap), capabilityForWritingSystem[j]) == 0)
diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp
index 325c98b93d..ef26edc494 100644
--- a/src/platformsupport/graphics/qrasterbackingstore.cpp
+++ b/src/platformsupport/graphics/qrasterbackingstore.cpp
@@ -39,6 +39,7 @@
#include "qrasterbackingstore_p.h"
+#include <QtGui/qbackingstore.h>
#include <QtGui/qpainter.h>
QT_BEGIN_NAMESPACE
@@ -104,6 +105,10 @@ bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
void QRasterBackingStore::beginPaint(const QRegion &region)
{
+ // Keep backing store device pixel ratio in sync with window
+ if (m_image.devicePixelRatio() != window()->devicePixelRatio())
+ resize(backingStore()->size(), backingStore()->staticContents());
+
if (!m_image.hasAlphaChannel())
return;
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index b9009fe704..c4387c5d88 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -368,9 +368,6 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an
// default in case the style has not set a font
m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
-
- // by default use native menu bar
- QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false);
}
QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index f3f720654e..92fffb4d15 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -301,8 +301,6 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
initResources();
QMacAutoReleasePool pool;
- qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
-
NSApplication *cocoaApplication = [QNSApplication sharedApplication];
qt_redirectNSApplicationSendEvent();
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 6f4375b251..ee0bf75606 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1114,7 +1114,7 @@ static bool _q_dontOverrideCtrlLMB = false;
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
m_platformWindow->m_enterLeaveTargetWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
@@ -1156,7 +1156,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint: &windowPoint andScreenPoint: &screenPoint];
+ [self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint: &windowPoint andScreenPoint: &screenPoint];
uint deviceId = [theEvent deviceID];
if (!tabletDeviceDataHash->contains(deviceId)) {
@@ -1371,7 +1371,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::ZoomNativeGesture,
[event magnification], windowPoint, screenPoint);
}
@@ -1383,7 +1383,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::SmartZoomNativeGesture,
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
zoomIn = !zoomIn;
@@ -1397,7 +1397,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::RotateNativeGesture,
-[event rotation], windowPoint, screenPoint);
}
@@ -1408,7 +1408,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
qreal angle = 0.0f;
if ([event deltaX] == 1)
@@ -1429,7 +1429,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
qCDebug(lcQpaGestures) << "beginGestureWithEvent @" << windowPoint;
QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::BeginNativeGesture,
windowPoint, screenPoint);
@@ -1441,7 +1441,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[self screenMousePoint:event] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::EndNativeGesture,
windowPoint, screenPoint);
}
@@ -1485,7 +1485,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QPointF qt_windowPoint;
QPointF qt_screenPoint;
- [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint];
+ [self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint];
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index 357a3db3c9..076e34c1a5 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -66,6 +66,33 @@ void QIOSPaintDevice::ensureActiveTarget()
m_backingStore->makeCurrent();
}
+/*!
+ \class QIOSBackingStore
+
+ \brief The QPlatformBackingStore on iOS.
+
+ QBackingStore enables the use of QPainter to paint on a QWindow, as opposed
+ to rendering to a QWindow through the use of OpenGL with QOpenGLContext.
+
+ Historically, the iOS port initially implemented the backing store by using
+ an QOpenGLPaintDevice as its paint device, triggering the use of the OpenGL
+ paint engine for QPainter based drawing. This was due to raster drawing
+ operations being too slow when not being NEON-optimized, and got the port
+ up and running quickly.
+
+ As of 3e892e4a97, released in Qt 5.7, the backing store now uses a QImage,
+ for its paint device, giving normal raster-based QPainter operations, and
+ enabling features such as antialiased drawing.
+
+ To account for regressions in performance, the old code path is still
+ available by setting the surface type of the QWindow to OpenGLSurface.
+ This surface type is normally used when rendering though QOpenGLContext,
+ but will in the case of QIOSBackingStore trigger the old OpenGL based
+ painter.
+
+ This fallback path is not too intrusive, as the QImage based path still
+ uses OpenGL to composite the image at flush() time using composeAndFlush.
+*/
QIOSBackingStore::QIOSBackingStore(QWindow *window)
: QRasterBackingStore(window)
, m_context(new QOpenGLContext)
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index d667036e8a..4f022141cf 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1274,8 +1274,23 @@ QT_WARNING_POP
Q_ASSERT(fontEngine->ref.load() == 0);
// Override the generated font name
- static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
- fontEngine->fontDef.family = actualFontName;
+ switch (fontEngine->type()) {
+ case QFontEngine::Win:
+ static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ fontEngine->fontDef.family = actualFontName;
+ break;
+
+#if !defined(QT_NO_DIRECTWRITE)
+ case QFontEngine::DirectWrite:
+ static_cast<QWindowsFontEngineDirectWrite *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ fontEngine->fontDef.family = actualFontName;
+ break;
+#endif // !QT_NO_DIRECTWRITE
+
+ default:
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unhandled font engine.");
+ }
+
UniqueFontData uniqueData;
uniqueData.handle = fontHandle;
uniqueData.refCount.ref();
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index ec73a4c065..66cc08f9fa 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -49,6 +49,8 @@
#include <QtCore/QFile>
#include <private/qstringiterator_p.h>
#include <QtCore/private/qsystemlibrary_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
#if defined(QT_USE_DIRECTWRITE2)
# include <dwrite_2.h>
@@ -235,6 +237,11 @@ QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
if (m_directWriteBitmapRenderTarget != 0)
m_directWriteBitmapRenderTarget->Release();
+
+ if (!m_uniqueFamilyName.isEmpty()) {
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->derefUniqueFont(m_uniqueFamilyName);
+ }
}
#ifndef Q_CC_MINGW
@@ -866,12 +873,17 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t,
QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const
{
- QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace,
- pixelSize,
- m_fontEngineData);
+ QWindowsFontEngineDirectWrite *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace,
+ pixelSize,
+ m_fontEngineData);
fontEngine->fontDef = fontDef;
fontEngine->fontDef.pixelSize = pixelSize;
+ if (!m_uniqueFamilyName.isEmpty()) {
+ fontEngine->setUniqueFamilyName(m_uniqueFamilyName);
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->refUniqueFont(m_uniqueFamilyName);
+ }
return fontEngine;
}
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
index 1978304b13..e4a82c6a6e 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
@@ -111,6 +111,8 @@ public:
IDWriteFontFace *directWriteFontFace() const { return m_directWriteFontFace; }
+ void setUniqueFamilyName(const QString &newName) { m_uniqueFamilyName = newName; }
+
private:
QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform);
void collectMetrics();
@@ -131,6 +133,7 @@ private:
QFixed m_xHeight;
QFixed m_lineGap;
FaceId m_faceId;
+ QString m_uniqueFamilyName;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
index 079f0466dc..00f64e3c40 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
@@ -42,6 +42,7 @@
#include "qxcbeglcontext.h"
#include <QtGui/QOffscreenSurface>
+#include <QtPlatformSupport/private/qeglstreamconvenience_p.h>
#include "qxcbeglnativeinterfacehandler.h"
@@ -63,7 +64,18 @@ QXcbEglIntegration::~QXcbEglIntegration()
bool QXcbEglIntegration::initialize(QXcbConnection *connection)
{
m_connection = connection;
- m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
+
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+
+ if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) {
+ QEGLStreamConvenience streamFuncs;
+ m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR,
+ xlib_display(),
+ nullptr);
+ }
+
+ if (!m_egl_display)
+ m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
EGLint major, minor;
bool success = eglInitialize(m_egl_display, &major, &minor);
diff --git a/src/sql/configure.json b/src/sql/configure.json
index 5476d419ed..96c82e84f9 100644
--- a/src/sql/configure.json
+++ b/src/sql/configure.json
@@ -69,6 +69,7 @@
"label": "PostgreSQL",
"test": "unix/psql",
"sources": [
+ { "type": "pkgConfig", "args": "libpq" },
{ "type": "psqlConfig" },
{ "type": "psqlEnv", "libs": "-llibpq -lws2_32 -ladvapi32", "condition": "config.win32" },
{ "type": "psqlEnv", "libs": "-lpq", "condition": "!config.win32" }
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index e4b9b19758..3bd87e1f01 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -538,7 +538,6 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
return true;
}
-
void Moc::parse()
{
QVector<NamespaceDef> namespaceList;
@@ -560,9 +559,27 @@ void Moc::parse()
until(RBRACE);
def.end = index;
index = def.begin + 1;
+
const bool parseNamespace = currentFilenames.size() <= 1;
+ if (parseNamespace) {
+ for (int i = namespaceList.size() - 1; i >= 0; --i) {
+ if (inNamespace(&namespaceList.at(i))) {
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
+ }
+ }
+ }
while (parseNamespace && inNamespace(&def) && hasNext()) {
switch (next()) {
+ case NAMESPACE:
+ if (test(IDENTIFIER)) {
+ if (test(EQ)) {
+ // namespace Foo = Bar::Baz;
+ until(SEMIC);
+ } else if (!test(SEMIC)) {
+ until(RBRACE);
+ }
+ }
+ break;
case Q_NAMESPACE_TOKEN:
def.hasQNamespace = true;
break;
@@ -857,13 +874,22 @@ void Moc::parse()
continue;
ClassDef def;
static_cast<BaseDef &>(def) = static_cast<BaseDef>(n);
- if (!def.qualified.isEmpty())
- def.qualified += "::";
def.qualified += def.classname;
def.hasQGadget = true;
- classList += def;
- knownGadgets.insert(def.classname, def.qualified);
- knownGadgets.insert(def.qualified, def.qualified);
+ auto it = std::find_if(classList.begin(), classList.end(), [&def](const ClassDef &val) {
+ return def.classname == val.classname && def.qualified == val.qualified;
+ });
+
+ if (it != classList.end()) {
+ it->classInfoList += def.classInfoList;
+ it->enumDeclarations.unite(def.enumDeclarations);
+ it->enumList += def.enumList;
+ it->flagAliases.unite(def.flagAliases);
+ } else {
+ knownGadgets.insert(def.classname, def.qualified);
+ knownGadgets.insert(def.qualified, def.qualified);
+ classList += def;
+ }
}
}
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index e58f194b72..8dbb1bf350 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -32,6 +32,7 @@
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
+#include <qloggingcategory.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qtextstream.h>
@@ -1092,6 +1093,9 @@ int main(int argc, char **argv)
}
}
+ if (verbose)
+ QLoggingCategory::setFilterRules(QStringLiteral("dbus.parser.debug=true"));
+
QDBusIntrospection::Interfaces interfaces = readInput();
cleanInterfaces(interfaces);
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 1116685fc7..39eacae596 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1862,12 +1862,14 @@ void QColorDialogPrivate::retranslateStrings()
bool QColorDialogPrivate::canBeNativeDialog() const
{
- Q_Q(const QColorDialog);
+ // Don't use Q_Q here! This function is called from ~QDialog,
+ // so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
+ const QDialog * const q = static_cast<const QDialog*>(q_ptr);
if (nativeDialogInUse)
return true;
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
- || (q->options() & QColorDialog::DontUseNativeDialog)) {
+ || (options->options() & QColorDialog::DontUseNativeDialog)) {
return false;
}
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 7b60e9cb56..879f085f11 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -692,12 +692,14 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
bool QFileDialogPrivate::canBeNativeDialog() const
{
- Q_Q(const QFileDialog);
+ // Don't use Q_Q here! This function is called from ~QDialog,
+ // so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
+ const QDialog * const q = static_cast<const QDialog*>(q_ptr);
if (nativeDialogInUse)
return true;
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
- || (q->options() & QFileDialog::DontUseNativeDialog)) {
+ || (options->options() & QFileDialog::DontUseNativeDialog)) {
return false;
}
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 5118383fe5..3a833e85c0 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -1030,7 +1030,9 @@ void QFontDialog::done(int result)
bool QFontDialogPrivate::canBeNativeDialog() const
{
- Q_Q(const QFontDialog);
+ // Don't use Q_Q here! This function is called from ~QDialog,
+ // so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
+ const QDialog * const q = static_cast<const QDialog*>(q_ptr);
if (nativeDialogInUse)
return true;
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 02956b76f9..6a9036997c 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -2096,7 +2096,7 @@ QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints)
void QGraphicsAnchorLayoutPrivate::calculateGraphs(
QGraphicsAnchorLayoutPrivate::Orientation orientation)
{
-#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
+#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
lastCalculationUsedSimplex[orientation] = false;
#endif
@@ -2249,7 +2249,7 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const
sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum;
}
-#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
+#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
lastCalculationUsedSimplex[orientation] = needsSimplex;
#endif
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index ee11cb8561..b6d8a12658 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -579,7 +579,7 @@ public:
bool graphHasConflicts[2];
QSet<QGraphicsLayoutItem *> m_floatItems[2];
-#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
+#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
bool lastCalculationUsedSimplex[2];
#endif
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index aa781e8f8b..5b46eb35be 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -717,10 +717,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
++it;
}
- QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item);
- cachedTargetItems.removeOne(dummy);
- cachedItemGestures.remove(dummy);
- cachedAlreadyDeliveredGestures.remove(dummy);
+ if (QGraphicsObject *dummy = item->toGraphicsObject()) {
+ cachedTargetItems.removeOne(dummy);
+ cachedItemGestures.remove(dummy);
+ cachedAlreadyDeliveredGestures.remove(dummy);
+ }
foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys())
ungrabGesture(item, gesture);
@@ -996,7 +997,7 @@ void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying)
// If the item is a popup, go via removePopup to ensure state
// consistency and that it gets hidden correctly - beware that
// removePopup() reenters this function to continue removing the grab.
- removePopup((QGraphicsWidget *)item, itemIsDying);
+ removePopup(popupWidgets.constLast(), itemIsDying);
return;
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 9b8677e6a8..815ae7fe33 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1068,15 +1068,17 @@ QStyle *QApplication::style()
if (!QApplicationPrivate::app_style) {
// Compile-time search for default style
//
- QString style;
+ QStyle *&app_style = QApplicationPrivate::app_style;
+
if (!QApplicationPrivate::styleOverride.isEmpty()) {
- style = QApplicationPrivate::styleOverride.toLower();
- } else {
- style = QApplicationPrivate::desktopStyleKey();
+ const QString style = QApplicationPrivate::styleOverride.toLower();
+ app_style = QStyleFactory::create(style);
+ if (!app_style)
+ qWarning("QApplication: invalid style override passed, ignoring it.");
}
+ if (!app_style)
+ app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey());
- QStyle *&app_style = QApplicationPrivate::app_style;
- app_style = QStyleFactory::create(style);
if (!app_style) {
const QStringList styles = QStyleFactory::keys();
for (const auto &style : styles) {
@@ -3116,11 +3118,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
key->accept();
else
key->ignore();
- res = d->notify_helper(receiver, e);
QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
#ifndef QT_NO_GRAPHICSVIEW
QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
#endif
+ res = d->notify_helper(receiver, e);
if ((res && key->isAccepted())
/*
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 0a21ece1dd..1a341d155b 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -546,7 +546,7 @@ void QLayout::invalidate()
update();
}
-static bool removeWidgetRecursively(QLayoutItem *li, QWidget *w)
+static bool removeWidgetRecursively(QLayoutItem *li, QObject *w)
{
QLayout *lay = li->layout();
if (!lay)
@@ -609,12 +609,11 @@ void QLayout::widgetEvent(QEvent *e)
{
QChildEvent *c = (QChildEvent *)e;
if (c->child()->isWidgetType()) {
- QWidget *w = (QWidget *)c->child();
#ifndef QT_NO_MENUBAR
- if (w == d->menubar)
+ if (c->child() == d->menubar)
d->menubar = 0;
#endif
- removeWidgetRecursively(this, w);
+ removeWidgetRecursively(this, c->child());
}
}
break;
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 006b3e8588..d9c1c524d7 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -41,7 +41,7 @@
#include "qlayout_p.h"
#include <qlist.h>
-#include <qwidget.h>
+#include "private/qwidget_p.h"
#include "private/qlayoutengine_p.h"
QT_BEGIN_NAMESPACE
@@ -251,14 +251,10 @@ QLayoutItem *QStackedLayout::itemAt(int index) const
// Code that enables proper handling of the case that takeAt() is
// called somewhere inside QObject destructor (can't call hide()
// on the object then)
-
-class QtFriendlyLayoutWidget : public QWidget
+static bool qt_wasDeleted(const QWidget *w)
{
-public:
- inline bool wasDeleted() const { return d_ptr->wasDeleted; }
-};
-
-static bool qt_wasDeleted(const QWidget *w) { return static_cast<const QtFriendlyLayoutWidget*>(w)->wasDeleted(); }
+ return QWidgetPrivate::get(w)->wasDeleted;
+}
/*!
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 68ac874b59..759c9864a6 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -508,45 +508,46 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
}
- const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
- const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
-#ifndef QT_NO_GRAPHICSVIEW
- const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
-#endif
-
enum { TapRadius = 40 };
switch (event->type()) {
#ifndef QT_NO_GRAPHICSVIEW
- case QEvent::GraphicsSceneMousePress:
+ case QEvent::GraphicsSceneMousePress: {
+ const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
d->position = gsme->screenPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ }
#endif
- case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonPress: {
+ const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
d->position = me->globalPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
- case QEvent::TouchBegin:
+ }
+ case QEvent::TouchBegin: {
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
d->position = ev->touchPoints().at(0).startScreenPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+ }
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseRelease:
#endif
case QEvent::MouseButtonRelease:
case QEvent::TouchEnd:
return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state
- case QEvent::TouchUpdate:
+ case QEvent::TouchUpdate: {
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
if (d->timerId && ev->touchPoints().size() == 1) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
@@ -554,7 +555,9 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
return QGestureRecognizer::MayBeGesture;
}
return QGestureRecognizer::CancelGesture;
+ }
case QEvent::MouseMove: {
+ const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
QPoint delta = me->globalPos() - d->position.toPoint();
if (d->timerId && delta.manhattanLength() <= TapRadius)
return QGestureRecognizer::MayBeGesture;
@@ -562,6 +565,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
}
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseMove: {
+ const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
QPoint delta = gsme->screenPos() - d->position.toPoint();
if (d->timerId && delta.manhattanLength() <= TapRadius)
return QGestureRecognizer::MayBeGesture;
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index c606ef6375..78929d8cd5 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -342,6 +342,7 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e)
case QEvent::FocusIn:
case QEvent::FocusOut:
#endif
+ case QEvent::Close: // For QTBUG-55523 (QQC) specifically: Hide tooltip when windows are closed
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 28f4cd34ce..51e1ef9aaf 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -5226,8 +5226,10 @@ static void sendResizeEvents(QWidget *target)
const QObjectList children = target->children();
for (int i = 0; i < children.size(); ++i) {
+ if (!children.at(i)->isWidgetType())
+ continue;
QWidget *child = static_cast<QWidget*>(children.at(i));
- if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
+ if (!child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
sendResizeEvents(child);
}
}
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index a2579df48f..3e57f9de41 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -330,6 +330,7 @@ public:
~QWidgetPrivate();
static QWidgetPrivate *get(QWidget *w) { return w->d_func(); }
+ static const QWidgetPrivate *get(const QWidget *w) { return w->d_func(); }
QWExtra *extraData() const;
QTLWExtra *topData() const;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index b168c98410..54094de765 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2394,18 +2394,21 @@ void QDateTimeEditPrivate::init(const QVariant &var)
switch (var.type()) {
case QVariant::Date:
value = QDateTime(var.toDate(), QDATETIMEEDIT_TIME_MIN);
+ updateTimeSpec();
q->setDisplayFormat(defaultDateFormat);
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
q->setDisplayFormat(QLatin1String("dd/MM/yyyy"));
break;
case QVariant::DateTime:
value = var;
+ updateTimeSpec();
q->setDisplayFormat(defaultDateTimeFormat);
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
q->setDisplayFormat(QLatin1String("dd/MM/yyyy hh:mm:ss"));
break;
case QVariant::Time:
value = QDateTime(QDATETIMEEDIT_DATE_INITIAL, var.toTime());
+ updateTimeSpec();
q->setDisplayFormat(defaultTimeFormat);
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
q->setDisplayFormat(QLatin1String("hh:mm:ss"));
@@ -2418,7 +2421,6 @@ void QDateTimeEditPrivate::init(const QVariant &var)
if (QApplication::keypadNavigationEnabled())
q->setCalendarPopup(true);
#endif
- updateTimeSpec();
q->setInputMethodHints(Qt::ImhPreferNumbers);
setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem);
}
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index a8760843b3..fea185c48f 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6546,6 +6546,29 @@ signals:
CountedStruct mySignal(const CountedStruct &s1, CountedStruct s2);
};
+class CountedExceptionThrower : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit CountedExceptionThrower(bool throwException, QObject *parent = Q_NULLPTR)
+ : QObject(parent)
+ {
+ if (throwException)
+ throw ObjectException();
+ ++counter;
+ }
+
+ ~CountedExceptionThrower()
+ {
+ --counter;
+ }
+
+ static int counter;
+};
+
+int CountedExceptionThrower::counter = 0;
+
void tst_QObject::exceptions()
{
#ifndef QT_NO_EXCEPTIONS
@@ -6607,6 +6630,59 @@ void tst_QObject::exceptions()
}
QCOMPARE(countedStructObjectsCount, 0);
+ // Child object reaping in case of exceptions thrown by constructors
+ {
+ QCOMPARE(CountedExceptionThrower::counter, 0);
+
+ try {
+ class ParentObject : public QObject {
+ public:
+ explicit ParentObject(QObject *parent = Q_NULLPTR)
+ : QObject(parent)
+ {
+ new CountedExceptionThrower(false, this);
+ new CountedExceptionThrower(false, this);
+ new CountedExceptionThrower(true, this); // throws
+ }
+ };
+
+ ParentObject p;
+ QFAIL("Exception not thrown");
+ } catch (const ObjectException &) {
+ } catch (...) {
+ QFAIL("Wrong exception thrown");
+ }
+
+ QCOMPARE(CountedExceptionThrower::counter, 0);
+
+ try {
+ QObject o;
+ new CountedExceptionThrower(false, &o);
+ new CountedExceptionThrower(false, &o);
+ new CountedExceptionThrower(true, &o); // throws
+
+ QFAIL("Exception not thrown");
+ } catch (const ObjectException &) {
+ } catch (...) {
+ QFAIL("Wrong exception thrown");
+ }
+
+ QCOMPARE(CountedExceptionThrower::counter, 0);
+
+ try {
+ QObject o;
+ CountedExceptionThrower c1(false, &o);
+ CountedExceptionThrower c2(false, &o);
+ CountedExceptionThrower c3(true, &o); // throws
+
+ QFAIL("Exception not thrown");
+ } catch (const ObjectException &) {
+ } catch (...) {
+ QFAIL("Wrong exception thrown");
+ }
+
+ QCOMPARE(CountedExceptionThrower::counter, 0);
+ }
#else
QSKIP("Needs exceptions");
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 03ddd4d6f8..4eb26d17fe 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -227,6 +227,7 @@ private slots:
void ecdhServer();
void verifyClientCertificate_data();
void verifyClientCertificate();
+ void readBufferMaxSize();
#ifndef QT_NO_OPENSSL
void simplePskConnect_data();
@@ -3136,6 +3137,68 @@ void tst_QSslSocket::verifyClientCertificate()
QCOMPARE(client.isEncrypted(), works);
}
+void tst_QSslSocket::readBufferMaxSize()
+{
+#ifdef QT_SECURETRANSPORT
+ // QTBUG-55170:
+ // SecureTransport back-end was ignoring read-buffer
+ // size limit, resulting (potentially) in a constantly
+ // growing internal buffer.
+ // The test's logic is: we set a small read buffer size on a client
+ // socket (to some ridiculously small value), server sends us
+ // a bunch of bytes , we ignore readReady signal so
+ // that socket's internal buffer size stays
+ // >= readBufferMaxSize, we wait for a quite long time
+ // (which previously would be enough to read completely)
+ // and we check socket's bytesAvaiable to be less than sent.
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SslServer server;
+ QVERIFY(server.listen());
+
+ QEventLoop loop;
+
+ QSslSocketPtr client(new QSslSocket);
+ socket = client.data();
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+ connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+
+ client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(),
+ server.serverPort());
+
+ // Wait for 'encrypted' first:
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+ loop.exec();
+
+ QCOMPARE(client->state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(client->mode(), QSslSocket::SslClientMode);
+
+ client->setReadBufferSize(10);
+ const QByteArray message(int(0xffff), 'a');
+ server.socket->write(message);
+
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+ loop.exec();
+
+ int readSoFar = client->bytesAvailable();
+ QVERIFY(readSoFar > 0 && readSoFar < message.size());
+ // Now, let's check that we still can read the rest of it:
+ QCOMPARE(client->readAll().size(), readSoFar);
+
+ client->setReadBufferSize(0);
+
+ QTimer::singleShot(1500, &loop, SLOT(quit()));
+ loop.exec();
+
+ QCOMPARE(client->bytesAvailable() + readSoFar, message.size());
+#else
+ // Not needed, QSslSocket works correctly with other back-ends.
+#endif
+}
+
void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, as it has some side effects
{
// used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index eb575a88ea..8fc0521102 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -75,6 +75,10 @@ private slots:
void testRasterA2RGB30PM();
void testRasterBGR30_data();
void testRasterBGR30();
+ void testRasterARGB8565PM_data();
+ void testRasterARGB8565PM();
+ void testRasterGrayscale8_data();
+ void testRasterGrayscale8();
#ifndef QT_NO_OPENGL
void testOpenGL_data();
@@ -178,6 +182,28 @@ void tst_Lancelot::testRasterBGR30()
}
+void tst_Lancelot::testRasterARGB8565PM_data()
+{
+ setupTestSuite();
+}
+
+void tst_Lancelot::testRasterARGB8565PM()
+{
+ runTestSuite(Raster, QImage::Format_ARGB8565_Premultiplied);
+}
+
+
+void tst_Lancelot::testRasterGrayscale8_data()
+{
+ setupTestSuite();
+}
+
+void tst_Lancelot::testRasterGrayscale8()
+{
+ runTestSuite(Raster, QImage::Format_Grayscale8);
+}
+
+
#ifndef QT_NO_OPENGL
bool tst_Lancelot::checkSystemGLSupport()
{
diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h
index 2bb1d8e958..6e04831589 100644
--- a/tests/auto/tools/moc/namespace.h
+++ b/tests/auto/tools/moc/namespace.h
@@ -1,7 +1,77 @@
-#pragma once
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef NAMESPACE_H
+#define NAMESPACE_H
#include <QObject>
+#include "namespace_no_merge.h"
+// moc should not merge namespace_no_merge.h content with this one !
+
namespace FooNamespace {
Q_NAMESPACE
+ enum class Enum1 {
+ Key1,
+ Key2
+ };
+ Q_ENUM_NS(Enum1)
+
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum2 {
+ Key3,
+ Key4
+ };
+ Q_ENUM_NS(Enum2)
+ }
+
+ using namespace FooNamespace;
+ namespace Bar = FooNamespace;
+
+ // Moc should merge this namespace with the previous one
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum3 {
+ Key5,
+ Key6
+ };
+ Q_ENUM_NS(Enum3)
+
+ namespace FooMoreNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum4 {
+ Key7,
+ Key8
+ };
+ Q_ENUM_NS(Enum4)
+ }
+ }
}
+
+#endif // NAMESPACE_H
diff --git a/tests/auto/tools/moc/namespace_no_merge.h b/tests/auto/tools/moc/namespace_no_merge.h
new file mode 100644
index 0000000000..8d1639ad4c
--- /dev/null
+++ b/tests/auto/tools/moc/namespace_no_merge.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef NAMESPACE_NO_MERGE_H
+#define NAMESPACE_NO_MERGE_H
+
+#include <QObject>
+
+namespace FooNamespace {
+ Q_NAMESPACE
+ enum class MEnum1 {
+ Key1,
+ Key2
+ };
+ Q_ENUM_NS(MEnum1)
+
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum2 {
+ Key3,
+ Key4
+ };
+ Q_ENUM_NS(MEnum2)
+ }
+
+ using namespace FooNamespace;
+ namespace Bar = FooNamespace;
+
+ // Moc should merge this namespace with the previous one
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum3 {
+ Key5,
+ Key6
+ };
+ Q_ENUM_NS(MEnum3)
+
+ namespace FooMoreNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum4 {
+ Key7,
+ Key8
+ };
+ Q_ENUM_NS(MEnum4)
+ }
+ }
+}
+
+#endif // NAMESPACE_NO_MERGE_H
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 601b1bb36b..ecf6c7e992 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -3777,6 +3777,10 @@ void tst_Moc::testQNamespace()
QCOMPARE(meta.name(), "TestEnum1");
QCOMPARE(meta.enclosingMetaObject(), &TestQNamespace::staticMetaObject);
QCOMPARE(meta.keyCount(), 2);
+
+ QCOMPARE(FooNamespace::staticMetaObject.enumeratorCount(), 1);
+ QCOMPARE(FooNamespace::FooNestedNamespace::staticMetaObject.enumeratorCount(), 2);
+ QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1);
}
QTEST_MAIN(tst_Moc)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 46d0b18990..76e3b43ce2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -5050,9 +5050,10 @@ void tst_QGraphicsItem::sceneEventFilter()
delete ti;
}
-class GeometryChanger : public QGraphicsItem
+class GeometryChanger : public QGraphicsRectItem
{
public:
+ explicit GeometryChanger(QRectF r) : QGraphicsRectItem(r) {}
void changeGeometry()
{ prepareGeometryChange(); }
};
@@ -5061,10 +5062,12 @@ void tst_QGraphicsItem::prepareGeometryChange()
{
{
QGraphicsScene scene;
- QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
- QVERIFY(scene.items(QRectF(0, 0, 100, 100)).contains(item));
- ((GeometryChanger *)item)->changeGeometry();
- QVERIFY(scene.items(QRectF(0, 0, 100, 100)).contains(item));
+ const QRectF rect(0, 0, 100, 100);
+ GeometryChanger item(rect);
+ scene.addItem(&item);
+ QVERIFY(scene.items(rect).contains(&item));
+ item.changeGeometry();
+ QVERIFY(scene.items(rect).contains(&item));
}
}
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index eda51e31a9..411b925adb 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1715,25 +1715,6 @@ 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;
@@ -1751,14 +1732,14 @@ void tst_QApplication::focusMouseClick()
// 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;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
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;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QTRY_COMPARE(QApplication::focusWidget(), &w2);
@@ -1766,7 +1747,7 @@ void tst_QApplication::focusMouseClick()
// 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;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QCOMPARE(QApplication::focusWidget(), &w2);
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index e87598617a..0b35db1b5f 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -183,7 +183,7 @@ void tst_QBoxLayout::sizeConstraints()
window.show();
QTest::qWaitForWindowExposed(&window);
QSize sh = window.sizeHint();
- lay->takeAt(1);
+ delete lay->takeAt(1);
QVERIFY(sh.width() >= window.sizeHint().width() &&
sh.height() >= window.sizeHint().height());
@@ -512,7 +512,7 @@ void tst_QBoxLayout::replaceWidget()
QCOMPARE(boxLayout->indexOf(replaceFrom), 1);
QCOMPARE(boxLayout->indexOf(replaceTo), -1);
- boxLayout->replaceWidget(replaceFrom, replaceTo);
+ delete boxLayout->replaceWidget(replaceFrom, replaceTo);
QCOMPARE(boxLayout->indexOf(replaceFrom), -1);
QCOMPARE(boxLayout->indexOf(replaceTo), 1);
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 3c4c1a1d41..c1ab5f51be 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -341,6 +341,8 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.removeItem(spacer);
+ delete spacer;
+ spacer = Q_NULLPTR;
rightChild.hide();
QApplication::sendPostedEvents(0, 0);
@@ -1577,10 +1579,10 @@ void tst_QGridLayout::contentsRect()
void tst_QGridLayout::distributeMultiCell()
{
QWidget w;
- Qt42Style *style = new Qt42Style();
- style->spacing = 9;
+ Qt42Style style;
+ style.spacing = 9;
- w.setStyle(style);
+ w.setStyle(&style);
QGridLayout grid;
w.setLayout(&grid);
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index eaa4c8a636..5f3fed1f66 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -4997,7 +4997,8 @@ void tst_QWidget::moveChild()
ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
- parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ parent.setStyle(style.data());
ColorWidget child(&parent, Qt::Widget, Qt::blue);
parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
@@ -5042,7 +5043,8 @@ void tst_QWidget::showAndMoveChild()
QSKIP("Wayland: This fails. Figure out why.");
QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
- parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ parent.setStyle(style.data());
QDesktopWidget desktop;
QRect desktopDimensions = desktop.availableGeometry(&parent);
@@ -6542,7 +6544,9 @@ void tst_QWidget::renderWithPainter()
{
QWidget widget(0, Qt::Tool);
// prevent custom styles
- widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
+
+ const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
+ widget.setStyle(style.data());
widget.show();
widget.resize(70, 50);
widget.setAutoFillBackground(true);
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 28c2e92f78..09ab20f7ca 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -221,6 +221,7 @@ private slots:
void timeSpec_data();
void timeSpec();
void timeSpecBug();
+ void timeSpecInit();
void monthEdgeCase();
void setLocale();
@@ -3176,6 +3177,13 @@ void tst_QDateTimeEdit::timeSpecBug()
QCOMPARE(oldText, testWidget->text());
}
+void tst_QDateTimeEdit::timeSpecInit()
+{
+ QDateTime utc(QDate(2000, 1, 1), QTime(12, 0, 0), Qt::UTC);
+ QDateTimeEdit widget(utc);
+ QCOMPARE(widget.dateTime(), utc);
+}
+
void tst_QDateTimeEdit::cachedDayTest()
{
testWidget->setDisplayFormat("MM/dd");
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index 086c1049ab..76c3ac4143 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -357,25 +357,25 @@ void tst_QMdiSubWindow::mainWindowSupport()
mainWindow.show();
mainWindow.menuBar()->setVisible(true);
qApp->setActiveWindow(&mainWindow);
-
- // QMainWindow's window title is empty
-#if !defined(Q_OS_DARWIN)
- {
- QCOMPARE(mainWindow.windowTitle(), QString());
- QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test")));
- QString expectedTitle = QLatin1String("MainWindow's title is empty");
- window->setWindowTitle(expectedTitle);
- QCOMPARE(window->windowTitle(), expectedTitle);
- window->showMaximized();
- QVERIFY(window->isMaximized());
- QCOMPARE(window->windowTitle(), expectedTitle);
- QCOMPARE(mainWindow.windowTitle(), expectedTitle);
- window->showNormal();
- QCOMPARE(window->windowTitle(), expectedTitle);
- QCOMPARE(mainWindow.windowTitle(), QString());
- window->close();
+ bool nativeMenuBar = mainWindow.menuBar()->isNativeMenuBar();
+
+ // QMainWindow's window title is empty, so on a platform which does NOT have a native menubar,
+ // the maximized subwindow's title is imposed onto the main window's titlebar.
+ if (!nativeMenuBar) {
+ QCOMPARE(mainWindow.windowTitle(), QString());
+ QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test")));
+ QString expectedTitle = QLatin1String("MainWindow's title is empty");
+ window->setWindowTitle(expectedTitle);
+ QCOMPARE(window->windowTitle(), expectedTitle);
+ window->showMaximized();
+ QVERIFY(window->isMaximized());
+ QCOMPARE(window->windowTitle(), expectedTitle);
+ QCOMPARE(mainWindow.windowTitle(), expectedTitle);
+ window->showNormal();
+ QCOMPARE(window->windowTitle(), expectedTitle);
+ QCOMPARE(mainWindow.windowTitle(), QString());
+ window->close();
}
-#endif
QString originalWindowTitle = QString::fromLatin1("MainWindow");
mainWindow.setWindowTitle(originalWindowTitle);
@@ -411,16 +411,16 @@ void tst_QMdiSubWindow::mainWindowSupport()
window->showMaximized();
qApp->processEvents();
QVERIFY(window->isMaximized());
-#if !defined(Q_OS_DARWIN)
- QVERIFY(window->maximizedButtonsWidget());
- QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner));
- QVERIFY(window->maximizedSystemMenuIconWidget());
- QCOMPARE(window->maximizedSystemMenuIconWidget(), qobject_cast<QWidget *>(mainWindow.menuBar()
- ->cornerWidget(Qt::TopLeftCorner)));
- const QString expectedTitle = originalWindowTitle + QLatin1String(" - [")
- + window->widget()->windowTitle() + QLatin1Char(']');
- QCOMPARE(mainWindow.windowTitle(), expectedTitle);
-#endif
+ if (!nativeMenuBar) {
+ QVERIFY(window->maximizedButtonsWidget());
+ QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner));
+ QVERIFY(window->maximizedSystemMenuIconWidget());
+ QCOMPARE(window->maximizedSystemMenuIconWidget(),
+ qobject_cast<QWidget *>(mainWindow.menuBar()->cornerWidget(Qt::TopLeftCorner)));
+ const QString expectedTitle = originalWindowTitle + QLatin1String(" - [")
+ + window->widget()->windowTitle() + QLatin1Char(']');
+ QCOMPARE(mainWindow.windowTitle(), expectedTitle);
+ }
// Check that nested child windows don't set window title
nestedWorkspace->show();
@@ -434,15 +434,14 @@ void tst_QMdiSubWindow::mainWindowSupport()
QVERIFY(!nestedWindow->maximizedButtonsWidget());
QVERIFY(!nestedWindow->maximizedSystemMenuIconWidget());
-#if !defined(Q_OS_DARWIN) && !defined(Q_OS_QNX)
- QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]")
- .arg(originalWindowTitle, window->widget()->windowTitle()));
-#endif
+ if (!nativeMenuBar) {
+ QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]")
+ .arg(originalWindowTitle, window->widget()->windowTitle()));
+ }
}
-#if defined(Q_OS_DARWIN)
- return;
-#endif
+ if (nativeMenuBar)
+ return;
workspace->activateNextSubWindow();
qApp->processEvents();
@@ -1905,14 +1904,14 @@ void tst_QMdiSubWindow::mdiArea()
void tst_QMdiSubWindow::task_182852()
{
-#if !defined(Q_OS_DARWIN)
-
QMdiArea *workspace = new QMdiArea;
QMainWindow mainWindow;
mainWindow.setCentralWidget(workspace);
mainWindow.show();
mainWindow.menuBar()->setVisible(true);
qApp->setActiveWindow(&mainWindow);
+ if (mainWindow.menuBar()->isNativeMenuBar())
+ return; // The main window's title is not overwritten if we have a native menubar (macOS, Unity etc.)
QString originalWindowTitle = QString::fromLatin1("MainWindow - [foo]");
mainWindow.setWindowTitle(originalWindowTitle);
@@ -1948,9 +1947,6 @@ void tst_QMdiSubWindow::task_182852()
QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]")
.arg(originalWindowTitle, window->widget()->windowTitle()));
-
-
-#endif
}
void tst_QMdiSubWindow::task_233197()
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 58725346d0..ca58dc1247 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -93,7 +93,6 @@ private slots:
#if !defined(Q_OS_DARWIN)
void accel();
void activatedCount();
- void allowActiveAndDisabled();
void check_accelKeys();
void check_cursorKeys1();
@@ -102,6 +101,9 @@ private slots:
void check_escKey();
#endif
+#ifndef Q_OS_WINCE
+ void allowActiveAndDisabled();
+#endif
void check_endKey();
void check_homeKey();
@@ -918,10 +920,10 @@ void tst_QMenuBar::check_escKey()
// QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count);
// }
-#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::allowActiveAndDisabled()
{
QMenuBar menuBar;
+ menuBar.setNativeMenuBar(false);
// Task 241043 : check that second menu is activated if only
// disabled menu items are added
@@ -957,7 +959,6 @@ void tst_QMenuBar::allowActiveAndDisabled()
else
QCOMPARE(menuBar.activeAction()->text(), fileMenu.title());
}
-#endif
void tst_QMenuBar::check_altPress()
{
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index f46d58513e..b09a3447e3 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -1718,14 +1718,14 @@ void tst_QDom::germanUmlautToFile() const
QDomDocument d("test");
d.appendChild(d.createElement(name));
- QFile file("germanUmlautToFile.xml");
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QTemporaryFile file;
+ QVERIFY(file.open());
QTextStream ts(&file);
ts.setCodec("UTF-8");
ts << d.toString();
file.close();
- QFile inFile("germanUmlautToFile.xml");
+ QFile inFile(file.fileName());
QVERIFY(inFile.open(QIODevice::ReadOnly));
QString baseline(QLatin1String("<!DOCTYPE test>\n<german"));