diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-29 00:38:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-29 00:38:01 +0200 |
commit | cdb56c42fc1145ad25560720fb95df2bfa760a20 (patch) | |
tree | 4dbe524a511b9343464e8509bd5352715aebdfa9 | |
parent | 87583738f960e83918da3b66e455e75c144fbf8e (diff) | |
parent | e918334045612ec2c7c6203845ad05c4a1972e87 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
mkspecs/features/uikit/xcodebuild.mk
tests/auto/other/lancelot/tst_lancelot.cpp
tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
47 files changed, 473 insertions, 177 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 = "—" macro.pi.HTML = "Π" 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/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 ec69966c2a..85a5ba56c3 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) { @@ -1405,25 +1431,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/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 f076e10e20..61343e5f5a 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -523,16 +523,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/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/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/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/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 ¶mList) 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 72ac3431de..8d3b970158 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/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/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 4c01219d87..6e10d18e11 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 7fa3b26e45..815ae7fe33 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3118,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 52bf8e9004..0f7f75fb2e 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6548,6 +6548,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 @@ -6609,6 +6632,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/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")); |