summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.2.09
-rw-r--r--doc/global/qt-cpp-defines.qdocconf1
-rw-r--r--mkspecs/features/android/android.prf (renamed from mkspecs/features/android.prf)0
-rw-r--r--mkspecs/features/android/android_deployment_settings.prf (renamed from mkspecs/features/android_deployment_settings.prf)0
-rw-r--r--mkspecs/features/ios/default_post.prf11
-rw-r--r--mkspecs/features/ios/qt.prf3
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp3
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java29
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java4
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/global/qfeatures.h5
-rw-r--r--src/corelib/global/qfeatures.txt2
-rw-r--r--src/corelib/global/qlogging.cpp1
-rw-r--r--src/corelib/io/qdir.cpp8
-rw-r--r--src/corelib/io/qfileinfo.cpp8
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h4
-rw-r--r--src/corelib/io/qloggingcategory.cpp30
-rw-r--r--src/corelib/io/qloggingcategory.h5
-rw-r--r--src/corelib/io/qprocess.cpp28
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qsettings_win.cpp2
-rw-r--r--src/corelib/io/qtemporarydir.cpp8
-rw-r--r--src/corelib/io/qurl.cpp17
-rw-r--r--src/corelib/io/qurlquery.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp17
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp1
-rw-r--r--src/corelib/kernel/qtimer.cpp19
-rw-r--r--src/corelib/kernel/qvariant.cpp17
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp8
-rw-r--r--src/corelib/tools/qbitarray.cpp17
-rw-r--r--src/corelib/tools/qbytearray.cpp17
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp8
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp8
-rw-r--r--src/corelib/tools/qdatetime.cpp54
-rw-r--r--src/corelib/tools/qdatetime_p.h16
-rw-r--r--src/corelib/tools/qeasingcurve.cpp17
-rw-r--r--src/corelib/tools/qhash.cpp17
-rw-r--r--src/corelib/tools/qlinkedlist.cpp17
-rw-r--r--src/corelib/tools/qlist.cpp17
-rw-r--r--src/corelib/tools/qmap.cpp17
-rw-r--r--src/corelib/tools/qregexp.cpp8
-rw-r--r--src/corelib/tools/qscopedpointer.cpp2
-rw-r--r--src/corelib/tools/qshareddata.cpp34
-rw-r--r--src/corelib/tools/qstring.cpp16
-rw-r--r--src/corelib/tools/qtimezone.cpp9
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp11
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc4
-rw-r--r--src/corelib/tools/qvector.cpp17
-rw-r--r--src/dbus/qdbusxmlparser.cpp2
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp69
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp102
-rw-r--r--src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp (renamed from src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp)0
-rw-r--r--src/gui/image/qicon.cpp8
-rw-r--r--src/gui/image/qimage.cpp17
-rw-r--r--src/gui/image/qpicture.cpp8
-rw-r--r--src/gui/image/qpixmap.cpp8
-rw-r--r--src/gui/kernel/qcursor.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp30
-rw-r--r--src/gui/kernel/qguiapplication_p.h3
-rw-r--r--src/gui/kernel/qkeysequence.cpp8
-rw-r--r--src/gui/kernel/qpalette.cpp8
-rw-r--r--src/gui/kernel/qplatformintegration.cpp22
-rw-r--r--src/gui/kernel/qplatformintegration.h2
-rw-r--r--src/gui/kernel/qsessionmanager.cpp50
-rw-r--r--src/gui/kernel/qstylehints.cpp2
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.h2
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/painting/qbrush.cpp7
-rw-r--r--src/gui/painting/qpainterpath.cpp8
-rw-r--r--src/gui/painting/qpen.cpp8
-rw-r--r--src/gui/painting/qregion.cpp8
-rw-r--r--src/gui/text/qfont.cpp8
-rw-r--r--src/gui/text/qfontmetrics.cpp8
-rw-r--r--src/gui/text/qtextoption.cpp3
-rw-r--r--src/gui/text/qtextoption.h3
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp16
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h33
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp39
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.cpp8
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm16
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm21
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp6
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp11
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp17
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h1
-rw-r--r--src/plugins/platforms/ios/ios.pro6
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm4
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h7
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm24
-rw-r--r--src/plugins/platforms/ios/qiosservices.h57
-rw-r--r--src/plugins/platforms/ios/qiosservices.mm69
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.cpp6
-rw-r--r--src/plugins/platforms/kms/qkmsintegration.h3
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp9
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h3
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp22
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.h5
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.h2
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp21
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.h3
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.cpp6
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.h3
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp12
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h4
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.h12
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp41
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h27
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp30
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h7
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp40
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h30
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp20
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.h9
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp4
-rw-r--r--src/testlib/testlib.pro6
-rw-r--r--src/tools/qdoc/generator.cpp6
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp16
-rw-r--r--src/tools/qdoc/node.cpp71
-rw-r--r--src/tools/qdoc/node.h40
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp53
-rw-r--r--src/tools/qdoc/qdocdatabase.h6
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp45
-rw-r--r--src/tools/qdoc/tree.cpp13
-rw-r--r--src/tools/qdoc/tree.h1
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp108
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp13
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro1
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp82
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h73
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp30
-rw-r--r--tests/auto/gui/kernel/qguiapplication/qguiapplication.pro11
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp4
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp28
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp4
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp63
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp11
151 files changed, 1678 insertions, 698 deletions
diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0
index 54f809ae25..a8a3e581de 100644
--- a/dist/changes-5.2.0
+++ b/dist/changes-5.2.0
@@ -75,3 +75,12 @@ QtCore
- qUpperBound (std::upper_bound)
- qLess (std::less)
- qGreater (std::greater)
+
+QtGui
+-----
+- [QTBUG-28228] Session Management:
+ The new QPlatformSessionManager class brings back the session management
+ functionality. It allows the implementation of platform specific behavior
+ related to session management. For platform that don't support this
+ feature the default behavior has not changed.
+ Both X11 and Windows session management are supported.
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index 406e37af08..b1738e129f 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -72,6 +72,7 @@ Cpp.ignoretokens += \
Q_TESTLIB_EXPORT \
Q_TYPENAME \
Q_WIDGETS_EXPORT \
+ Q_WINEXTRAS_EXPORT \
Q_XML_EXPORT \
Q_XMLPATTERNS_EXPORT \
Q_XMLSTREAM_EXPORT \
diff --git a/mkspecs/features/android.prf b/mkspecs/features/android/android.prf
index 5e21f0b845..5e21f0b845 100644
--- a/mkspecs/features/android.prf
+++ b/mkspecs/features/android/android.prf
diff --git a/mkspecs/features/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf
index 1e54b67789..1e54b67789 100644
--- a/mkspecs/features/android_deployment_settings.prf
+++ b/mkspecs/features/android/android_deployment_settings.prf
diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf
index 3322047788..a61db3daea 100644
--- a/mkspecs/features/ios/default_post.prf
+++ b/mkspecs/features/ios/default_post.prf
@@ -1,6 +1,15 @@
equals(TEMPLATE, app) {
- qt:app_bundle:!macx-xcode {
+
+ # If the application uses Qt, it needs to be an application bundle
+ # to be able to deploy and run on iOS. The only exception to this
+ # is if you're working with a jailbroken device and can run the
+ # resulting binary from the console/over SSH, but that's not a
+ # use-case we care about, so no need to complicate the logic.
+ qt: CONFIG *= app_bundle
+
+ # Application bundles require building through Xcode
+ app_bundle:!macx-xcode {
# For Qt applications we want Xcode project files as the generated output,
# but since qmake doesn't handle the transition between makefiles and Xcode
# project files (which happens when using subdirs), we create a wrapper
diff --git a/mkspecs/features/ios/qt.prf b/mkspecs/features/ios/qt.prf
index 79bc9a8f46..9fa882c99f 100644
--- a/mkspecs/features/ios/qt.prf
+++ b/mkspecs/features/ios/qt.prf
@@ -1,5 +1,8 @@
equals(TEMPLATE, app):contains(QT, gui(-private)?) {
+ !macx-xcode: \
+ error("Linking the iOS platform plugin requires bulding through Xcode")
+
LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms
lib_name = qios
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index ff7779f79f..cf69bfe987 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -912,9 +912,10 @@ static inline QString toString(debugOption option)
{
switch (option) {
case debugUnknown:
- case debugDisabled:
case debugLineInfoOnly:
break;
+ case debugDisabled:
+ return "None";
case debugOldStyleInfo:
return "OldStyle";
case debugEditAndContinue:
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index dff437c3d8..11af4d4280 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -141,26 +141,31 @@ public class QtActivityDelegate
}
}
- // case status
- private final int ImhNoAutoUppercase = 0x2;
- private final int ImhPreferUppercase = 0x8;
- @SuppressWarnings("unused")
- private final int ImhPreferLowercase = 0x10;
- private final int ImhUppercaseOnly = 0x40000;
- private final int ImhLowercaseOnly = 0x80000;
-
- // options
- private final int ImhNoPredictiveText = 0x20;
- // layout
+ // input method hints - must be kept in sync with QTDIR/src/corelib/global/qnamespace.h
private final int ImhHiddenText = 0x1;
- private final int ImhPreferNumbers = 0x4;
+ private final int ImhSensitiveData = 0x2;
+ private final int ImhNoAutoUppercase = 0x4;
+ private final int ImhPreferNumbers = 0x8;
+ private final int ImhPreferUppercase = 0x10;
+ private final int ImhPreferLowercase = 0x20;
+ private final int ImhNoPredictiveText = 0x40;
+
+ private final int ImhDate = 0x80;
+ private final int ImhTime = 0x100;
+
+ private final int ImhPreferLatin = 0x200;
+
private final int ImhMultiLine = 0x400;
+
private final int ImhDigitsOnly = 0x10000;
private final int ImhFormattedNumbersOnly = 0x20000;
+ private final int ImhUppercaseOnly = 0x40000;
+ private final int ImhLowercaseOnly = 0x80000;
private final int ImhDialableCharactersOnly = 0x100000;
private final int ImhEmailCharactersOnly = 0x200000;
private final int ImhUrlCharactersOnly = 0x400000;
+ private final int ImhLatinOnly = 0x800000;
// application state
private final int ApplicationSuspended = 0x0;
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index f5bfe7e029..1385c90e3e 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -297,8 +297,8 @@ public class QtNative
if (action == MotionEvent.ACTION_MOVE) {
int hsz = event.getHistorySize();
if (hsz > 0) {
- if (Math.abs(event.getX(index) - event.getHistoricalX(index, hsz-1)) > 1
- || Math.abs(event.getY(index) - event.getHistoricalY(index, hsz-1)) > 1) {
+ if (event.getX(index) != event.getHistoricalX(index, hsz-1)
+ || event.getY(index) != event.getHistoricalY(index, hsz-1)) {
return 1;
} else {
return 2;
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 65bffd87bd..1ed55bb0c8 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -47,9 +47,9 @@ mac|darwin {
!ios {
LIBS_PRIVATE += -framework ApplicationServices
LIBS_PRIVATE += -framework CoreServices
- LIBS_PRIVATE += -framework Foundation
}
LIBS_PRIVATE += -framework CoreFoundation
+ LIBS += -framework Foundation
}
win32:DEFINES-=QT_NO_CAST_TO_ASCII
DEFINES += $$MODULE_DEFINES
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index ba84dd109e..17dd600265 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -279,11 +279,6 @@
#define QT_NO_DRAGANDDROP
#endif
-// QFileSystemModel
-#if !defined(QT_NO_FILESYSTEMMODEL) && (defined(QT_NO_FILESYSTEMWATCHER))
-#define QT_NO_FILESYSTEMMODEL
-#endif
-
// File Transfer Protocol
#if !defined(QT_NO_FTP) && (defined(QT_NO_TEXTDATE))
#define QT_NO_FTP
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 814e95c256..ec54c7bdbf 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -202,7 +202,7 @@ SeeAlso: ???
Feature: FILESYSTEMMODEL
Description: Provides a data model for the local filesystem.
Section: File I/O
-Requires: FILESYSTEMWATCHER
+Requires:
Name: QFileSystemModel
SeeAlso: ???
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index c0709ce258..694935b326 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -869,6 +869,7 @@ static void android_default_message_handler(QtMsgType type,
{
android_LogPriority priority;
switch (type) {
+ case QtTraceMsg:
case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break;
case QtWarningMsg: priority = ANDROID_LOG_WARN; break;
case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break;
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index cd30533ff8..5af398c360 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -515,6 +515,14 @@ inline void QDirPrivate::initFileEngine()
*/
/*!
+ \fn QDir &QDir::operator=(QDir &&other)
+
+ Move-assigns \a other to this QDir instance.
+
+ \since 5.2
+*/
+
+/*!
\internal
*/
QDir::QDir(QDirPrivate &p) : d_ptr(&p)
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 1d5f16c9d9..d1b7ebac65 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -294,6 +294,14 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
*/
/*!
+ \fn QFileInfo &QFileInfo::operator=(QFileInfo &&other)
+
+ Move-assigns \a other to this QFileInfo instance.
+
+ \since 5.2
+*/
+
+/*!
\internal
*/
QFileInfo::QFileInfo(QFileInfoPrivate *p) : d_ptr(p)
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 790fb954d9..20dfe433ec 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -168,8 +168,8 @@ Q_SIGNALS:
void directoryChanged(const QString &path, bool removed);
};
-#endif // QT_NO_FILESYSTEMWATCHER
-
QT_END_NAMESPACE
+#endif // QT_NO_FILESYSTEMWATCHER
+
#endif // QFILESYSTEMWATCHER_WIN_P_H
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 80acee6ad1..24eeb1584c 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -98,13 +98,28 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
*/
/*!
+ \internal
+*/
+typedef QVector<QTracer *> Tracers;
+
+/*!
+ \internal
+*/
+class QLoggingCategoryPrivate
+{
+public:
+ Tracers tracers;
+};
+
+/*!
Constructs a QLoggingCategory object with the provided \a category name.
The object becomes the local identifier for the category.
If \a category is \c{0}, the category name is changed to \c{"default"}.
*/
QLoggingCategory::QLoggingCategory(const char *category)
- : name(0),
+ : d(new QLoggingCategoryPrivate),
+ name(0),
enabledDebug(false),
enabledWarning(true),
enabledCritical(true),
@@ -133,6 +148,7 @@ QLoggingCategory::~QLoggingCategory()
{
if (QLoggingRegistry *reg = QLoggingRegistry::instance())
reg->unregisterCategory(this);
+ delete d;
}
/*!
@@ -459,7 +475,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
void QTracer::addToCategory(QLoggingCategory &category)
{
- category.tracers.append(this);
+ category.d->tracers.append(this);
}
/*!
@@ -571,7 +587,7 @@ void QTracer::addToCategory(QLoggingCategory &category)
void QTraceGuard::start()
{
- QLoggingCategory::Tracers &tracers = target->tracers;
+ const Tracers &tracers = target->d->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->start();
}
@@ -584,7 +600,7 @@ void QTraceGuard::start()
void QTraceGuard::end()
{
- QLoggingCategory::Tracers &tracers = target->tracers;
+ const Tracers &tracers = target->d->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->end();
}
@@ -599,7 +615,7 @@ void QTraceGuard::end()
QTraceGuard &QTraceGuard::operator<<(int msg)
{
- QLoggingCategory::Tracers &tracers = target->tracers;
+ const Tracers &tracers = target->d->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
@@ -614,7 +630,7 @@ QTraceGuard &QTraceGuard::operator<<(int msg)
QTraceGuard &QTraceGuard::operator<<(const char *msg)
{
- QLoggingCategory::Tracers &tracers = target->tracers;
+ const Tracers &tracers = target->d->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
@@ -630,7 +646,7 @@ QTraceGuard &QTraceGuard::operator<<(const char *msg)
QTraceGuard &QTraceGuard::operator<<(const QVariant &msg)
{
- QLoggingCategory::Tracers &tracers = target->tracers;
+ const Tracers &tracers = target->d->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 23b25b5e3f..70192fef13 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
class QTracer;
class QTraceGuard;
+class QLoggingCategoryPrivate;
class Q_CORE_EXPORT QLoggingCategory
{
@@ -80,18 +81,18 @@ public:
static void setFilterRules(const QString &rules);
private:
+ friend class QLoggingCategoryPrivate;
friend class QLoggingRegistry;
friend class QTraceGuard;
friend class QTracer;
+ QLoggingCategoryPrivate *d;
const char *name;
bool enabledDebug;
bool enabledWarning;
bool enabledCritical;
bool enabledTrace;
- typedef QVector<QTracer *> Tracers;
- Tracers tracers;
};
template <>
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 7f4d7f0313..fb86b053e9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -854,8 +854,7 @@ void QProcessPrivate::cleanup()
pid = 0;
}
if (processFinishedNotifier) {
- processFinishedNotifier->setEnabled(false);
- qDeleteInEventHandler(processFinishedNotifier);
+ delete processFinishedNotifier;
processFinishedNotifier = 0;
}
@@ -865,33 +864,28 @@ void QProcessPrivate::cleanup()
dying = false;
if (stdoutChannel.notifier) {
- stdoutChannel.notifier->setEnabled(false);
- qDeleteInEventHandler(stdoutChannel.notifier);
+ delete stdoutChannel.notifier;
stdoutChannel.notifier = 0;
}
if (stderrChannel.notifier) {
- stderrChannel.notifier->setEnabled(false);
- qDeleteInEventHandler(stderrChannel.notifier);
+ delete stderrChannel.notifier;
stderrChannel.notifier = 0;
}
if (stdinChannel.notifier) {
- stdinChannel.notifier->setEnabled(false);
- qDeleteInEventHandler(stdinChannel.notifier);
+ delete stdinChannel.notifier;
stdinChannel.notifier = 0;
}
if (startupSocketNotifier) {
- startupSocketNotifier->setEnabled(false);
- qDeleteInEventHandler(startupSocketNotifier);
+ delete startupSocketNotifier;
startupSocketNotifier = 0;
}
if (deathNotifier) {
- deathNotifier->setEnabled(false);
- qDeleteInEventHandler(deathNotifier);
+ delete deathNotifier;
deathNotifier = 0;
}
#ifdef Q_OS_WIN
if (notifier) {
- qDeleteInEventHandler(notifier);
+ delete notifier;
notifier = 0;
}
#endif
@@ -1161,12 +1155,8 @@ void QProcessPrivate::closeWriteChannel()
qDebug("QProcessPrivate::closeWriteChannel()");
#endif
if (stdinChannel.notifier) {
- extern void qDeleteInEventHandler(QObject *o);
- stdinChannel.notifier->setEnabled(false);
- if (stdinChannel.notifier) {
- qDeleteInEventHandler(stdinChannel.notifier);
- stdinChannel.notifier = 0;
- }
+ delete stdinChannel.notifier;
+ stdinChannel.notifier = 0;
}
#ifdef Q_OS_WIN
// ### Find a better fix, feeding the process little by little
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 291ea319ec..dba9f62b98 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -654,11 +654,11 @@ bool QProcessPrivate::drainOutputPipes()
bool readOperationActive = false;
if (stdoutReader) {
readyReadEmitted |= stdoutReader->waitForReadyRead(0);
- readOperationActive = stdoutReader->isReadOperationActive();
+ readOperationActive = stdoutReader && stdoutReader->isReadOperationActive();
}
if (stderrReader) {
readyReadEmitted |= stderrReader->waitForReadyRead(0);
- readOperationActive |= stderrReader->isReadOperationActive();
+ readOperationActive |= stderrReader && stderrReader->isReadOperationActive();
}
someReadyReadEmitted |= readyReadEmitted;
if (!readOperationActive || !readyReadEmitted)
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 9ce14f1851..1d410862f0 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -450,7 +450,7 @@ QWinSettingsPrivate::QWinSettingsPrivate(QString rPath)
regList.append(RegistryKey(HKEY_CLASSES_ROOT, QString(), false));
else if (rPath.startsWith(QLatin1String("HKEY_USERS\\")))
regList.append(RegistryKey(HKEY_USERS, rPath.mid(11), false));
- else if (rPath == QLatin1String(QLatin1String("HKEY_USERS")))
+ else if (rPath == QLatin1String("HKEY_USERS"))
regList.append(RegistryKey(HKEY_USERS, QString(), false));
else
regList.append(RegistryKey(HKEY_LOCAL_MACHINE, rPath, false));
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 755c31f371..f21403d7f1 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -299,7 +299,13 @@ bool QTemporaryDir::remove()
Q_ASSERT(!path().isEmpty());
Q_ASSERT(path() != QLatin1String("."));
- return QDir(path()).removeRecursively();
+ const bool result = QDir(path()).removeRecursively();
+ if (!result) {
+ qWarning() << "QTemporaryDir: Unable to remove"
+ << QDir::toNativeSeparators(path())
+ << "most likely due to the presence of read-only files.";
+ }
+ return result;
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 5535ae126a..d14add36a5 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -363,6 +363,23 @@
\sa QUrl::FormattingOptions
*/
+/*!
+ \fn QUrl::QUrl(QUrl &&other)
+
+ Move-constructs a QUrl instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
+ \fn QUrl &QUrl::operator=(QUrl &&other)
+
+ Move-assigns \a other to this QUrl instance.
+
+ \since 5.2
+*/
+
#include "qurl.h"
#include "qurl_p.h"
#include "qplatformdefs.h"
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index f6b5cd44bd..f773af1433 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -139,6 +139,14 @@ QT_BEGIN_NAMESPACE
\sa QUrl
*/
+/*!
+ \fn QUrlQuery &QUrlQuery::operator=(QUrlQuery &&other)
+
+ Move-assigns \a other to this QUrlQuery instance.
+
+ \since 5.2
+*/
+
typedef QList<QPair<QString, QString> > Map;
class QUrlQueryPrivate : public QSharedData
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 2ea560e611..2238902abc 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -107,6 +107,23 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
\sa {Model/View Programming}, QModelIndex, QAbstractItemModel
*/
+/*!
+ \fn QPersistentModelIndex::QPersistentModelIndex(QPersistentModelIndex &&other)
+
+ Move-constructs a QPersistentModelIndex instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
+ \fn QPersistentModelIndex &QPersistentModelIndex::operator=(QPersistentModelIndex &&other)
+
+ Move-assigns \a other to this QPersistentModelIndex instance.
+
+ \since 5.2
+*/
+
/*!
\fn QPersistentModelIndex::QPersistentModelIndex()
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 8617b17419..8ae3057f3e 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -54,6 +54,7 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qhash.h>
+#include <qmutex.h>
#include <private/qprocess_p.h>
#include <qstandardpaths.h>
#include <qtextcodec.h>
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 667c490d31..71d8d99a91 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -103,18 +103,23 @@ QT_BEGIN_NAMESPACE
\section1 Accuracy and Timer Resolution
- Timers will never time out earlier than the specified timeout value
- and they are not guaranteed to time out at the exact value specified.
- In many situations, they may time out late by a period of time that
- depends on the accuracy of the system timers.
-
The accuracy of timers depends on the underlying operating system
and hardware. Most platforms support a resolution of 1 millisecond,
though the accuracy of the timer will not equal this resolution
in many real-world situations.
- If Qt is unable to deliver the requested number of timer clicks,
- it will silently discard some.
+ The accuracy also depends on the \l{Qt::TimerType}{timer type}. For
+ Qt::PreciseTimer, QTimer will try to keep the accurance at 1 millisecond.
+ Precise timers will also never time out earlier than expected.
+
+ For Qt::CoarseTimer and Qt::VeryCoarseTimer types, QTimer may wake up
+ earlier than expected, within the margins for those types: 5% of the
+ interval for Qt::CoarseTimer and 500 ms for Qt::VeryCoarseTimer.
+
+ All timer types may time out later than expected if the system is busy or
+ unable to provide the requested accuracy. In such a case of timeout
+ overrun, Qt will emit activated() only once, even if multiple timeouts have
+ expired, and then will resume the original interval.
\section1 Alternatives to QTimer
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 75e945a0cc..a7c0bd2321 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1105,6 +1105,23 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
*/
/*!
+ \fn QVariant::QVariant(QVariant &&other)
+
+ Move-constructs a QVariant instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
+ \fn QVariant &QVariant::operator=(QVariant &&other)
+
+ Move-assigns \a other to this QVariant instance.
+
+ \since 5.2
+*/
+
+/*!
\fn QVariant::QVariant()
Constructs an invalid variant.
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 4dec1ab696..31237797df 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -109,6 +109,14 @@ void QMimeTypePrivate::addGlobPattern(const QString &pattern)
*/
/*!
+ \fn QMimeType &QMimeType::operator=(QMimeType &&other)
+
+ Move-assigns \a other to this QMimeType instance.
+
+ \since 5.2
+*/
+
+/*!
\fn QMimeType::QMimeType();
Constructs this QMimeType object initialized with default property values that indicate an invalid MIME type.
*/
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index da2f48c071..4f1fce3077 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -110,6 +110,23 @@ QT_BEGIN_NAMESPACE
\sa QByteArray, QVector
*/
+/*!
+ \fn QBitArray::QBitArray(QBitArray &&other)
+
+ Move-constructs a QBitArray instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
+ \fn QBitArray &QBitArray::operator=(QBitArray &&other)
+
+ Move-assigns \a other to this QBitArray instance.
+
+ \since 5.2
+*/
+
/*! \fn QBitArray::QBitArray()
Constructs an empty bit array.
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 975894a516..92d0d30f54 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -910,6 +910,15 @@ static inline char qToLower(char c)
\sa operator=()
*/
+/*!
+ \fn QByteArray::QByteArray(QByteArray &&other)
+
+ Move-constructs a QByteArray instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QByteArray::QByteArray(QByteArrayDataPtr dd)
\internal
@@ -965,6 +974,14 @@ QByteArray &QByteArray::operator=(const char *str)
return *this;
}
+/*!
+ \fn QByteArray &QByteArray::operator=(QByteArray &&other)
+
+ Move-assigns \a other to this QByteArray instance.
+
+ \since 5.2
+*/
+
/*! \fn void QByteArray::swap(QByteArray &other)
\since 4.8
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index b30f7d25b4..9827547c56 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -88,6 +88,14 @@ public:
*/
/*!
+ \fn QCommandLineOption &QCommandLineOption::operator=(QCommandLineOption &&other)
+
+ Move-assigns \a other to this QCommandLineOption instance.
+
+ \since 5.2
+*/
+
+/*!
Constructs a command line option object with the given arguments.
The name of the option is set to \a name.
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index b92c4d3fe9..6ccdb7b771 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -202,6 +202,14 @@ MyRecord record(int row) const
Assigns \a other to this cache and returns a reference to this cache.
*/
+/*!
+ \fn QContiguousCache<T> &QContiguousCache::operator=(QContiguousCache<T> &&other)
+
+ Move-assigns \a other to this QContiguousCache instance.
+
+ \since 5.2
+*/
+
/*! \fn void QContiguousCache::swap(QContiguousCache<T> &other)
\since 4.8
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index d64d929d5a..4839560c51 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2224,7 +2224,7 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus)
#endif // Q_OS_WINCE
}
-// Calls the platform variant of mktime for the given date and time,
+// Calls the platform variant of mktime for the given date, time and daylightStatus,
// and updates the date, time, daylightStatus and abbreviation with the returned values
// If the date falls outside the 1970 to 2037 range supported by mktime / time_t
// then null date/time will be returned, you should adjust the date first if
@@ -2288,7 +2288,10 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat
local.tm_year = yy - 1900;
local.tm_wday = 0;
local.tm_yday = 0;
- local.tm_isdst = -1;
+ if (daylightStatus)
+ local.tm_isdst = int(*daylightStatus);
+ else
+ local.tm_isdst = -1;
#if defined(Q_OS_WIN)
int hh = local.tm_hour;
#endif // Q_OS_WIN
@@ -2481,7 +2484,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
// Convert a LocalTime expressed in local msecs encoding into a UTC epoch msecs
// Optionally populate the returned values from mktime for the adjusted local
-// date and time and daylight status
+// date and time and daylight status. Uses daylightStatus in calculation if populated.
static qint64 localMSecsToEpochMSecs(qint64 localMsecs, QDate *localDate = 0, QTime *localTime = 0,
QDateTimePrivate::DaylightStatus *daylightStatus = 0,
QString *abbreviation = 0, bool *ok = 0)
@@ -2614,6 +2617,7 @@ void QDateTimePrivate::setTimeSpec(Qt::TimeSpec spec, int offsetSeconds)
{
clearValidDateTime();
clearTimeZoneCached();
+ clearSetToDaylightStatus();
#ifndef QT_BOOTSTRAPPED
m_timeZone = QTimeZone();
@@ -2688,6 +2692,30 @@ void QDateTimePrivate::getDateTime(QDate *date, QTime *time) const
*time = QTime();
}
+// Set the Daylight Status if LocalTime set via msecs
+void QDateTimePrivate::setDaylightStatus(QDateTimePrivate::DaylightStatus status)
+{
+ if (status == DaylightTime) {
+ m_status = m_status & ~SetToStandardTime;
+ m_status = m_status | SetToDaylightTime;
+ } else if (status == StandardTime) {
+ m_status = m_status & ~SetToDaylightTime;
+ m_status = m_status | SetToStandardTime;
+ } else {
+ clearSetToDaylightStatus();
+ }
+}
+
+// Get the Daylight Status if LocalTime set via msecs
+QDateTimePrivate::DaylightStatus QDateTimePrivate::daylightStatus() const
+{
+ if ((m_status & SetToDaylightTime) == SetToDaylightTime)
+ return DaylightTime;
+ if ((m_status & SetToStandardTime) == SetToStandardTime)
+ return StandardTime;
+ return UnknownDaylightTime;
+}
+
// Check the UTC / offsetFromUTC validity
void QDateTimePrivate::checkValidDateTime()
{
@@ -2748,12 +2776,14 @@ void QDateTimePrivate::refreshDateTime()
QDate testDate;
QTime testTime;
qint64 epochMSecs = 0;
+ if (m_spec == Qt::LocalTime) {
+ DaylightStatus status = daylightStatus();
+ epochMSecs = localMSecsToEpochMSecs(m_msecs, &testDate, &testTime, &status);
#ifndef QT_BOOTSTRAPPED
- if (m_spec == Qt::TimeZone)
+ } else {
epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime);
- else
#endif // QT_BOOTSTRAPPED
- epochMSecs = localMSecsToEpochMSecs(m_msecs, &testDate, &testTime);
+ }
if (testDate == date && testTime == time) {
setValidDateTime();
// Cache the offset to use in toMSecsSinceEpoch()
@@ -3189,7 +3219,8 @@ QString QDateTime::timeZoneAbbreviation() const
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
QString abbrev;
- localMSecsToEpochMSecs(d->m_msecs, 0, 0, 0, &abbrev);
+ QDateTimePrivate::DaylightStatus status = d->daylightStatus();
+ localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, &abbrev);
return abbrev;
}
}
@@ -3218,8 +3249,9 @@ bool QDateTime::isDaylightTime() const
return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
- QDateTimePrivate::DaylightStatus status;
- localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, 0);
+ QDateTimePrivate::DaylightStatus status = d->daylightStatus();
+ if (status == QDateTimePrivate::UnknownDaylightTime)
+ localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, 0);
return (status == QDateTimePrivate::DaylightTime);
}
}
@@ -3424,8 +3456,10 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
case Qt::LocalTime: {
QDate dt;
QTime tm;
- epochMSecsToLocalTime(msecs, &dt, &tm);
+ QDateTimePrivate::DaylightStatus status;
+ epochMSecsToLocalTime(msecs, &dt, &tm, &status);
d->setDateTime(dt, tm);
+ d->setDaylightStatus(status);
break;
}
}
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index f52108d764..70771844d6 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -77,10 +77,10 @@ public:
// Daylight Time Status
enum DaylightStatus {
- NoDaylightTime,
- UnknownDaylightTime,
- StandardTime,
- DaylightTime
+ NoDaylightTime = -2,
+ UnknownDaylightTime = -1,
+ StandardTime = 0,
+ DaylightTime = 1
};
// Status of date/time
@@ -90,7 +90,9 @@ public:
ValidDate = 0x04,
ValidTime = 0x08,
ValidDateTime = 0x10,
- TimeZoneCached = 0x20
+ TimeZoneCached = 0x20,
+ SetToStandardTime = 0x40,
+ SetToDaylightTime = 0x80
};
Q_DECLARE_FLAGS(StatusFlags, StatusFlag)
@@ -129,6 +131,9 @@ public:
void setDateTime(const QDate &date, const QTime &time);
void getDateTime(QDate *date, QTime *time) const;
+ void setDaylightStatus(DaylightStatus status);
+ DaylightStatus daylightStatus() const;
+
// Returns msecs since epoch, assumes offset value is current
inline qint64 toMSecsSinceEpoch() const { return (m_msecs - (m_offsetFromUtc * 1000)); }
@@ -146,6 +151,7 @@ public:
inline bool isTimeZoneCached() const { return (m_status & TimeZoneCached) == TimeZoneCached; }
inline void setTimeZoneCached() { m_status = m_status | TimeZoneCached; }
inline void clearTimeZoneCached() { m_status = m_status & ~TimeZoneCached; }
+ inline void clearSetToDaylightStatus() { m_status = m_status & ~SetToStandardTime & ~SetToDaylightTime; }
#ifndef QT_BOOTSTRAPPED
static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone,
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 23451f095c..fc9a1ca867 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1066,6 +1066,15 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type)
}
/*!
+ \fn QEasingCurve::QEasingCurve(QEasingCurve &&other)
+
+ Move-constructs a QEasingCurve instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
Constructs an easing curve of the given \a type.
*/
QEasingCurve::QEasingCurve(Type type)
@@ -1098,6 +1107,14 @@ QEasingCurve::~QEasingCurve()
*/
/*!
+ \fn QEasingCurve &QEasingCurve::operator=(QEasingCurve &&other)
+
+ Move-assigns \a other to this QEasingCurve instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QEasingCurve::swap(QEasingCurve &other)
\since 5.0
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 4b9d120bb3..b6257c8907 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -941,6 +941,15 @@ void QHashData::checkSanity()
\sa clear()
*/
+/*!
+ \fn QHash::QHash(QHash<Key, T> &&other)
+
+ Move-constructs a QHash instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QHash::QHash(std::initializer_list<std::pair<Key,T> > list)
\since 5.1
@@ -974,6 +983,14 @@ void QHashData::checkSanity()
Assigns \a other to this hash and returns a reference to this hash.
*/
+/*!
+ \fn QHash<Key, T> &QHash::operator=(QHash<Key, T> &&other)
+
+ Move-assigns \a other to this QHash instance.
+
+ \since 5.2
+*/
+
/*! \fn void QHash::swap(QHash<Key, T> &other)
\since 4.8
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index 6e7a7a2635..c6e79c02a3 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -125,6 +125,15 @@ const QLinkedListData QLinkedListData::shared_null = {
Constructs an empty list.
*/
+/*!
+ \fn QLinkedList::QLinkedList(QLinkedList<T> &&other)
+
+ Move-constructs a QLinkedList instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QLinkedList::QLinkedList(const QLinkedList<T> &other)
Constructs a copy of \a other.
@@ -740,6 +749,14 @@ const QLinkedListData QLinkedListData::shared_null = {
Assigns \a other to this iterator.
*/
+/*!
+ \fn QLinkedList<T> &QLinkedList::operator=(QLinkedList<T> &&other)
+
+ Move-assigns \a other to this QLinkedList instance.
+
+ \since 5.2
+*/
+
/*! \fn T &QLinkedList::iterator::operator*() const
Returns a modifiable reference to the current item.
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 760c944c29..4770054d79 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -480,6 +480,15 @@ void **QListData::erase(void **xi)
*/
/*!
+ \fn QList::QList(QList<T> &&other)
+
+ Move-constructs a QList instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
\fn QList<T> QList<T>::mid(int pos, int length) const
Returns a list whose elements are copied from this list,
@@ -527,6 +536,14 @@ void **QListData::erase(void **xi)
list.
*/
+/*!
+ \fn QList &QList::operator=(QList<T> &&other)
+
+ Move-assigns \a other to this QList instance.
+
+ \since 5.2
+*/
+
/*! \fn void QList::swap(QList<T> &other)
\since 4.8
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index 71b90bcada..01a6a22631 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -516,6 +516,15 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa clear()
*/
+/*!
+ \fn QMap::QMap(QMap<Key, T> &&other)
+
+ Move-constructs a QMap instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QMap::QMap(const QMap<Key, T> &other)
Constructs a copy of \a other.
@@ -567,6 +576,14 @@ void QMapDataBase::freeData(QMapDataBase *d)
Assigns \a other to this map and returns a reference to this map.
*/
+/*!
+ \fn QMap<Key, T> &QMap::operator=(QMap<Key, T> &&other)
+
+ Move-assigns \a other to this QMap instance.
+
+ \since 5.2
+*/
+
/*! \fn void QMap::swap(QMap<Key, T> &other)
\since 4.8
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index ef2dba5700..5debb1a238 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -4013,6 +4013,14 @@ QRegExp &QRegExp::operator=(const QRegExp &rx)
}
/*!
+ \fn QRegExp &QRegExp::operator=(QRegExp &&other)
+
+ Move-assigns \a other to this QRegExp instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QRegExp::swap(QRegExp &other)
\since 4.8
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index fb0025c1ff..e0c369ecad 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
QScopedPointer guarantees that the object pointed to will get deleted when
the current scope disappears.
- Consider this function which does heap allocations, and have various exit points:
+ Consider this function which does heap allocations, and has various exit points:
\snippet code/src_corelib_tools_qscopedpointer.cpp 0
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index cee0c1d450..0afda357a6 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -306,6 +306,14 @@ QT_BEGIN_NAMESPACE
data pointer in \a other.
*/
+/*!
+ \fn QSharedDataPointer<T> &QSharedDataPointer::operator=(QSharedDataPointer<T> &&other)
+
+ Move-assigns \a other to this QSharedDataPointer instance.
+
+ \since 5.2
+*/
+
/*! \fn bool QSharedDataPointer::operator==(const QSharedDataPointer<T>& other) const
Returns true if \a other and \e this have the same \e{d pointer}.
This function does \e not call detach().
@@ -320,6 +328,15 @@ QT_BEGIN_NAMESPACE
Constructs a QSharedDataPointer initialized with a null \e{d pointer}.
*/
+/*!
+ \fn QSharedDataPointer::QSharedDataPointer(QSharedDataPointer &&o)
+
+ Move-constructs a QSharedDataPointer instance, making it point at the same
+ object that \a o was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QSharedDataPointer::~QSharedDataPointer()
Decrements the reference count of the shared data object.
If the reference count becomes 0, the shared data object
@@ -465,6 +482,14 @@ QT_BEGIN_NAMESPACE
Returns true if \a other and \e this have the same \e{d pointer}.
*/
+/*!
+ \fn QExplicitlySharedDataPointer<T> &QExplicitlySharedDataPointer::operator=(QExplicitlySharedDataPointer<T> &&other)
+
+ Move-assigns \a other to this QExplicitlySharedDataPointer instance.
+
+ \since 5.2
+*/
+
/*! \fn bool QExplicitlySharedDataPointer::operator==(const T* ptr) const
Returns true if the \e{d pointer} of \e this is \a ptr.
*/
@@ -489,6 +514,15 @@ QT_BEGIN_NAMESPACE
is deleted. \e This is then destroyed.
*/
+/*!
+ \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o)
+
+ Move-constructs a QExplicitlySharedDataPointer instance, making it point at the same
+ object that \a o was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(T* sharedData)
Constructs a QExplicitlySharedDataPointer with \e{d pointer}
set to \a sharedData and increments \a{sharedData}'s reference
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 239cf0446a..1ba9e81b59 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -929,6 +929,15 @@ const QString::Null QString::null = { };
\sa isEmpty()
*/
+/*!
+ \fn QString::QString(QString &&other)
+
+ Move-constructs a QString instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QString::QString(const char *str)
Constructs a string initialized with the 8-bit string \a str. The
@@ -1349,6 +1358,13 @@ QString &QString::operator=(const QString &other)
return *this;
}
+/*!
+ \fn QString &QString::operator=(QString &&other)
+
+ Move-assigns \a other to this QString instance.
+
+ \since 5.2
+*/
/*! \fn QString &QString::operator=(QLatin1String str)
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 890798b421..860ad180f1 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -425,6 +425,15 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other)
}
/*!
+ \fn QTimeZone &QTimeZone::operator=(QTimeZone &&other)
+
+ Move-assigns \a other to this QTimeZone instance, transferring the
+ ownership of the managed pointer to this instance.
+
+ \since 5.2
+*/
+
+/*!
Returns true if this time zone is equal to the \a other time zone.
*/
diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp
index 51300c0cad..c219a49e1e 100644
--- a/src/corelib/tools/qtimezoneprivate_win.cpp
+++ b/src/corelib/tools/qtimezoneprivate_win.cpp
@@ -106,17 +106,6 @@ static QDate msecsToDate(qint64 msecs)
return QDate::fromJulianDay(jd);
}
-static SYSTEMTIME msecsToSystemtime(qint64 forMSecsSinceEpoch)
-{
- FILETIME utcFileTime;
- ULONGLONG nsecs = (forMSecsSinceEpoch * 10000 ) + FILETIME_UNIX_EPOCH;
- utcFileTime.dwLowDateTime = (DWORD) (nsecs & 0xFFFFFFFF);
- utcFileTime.dwHighDateTime = (DWORD) (nsecs >> 32);
- SYSTEMTIME utcTime;
- FileTimeToSystemTime(&utcFileTime, &utcTime);
- return utcTime;
-}
-
static qint64 systemtimeToMsecs(const SYSTEMTIME &systemtime)
{
FILETIME utcFileTime;
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index 93aa5e993e..4452bcf1cd 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -70,8 +70,8 @@
structure. The main differences between the two classes are:
\list
- \li QVarLengthArray's API is much more low-level. It provides no
- iterators and lacks much of QVector's functionality.
+ \li QVarLengthArray's API is much more low-level and it lacks
+ some of QVector's functionality.
\li QVarLengthArray doesn't initialize the memory if the value is
a basic type. (QVector always does.)
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index a443a6b4e8..8982e797d9 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -195,6 +195,15 @@
\sa resize()
*/
+/*!
+ \fn QVector::QVector(QVector<T> &&other)
+
+ Move-constructs a QVector instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
/*! \fn QVector::QVector(int size)
Constructs a vector with an initial size of \a size elements.
@@ -246,6 +255,14 @@
vector.
*/
+/*!
+ \fn QVector<T> &QVector::operator=(QVector<T> &&other)
+
+ Move-assigns \a other to this QVector instance.
+
+ \since 5.2
+*/
+
/*! \fn void QVector::swap(QVector<T> &other)
\since 4.8
diff --git a/src/dbus/qdbusxmlparser.cpp b/src/dbus/qdbusxmlparser.cpp
index 5aefbb2be2..82d95a5c1b 100644
--- a/src/dbus/qdbusxmlparser.cpp
+++ b/src/dbus/qdbusxmlparser.cpp
@@ -103,7 +103,7 @@ static bool parseAnnotation(const QXmlStreamReader &xml, QDBusIntrospection::Ann
annotations.insert(name, value);
if (!interfaceAnnotation)
ifaceData->introspection += QLatin1String(" ");
- ifaceData->introspection += QLatin1String(" <annotation value=\"") + value + QLatin1String("\" name=\"") + name + QLatin1String("\"/>\n");
+ ifaceData->introspection += QLatin1String(" <annotation value=\"") + value.toHtmlEscaped() + QLatin1String("\" name=\"") + name + QLatin1String("\"/>\n");
return true;
}
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
index f30f88ccb7..b79a30f37b 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -107,79 +107,20 @@ void updateAllWidgets()
//! [6]
-int main(int argc, char *argv[])
-{
- QApplication::setDesktopSettingsAware(false);
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [6]
-
-
-//! [7]
if ((startPos - currentPos).manhattanLength() >=
QApplication::startDragDistance())
startTheDrag();
-//! [7]
-
-
-//! [8]
-void MyApplication::commitData(QSessionManager& manager)
-{
- if (manager.allowsInteraction()) {
- int ret = QMessageBox::warning(
- mainWindow,
- tr("My Application"),
- tr("Save changes to document?"),
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
-
- switch (ret) {
- case QMessageBox::Save:
- manager.release();
- if (!saveDocument())
- manager.cancel();
- break;
- case QMessageBox::Discard:
- break;
- case QMessageBox::Cancel:
- default:
- manager.cancel();
- }
- } else {
- // we did not get permission to interact, then
- // do something reasonable instead
- }
-}
-//! [8]
-
-
-//! [9]
-appname -session id
-//! [9]
-
-
-//! [10]
-foreach (const QString &command, mySession.restartCommand())
- do_something(command);
-//! [10]
-
-
-//! [11]
-foreach (const QString &command, mySession.discardCommand())
- do_something(command);
-//! [11]
-
+//! [6]
-//! [12]
+//! [7]
QWidget *widget = qApp->widgetAt(x, y);
if (widget)
widget = widget->window();
-//! [12]
+//! [7]
-//! [13]
+//! [8]
QWidget *widget = qApp->widgetAt(point);
if (widget)
widget = widget->window();
-//! [13]
+//! [8]
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
new file mode 100644
index 0000000000..914748b7dd
--- /dev/null
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+int main(int argc, char *argv[])
+{
+ QApplication::setDesktopSettingsAware(false);
+ QApplication app(argc, argv);
+ ...
+ return app.exec();
+}
+//! [0]
+
+
+//! [1]
+MyMainWidget::MyMainWidget(QWidget *parent)
+ :QWidget(parent)
+{
+ connect(qApp, SIGNAL(commitDataRequest(QSessionManager)), SLOT(commitData(QSessionManager)));
+}
+
+void MyMainWidget::commitData(QSessionManager& manager)
+{
+ if (manager.allowsInteraction()) {
+ int ret = QMessageBox::warning(
+ mainWindow,
+ tr("My Application"),
+ tr("Save changes to document?"),
+ QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+
+ switch (ret) {
+ case QMessageBox::Save:
+ manager.release();
+ if (!saveDocument())
+ manager.cancel();
+ break;
+ case QMessageBox::Discard:
+ break;
+ case QMessageBox::Cancel:
+ default:
+ manager.cancel();
+ }
+ } else {
+ // we did not get permission to interact, then
+ // do something reasonable instead
+ }
+}
+//! [1]
+
+
+//! [2]
+appname -session id
+//! [2]
+
+
+//! [3]
+foreach (const QString &command, mySession.restartCommand())
+ do_something(command);
+//! [3]
+
+
+//! [4]
+foreach (const QString &command, mySession.discardCommand())
+ do_something(command);
+//! [4]
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp
index b136c2ad51..b136c2ad51 100644
--- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index cb508ae6c7..5a37a8fecf 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -644,6 +644,14 @@ QIcon &QIcon::operator=(const QIcon &other)
}
/*!
+ \fn QIcon &QIcon::operator=(QIcon &&other)
+
+ Move-assigns \a other to this QIcon instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QIcon::swap(QIcon &other)
\since 4.8
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 3d6315a7fe..28af8adf9c 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -602,6 +602,23 @@ bool QImageData::checkForAlphaPixels() const
*/
/*!
+ \fn QImage::QImage(QImage &&other)
+
+ Move-constructs a QImage instance, making it point at the same
+ object that \a other was pointing to.
+
+ \since 5.2
+*/
+
+/*!
+ \fn QImage &operator=(QImage &&other)
+
+ Move-assigns \a other to this QImage instance.
+
+ \since 5.2
+*/
+
+/*!
\typedef QImageCleanupFunction
\relates QImage
\since 5.0
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index be7a1e8001..e11d3bb019 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -109,6 +109,14 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
\sa QMovie
*/
+/*!
+ \fn QPicture &QPicture::operator=(QPicture &&other)
+
+ Move-assigns \a other to this QPicture instance.
+
+ \since 5.2
+*/
+
const char *qt_mfhdr_tag = "QPIC"; // header tag
static const quint16 mfhdr_maj = 11; // major version #
static const quint16 mfhdr_min = 0; // minor version #
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index f98ca04f4d..bb48a4b3a5 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -392,6 +392,14 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
}
/*!
+ \fn QPixmap &QPixmap::operator=(QPixmap &&other)
+
+ Move-assigns \a other to this QPixmap instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QPixmap::swap(QPixmap &other)
\since 4.8
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index d6287aef5c..a33b264704 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -154,6 +154,14 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QCursor &QCursor::operator=(QCursor &&other)
+
+ Move-assigns \a other to this QCursor instance.
+
+ \since 5.2
+*/
+
+/*!
\fn QPoint QCursor::pos(const QScreen *screen)
Returns the position of the cursor (hot spot) of the \a screen
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index b242a3cc68..bde8d99a1c 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1029,27 +1029,23 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
+/*!
+ Called from QCoreApplication::init()
+
+ Responsible for creating an event dispatcher when QCoreApplication
+ decides that it needs one (because a custom one has not been set).
+*/
void QGuiApplicationPrivate::createEventDispatcher()
{
+ Q_ASSERT(!eventDispatcher);
+
if (platform_integration == 0)
createPlatformIntegration();
- if (!eventDispatcher) {
- QAbstractEventDispatcher *eventDispatcher = platform_integration->guiThreadEventDispatcher();
- setEventDispatcher(eventDispatcher);
- }
-}
-
-void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
-{
- Q_Q(QGuiApplication);
-
- if (!QCoreApplicationPrivate::eventDispatcher) {
- QCoreApplicationPrivate::eventDispatcher = eventDispatcher;
- QCoreApplicationPrivate::eventDispatcher->setParent(q);
- threadData->eventDispatcher = eventDispatcher;
- }
+ // The platform integration should not mess with the event dispatcher
+ Q_ASSERT(!eventDispatcher);
+ eventDispatcher = platform_integration->createEventDispatcher();
}
#if defined(QT_DEBUG) && defined(Q_OS_LINUX)
@@ -2939,7 +2935,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
restoreOverrideCursor(), otherwise the stack will never be emptied.
Example:
- \snippet code/src_gui_kernel_qapplication_x11.cpp 0
+ \snippet code/src_gui_kernel_qguiapplication_x11.cpp 0
\sa overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(),
QWidget::setCursor()
@@ -2999,7 +2995,7 @@ QStyleHints *QGuiApplication::styleHints()
This function must be called before creating the QGuiApplication object, like
this:
- \snippet code/src_gui_kernel_qapplication.cpp 6
+ \snippet code/src_gui_kernel_qguiapplication.cpp 0
\sa desktopSettingsAware()
*/
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 7a4a161476..91c63e54c5 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -83,8 +83,7 @@ public:
~QGuiApplicationPrivate();
void createPlatformIntegration();
- void createEventDispatcher();
- void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
+ void createEventDispatcher() Q_DECL_OVERRIDE;
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 16324b3659..1fcf1026d2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -733,6 +733,14 @@ static const struct {
*/
/*!
+ \fn QKeySequence &QKeySequence::operator=(QKeySequence &&other)
+
+ Move-assigns \a other to this QKeySequence instance.
+
+ \since 5.2
+*/
+
+/*!
\since 4.2
Constructs a QKeySequence object for the given \a key.
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index b266d31c5c..00ab74e4e4 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -90,6 +90,14 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
}
/*!
+ \fn QPalette &QPalette::operator=(QPalette &&other)
+
+ Move-assigns \a other to this QPalette instance.
+
+ \since 5.2
+*/
+
+/*!
\fn const QColor &QPalette::color(ColorRole role) const
\overload
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index dc775bcb61..3f93856349 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -231,17 +231,23 @@ QPlatformServices *QPlatformIntegration::services() const
are never repositioned by the window manager. The default implementation returns true.
*/
-
/*!
- \fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0
+ \fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0
+
+ Factory function for the GUI event dispatcher. The platform plugin should create
+ and return a QAbstractEventDispatcher subclass when this function is called.
+
+ If the platform plugin for some reason creates the event dispatcher outside of
+ this function (for example in the constructor), it needs to handle the case
+ where this function is never called, ensuring that the event dispatcher is
+ still deleted at some point (typically in the destructor).
+
+ Note that the platform plugin should never explicitly set the event dispatcher
+ itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication
+ decide when and which event dispatcher to create.
- Accessor function for the event dispatcher. The platform plugin should create
- an instance of the QAbstractEventDispatcher in its constructor and set it
- on the application using QGuiApplicationPrivate::instance()->setEventDispatcher().
- The event dispatcher is owned by QGuiApplication, the accessor should return
- a flat pointer.
- \sa QGuiApplicationPrivate
+ \since 5.2
*/
bool QPlatformIntegration::hasCapability(Capability cap) const
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 0204181ca6..0af74370b5 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -111,7 +111,7 @@ public:
virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
// Event dispatcher:
- virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
+ virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index 8cc8d3d961..c46dd5f55a 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -74,10 +74,11 @@ QT_BEGIN_NAMESPACE
QSessionManager provides an interface between the application and the
session manager so that the program can work well with the session manager.
In Qt, session management requests for action are handled by the two
- virtual functions QApplication::commitData() and QApplication::saveState().
- Both provide a reference to a session manager object as argument, to allow
- the application to communicate with the session manager. The session
- manager can only be accessed through these functions.
+ signals QGuiApplication::commitDataRequest() and
+ QGuiApplication::saveStateRequest(). Both provide a reference to a session
+ manager object as argument, to allow the application to communicate with
+ the session manager. The session manager can only be accessed through these
+ functions.
No user interaction is possible \e unless the application gets explicit
permission from the session manager. You ask for permission by calling
@@ -94,7 +95,7 @@ QT_BEGIN_NAMESPACE
setRestartHint(), setProperty(), requestPhase2(). See the respective
function descriptions for further details.
- \sa QApplication, {Session Management}
+ \sa QGuiApplication, {Session Management}
*/
@@ -151,7 +152,7 @@ QSessionManager::~QSessionManager()
If the application has been restored from an earlier session, this
identifier is the same as it was in the earlier session.
- \sa sessionKey(), QApplication::sessionId()
+ \sa sessionKey(), QGuiApplication::sessionId()
*/
QString QSessionManager::sessionId() const
{
@@ -169,7 +170,7 @@ QString QSessionManager::sessionId() const
The session key changes with every call of commitData() or saveState().
- \sa sessionId(), QApplication::sessionKey()
+ \sa sessionId(), QGuiApplication::sessionKey()
*/
QString QSessionManager::sessionKey() const
{
@@ -197,15 +198,15 @@ QString QSessionManager::sessionKey() const
phase, you must tell the session manager that this has happened by calling
cancel().
- Here's an example of how an application's QApplication::commitData() might
- be implemented:
+ Here's an example of how an application's QGuiApplication::commitDataRequest()
+ might be implemented:
- \snippet code/src_gui_kernel_qapplication.cpp 8
+ \snippet code/src_gui_kernel_qguiapplication.cpp 8
If an error occurred within the application while saving its data, you may
want to try allowsErrorInteraction() instead.
- \sa QApplication::commitData(), release(), cancel()
+ \sa QGuiApplication::commitDataRequest(), release(), cancel()
*/
bool QSessionManager::allowsInteraction()
{
@@ -261,8 +262,9 @@ void QSessionManager::cancel()
\note These flags are only hints, a session manager may or may not respect
them.
- We recommend setting the restart hint in QApplication::saveState() because
- most session managers perform a checkpoint shortly after an application's
+ We recommend setting the restart hint in QGuiApplication::saveStateRequest()
+ because most session managers perform a checkpoint shortly after an
+ application's
startup.
\sa restartHint()
@@ -291,12 +293,13 @@ QSessionManager::RestartHint QSessionManager::restartHint() const
If the session manager is capable of restoring sessions it will execute
\a command in order to restore the application. The command defaults to
- \snippet code/src_gui_kernel_qapplication.cpp 9
+ \snippet code/src_gui_kernel_qguiapplication.cpp 9
- The \c -session option is mandatory; otherwise QApplication cannot tell
- whether it has been restored or what the current session identifier is.
- See QApplication::isSessionRestored() and QApplication::sessionId() for
- details.
+ The \c -session option is mandatory; otherwise QGuiApplication cannot
+ tell whether it has been restored or what the current session identifier
+ is.
+ See QGuiApplication::isSessionRestored() and
+ QGuiApplication::sessionId() for details.
If your application is very simple, it may be possible to store the entire
application state in additional command line options. This is usually a
@@ -318,7 +321,7 @@ void QSessionManager::setRestartCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet code/src_gui_kernel_qapplication.cpp 10
+ \snippet code/src_gui_kernel_qguiapplication.cpp 10
\sa setRestartCommand(), restartHint()
*/
@@ -344,7 +347,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
- \snippet code/src_gui_kernel_qapplication.cpp 11
+ \snippet code/src_gui_kernel_qguiapplication.cpp 11
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/
@@ -396,9 +399,10 @@ bool QSessionManager::isPhase2() const
/*!
Requests a second session management phase for the application. The
- application may then return immediately from the QApplication::commitData()
- or QApplication::saveState() function, and they will be called again once
- most or all other applications have finished their session management.
+ application may then return immediately from the
+ QGuiApplication::commitDataRequest() or QApplication::saveStateRequest()
+ function, and they will be called again once most or all other
+ applications have finished their session management.
The two phases are useful for applications such as the X11 window manager
that need to store information about another application's windows and
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index a302f2186c..04ea9c27d5 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -106,7 +106,7 @@ int QStyleHints::mouseDoubleClickInterval() const
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
- \snippet code/src_gui_kernel_qapplication.cpp 7
+ \snippet code/src_gui_kernel_qguiapplication.cpp 6
\sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}
*/
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h
index 1a416efe03..1a5d3f00e2 100644
--- a/src/gui/opengl/qopenglpixeltransferoptions.h
+++ b/src/gui/opengl/qopenglpixeltransferoptions.h
@@ -46,7 +46,7 @@
#if !defined(QT_NO_OPENGL)
-#include <QSharedDataPointer>
+#include <QtCore/QSharedDataPointer>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index d053937c89..a6e1c2953d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -175,7 +175,7 @@ bool QOpenGLTexturePrivate::create()
void QOpenGLTexturePrivate::destroy()
{
- if (QOpenGLContext::currentContext() == context) {
+ if (QOpenGLContext::currentContext() != context) {
qWarning("Requires a valid current OpenGL context.\n"
"Texture has not been destroyed");
return;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 5b8556d198..252e6ff9b5 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -636,6 +636,13 @@ QBrush &QBrush::operator=(const QBrush &b)
return *this;
}
+/*!
+ \fn QBrush &QBrush::operator=(QBrush &&other)
+
+ Move-assigns \a other to this QBrush instance.
+
+ \since 5.2
+*/
/*!
\fn void QBrush::swap(QBrush &other)
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 626a91c331..1e36cd224a 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -608,6 +608,14 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other)
}
/*!
+ \fn QPainterPath &QPainterPath::operator=(QPainterPath &&other)
+
+ Move-assigns \a other to this QPainterPath instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QPainterPath::swap(QPainterPath &other)
\since 4.8
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index d27e0c409d..d8db244d66 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -378,6 +378,14 @@ QPen &QPen::operator=(const QPen &p)
}
/*!
+ \fn QPen &QPen::operator=(QPen &&other)
+
+ Move-assigns \a other to this QPen instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QPen::swap(QPen &other)
\since 4.8
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 47668c62b6..913daee3e1 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -361,6 +361,14 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
*/
/*!
+ \fn QRegion &QRegion::operator=(QRegion &&other)
+
+ Move-assigns \a other to this QRegion instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QRegion::swap(QRegion &other)
\since 4.8
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 9d603bb08d..2a9cac352d 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -537,6 +537,14 @@ QFontEngineData::~QFontEngineData()
*/
/*!
+ \fn QFont &QFont::operator=(QFont &&other)
+
+ Move-assigns \a other to this QFont instance.
+
+ \since 5.2
+*/
+
+/*!
\fn QString QFont::rawName() const
Returns the name of the font within the underlying window system.
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 160d66c96c..1d0a1c1078 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -213,6 +213,14 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
}
/*!
+ \fn QFontMetrics &QFontMetrics::operator=(QFontMetrics &&other)
+
+ Move-assigns \a other to this QFontMetrics instance.
+
+ \since 5.2
+*/
+
+/*!
\fn void QFontMetrics::swap(QFontMetrics &other)
\since 5.0
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index c939020457..1284207307 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -61,6 +61,7 @@ QTextOption::QTextOption()
wordWrap(QTextOption::WordWrap),
design(false),
unused(0),
+ unused2(0),
f(0),
tab(-1),
d(0)
@@ -78,6 +79,7 @@ QTextOption::QTextOption(Qt::Alignment alignment)
wordWrap(QTextOption::WordWrap),
design(false),
unused(0),
+ unused2(0),
f(0),
tab(-1),
d(0)
@@ -104,6 +106,7 @@ QTextOption::QTextOption(const QTextOption &o)
design(o.design),
direction(o.direction),
unused(o.unused),
+ unused2(o.unused2),
f(o.f),
tab(o.tab),
d(0)
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index a6818eb79a..3c76768f87 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -134,7 +134,8 @@ private:
uint wordWrap : 4;
uint design : 1;
uint direction : 2;
- uint unused : 18;
+ uint unused : 17;
+ uint unused2; // ### Qt 6: remove unnecessary, extra 32 bits
uint f;
qreal tab;
QTextOptionPrivate *d;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index b6a3b5e3ab..ba9e5cbdc4 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -560,7 +560,7 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
// untill we have started the first connection attempt. So no
// request will be started untill we know if IPv4 or IPv6
// should be used.
- if (networkLayerState == Unknown) {
+ if (networkLayerState == Unknown || networkLayerState == InProgress) {
startHostInfoLookup();
} else if ( networkLayerState == IPv4 || networkLayerState == IPv6 ) {
// this used to be called via invokeMethod and a QueuedConnection
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index a010075436..ddf53f18f4 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -114,6 +114,18 @@ QT_BEGIN_NAMESPACE
possibly with a different version of OpenSSL.
*/
+namespace {
+void qsslSocketUnresolvedSymbolWarning(const char *functionName)
+{
+ qWarning("QSslSocket: cannot call unresolved function %s", functionName);
+}
+
+void qsslSocketCannotResolveSymbolWarning(const char *functionName)
+{
+ qWarning("QSslSocket: cannot resolve %s", functionName);
+}
+}
+
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
@@ -338,7 +350,7 @@ DEFINEFUNC3(SSL_SESSION *, d2i_SSL_SESSION, SSL_SESSION **a, a, const unsigned c
#define RESOLVEFUNC(func) \
if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \
&& !(_q_##func = _q_PTR_##func(libs.second->resolve(#func)))) \
- qWarning("QSslSocket: cannot resolve "#func);
+ qsslSocketCannotResolveSymbolWarning(#func);
#if !defined QT_LINKED_OPENSSL
@@ -516,8 +528,6 @@ static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32()
static QPair<QLibrary*, QLibrary*> loadOpenSsl()
{
QPair<QLibrary*,QLibrary*> pair;
- pair.first = 0;
- pair.second = 0;
# if defined(Q_OS_UNIX)
QLibrary *&libssl = pair.first;
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 1fd98cc7fb..7e1a1c983c 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -69,6 +69,7 @@
//
#include "qsslsocket_openssl_p.h"
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
@@ -82,8 +83,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a); \
@@ -94,8 +95,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func);\
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func);\
err; \
} \
funcret _q_##func(a, b); \
@@ -106,8 +107,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c); \
@@ -118,8 +119,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d); \
@@ -130,8 +131,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e); \
@@ -142,8 +143,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f); \
@@ -154,8 +155,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
- if (!_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f, g); \
@@ -166,8 +167,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
- if (_q_##func) { \
- qWarning("QSslSocket: cannot call unresolved function "#func); \
+ if (Q_UNLIKELY(!_q_##func)) { \
+ qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f, g, h, i); \
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index 176373e9f9..3b79a2ac80 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -170,7 +170,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
{
setObjectName(QLatin1String("Evdev Touch Handler"));
- QString dev;
+ bool printDeviceInfo = qgetenv("QT_QPA_EVDEV_DEBUG").toInt();
// only the first device argument is used for now
QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS"));
@@ -180,6 +180,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
QStringList args = spec.split(QLatin1Char(':'));
+ QString dev;
int rotationAngle = 0;
for (int i = 0; i < args.count(); ++i) {
if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) {
@@ -213,17 +214,22 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
}
}
- if (dev.isEmpty())
+ if (dev.isEmpty()) {
+ if (printDeviceInfo)
+ qDebug("evdevtouch: No touch devices found");
return;
+ }
+
+ if (printDeviceInfo)
+ qDebug("evdevtouch: Using device %s", qPrintable(dev));
- qDebug("evdevtouch: Using device %s", qPrintable(dev));
m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (m_fd >= 0) {
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData()));
} else {
- qErrnoWarning(errno, "Cannot open input device %s", qPrintable(dev));
+ qErrnoWarning(errno, "evdevtouch: Cannot open input device %s", qPrintable(dev));
return;
}
@@ -231,7 +237,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev)));
int mtdeverr = mtdev_open(m_mtdev, m_fd);
if (mtdeverr) {
- qWarning("mtdev_open failed: %d", mtdeverr);
+ qWarning("evdevtouch: mtdev_open failed: %d", mtdeverr);
QT_CLOSE(m_fd);
return;
}
@@ -250,21 +256,26 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
d->m_singleTouch = !testBit(ABS_MT_POSITION_X, absbits);
}
#endif
- qDebug("Protocol type %c %s (%s)", d->m_typeB ? 'B' : 'A', mtdevStr, d->m_singleTouch ? "single" : "multi");
+
+ if (printDeviceInfo)
+ qDebug("evdevtouch: Protocol type %c %s (%s)", d->m_typeB ? 'B' : 'A',
+ mtdevStr, d->m_singleTouch ? "single" : "multi");
input_absinfo absInfo;
memset(&absInfo, 0, sizeof(input_absinfo));
bool has_x_range = false, has_y_range = false;
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X)), &absInfo) >= 0) {
- qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
+ if (printDeviceInfo)
+ qDebug("evdevtouch: min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_x_min = absInfo.minimum;
d->hw_range_x_max = absInfo.maximum;
has_x_range = true;
}
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y)), &absInfo) >= 0) {
- qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
+ if (printDeviceInfo)
+ qDebug("evdevtouch: min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_y_min = absInfo.minimum;
d->hw_range_y_max = absInfo.maximum;
has_y_range = true;
@@ -274,7 +285,8 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
qWarning("evdevtouch: Invalid ABS limits, behavior unspecified");
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
- qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
+ if (printDeviceInfo)
+ qDebug("evdevtouch: min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
if (absInfo.maximum > absInfo.minimum) {
d->hw_pressure_min = absInfo.minimum;
d->hw_pressure_max = absInfo.maximum;
@@ -284,14 +296,15 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
char name[1024];
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
d->hw_name = QString::fromLocal8Bit(name);
- qDebug("device name: %s", name);
+ if (printDeviceInfo)
+ qDebug("evdevtouch: device name: %s", name);
}
bool grabSuccess = !ioctl(m_fd, EVIOCGRAB, (void *) 1);
if (grabSuccess)
ioctl(m_fd, EVIOCGRAB, (void *) 0);
else
- qWarning("ERROR: The device is grabbed by another process. No events will be read.");
+ qWarning("evdevtouch: The device is grabbed by another process. No events will be read.");
if (rotationAngle)
d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5);
@@ -327,11 +340,11 @@ void QEvdevTouchScreenHandler::readData()
int result = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);
#endif
if (!result) {
- qWarning("Got EOF from input device");
+ qWarning("evdevtouch: Got EOF from input device");
return;
} else if (result < 0) {
if (errno != EINTR && errno != EAGAIN) {
- qWarning("Could not read from input device: %s", strerror(errno));
+ qErrnoWarning(errno, "evdevtouch: Could not read from input device");
if (errno == ENODEV) { // device got disconnected -> stop reading
delete m_notify;
m_notify = 0;
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
index 358c3caf89..9ce382bd53 100644
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
@@ -100,10 +100,6 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
{
Q_UNUSED(paramList);
-#ifndef ANDROID_PLUGIN_OPENGL
- m_eventDispatcher = createUnixEventDispatcher();
-#endif
-
m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();
#ifndef ANDROID_PLUGIN_OPENGL
@@ -150,9 +146,9 @@ QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *wind
return new QAndroidPlatformWindow(window);
}
-QAbstractEventDispatcher *QAndroidPlatformIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+ return createUnixEventDispatcher();
}
#else // !ANDROID_PLUGIN_OPENGL
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h
index e7bb55b3d5..5ebdf9e65c 100644
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h
@@ -93,7 +93,7 @@ public:
#ifndef ANDROID_PLUGIN_OPENGL
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
#else
QPlatformWindow *createPlatformWindow(QWindow *window) const;
@@ -147,7 +147,6 @@ private:
QTouchDevice *m_touchDevice;
#ifndef ANDROID_PLUGIN_OPENGL
- QAbstractEventDispatcher *m_eventDispatcher;
QAndroidPlatformScreen *m_primaryScreen;
#endif
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 8620ef4267..111329aaee 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -108,7 +108,7 @@ public:
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
QPlatformNativeInterface *nativeInterface() const;
@@ -130,7 +130,6 @@ public:
private:
QScopedPointer<QPlatformFontDatabase> mFontDb;
- QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformInputContext> mInputContext;
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 365fa92470..8ce72e08b5 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -216,7 +216,6 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
- , mEventDispatcher(new QCocoaEventDispatcher())
, mInputContext(new QCocoaInputContext)
#ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QCocoaAccessibility)
@@ -384,9 +383,9 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return new QCocoaBackingStore(window);
}
-QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
{
- return mEventDispatcher;
+ return new QCocoaEventDispatcher;
}
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 671214f424..54cf8a79fe 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -400,15 +400,17 @@ void QCocoaWindow::setVisible(bool visible)
} else {
[m_contentView setHidden:YES];
}
- if (parentCocoaWindow && window()->type() == Qt::Popup
- && m_resizableTransientParent
+ if (parentCocoaWindow && window()->type() == Qt::Popup) {
+ parentCocoaWindow->m_activePopupWindow = 0;
+ if (m_resizableTransientParent
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
- && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
+ && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
+ && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
#endif
- )
- // QTBUG-30266: a window should not be resizable while a transient popup is open
- [parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
+ )
+ // QTBUG-30266: a window should not be resizable while a transient popup is open
+ [parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
+ }
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index ab098b08bf..8813a934bf 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1026,20 +1026,21 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;
- // Set keyboard modifiers depending on event phase. A two-finger trackpad flick
- // generates a stream of scroll events. We want the keyboard modifier state to
- // be the state at the beginning of the flick in order to avoid changing the
- // interpretation of the events mid-stream. One example of this happening would
- // be when pressing cmd after scrolling in Qt Creator: not taking the phase into
- // account causes the end of the event stream to be interpreted as font size changes.
-
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
- NSEventPhase phase = [theEvent phase];
- if (phase == NSEventPhaseBegan || phase == NSEventPhaseNone) {
+ // Prevent keyboard modifier state from changing during scroll event streams.
+ // A two-finger trackpad flick generates a stream of scroll events. We want
+ // the keyboard modifier state to be the state at the beginning of the
+ // flick in order to avoid changing the interpretation of the events
+ // mid-stream. One example of this happening would be when pressing cmd
+ // after scrolling in Qt Creator: not taking the phase into account causes
+ // the end of the event stream to be interpreted as font size changes.
+ NSEventPhase momentumPhase = [theEvent momentumPhase];
+ if (momentumPhase == NSEventPhaseNone) {
currentWheelModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
}
+ NSEventPhase phase = [theEvent phase];
Qt::ScrollPhase ph = Qt::ScrollUpdate;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
@@ -1058,7 +1059,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph);
- if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled || phase == NSEventPhaseNone) {
+ if (momentumPhase == NSEventPhaseEnded || momentumPhase == NSEventPhaseCancelled || momentumPhase == NSEventPhaseNone) {
currentWheelModifiers = Qt::NoModifier;
}
} else
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index 9e8120a29e..7ca7da8bcd 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE
QDirectFbIntegration::QDirectFbIntegration()
: m_fontDb(new QGenericUnixFontDatabase())
- , m_eventDispatcher(createUnixEventDispatcher())
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
}
void QDirectFbIntegration::initialize()
@@ -129,9 +127,9 @@ QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) con
return dfbWindow;
}
-QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+ return createUnixEventDispatcher();
}
QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
index b96e6d96de..5822202eea 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
@@ -65,7 +65,7 @@ public:
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
@@ -80,7 +80,6 @@ protected:
QScopedPointer<QDirectFbInput> m_input;
QScopedPointer<QThread> m_inputRunner;
QScopedPointer<QPlatformFontDatabase> m_fontDb;
- QAbstractEventDispatcher *m_eventDispatcher;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index ff06ac223b..a6d964dcb0 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -78,12 +78,9 @@ QT_BEGIN_NAMESPACE
static void *eglContextForContext(QOpenGLContext *context);
QEglFSIntegration::QEglFSIntegration()
- : mEventDispatcher(createUnixEventDispatcher()),
- mFontDb(new QGenericUnixFontDatabase),
- mServices(new QGenericUnixServices)
+ : mFontDb(new QGenericUnixFontDatabase)
+ , mServices(new QGenericUnixServices)
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
-
#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
@@ -168,9 +165,9 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
return mFontDb.data();
}
-QAbstractEventDispatcher *QEglFSIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const
{
- return mEventDispatcher;
+ return createUnixEventDispatcher();
}
QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index c6265bb970..4e24e2f2f7 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -67,7 +67,7 @@ public:
QPlatformFontDatabase *fontDatabase() const;
QPlatformServices *services() const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
@@ -87,7 +87,6 @@ public:
private:
EGLDisplay mDisplay;
- QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformFontDatabase> mFontDb;
QScopedPointer<QPlatformServices> mServices;
QEglFSScreen *mScreen;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index ac2e7e72fb..17ab68f747 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -114,8 +114,9 @@ void QEglFSWindow::create()
}
window()->setSurfaceType(QSurface::OpenGLSurface);
- setGeometry(screen()->availableGeometry());
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(screen()->availableGeometry()));
+ m_flags |= HasNativeWindow;
+ setGeometry(QRect()); // will become fullscreen
+ QWindowSystemInterface::handleExposeEvent(window(), geometry());
EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat());
@@ -124,7 +125,6 @@ void QEglFSWindow::create()
resetSurface();
- m_flags |= HasNativeWindow;
if (screen()->primarySurface() == EGL_NO_SURFACE) {
screen()->setPrimarySurface(m_surface);
m_flags |= IsRasterRoot;
@@ -212,6 +212,17 @@ void QEglFSWindow::setGeometry(const QRect &r)
QWindowSystemInterface::handleGeometryChange(window(), rect);
}
+QRect QEglFSWindow::geometry() const
+{
+ // For yet-to-become-fullscreen windows report the geometry covering the entire
+ // screen. This is particularly important for Quick where the root object may get
+ // sized to some geometry queried before calling create().
+ if (!m_flags.testFlag(Created) && screen()->primarySurface() == EGL_NO_SURFACE)
+ return screen()->availableGeometry();
+
+ return QPlatformWindow::geometry();
+}
+
WId QEglFSWindow::winId() const
{
return m_wid;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index a5a25409b2..71c0ed5c27 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -58,6 +58,7 @@ public:
~QEglFSWindow();
void setGeometry(const QRect &);
+ QRect geometry() const;
WId winId() const;
void setVisible(bool visible);
void requestActivateWindow();
diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro
index 9b53974998..72716e6a4c 100644
--- a/src/plugins/platforms/ios/ios.pro
+++ b/src/plugins/platforms/ios/ios.pro
@@ -20,7 +20,8 @@ OBJECTIVE_SOURCES = \
qioscontext.mm \
qiosinputcontext.mm \
qiostheme.mm \
- qiosglobal.mm
+ qiosglobal.mm \
+ qiosservices.mm
HEADERS = \
qiosintegration.h \
@@ -34,6 +35,7 @@ HEADERS = \
qioscontext.h \
qiosinputcontext.h \
qiostheme.h \
- qiosglobal.h
+ qiosglobal.h \
+ qiosservices.h
#HEADERS = qiossoftwareinputhandler.h
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index 6148338000..3de7c996f5 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -148,8 +148,10 @@ namespace
// Add memory guard at the end of the reserved stack, so that any stack
// overflow during the user's main will trigger an exception at that point,
// and not when we return and find that the current stack has been smashed.
+ // We allow read though, so that garbage-collection can pass through our
+ // stack in its mark phase without triggering access violations.
uintptr_t memoryGuardStart = qAlignUp(memoryStart, kPageSize);
- if (mprotect((void*)memoryGuardStart, kPageSize, PROT_NONE))
+ if (mprotect((void*)memoryGuardStart, kPageSize, PROT_READ))
qWarning() << "Failed to add memory guard:" << strerror(errno);
// We don't consider the memory guard part of the usable stack space
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index 4aaf98f839..c655d8d3bf 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -50,10 +50,13 @@
QT_BEGIN_NAMESPACE
+class QIOSServices;
+
class QIOSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
{
public:
QIOSIntegration();
+ ~QIOSIntegration();
bool hasCapability(Capability cap) const;
@@ -64,13 +67,14 @@ public:
QPlatformFontDatabase *fontDatabase() const;
QPlatformInputContext *inputContext() const;
+ QPlatformServices *services() const Q_DECL_OVERRIDE;
QVariant styleHint(StyleHint hint) const;
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
@@ -82,6 +86,7 @@ private:
QPlatformScreen *m_screen;
QTouchDevice *m_touchDevice;
QIOSApplicationState m_applicationState;
+ QIOSServices *m_platformServices;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index d854bf7723..b9bb82a326 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -48,6 +48,7 @@
#include "qioscontext.h"
#include "qiosinputcontext.h"
#include "qiostheme.h"
+#include "qiosservices.h"
#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
#include <QDir>
@@ -60,6 +61,7 @@ QIOSIntegration::QIOSIntegration()
: m_fontDatabase(new QCoreTextFontDatabase)
, m_inputContext(new QIOSInputContext)
, m_screen(new QIOSScreen(QIOSScreen::MainScreen))
+ , m_platformServices(new QIOSServices)
{
if (![UIApplication sharedApplication]) {
qWarning()
@@ -81,6 +83,21 @@ QIOSIntegration::QIOSIntegration()
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
+QIOSIntegration::~QIOSIntegration()
+{
+ delete m_fontDatabase;
+ m_fontDatabase = 0;
+
+ delete m_inputContext;
+ m_inputContext = 0;
+
+ delete m_screen;
+ m_screen = 0;
+
+ delete m_platformServices;
+ m_platformServices = 0;
+}
+
bool QIOSIntegration::hasCapability(Capability cap) const
{
switch (cap) {
@@ -113,7 +130,7 @@ QPlatformOpenGLContext *QIOSIntegration::createPlatformOpenGLContext(QOpenGLCont
return new QIOSContext(context);
}
-QAbstractEventDispatcher *QIOSIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QIOSIntegration::createEventDispatcher() const
{
if (isQtApplication())
return new QIOSEventDispatcher;
@@ -131,6 +148,11 @@ QPlatformInputContext *QIOSIntegration::inputContext() const
return m_inputContext;
}
+QPlatformServices *QIOSIntegration::services() const
+{
+ return m_platformServices;
+}
+
QVariant QIOSIntegration::styleHint(StyleHint hint) const
{
switch (hint) {
diff --git a/src/plugins/platforms/ios/qiosservices.h b/src/plugins/platforms/ios/qiosservices.h
new file mode 100644
index 0000000000..692b3a0b99
--- /dev/null
+++ b/src/plugins/platforms/ios/qiosservices.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QIOSSERVICES_H
+#define QIOSSERVICES_H
+#include <qpa/qplatformservices.h>
+
+QT_BEGIN_NAMESPACE
+
+class QIOSServices : public QPlatformServices
+{
+public:
+ bool openUrl(const QUrl &url);
+ bool openDocument(const QUrl &url);
+};
+
+QT_END_NAMESPACE
+
+#endif // QIOSSERVICES_H
diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm
new file mode 100644
index 0000000000..32203aeb71
--- /dev/null
+++ b/src/plugins/platforms/ios/qiosservices.mm
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qiosservices.h"
+
+#include <QtCore/qurl.h>
+
+#import <UIKit/UIApplication.h>
+
+QT_BEGIN_NAMESPACE
+
+bool QIOSServices::openUrl(const QUrl &url)
+{
+ if (url.scheme().isEmpty())
+ return openDocument(url);
+
+ NSURL *nsUrl = url.toNSURL();
+
+ if (![[UIApplication sharedApplication] canOpenURL:nsUrl])
+ return false;
+
+ return [[UIApplication sharedApplication] openURL:nsUrl];
+}
+
+bool QIOSServices::openDocument(const QUrl &url)
+{
+ // FIXME: Implement using UIDocumentInteractionController
+ return QPlatformServices::openDocument(url);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp
index 539363722d..80c5887a28 100644
--- a/src/plugins/platforms/kms/qkmsintegration.cpp
+++ b/src/plugins/platforms/kms/qkmsintegration.cpp
@@ -65,10 +65,8 @@ QT_BEGIN_NAMESPACE
QKmsIntegration::QKmsIntegration()
: QPlatformIntegration(),
m_fontDatabase(new QGenericUnixFontDatabase()),
- m_eventDispatcher(createUnixEventDispatcher()),
m_nativeInterface(new QKmsNativeInterface)
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
setenv("EGL_PLATFORM", "drm",1);
m_vtHandler = new QKmsVTHandler;
@@ -152,9 +150,9 @@ void QKmsIntegration::addScreen(QKmsScreen *screen)
screenAdded(screen);
}
-QAbstractEventDispatcher *QKmsIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QKmsIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+ return createUnixEventDispatcher();
}
QPlatformNativeInterface *QKmsIntegration::nativeInterface() const
diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h
index 5069753aa5..0a626e6bd2 100644
--- a/src/plugins/platforms/kms/qkmsintegration.h
+++ b/src/plugins/platforms/kms/qkmsintegration.h
@@ -67,7 +67,7 @@ public:
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformFontDatabase *fontDatabase() const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const;
@@ -84,7 +84,6 @@ private:
QList<QPlatformScreen *> m_screens;
QList<QKmsDevice *> m_devices;
QPlatformFontDatabase *m_fontDatabase;
- QAbstractEventDispatcher *m_eventDispatcher;
QPlatformNativeInterface *m_nativeInterface;
QKmsVTHandler *m_vtHandler;
QDeviceDiscovery *m_deviceDiscovery;
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 99914fa36d..aa2687da30 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -54,11 +54,8 @@
QT_BEGIN_NAMESPACE
QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
- : m_fontDb(new QGenericUnixFontDatabase()),
- m_eventDispatcher(createUnixEventDispatcher())
+ : m_fontDb(new QGenericUnixFontDatabase())
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
-
m_primaryScreen = new QLinuxFbScreen;
if (m_primaryScreen->initialize(paramList))
screenAdded(m_primaryScreen);
@@ -92,9 +89,9 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWindow *window) cons
return new QFbWindow(window);
}
-QAbstractEventDispatcher *QLinuxFbIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QLinuxFbIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+ return createUnixEventDispatcher();
}
QList<QPlatformScreen *> QLinuxFbIntegration::screens() const
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index 1d91d364ff..6de9ac9992 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -61,14 +61,13 @@ public:
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QList<QPlatformScreen *> screens() const;
QPlatformFontDatabase *fontDatabase() const;
private:
QLinuxFbScreen *m_primaryScreen;
QPlatformFontDatabase *m_fontDb;
- QAbstractEventDispatcher *m_eventDispatcher;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 29bd223f3f..bb2c5f53c3 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -56,16 +56,8 @@
QT_BEGIN_NAMESPACE
-QMinimalIntegration::QMinimalIntegration() :
-#if defined(Q_OS_WINRT)
- m_eventDispatcher(new QEventDispatcherWinRT())
-#elif defined(Q_OS_WIN)
- m_eventDispatcher(new QEventDispatcherWin32())
-#else
- m_eventDispatcher(createUnixEventDispatcher())
-#endif
+QMinimalIntegration::QMinimalIntegration()
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
QMinimalScreen *mPrimaryScreen = new QMinimalScreen();
mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320);
@@ -97,9 +89,17 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow *
return new QMinimalBackingStore(window);
}
-QAbstractEventDispatcher *QMinimalIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+#ifdef Q_OS_WIN
+#ifndef Q_OS_WINRT
+ return new QEventDispatcherWin32;
+#else // !Q_OS_WINRT
+ return new QEventDispatcherWinRT;
+#endif // Q_OS_WINRT
+#else
+ return createUnixEventDispatcher();
+#endif
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h
index ef39e32fa7..7dc01e1d51 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.h
+++ b/src/plugins/platforms/minimal/qminimalintegration.h
@@ -73,10 +73,7 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
-
-private:
- QAbstractEventDispatcher *m_eventDispatcher;
+ QAbstractEventDispatcher *createEventDispatcher() const;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
index 4a1ac0f307..21c23250e4 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
@@ -110,7 +110,7 @@ QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
return mFontDb;
}
-QAbstractEventDispatcher *QMinimalEglIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
{
return createUnixEventDispatcher();
}
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.h b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
index dba7504033..58b8f28ac9 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
@@ -63,7 +63,7 @@ public:
QPlatformFontDatabase *fontDatabase() const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index aafa90c0fd..76881db6fc 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -99,18 +99,12 @@ public:
QOffscreenIntegration::QOffscreenIntegration()
{
#if defined(Q_OS_UNIX)
- m_eventDispatcher = createUnixEventDispatcher();
#if defined(Q_OS_MAC)
m_fontDatabase.reset(new QPlatformFontDatabase());
#else
m_fontDatabase.reset(new QGenericUnixFontDatabase());
#endif
#elif defined(Q_OS_WIN)
-#ifndef Q_OS_WINRT
- m_eventDispatcher = new QOffscreenEventDispatcher<QEventDispatcherWin32>();
-#else
- m_eventDispatcher = new QOffscreenEventDispatcher<QEventDispatcherWinRT>();
-#endif
m_fontDatabase.reset(new QBasicFontDatabase());
#endif
@@ -119,7 +113,6 @@ QOffscreenIntegration::QOffscreenIntegration()
#endif
m_services.reset(new QPlatformServices);
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
screenAdded(new QOffscreenScreen);
}
@@ -149,9 +142,19 @@ QPlatformBackingStore *QOffscreenIntegration::createPlatformBackingStore(QWindow
return new QOffscreenBackingStore(window);
}
-QAbstractEventDispatcher *QOffscreenIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QOffscreenIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+#if defined(Q_OS_UNIX)
+ return createUnixEventDispatcher();
+#elif defined(Q_OS_WIN)
+#ifndef Q_OS_WINRT
+ return new QOffscreenEventDispatcher<QEventDispatcherWin32>();
+#else // !Q_OS_WINRT
+ return new QOffscreenEventDispatcher<QEventDispatcherWinRT>();
+#endif // Q_OS_WINRT
+#else
+ return 0;
+#endif
}
QPlatformFontDatabase *QOffscreenIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.h b/src/plugins/platforms/offscreen/qoffscreenintegration.h
index b403ce83b3..c7cdb5fdd6 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.h
@@ -66,12 +66,11 @@ public:
QPlatformServices *services() const;
QPlatformFontDatabase *fontDatabase() const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
static QOffscreenIntegration *createOffscreenIntegration();
private:
- QAbstractEventDispatcher *m_eventDispatcher;
QScopedPointer<QPlatformFontDatabase> m_fontDatabase;
#ifndef QT_NO_DRAGANDDROP
QScopedPointer<QPlatformDrag> m_drag;
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
index aeea035a3a..382ce82dc9 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
@@ -63,9 +63,7 @@
QOpenWFDIntegration::QOpenWFDIntegration()
: QPlatformIntegration()
, mPrinterSupport(new QGenericUnixPrinterSupport)
- , mEventDispatcher(createUnixEventDispatcher())
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
int numberOfDevices = wfdEnumerateDevices(0,0,0);
WFDint devices[numberOfDevices];
@@ -119,9 +117,9 @@ QPlatformBackingStore *QOpenWFDIntegration::createPlatformBackingStore(QWindow *
return new QOpenWFDBackingStore(window);
}
-QAbstractEventDispatcher *QOpenWFDIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QOpenWFDIntegration::createEventDispatcher() const
{
- return mEventDispatcher;
+ return createUnixEventDispatcher();
}
QPlatformFontDatabase *QOpenWFDIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h
index 7118933841..9af91deeac 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.h
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.h
@@ -62,7 +62,7 @@ public:
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
//This should not be a factory interface, but rather a accessor
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
@@ -78,7 +78,6 @@ private:
QPlatformFontDatabase *mFontDatabase;
QPlatformNativeInterface *mNativeInterface;
QPlatformPrinterSupport *mPrinterSupport;
- QAbstractEventDispatcher *mEventDispatcher;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index bd627fef0b..36a2194b56 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -294,6 +294,9 @@ QQnxIntegration::~QQnxIntegration()
delete m_bpsEventFilter;
#endif
+ // In case the event-dispatcher was never transferred to QCoreApplication
+ delete m_eventDispatcher;
+
delete m_screenEventHandler;
// Destroy all displays
@@ -386,10 +389,15 @@ void QQnxIntegration::moveToScreen(QWindow *window, int screen)
platformWindow->setScreen(platformScreen);
}
-QAbstractEventDispatcher *QQnxIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QQnxIntegration::createEventDispatcher() const
{
qIntegrationDebug() << Q_FUNC_INFO;
- return m_eventDispatcher;
+
+ // We transfer ownersip of the event-dispatcher to QtCoreApplication
+ QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher;
+ m_eventDispatcher = 0;
+
+ return eventDispatcher;
}
QPlatformNativeInterface *QQnxIntegration::nativeInterface() const
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index dd8973b767..ab0d6a3156 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -107,7 +107,7 @@ public:
bool supportsNavigatorEvents() const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; }
@@ -158,7 +158,7 @@ private:
#endif
QQnxServices *m_services;
QPlatformFontDatabase *m_fontDatabase;
- QAbstractEventDispatcher *m_eventDispatcher;
+ mutable QAbstractEventDispatcher *m_eventDispatcher;
#if defined(Q_OS_BLACKBERRY)
QQnxBpsEventFilter *m_bpsEventFilter;
#endif
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.h b/src/plugins/platforms/windows/accessible/iaccessible2.h
index a391d495f9..9c922dce36 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.h
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.h
@@ -331,9 +331,21 @@ private:
{
wchar_t *constRelationString = 0;
switch (relation) {
+ case QAccessible::Label:
+ constRelationString = IA2_RELATION_LABEL_FOR;
+ break;
+ case QAccessible::Labelled:
+ constRelationString = IA2_RELATION_LABELLED_BY;
+ break;
+ case QAccessible::Controller:
+ constRelationString = IA2_RELATION_CONTROLLER_FOR;
+ break;
case QAccessible::Controlled:
constRelationString = IA2_RELATION_CONTROLLED_BY;
break;
+ case QAccessible::AllRelations:
+ constRelationString = ( L"AllRelations" );
+ break;
}
if (constRelationString) {
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index cf6cb199c7..51e0d0e803 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -203,13 +203,12 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L
qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO);
return;
}
- // Also refuse if the process is being debugged, specifically, if it is
+ // Do not block if the process is being debugged, specifically, if it is
// displaying a runtime assert, which is not caught by isHungAppWindow().
- if (isProcessBeingDebugged(m_nextClipboardViewer)) {
- qWarning("%s: Cowardly refusing to send clipboard message to application under debugger...", Q_FUNC_INFO);
- return;
- }
- SendMessage(m_nextClipboardViewer, message, wParam, lParam);
+ if (isProcessBeingDebugged(m_nextClipboardViewer))
+ PostMessage(m_nextClipboardViewer, message, wParam, lParam);
+ else
+ SendMessage(m_nextClipboardViewer, message, wParam, lParam);
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 5b2a3acbae..5e7944a4cf 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -45,7 +45,7 @@
#include "qwindowswindow.h"
#include "qwindowsscreen.h"
-#include <QtGui/QPixmap>
+#include <QtGui/QBitmap>
#include <QtGui/QImage>
#include <QtGui/QBitmap>
#include <QtGui/QGuiApplication>
@@ -61,6 +61,30 @@ Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat =
Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap);
/*!
+ \class QWindowsCursorCacheKey
+ \brief Cache key for storing values in a QHash with a QCursor as key.
+
+ \internal
+ \ingroup qt-lighthouse-win
+*/
+
+QWindowsCursorCacheKey::QWindowsCursorCacheKey(const QCursor &c)
+ : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0)
+{
+ if (shape == Qt::BitmapCursor) {
+ const qint64 pixmapCacheKey = c.pixmap().cacheKey();
+ if (pixmapCacheKey) {
+ bitmapCacheKey = pixmapCacheKey;
+ } else {
+ Q_ASSERT(c.bitmap());
+ Q_ASSERT(c.mask());
+ bitmapCacheKey = c.bitmap()->cacheKey();
+ maskCacheKey = c.mask()->cacheKey();
+ }
+ }
+}
+
+/*!
\class QWindowsCursor
\brief Platform cursor implementation
@@ -388,9 +412,10 @@ HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c)
QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
{
- StandardCursorCache::iterator it = m_standardCursorCache.find(shape);
- if (it == m_standardCursorCache.end())
- it = m_standardCursorCache.insert(shape, QWindowsWindowCursor(QCursor(shape)));
+ const QWindowsCursorCacheKey key(shape);
+ CursorCache::iterator it = m_cursorCache.find(key);
+ if (it == m_cursorCache.end())
+ it = m_cursorCache.insert(key, QWindowsWindowCursor(QCursor(shape)));
return it.value();
}
@@ -400,10 +425,10 @@ QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
QWindowsWindowCursor QWindowsCursor::pixmapWindowCursor(const QCursor &c)
{
- const qint64 cacheKey = c.pixmap().cacheKey();
- PixmapCursorCache::iterator it = m_pixmapCursorCache.find(cacheKey);
- if (it == m_pixmapCursorCache.end())
- it = m_pixmapCursorCache.insert(cacheKey, QWindowsWindowCursor(c));
+ const QWindowsCursorCacheKey cacheKey(c);
+ CursorCache::iterator it = m_cursorCache.find(cacheKey);
+ if (it == m_cursorCache.end())
+ it = m_cursorCache.insert(cacheKey, QWindowsWindowCursor(c));
return it.value();
}
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 1e818bc9b8..b366d9a06a 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -52,6 +52,27 @@ QT_BEGIN_NAMESPACE
class QWindowsWindowCursorData;
+struct QWindowsCursorCacheKey
+{
+ explicit QWindowsCursorCacheKey(const QCursor &c);
+ explicit QWindowsCursorCacheKey(Qt::CursorShape s) : shape(s), bitmapCacheKey(0), maskCacheKey(0) {}
+ QWindowsCursorCacheKey() : shape(Qt::CustomCursor), bitmapCacheKey(0), maskCacheKey(0) {}
+
+ Qt::CursorShape shape;
+ qint64 bitmapCacheKey;
+ qint64 maskCacheKey;
+};
+
+inline bool operator==(const QWindowsCursorCacheKey &k1, const QWindowsCursorCacheKey &k2)
+{
+ return k1.shape == k2.shape && k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey;
+}
+
+inline uint qHash(const QWindowsCursorCacheKey &k, uint seed) Q_DECL_NOTHROW
+{
+ return (uint(k.shape) + uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed;
+}
+
class QWindowsWindowCursor
{
public:
@@ -86,11 +107,9 @@ public:
QWindowsWindowCursor pixmapWindowCursor(const QCursor &c);
private:
- typedef QHash<Qt::CursorShape, QWindowsWindowCursor> StandardCursorCache;
- typedef QHash<qint64, QWindowsWindowCursor> PixmapCursorCache;
+ typedef QHash<QWindowsCursorCacheKey, QWindowsWindowCursor> CursorCache;
- StandardCursorCache m_standardCursorCache;
- PixmapCursorCache m_pixmapCursorCache;
+ CursorCache m_cursorCache;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index d7ac4cfc1e..b6e75929f8 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -315,7 +315,6 @@ struct QWindowsIntegrationPrivate
QWindowsDrag m_drag;
# endif
#endif
- QWindowsGuiEventDispatcher *m_eventDispatcher;
#if defined(QT_OPENGL_ES_2)
QEGLStaticContextPtr m_staticEGLContext;
#elif !defined(QT_NO_OPENGL)
@@ -356,7 +355,6 @@ static inline unsigned parseOptions(const QStringList &paramList)
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
: m_options(parseOptions(paramList))
, m_fontDatabase(0)
- , m_eventDispatcher(new QWindowsGuiEventDispatcher)
{
}
@@ -369,7 +367,6 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
d(new QWindowsIntegrationPrivate(paramList))
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher);
#ifndef QT_NO_CLIPBOARD
d->m_clipboard.registerViewer();
#endif
@@ -635,9 +632,9 @@ QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const
}
#endif
-QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher * QWindowsIntegration::createEventDispatcher() const
{
- return d->m_eventDispatcher;
+ return new QWindowsGuiEventDispatcher;
}
QStringList QWindowsIntegration::themeNames() const
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 6643b1642e..97916a479b 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -74,7 +74,7 @@ public:
#ifndef QT_NO_OPENGL
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
#endif
- virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ virtual QAbstractEventDispatcher *createEventDispatcher() const;
#ifndef QT_NO_CLIPBOARD
virtual QPlatformClipboard *clipboard() const;
# ifndef QT_NO_DRAGANDDROP
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 7077eaf4b0..be739d0551 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1260,11 +1260,11 @@ void QWindowsWindow::setGeometry(const QRect &rectIn)
const QWindowsGeometryHint hint(window(), m_data.customMargins);
if (!hint.validSize(newSize)) {
qWarning("%s: Attempt to set a size (%dx%d) violating the constraints"
- "(%dx%d - %dx%d) on window '%s'.", __FUNCTION__,
+ "(%dx%d - %dx%d) on window %s/'%s'.", __FUNCTION__,
newSize.width(), newSize.height(),
hint.minimumSize.width(), hint.minimumSize.height(),
hint.maximumSize.width(), hint.maximumSize.height(),
- qPrintable(window()->objectName()));
+ window()->metaObject()->className(), qPrintable(window()->objectName()));
}
}
if (m_data.hwnd) {
@@ -1273,13 +1273,13 @@ void QWindowsWindow::setGeometry(const QRect &rectIn)
// notify and warn.
setGeometry_sys(rect);
if (m_data.geometry != rect) {
- qWarning("%s: Unable to set geometry %dx%d+%d+%d on '%s'."
+ qWarning("%s: Unable to set geometry %dx%d+%d+%d on %s/'%s'."
" Resulting geometry: %dx%d+%d+%d "
"(frame: %d, %d, %d, %d, custom margin: %d, %d, %d, %d"
", minimum size: %dx%d, maximum size: %dx%d).",
__FUNCTION__,
rect.width(), rect.height(), rect.x(), rect.y(),
- qPrintable(window()->objectName()),
+ window()->metaObject()->className(), qPrintable(window()->objectName()),
m_data.geometry.width(), m_data.geometry.height(),
m_data.geometry.x(), m_data.geometry.y(),
m_data.frame.left(), m_data.frame.top(),
@@ -1838,8 +1838,9 @@ bool QWindowsWindow::setMouseGrabEnabled(bool grab)
return false;
}
if (!isVisible() && grab) {
- qWarning("%s: Not setting mouse grab for invisible window %s",
- __FUNCTION__, qPrintable(window()->objectName()));
+ qWarning("%s: Not setting mouse grab for invisible window %s/'%s'",
+ __FUNCTION__, window()->metaObject()->className(),
+ qPrintable(window()->objectName()));
return false;
}
// release grab or an explicit grab overriding autocapture: Clear flag.
@@ -2091,8 +2092,10 @@ EGLSurface QWindowsWindow::ensureEglSurfaceHandle(const QWindowsWindow::QWindows
m_staticEglContext = staticContext;
m_eglSurface = eglCreateWindowSurface(staticContext->display(), config, (EGLNativeWindowType)m_data.hwnd, NULL);
if (m_eglSurface == EGL_NO_SURFACE)
- qWarning("%s: Could not create the egl surface (eglCreateWindowSurface failed): error = 0x%x\n",
- Q_FUNC_INFO, eglGetError());
+ qWarning("%s: Could not create the egl surface for %s/'%s' (eglCreateWindowSurface failed): error = 0x%x\n",
+ Q_FUNC_INFO, window()->metaObject()->className(),
+ qPrintable(window()->objectName()), eglGetError());
+
if (QWindowsContext::verboseGL)
qDebug("%s: Created EGL surface %p, this = %p",
__FUNCTION__, m_eglSurface, this);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index d6f64d29fd..433758e065 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -290,16 +290,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData());
m_reader = new QXcbEventReader(this);
- connect(m_reader, SIGNAL(eventPending()), this, SLOT(processXcbEvents()), Qt::QueuedConnection);
- connect(m_reader, SIGNAL(finished()), this, SLOT(processXcbEvents()));
- if (!m_reader->startThread()) {
- QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents()));
-
- QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
- connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents()));
- connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents()));
- }
+ m_reader->start();
xcb_extension_t *extensions[] = {
&xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id,
@@ -977,14 +968,27 @@ QXcbEventReader::QXcbEventReader(QXcbConnection *connection)
#endif
}
-bool QXcbEventReader::startThread()
+void QXcbEventReader::start()
{
if (m_xcb_poll_for_queued_event) {
+ connect(this, SIGNAL(eventPending()), m_connection, SLOT(processXcbEvents()), Qt::QueuedConnection);
+ connect(this, SIGNAL(finished()), m_connection, SLOT(processXcbEvents()));
QThread::start();
- return true;
+ } else {
+ // Must be done after we have an event-dispatcher. By posting a method invocation
+ // we are sure that by the time the method is called we have an event-dispatcher.
+ QMetaObject::invokeMethod(this, "registerForEvents", Qt::QueuedConnection);
}
+}
- return false;
+void QXcbEventReader::registerForEvents()
+{
+ QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(m_connection->xcb_connection()), QSocketNotifier::Read, this);
+ connect(notifier, SIGNAL(activated(int)), m_connection, SLOT(processXcbEvents()));
+
+ QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
+ connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(processXcbEvents()));
+ connect(dispatcher, SIGNAL(awake()), m_connection, SLOT(processXcbEvents()));
}
void QXcbEventReader::run()
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 7cabe67a68..0e52b2ec46 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -298,11 +298,14 @@ public:
QXcbEventArray *lock();
void unlock();
- bool startThread();
+ void start();
signals:
void eventPending();
+private slots:
+ void registerForEvents();
+
private:
void addEvent(xcb_generic_event_t *event);
@@ -574,6 +577,8 @@ private:
QByteArray m_startupId;
QXcbSystemTrayTracker *m_systemTrayTracker;
+
+ friend class QXcbEventReader;
};
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 756c3c22dd..11848d503b 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -272,6 +272,26 @@ static const char * const cursorNames[] = {
"link"
};
+#ifndef QT_NO_CURSOR
+
+QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c)
+ : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0)
+{
+ if (shape == Qt::BitmapCursor) {
+ const qint64 pixmapCacheKey = c.pixmap().cacheKey();
+ if (pixmapCacheKey) {
+ bitmapCacheKey = pixmapCacheKey;
+ } else {
+ Q_ASSERT(c.bitmap());
+ Q_ASSERT(c.mask());
+ bitmapCacheKey = c.bitmap()->cacheKey();
+ maskCacheKey = c.mask()->cacheKey();
+ }
+ }
+}
+
+#endif // !QT_NO_CURSOR
+
QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
: QXcbObject(conn), m_screen(screen), m_gtkCursorThemeInitialized(false)
{
@@ -318,9 +338,7 @@ QXcbCursor::~QXcbCursor()
if (!--cursorCount)
xcb_close_font(conn, cursorFont);
- foreach (xcb_cursor_t cursor, m_bitmapCursorMap)
- xcb_free_cursor(conn, cursor);
- foreach (xcb_cursor_t cursor, m_shapeCursorMap)
+ foreach (xcb_cursor_t cursor, m_cursorHash)
xcb_free_cursor(conn, cursor);
}
@@ -336,17 +354,13 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
xcb_cursor_t c = XCB_CURSOR_NONE;
if (cursor) {
- if (cursor->shape() == Qt::BitmapCursor) {
- qint64 id = cursor->pixmap().cacheKey();
- if (!m_bitmapCursorMap.contains(id))
- m_bitmapCursorMap.insert(id, createBitmapCursor(cursor));
- c = m_bitmapCursorMap.value(id);
- } else {
- int id = cursor->shape();
- if (!m_shapeCursorMap.contains(id))
- m_shapeCursorMap.insert(id, createFontCursor(cursor->shape()));
- c = m_shapeCursorMap.value(id);
+ const QXcbCursorCacheKey key(*cursor);
+ CursorHash::iterator it = m_cursorHash.find(key);
+ if (it == m_cursorHash.end()) {
+ const Qt::CursorShape shape = cursor->shape();
+ it = m_cursorHash.insert(key, shape == Qt::BitmapCursor ? createBitmapCursor(cursor) : createFontCursor(shape));
}
+ c = it.value();
}
w->setCursor(c);
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 081300868c..f224aae4e0 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -47,6 +47,31 @@
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_CURSOR
+
+struct QXcbCursorCacheKey
+{
+ explicit QXcbCursorCacheKey(const QCursor &c);
+ explicit QXcbCursorCacheKey(Qt::CursorShape s) : shape(s), bitmapCacheKey(0), maskCacheKey(0) {}
+ QXcbCursorCacheKey() : shape(Qt::CustomCursor), bitmapCacheKey(0), maskCacheKey(0) {}
+
+ Qt::CursorShape shape;
+ qint64 bitmapCacheKey;
+ qint64 maskCacheKey;
+};
+
+inline bool operator==(const QXcbCursorCacheKey &k1, const QXcbCursorCacheKey &k2)
+{
+ return k1.shape == k2.shape && k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey;
+}
+
+inline uint qHash(const QXcbCursorCacheKey &k, uint seed) Q_DECL_NOTHROW
+{
+ return (uint(k.shape) + uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed;
+}
+
+#endif // !QT_NO_CURSOR
+
class QXcbCursor : public QXcbObject, public QPlatformCursor
{
public:
@@ -62,6 +87,8 @@ public:
private:
#ifndef QT_NO_CURSOR
+ typedef QHash<QXcbCursorCacheKey, xcb_cursor_t> CursorHash;
+
xcb_cursor_t createFontCursor(int cshape);
xcb_cursor_t createBitmapCursor(QCursor *cursor);
xcb_cursor_t createNonStandardCursor(int cshape);
@@ -69,8 +96,7 @@ private:
QXcbScreen *m_screen;
#ifndef QT_NO_CURSOR
- QMap<int, xcb_cursor_t> m_shapeCursorMap;
- QMap<qint64, xcb_cursor_t> m_bitmapCursorMap;
+ CursorHash m_cursorHash;
#endif
#ifdef XCB_USE_XLIB
static void cursorThemePropertyChanged(QXcbScreen *screen,
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index cef81ddfec..2249446242 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -124,12 +124,9 @@ static bool runningUnderDebugger()
#endif
QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char **argv)
- : m_eventDispatcher(createUnixEventDispatcher())
- , m_services(new QGenericUnixServices)
+ : m_services(new QGenericUnixServices)
, m_instanceName(0)
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
-
#ifdef XCB_USE_XLIB
XInitThreads();
#endif
@@ -176,9 +173,6 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
m_fontDatabase.reset(new QGenericUnixFontDatabase());
m_inputContext.reset(QPlatformInputContextFactory::create());
-#if !defined(QT_NO_ACCESSIBILITY) && !defined(QT_NO_ACCESSIBILITY_ATSPI_BRIDGE)
- m_accessibility.reset(new QSpiAccessibleBridge());
-#endif
}
QXcbIntegration::~QXcbIntegration()
@@ -293,9 +287,9 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
}
}
-QAbstractEventDispatcher *QXcbIntegration::guiThreadEventDispatcher() const
+QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
{
- return m_eventDispatcher;
+ return createUnixEventDispatcher();
}
void QXcbIntegration::moveToScreen(QWindow *window, int screen)
@@ -336,6 +330,14 @@ QPlatformInputContext *QXcbIntegration::inputContext() const
#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *QXcbIntegration::accessibility() const
{
+#if !defined(QT_NO_ACCESSIBILITY_ATSPI_BRIDGE)
+ if (!m_accessibility) {
+ Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QXcbIntegration",
+ "Initializing accessibility without event-dispatcher!");
+ m_accessibility.reset(new QSpiAccessibleBridge());
+ }
+#endif
+
return m_accessibility.data();
}
#endif
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 7ca7befc64..008d03fbcb 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -67,7 +67,7 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
bool hasCapability(Capability cap) const;
- QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const;
void moveToScreen(QWindow *window, int screen);
@@ -112,10 +112,9 @@ private:
QScopedPointer<QXcbNativeInterface> m_nativeInterface;
QScopedPointer<QPlatformInputContext> m_inputContext;
- QAbstractEventDispatcher *m_eventDispatcher;
#ifndef QT_NO_ACCESSIBILITY
- QScopedPointer<QPlatformAccessibility> m_accessibility;
+ mutable QScopedPointer<QPlatformAccessibility> m_accessibility;
#endif
QScopedPointer<QPlatformServices> m_services;
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h
index 0dca36d16f..28eb287097 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.h
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h
@@ -43,6 +43,15 @@
#ifndef QXCBSESSIONMANAGER_H
#define QXCBSESSIONMANAGER_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the QPA API and is not meant to be used
+// in applications. Usage of this API may make your code
+// source and binary incompatible with future versions of Qt.
+//
+
#include <qpa/qplatformsessionmanager.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index e4979e54a4..05e9a4aac8 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1162,6 +1162,9 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
case QSql::HighPrecision:
v.convert(QVariant::String);
break;
+ case QSql::LowPrecisionDouble:
+ // no conversion
+ break;
}
}
row[idx] = v;
@@ -1424,6 +1427,7 @@ bool QIBaseDriver::hasFeature(DriverFeature f) const
case SimpleLocking:
case FinishQuery:
case MultipleResultSets:
+ case CancelQuery:
return false;
case Transactions:
case PreparedQueries:
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 97301de151..571e3b2fca 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -69,10 +69,8 @@ wince*::LIBS += libcmt.lib \
winsock.lib
mac {
- LIBS += -framework IOKit -framework Security
- !ios {
- LIBS += -framework ApplicationServices
- }
+ LIBS += -framework Security
+ osx: LIBS += -framework ApplicationServices -framework IOKit
}
load(qt_module)
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index 549b3a3918..3306447b34 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -531,8 +531,14 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
anchorRef = QLatin1Char('#') + node->name() + "-enum";
break;
case Node::Typedef:
+ {
+ const TypedefNode *tdef = static_cast<const TypedefNode *>(node);
+ if (tdef->associatedEnum()) {
+ return fullDocumentLocation(tdef->associatedEnum());
+ }
anchorRef = QLatin1Char('#') + node->name() + "-typedef";
break;
+ }
case Node::Property:
anchorRef = QLatin1Char('#') + node->name() + "-prop";
break;
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 697955629e..835443a6a2 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -494,7 +494,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
generateCompactList(Generic, relative, qdb_->getCppClasses(), true);
}
else if (atom->string() == "qmltypes") {
- generateCompactList(Generic, relative, qdb_->getQmlTypes(), true);
+ generateCompactList(Generic, relative, qdb_->getQmlTypes(), true, QStringLiteral(""));
}
else if (atom->string().contains("classesbymodule")) {
QString arg = atom->string().trimmed();
@@ -519,13 +519,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false);
}
else if (atom->string() == "obsoleteqmltypes") {
- generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false);
+ generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false, QStringLiteral(""));
}
else if (atom->string() == "obsoletecppmembers") {
generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false);
}
else if (atom->string() == "obsoleteqmlmembers") {
- generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false);
+ generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false, QStringLiteral(""));
}
else if (atom->string() == "functionindex") {
generateFunctionIndex(relative);
@@ -670,9 +670,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
<< "\"></a>\n";
out() << "<h3>" << protectEnc((*s).name) << "</h3>\n";
if (idx == Class)
- generateCompactList(Generic, 0, ncmap, false, QString("Q"));
+ generateCompactList(Generic, 0, ncmap, false, QStringLiteral("Q"));
else if (idx == QmlClass)
- generateCompactList(Generic, 0, nqcmap, false, QString("Q"));
+ generateCompactList(Generic, 0, nqcmap, false, QStringLiteral(""));
else if (idx == MemberFunction) {
ParentMaps parentmaps;
ParentMaps::iterator pmap;
@@ -2543,13 +2543,13 @@ void HtmlGenerator::generateCompactList(ListType listType,
/*
If commonPrefix is not empty, then the caller knows what
the common prefix is and has passed it in, so just use that
- one. But if the commonPrefix is empty (it normally is), then
+ one. But if commonPrefix is a null string (default value), then
compute a common prefix using this simple algorithm. Note we
assume the prefix length is 1, i.e. we will have a single
character as the common prefix.
*/
int commonPrefixLen = commonPrefix.length();
- if (commonPrefixLen == 0) {
+ if (commonPrefix.isNull()) {
QVector<int> count(26);
for (int i=0; i<26; ++i)
count[i] = 0;
@@ -2594,7 +2594,7 @@ void HtmlGenerator::generateCompactList(ListType listType,
QStringList pieces = c.key().split("::");
QString key;
int idx = commonPrefixLen;
- if (!pieces.last().startsWith(commonPrefix))
+ if (idx > 0 && !pieces.last().startsWith(commonPrefix))
idx = 0;
if (pieces.size() == 1)
key = pieces.last().mid(idx).toLower();
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index fd56c77742..66e0455074 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -2122,6 +2122,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const QString& name)
cnodeRequired_(false),
wrapper_(false),
cnode_(0),
+ qmlModule_(0),
baseNode_(0)
{
int i = 0;
@@ -2171,45 +2172,27 @@ void QmlClassNode::subclasses(const QString& base, NodeList& subs)
}
}
-/*! \fn QString QmlClassNode::qmlModuleIdentifier() const
- This function is called to get a string that is used either
- as a prefix for the file name to use for QML element or
- component reference page, or as a qualifier to prefix a
- reference to a QML element or comnponent. The string that
- is returned is the concatenation of the QML module name
- and its version number. e.g., if an element or component
- is defined to be in the QML module QtQuick 1, its module
- identifier is "QtQuick1". See setQmlModuleInfo().
- */
-
/*!
This function splits \a arg on the blank character to get a
- QML module name and version number. It then spilts the version
- number on the '.' character to get a major version number and
- a minor vrsion number. Both major the major and minor version
- numbers should be present, but the minor version number is not
+ QML module name and version number. If the version number is
+ present, it spilts the version number on the '.' character to
+ get a major version number and a minor vrsion number. If the
+ version number is present, both the major and minor version
+ numbers should be there, but the minor version number is not
absolutely necessary.
-
- It stores the three components separately in this node. If all
- three are found, true is returned. If any of the three is not
- found or is not in the correct format, false is returned.
*/
-bool Node::setQmlModuleInfo(const QString& arg)
+void QmlModuleNode::setQmlModuleInfo(const QString& arg)
{
- QStringList dotSplit;
QStringList blankSplit = arg.split(QLatin1Char(' '));
qmlModuleName_ = blankSplit[0];
- qmlModuleVersionMajor_ = "1";
- qmlModuleVersionMinor_ = "0";
if (blankSplit.size() > 1) {
- dotSplit = blankSplit[1].split(QLatin1Char('.'));
+ QStringList dotSplit = blankSplit[1].split(QLatin1Char('.'));
qmlModuleVersionMajor_ = dotSplit[0];
- if (dotSplit.size() > 1) {
+ if (dotSplit.size() > 1)
qmlModuleVersionMinor_ = dotSplit[1];
- return true;
- }
+ else
+ qmlModuleVersionMinor_ = "0";
}
- return false;
}
/*!
@@ -2259,6 +2242,36 @@ void QmlClassNode::clearCurrentChild()
}
/*!
+ If the QML type's QML module pointer is set, return the QML
+ module name from the QML module node. Otherwise, return the
+ empty string.
+ */
+QString QmlClassNode::qmlModuleName() const
+{
+ return (qmlModule_ ? qmlModule_->qmlModuleName() : QString());
+}
+
+/*!
+ If the QML type's QML module pointer is set, return the QML
+ module version from the QML module node. Otherwise, return
+ the empty string.
+ */
+QString QmlClassNode::qmlModuleVersion() const
+{
+ return (qmlModule_ ? qmlModule_->qmlModuleVersion() : QString());
+}
+
+/*!
+ If the QML type's QML module pointer is set, return the QML
+ module identifier from the QML module node. Otherwise, return
+ the empty string.
+ */
+QString QmlClassNode::qmlModuleIdentifier() const
+{
+ return (qmlModule_ ? qmlModule_->qmlModuleIdentifier() : QString());
+}
+
+/*!
Constructs a Qml basic type node (i.e. a Document node with
the subtype QmlBasicType. The new node has the given
\a parent and \a name.
@@ -2526,7 +2539,7 @@ QString Node::fullDocumentName() const
if (n->type() == Node::Document) {
if ((n->subType() == Node::QmlClass) && !n->qmlModuleName().isEmpty())
- pieces.insert(0, n->qmlModuleIdentifier());
+ pieces.insert(0, n->qmlModuleName());
break;
}
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index f1d9931a08..a530a2cf23 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -60,6 +60,7 @@ class InnerNode;
class ExampleNode;
class QmlClassNode;
class QDocDatabase;
+class QmlModuleNode;
class QmlPropertyNode;
typedef QList<Node*> NodeList;
@@ -193,6 +194,7 @@ public:
void markNotSeen() { seen_ = false; }
virtual bool isInnerNode() const = 0;
+ virtual bool isQmlModule() const { return false; }
virtual bool isExample() const { return false; }
virtual bool isExampleFile() const { return false; }
virtual bool isLeaf() const { return false; }
@@ -263,10 +265,12 @@ public:
QString extractClassName(const QString &string) const;
virtual QString qmlTypeName() const { return name_; }
virtual QString qmlFullBaseName() const { return QString(); }
- virtual QString qmlModuleName() const { return qmlModuleName_; }
- virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; }
- virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; }
- virtual bool setQmlModuleInfo(const QString& );
+ virtual QString qmlModuleName() const { return QString(); }
+ virtual QString qmlModuleVersion() const { return QString(); }
+ virtual QString qmlModuleIdentifier() const { return QString(); }
+ virtual void setQmlModuleInfo(const QString& ) { }
+ virtual QmlModuleNode* qmlModule() const { return 0; }
+ virtual void setQmlModule(QmlModuleNode* ) { }
virtual ClassNode* classNode() { return 0; }
virtual void setClassNode(ClassNode* ) { }
virtual void clearCurrentChild() { }
@@ -316,9 +320,6 @@ private:
QString reconstitutedBrief_;
mutable QString uuid_;
QString outSubDir_;
- QString qmlModuleName_;
- QString qmlModuleVersionMajor_;
- QString qmlModuleVersionMinor_;
static QStringMap operators_;
static int propertyGroupCount_;
};
@@ -526,6 +527,25 @@ private:
QString qtVariable_;
};
+class QmlModuleNode : public DocNode
+{
+ public:
+ QmlModuleNode(InnerNode* parent, const QString& name)
+ : DocNode(parent, name, Node::QmlModule, Node::OverviewPage) { }
+ virtual ~QmlModuleNode() { }
+
+ virtual bool isQmlModule() const { return true; }
+ virtual QString qmlModuleName() const { return qmlModuleName_; }
+ virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; }
+ virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; }
+ virtual void setQmlModuleInfo(const QString& );
+
+ private:
+ QString qmlModuleName_;
+ QString qmlModuleVersionMajor_;
+ QString qmlModuleVersionMinor_;
+};
+
class NameCollisionNode : public DocNode
{
public:
@@ -603,6 +623,11 @@ public:
virtual QString qmlFullBaseName() const;
virtual QString obsoleteLink() const { return obsoleteLink_; }
virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; };
+ virtual QString qmlModuleName() const;
+ virtual QString qmlModuleVersion() const;
+ virtual QString qmlModuleIdentifier() const;
+ virtual QmlModuleNode* qmlModule() const { return qmlModule_; }
+ virtual void setQmlModule(QmlModuleNode* t) { qmlModule_ = t; }
const ImportList& importList() const { return importList_; }
void setImportList(const ImportList& il) { importList_ = il; }
const QString& qmlBaseName() const { return baseName_; }
@@ -626,6 +651,7 @@ private:
ClassNode* cnode_;
QString baseName_;
QString obsoleteLink_;
+ QmlModuleNode* qmlModule_;
QmlClassNode* baseNode_;
ImportList importList_;
};
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 821170d0b1..5d7620519e 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -185,27 +185,17 @@ DocNode* QDocDatabase::findModule(const QString& name)
If a new QML module node is added, its parent is the tree root,
and the new QML module node is marked \e{not seen}.
*/
-DocNode* QDocDatabase::findQmlModule(const QString& name)
+QmlModuleNode* QDocDatabase::findQmlModule(const QString& name)
{
- QStringList dotSplit;
- QStringList blankSplit = name.split(QLatin1Char(' '));
- QString qmid = blankSplit[0];
- QString qmlModuleName = qmid;
- if (blankSplit.size() > 1) {
- dotSplit = blankSplit[1].split(QLatin1Char('.'));
- qmid += dotSplit[0];
- }
- DocNode* dn = 0;
- if (qmlModules_.contains(qmlModuleName))
- return qmlModules_.value(qmlModuleName);
- dn = new DocNode(tree_->root(), qmlModuleName, Node::QmlModule, Node::OverviewPage);
- dn->markNotSeen();
- dn->setQmlModuleInfo(name);
- qmlModules_.insert(qmlModuleName,dn);
- masterMap_.insert(qmlModuleName,dn);
- masterMap_.insert(qmid,dn);
- masterMap_.insert(dn->name(),dn);
- return dn;
+ if (qmlModules_.contains(name))
+ return static_cast<QmlModuleNode*>(qmlModules_.value(name));
+
+ QmlModuleNode* qmn = new QmlModuleNode(tree_->root(), name);
+ qmn->markNotSeen();
+ qmn->setQmlModuleInfo(name);
+ qmlModules_.insert(name, qmn);
+ masterMap_.insert(name, qmn);
+ return qmn;
}
/*!
@@ -246,11 +236,14 @@ DocNode* QDocDatabase::addModule(const QString& name)
to that node is returned. The QML module node is marked \e{seen}
in either case.
*/
-DocNode* QDocDatabase::addQmlModule(const QString& name)
+QmlModuleNode* QDocDatabase::addQmlModule(const QString& name)
{
- DocNode* qmlModule = findQmlModule(name);
- qmlModule->markSeen();
- return qmlModule;
+ QStringList blankSplit = name.split(QLatin1Char(' '));
+ QmlModuleNode* qmn = findQmlModule(blankSplit[0]);
+ qmn->setQmlModuleInfo(name);
+ qmn->markSeen();
+ masterMap_.insert(qmn->qmlModuleIdentifier(),qmn);
+ return qmn;
}
/*!
@@ -289,9 +282,8 @@ DocNode* QDocDatabase::addToModule(const QString& name, Node* node)
Looks up the QML module named \a name. If it isn't there,
create it. Then append \a node to the QML module's member
list. The parent of \a node is not changed by this function.
- Returns a pointer to the QML module node.
*/
-DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node)
+void QDocDatabase::addToQmlModule(const QString& name, Node* node)
{
QStringList qmid;
QStringList dotSplit;
@@ -302,9 +294,11 @@ DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node)
dotSplit = blankSplit[1].split(QLatin1Char('.'));
qmid.append(blankSplit[0] + dotSplit[0]);
}
- DocNode* dn = findQmlModule(name);
- dn->addMember(node);
- node->setQmlModuleInfo(name);
+
+ QmlModuleNode* qmn = findQmlModule(blankSplit[0]);
+ qmn->addMember(node);
+ node->setQmlModule(qmn);
+
if (node->subType() == Node::QmlClass) {
QmlClassNode* n = static_cast<QmlClassNode*>(node);
for (int i=0; i<qmid.size(); ++i) {
@@ -317,7 +311,6 @@ DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node)
if (!masterMap_.contains(node->name(),node))
masterMap_.insert(node->name(),node);
}
- return dn;
}
/*!
diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h
index d88160ee56..5786fa0664 100644
--- a/src/tools/qdoc/qdocdatabase.h
+++ b/src/tools/qdoc/qdocdatabase.h
@@ -96,15 +96,15 @@ class QDocDatabase
DocNode* getGroup(const QString& name);
DocNode* findGroup(const QString& name);
DocNode* findModule(const QString& name);
- DocNode* findQmlModule(const QString& name);
+ QmlModuleNode* findQmlModule(const QString& name);
DocNode* addGroup(const QString& name);
DocNode* addModule(const QString& name);
- DocNode* addQmlModule(const QString& name);
+ QmlModuleNode* addQmlModule(const QString& name);
DocNode* addToGroup(const QString& name, Node* node);
DocNode* addToModule(const QString& name, Node* node);
- DocNode* addToQmlModule(const QString& name, Node* node);
+ void addToQmlModule(const QString& name, Node* node);
QmlClassNode* findQmlType(const QString& qmid, const QString& name) const;
QmlClassNode* findQmlType(const ImportRec& import, const QString& name) const;
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index bef22631f0..4181478274 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -202,9 +202,8 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QmlClassNode* qcn = new QmlClassNode(parent, name);
qcn->setTitle(element.attribute("title"));
QString qmlModuleName = element.attribute("qml-module-name");
- QString qmlModuleVersion = element.attribute("qml-module-version");
if (!qmlModuleName.isEmpty())
- qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn);
+ qdb_->addToQmlModule(qmlModuleName, qcn);
QString qmlFullBaseName = element.attribute("qml-base-type");
if (!qmlFullBaseName.isEmpty())
qcn->setQmlBaseName(qmlFullBaseName);
@@ -273,50 +272,58 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
else if (element.nodeName() == "page") {
Node::SubType subtype;
Node::PageType ptype = Node::NoPageType;
- if (element.attribute("subtype") == "example") {
+ QString attr = element.attribute("subtype");
+ if (attr == "example") {
subtype = Node::Example;
ptype = Node::ExamplePage;
}
- else if (element.attribute("subtype") == "header") {
+ else if (attr == "header") {
subtype = Node::HeaderFile;
ptype = Node::ApiPage;
}
- else if (element.attribute("subtype") == "file") {
+ else if (attr == "file") {
subtype = Node::File;
ptype = Node::NoPageType;
}
- else if (element.attribute("subtype") == "group") {
+ else if (attr == "group") {
subtype = Node::Group;
ptype = Node::OverviewPage;
}
- else if (element.attribute("subtype") == "module") {
+ else if (attr == "module") {
subtype = Node::Module;
ptype = Node::OverviewPage;
}
- else if (element.attribute("subtype") == "qmlmodule") {
+ else if (attr == "qmlmodule") {
subtype = Node::QmlModule;
ptype = Node::OverviewPage;
}
- else if (element.attribute("subtype") == "page") {
+ else if (attr == "page") {
subtype = Node::Page;
ptype = Node::ArticlePage;
}
- else if (element.attribute("subtype") == "externalpage") {
+ else if (attr == "externalpage") {
subtype = Node::ExternalPage;
ptype = Node::ArticlePage;
}
- else if (element.attribute("subtype") == "qmlclass") {
+ else if (attr == "qmlclass") {
subtype = Node::QmlClass;
ptype = Node::ApiPage;
}
- else if (element.attribute("subtype") == "qmlbasictype") {
+ else if (attr == "qmlbasictype") {
subtype = Node::QmlBasicType;
ptype = Node::ApiPage;
}
else
return;
- DocNode* docNode = new DocNode(parent, name, subtype, ptype);
+ DocNode* docNode = 0;
+ if (subtype == Node::QmlModule) {
+ QString t = element.attribute("qml-module-name") + " " +
+ element.attribute("qml-module-version");
+ docNode = qdb_->addQmlModule(t);
+ }
+ else
+ docNode = new DocNode(parent, name, subtype, ptype);
docNode->setTitle(element.attribute("title"));
if (element.hasAttribute("location"))
@@ -650,8 +657,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
nodeName = "page";
if (node->subType() == Node::QmlClass) {
nodeName = "qmlclass";
- qmlModuleName = node->qmlModuleName();
- qmlModuleVersion = node->qmlModuleVersion();
+ QmlModuleNode* qmn = node->qmlModule();
+ if (qmn)
+ qmlModuleName = qmn->qmlModuleName();
qmlFullBaseName = node->qmlFullBaseName();
}
else if (node->subType() == Node::QmlBasicType)
@@ -771,9 +779,14 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeAttribute("status", status);
writer.writeAttribute("name", objName);
+ if (node->isQmlModule()) {
+ qmlModuleName = node->qmlModuleName();
+ qmlModuleVersion = node->qmlModuleVersion();
+ }
if (!qmlModuleName.isEmpty()) {
writer.writeAttribute("qml-module-name", qmlModuleName);
- writer.writeAttribute("qml-module-version", qmlModuleVersion);
+ if (node->isQmlModule())
+ writer.writeAttribute("qml-module-version", qmlModuleVersion);
if (!qmlFullBaseName.isEmpty())
writer.writeAttribute("qml-base-type", qmlFullBaseName);
}
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp
index 8c5ecdcfe9..5dd8540595 100644
--- a/src/tools/qdoc/tree.cpp
+++ b/src/tools/qdoc/tree.cpp
@@ -758,17 +758,4 @@ NamespaceNode* Tree::findNamespaceNode(const QStringList& path) const
return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType));
}
-/*!
- Find the Qml module node named \a path. Begin the search at the
- \a start node. If the \a start node is 0, begin the search
- at the root of the tree. Only a Qml module node named \a path is
- acceptible. If one is not found, 0 is returned.
- */
-DocNode* Tree::findQmlModuleNode(const QStringList& path, Node* start)
-{
- if (!start)
- start = const_cast<NamespaceNode*>(root());
- return static_cast<DocNode*>(findNodeRecursive(path, 0, start, Node::Document, Node::QmlModule));
-}
-
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h
index d569d8944b..26dd982abd 100644
--- a/src/tools/qdoc/tree.h
+++ b/src/tools/qdoc/tree.h
@@ -85,7 +85,6 @@ class Tree
ClassNode* findClassNode(const QStringList& path, Node* start = 0) const;
QmlClassNode* findQmlTypeNode(const QStringList& path);
NamespaceNode* findNamespaceNode(const QStringList& path) const;
- DocNode* findQmlModuleNode(const QStringList& path, Node* start = 0);
Node* findNodeByNameAndType(const QStringList& path,
Node::Type type,
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 0f12c2b80e..c06ef0c474 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -94,7 +94,9 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
QFileInfoGatherer::~QFileInfoGatherer()
{
abort.store(true);
+ QMutexLocker locker(&mutex);
condition.wakeAll();
+ locker.unlock();
wait();
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 90c8021d41..13aaca2f48 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -2552,8 +2552,10 @@ void QMessageBox::setDetailedText(const QString &text)
d->detailsText = new QMessageBoxDetailsText(this);
d->detailsText->hide();
}
- if (!d->detailsButton)
+ if (!d->detailsButton) {
d->detailsButton = new DetailButton(this);
+ addButton(d->detailsButton, QMessageBox::ActionRole);
+ }
d->detailsText->setText(text);
}
d->setupLayout();
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index a8d13c64ee..565960f8d5 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2647,7 +2647,7 @@ void QApplication::setStartDragDistance(int l)
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
- \snippet code/src_gui_kernel_qapplication.cpp 7
+ \snippet code/src_gui_kernel_qapplication.cpp 6
Qt uses this value internally, e.g. in QFileDialog.
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index d9292b8460..04c083e653 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -56,6 +56,29 @@
# include <windows.h>
#endif
+// Restore permissions so that the QTemporaryDir cleanup can happen
+class PermissionRestorer
+{
+ Q_DISABLE_COPY(PermissionRestorer)
+public:
+ explicit PermissionRestorer(const QString& path) : m_path(path) {}
+ ~PermissionRestorer() { restore(); }
+
+ inline void restore()
+ {
+ QFile file(m_path);
+#ifdef Q_OS_UNIX
+ file.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner));
+#else
+ file.setPermissions(QFile::WriteOwner);
+ file.remove();
+#endif
+ }
+
+private:
+ const QString m_path;
+};
+
class tst_QSaveFile : public QObject
{
Q_OBJECT
@@ -73,13 +96,21 @@ private slots:
void transactionalWriteErrorRenaming();
};
+static inline QByteArray msgCannotOpen(const QFileDevice &f)
+{
+ QString result = QStringLiteral("Cannot open ") + QDir::toNativeSeparators(f.fileName())
+ + QStringLiteral(": ") + f.errorString();
+ return result.toLocal8Bit();
+}
+
void tst_QSaveFile::transactionalWrite()
{
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile::remove(targetFile);
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QVERIFY(file.isOpen());
QCOMPARE(file.fileName(), targetFile);
QVERIFY(!QFile::exists(targetFile));
@@ -102,27 +133,29 @@ void tst_QSaveFile::saveTwice()
// Check that we can reuse a QSaveFile object
// (and test the case of an existing target file)
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE(file.write("Hello"), Q_INT64_C(5));
QVERIFY2(file.commit(), qPrintable(file.errorString()));
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE(file.write("World"), Q_INT64_C(5));
QVERIFY2(file.commit(), qPrintable(file.errorString()));
QFile reader(targetFile);
- QVERIFY(reader.open(QIODevice::ReadOnly));
+ QVERIFY2(reader.open(QIODevice::ReadOnly), msgCannotOpen(reader).constData());
QCOMPARE(QString::fromLatin1(reader.readAll()), QString::fromLatin1("World"));
}
void tst_QSaveFile::textStreamManualFlush()
{
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QTextStream ts(&file);
ts << "Manual flush";
@@ -140,9 +173,10 @@ void tst_QSaveFile::textStreamManualFlush()
void tst_QSaveFile::textStreamAutoFlush()
{
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QTextStream ts(&file);
ts << "Auto-flush.";
@@ -166,28 +200,8 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
{
#ifdef Q_OS_UNIX
QFETCH(bool, directWriteFallback);
- // Restore permissions so that the QTemporaryDir cleanup can happen
- class PermissionRestorer
- {
- QString m_path;
- public:
- PermissionRestorer(const QString& path)
- : m_path(path)
- {}
-
- ~PermissionRestorer()
- {
- restore();
- }
- void restore()
- {
- QFile file(m_path);
- file.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner));
- }
- };
-
-
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
QVERIFY(QFile(dir.path()).setPermissions(QFile::ReadOwner | QFile::ExeOwner));
PermissionRestorer permissionRestorer(dir.path());
@@ -212,7 +226,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
file.setDirectWriteFallback(directWriteFallback);
QCOMPARE(file.directWriteFallback(), directWriteFallback);
if (directWriteFallback) {
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE((int)file.error(), (int)QFile::NoError);
QCOMPARE(file.write("World"), Q_INT64_C(5));
QVERIFY(file.commit());
@@ -222,7 +236,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
QCOMPARE(QString::fromLatin1(reader.readAll()), QString::fromLatin1("World"));
reader.close();
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE((int)file.error(), (int)QFile::NoError);
QCOMPARE(file.write("W"), Q_INT64_C(1));
file.cancelWriting(); // no effect, as per the documentation
@@ -241,9 +255,11 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
{
// Setup an existing but readonly file
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ PermissionRestorer permissionRestorer(targetFile);
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE(file.write("Hello"), Q_INT64_C(5));
file.close();
file.setPermissions(QFile::ReadOwner);
@@ -260,10 +276,11 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
void tst_QSaveFile::transactionalWriteCanceled()
{
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile::remove(targetFile);
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QTextStream ts(&file);
ts << "This writing operation will soon be canceled.\n";
@@ -283,35 +300,12 @@ void tst_QSaveFile::transactionalWriteCanceled()
void tst_QSaveFile::transactionalWriteErrorRenaming()
{
QTemporaryDir dir;
+ QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
QCOMPARE(file.write("Hello"), qint64(5));
QVERIFY(!QFile::exists(targetFile));
-
- // Restore permissions so that the QTemporaryDir cleanup can happen
- class PermissionRestorer
- {
- public:
- PermissionRestorer(const QString& path)
- : m_path(path)
- {}
-
- ~PermissionRestorer()
- {
- QFile file(m_path);
-#ifdef Q_OS_UNIX
- file.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner));
-#else
- file.setPermissions(QFile::WriteOwner);
- file.remove();
-#endif
- }
-
- private:
- QString m_path;
- };
-
#ifdef Q_OS_UNIX
// Make rename() fail for lack of permissions in the directory
QFile dirAsFile(dir.path()); // yay, I have to use QFile to change a dir's permissions...
@@ -320,7 +314,7 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
#else
// Windows: Make rename() fail for lack of permissions on an existing target file
QFile existingTargetFile(targetFile);
- QVERIFY(existingTargetFile.open(QIODevice::WriteOnly));
+ QVERIFY2(existingTargetFile.open(QIODevice::WriteOnly), msgCannotOpen(existingTargetFile).constData());
QCOMPARE(file.write("Target"), qint64(6));
existingTargetFile.close();
QVERIFY(existingTargetFile.setPermissions(QFile::ReadOwner));
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index b63dbc449c..9ac1526f07 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -308,13 +308,16 @@ void tst_qstandardpaths::testDataLocation()
#ifndef Q_OS_WIN
// Find "sh" on Unix.
+// It may exist twice, in /bin/sh and /usr/bin/sh, in that case use the PATH order.
static inline QFileInfo findSh()
{
- const char *shPaths[] = {"/bin/sh", "/usr/bin/sh", 0};
- for (const char **shPath = shPaths; *shPath; ++shPath) {
- const QFileInfo fi = QFileInfo(QLatin1String(*shPath));
- if (fi.exists())
- return fi;
+ QLatin1String sh("/sh");
+ QByteArray pEnv = qgetenv("PATH");
+ const QLatin1Char pathSep(':');
+ const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(pathSep, QString::SkipEmptyParts);
+ foreach (const QString &path, rawPaths) {
+ if (QFile::exists(path + sh))
+ return path + sh;
}
return QFileInfo();
}
diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
index 14df20c986..0602b9fc38 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
+++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
@@ -2,3 +2,4 @@ CONFIG += testcase parallel_test
TARGET = tst_qcoreapplication
QT = core testlib core-private
SOURCES = tst_qcoreapplication.cpp
+HEADERS = tst_qcoreapplication.h
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 78f2cdae69..760303a027 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include "tst_qcoreapplication.h"
+
#include <QtCore/QtCore>
#include <QtTest/QtTest>
@@ -46,31 +48,12 @@
#include <private/qeventloop_p.h>
#include <private/qthread_p.h>
-class tst_QCoreApplication: public QObject
-{
- Q_OBJECT
-private slots:
- void sendEventsOnProcessEvents(); // this must be the first test
- void getSetCheck();
- void qAppName();
-#ifndef Q_OS_WIN
- void argc();
-#endif
- void postEvent();
- void removePostedEvents();
-#ifndef QT_NO_THREAD
- void deliverInDefinedOrder();
+#ifdef QT_GUI_LIB
+#include <QtGui/QGuiApplication>
+typedef QGuiApplication TestApplication;
+#else
+typedef QCoreApplication TestApplication;
#endif
- void applicationPid();
- void globalPostedEventsCount();
- void processEventsAlwaysSendsPostedEvents();
- void reexec();
- void execAfterExit();
- void eventLoopExecAfterExit();
- void customEventDispatcher();
- void testQuitLock();
- void QTBUG31606_QEventDestructorDeadLock();
-};
class EventSpy : public QObject
{
@@ -89,7 +72,7 @@ void tst_QCoreApplication::sendEventsOnProcessEvents()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
EventSpy spy;
app.installEventFilter(&spy);
@@ -111,7 +94,7 @@ void tst_QCoreApplication::getSetCheck()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCOMPARE(app.property("applicationVersion").toString(), v);
}
v = QString();
@@ -121,11 +104,17 @@ void tst_QCoreApplication::getSetCheck()
void tst_QCoreApplication::qAppName()
{
+#ifdef QT_GUI_LIB
+ const char* appName = "tst_qguiapplication";
+#else
+ const char* appName = "tst_qcoreapplication";
+#endif
+
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
- QCoreApplication app(argc, argv);
- QCOMPARE(::qAppName(), QString::fromLatin1("tst_qcoreapplication"));
- QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1("tst_qcoreapplication"));
+ char *argv[] = { const_cast<char*>(appName) };
+ TestApplication app(argc, argv);
+ QCOMPARE(::qAppName(), QString::fromLatin1(appName));
+ QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1(appName));
}
// "QCoreApplication::arguments() always parses arguments from actual command line on Windows
@@ -136,7 +125,7 @@ void tst_QCoreApplication::argc()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.arguments().count(), 1);
}
@@ -147,7 +136,7 @@ void tst_QCoreApplication::argc()
const_cast<char*>("arg1"),
const_cast<char*>("arg2"),
const_cast<char*>("arg3") };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCOMPARE(argc, 4);
QCOMPARE(app.arguments().count(), 4);
}
@@ -155,7 +144,7 @@ void tst_QCoreApplication::argc()
{
int argc = 0;
char **argv = 0;
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCOMPARE(argc, 0);
QCOMPARE(app.arguments().count(), 0);
}
@@ -164,7 +153,7 @@ void tst_QCoreApplication::argc()
int argc = 2;
char *argv[] = { const_cast<char*>(QTest::currentAppName()),
const_cast<char*>("-qmljsdebugger=port:3768,block") };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.arguments().count(), 1);
}
@@ -197,7 +186,7 @@ void tst_QCoreApplication::postEvent()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
EventSpy spy;
EventGenerator odd, even;
@@ -282,7 +271,7 @@ void tst_QCoreApplication::removePostedEvents()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
EventSpy spy;
QObject one, two;
@@ -461,7 +450,7 @@ void tst_QCoreApplication::deliverInDefinedOrder()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
DeliverInDefinedOrderObject obj(&app);
// causes sendPostedEvents() to recurse twice
@@ -501,7 +490,7 @@ void tst_QCoreApplication::globalPostedEventsCount()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QCoreApplication::sendPostedEvents();
QCOMPARE(qGlobalPostedEventsCount(), 0u);
@@ -547,7 +536,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
ProcessEventsAlwaysSendsPostedEventsObject object;
QTime t;
@@ -565,7 +554,7 @@ void tst_QCoreApplication::reexec()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
// exec once
QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
@@ -580,7 +569,7 @@ void tst_QCoreApplication::execAfterExit()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
app.exit(1);
QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
@@ -591,7 +580,7 @@ void tst_QCoreApplication::eventLoopExecAfterExit()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
// exec once and exit
QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
@@ -649,7 +638,7 @@ void tst_QCoreApplication::customEventDispatcher()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
// instantiating app should not overwrite the ED
QCOMPARE(QCoreApplication::eventDispatcher(), ed);
QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
@@ -764,7 +753,7 @@ void tst_QCoreApplication::testQuitLock()
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
QuitTester tester;
app.exec();
@@ -783,7 +772,7 @@ void tst_QCoreApplication::QTBUG31606_QEventDestructorDeadLock()
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
- QCoreApplication app(argc, argv);
+ TestApplication app(argc, argv);
EventSpy spy;
app.installEventFilter(&spy);
@@ -810,5 +799,8 @@ static void createQObjectOnDestruction()
}
Q_DESTRUCTOR_FUNCTION(createQObjectOnDestruction)
+#ifndef QT_GUI_LIB
QTEST_APPLESS_MAIN(tst_QCoreApplication)
+#endif
+
#include "tst_qcoreapplication.moc"
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
new file mode 100644
index 0000000000..16ade27f83
--- /dev/null
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TST_QCOREAPPLICATION_H
+#define TST_QCOREAPPLICATION_H
+
+#include <QtCore/QtCore>
+
+class tst_QCoreApplication: public QObject
+{
+ Q_OBJECT
+private slots:
+ void sendEventsOnProcessEvents(); // this must be the first test
+ void getSetCheck();
+ void qAppName();
+#ifndef Q_OS_WIN
+ void argc();
+#endif
+ void postEvent();
+ void removePostedEvents();
+#ifndef QT_NO_THREAD
+ void deliverInDefinedOrder();
+#endif
+ void applicationPid();
+ void globalPostedEventsCount();
+ void processEventsAlwaysSendsPostedEvents();
+ void reexec();
+ void execAfterExit();
+ void eventLoopExecAfterExit();
+ void customEventDispatcher();
+ void testQuitLock();
+ void QTBUG31606_QEventDestructorDeadLock();
+};
+
+#endif // TST_QCOREAPPLICATION_H
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 039f5cbc44..ffc4baa55d 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -2387,8 +2387,6 @@ void tst_QDateTime::daylightTransitions() const
// 2011-10-30 03:00:00 CEST became 02:00:00 CET at msecs = 1319936400000
// 2012-03-25 02:00:00 CET became 03:00:00 CEST at msecs = 1332637200000
// 2012-10-28 03:00:00 CEST became 02:00:00 CET at msecs = 1351386000000
- const qint64 daylight2011 = 1301187600000;
- const qint64 standard2011 = 1319936400000;
const qint64 daylight2012 = 1332637200000;
const qint64 standard2012 = 1351386000000;
const qint64 msecsOneHour = 3600000;
@@ -2538,10 +2536,6 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(hourBefore.isValid());
QCOMPARE(hourBefore.date(), QDate(2012, 10, 28));
QCOMPARE(hourBefore.time(), QTime(2, 0, 0));
-#ifndef Q_OS_MAC
- // Linux mktime bug uses last calculation
- QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
QCOMPARE(hourBefore.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
// 1 msec before transition is 2:59:59.999 FirstOccurrence
@@ -2549,7 +2543,6 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(msecBefore.isValid());
QCOMPARE(msecBefore.date(), QDate(2012, 10, 28));
QCOMPARE(msecBefore.time(), QTime(2, 59, 59, 999));
- QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
QCOMPARE(msecBefore.toMSecsSinceEpoch(), standard2012 - 1);
// At transition is 2:00:00 SecondOccurrence
@@ -2557,10 +2550,6 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(atTran.isValid());
QCOMPARE(atTran.date(), QDate(2012, 10, 28));
QCOMPARE(atTran.time(), QTime(2, 0, 0));
-#ifdef Q_OS_MAC
- // Mac defaults to FirstOccurrence here
- QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
QCOMPARE(atTran.toMSecsSinceEpoch(), standard2012);
// 59:59.999 after transition is 2:59:59.999 SecondOccurrence
@@ -2711,10 +2700,6 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
-#ifdef Q_OS_WIN
- // Windows uses SecondOccurrence
- QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
// Add hour to tran FirstOccurrence to get to tran SecondOccurrence
@@ -2727,11 +2712,10 @@ void tst_QDateTime::daylightTransitions() const
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_WIN
QCOMPARE(test.time(), QTime(2, 0, 0));
-#ifndef Q_OS_MAC
+#ifdef Q_OS_WIN
// Windows uses SecondOccurrence
- // Linux mktime bug uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
-#endif // Q_OS_MAC
+#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012);
// Add hour to tran SecondOccurrence to get to after tran FirstOccurrence
@@ -2739,15 +2723,13 @@ void tst_QDateTime::daylightTransitions() const
test = test.addMSecs(msecsOneHour);
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
-#ifndef Q_OS_WIN
- // Mac uses FirstOccurrence
- // Linux mktime bug uses last calculation
+#ifdef Q_OS_MAC
+ // Mac uses FirstOccurrence, Windows uses SecondOccurrence, Linux uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_WIN
QCOMPARE(test.time(), QTime(3, 0, 0));
-#ifndef Q_OS_WIN
- // Mac uses FirstOccurrence
- // Linux mktime bug uses last calculation
+#ifdef Q_OS_MAC
+ // Mac uses FirstOccurrence, Windows uses SecondOccurrence, Linux uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_WIN
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 + msecsOneHour);
diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
index a9baf29996..79acb9e5f1 100644
--- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
+++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
@@ -1,4 +1,9 @@
-CONFIG += testcase
+CORE_TEST_PATH = ../../../corelib/kernel/qcoreapplication
+
+VPATH += $$CORE_TEST_PATH
+include($${CORE_TEST_PATH}/qcoreapplication.pro)
+INCLUDEPATH += $$CORE_TEST_PATH
+
TARGET = tst_qguiapplication
-QT += core gui gui-private testlib
-SOURCES = tst_qguiapplication.cpp
+QT += gui gui-private
+SOURCES += tst_qguiapplication.cpp
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 7884426d68..d4237b135f 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -50,9 +50,11 @@
#include <QDebug>
+#include "tst_qcoreapplication.h"
+
enum { spacing = 50, windowSize = 200 };
-class tst_QGuiApplication: public QObject
+class tst_QGuiApplication: public tst_QCoreApplication
{
Q_OBJECT
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 97f3ec128d..4defbe181f 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -171,8 +171,8 @@ void tst_QOpenGL::sharedResourceCleanup()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext *ctx = new QOpenGLContext;
- ctx->create();
- ctx->makeCurrent(surface.data());
+ QVERIFY(ctx->create());
+ QVERIFY(ctx->makeCurrent(surface.data()));
SharedResourceTracker tracker;
SharedResource *resource = new SharedResource(&tracker);
@@ -188,7 +188,7 @@ void tst_QOpenGL::sharedResourceCleanup()
QOpenGLContext *ctx2 = new QOpenGLContext;
ctx2->setShareContext(ctx);
- ctx2->create();
+ QVERIFY(ctx2->create());
delete ctx;
@@ -238,7 +238,7 @@ void tst_QOpenGL::multiGroupSharedResourceCleanup()
for (int i = 0; i < 10; ++i) {
QOpenGLContext *gl = new QOpenGLContext();
- gl->create();
+ QVERIFY(gl->create());
gl->makeCurrent(surface.data());
{
// Cause QOpenGLMultiGroupSharedResource instantiation.
@@ -262,8 +262,8 @@ void tst_QOpenGL::multiGroupSharedResourceCleanupCustom()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext *ctx = new QOpenGLContext();
- ctx->create();
- ctx->makeCurrent(surface.data());
+ QVERIFY(ctx->create());
+ QVERIFY(ctx->makeCurrent(surface.data()));
QOpenGLMultiGroupSharedResource multiGroupSharedResource;
SharedResource *resource = multiGroupSharedResource.value<SharedResource>(ctx);
@@ -401,7 +401,7 @@ void tst_QOpenGL::fboSimpleRendering()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
- ctx.create();
+ QVERIFY(ctx.create());
ctx.makeCurrent(surface.data());
@@ -449,7 +449,7 @@ void tst_QOpenGL::fboRendering()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
- ctx.create();
+ QVERIFY(ctx.create());
ctx.makeCurrent(surface.data());
@@ -493,7 +493,7 @@ void tst_QOpenGL::fboHandleNulledAfterContextDestroyed()
{
QOpenGLContext ctx;
- ctx.create();
+ QVERIFY(ctx.create());
ctx.makeCurrent(&window);
@@ -523,7 +523,7 @@ void tst_QOpenGL::openGLPaintDevice()
QScopedPointer<QSurface> surface(createSurface(surfaceClass));
QOpenGLContext ctx;
- ctx.create();
+ QVERIFY(ctx.create());
QSurfaceFormat format = ctx.format();
if (format.majorVersion() < 2)
@@ -576,8 +576,8 @@ void tst_QOpenGL::aboutToBeDestroyed()
QOpenGLContext *context = new QOpenGLContext;
QSignalSpy spy(context, SIGNAL(aboutToBeDestroyed()));
- context->create();
- context->makeCurrent(&window);
+ QVERIFY(context->create());
+ QVERIFY(context->makeCurrent(&window));
QCOMPARE(spy.size(), 0);
@@ -598,8 +598,8 @@ void tst_QOpenGL::QTBUG15621_triangulatingStrokerDivZero()
window.create();
QOpenGLContext ctx;
- ctx.create();
- ctx.makeCurrent(&window);
+ QVERIFY(ctx.create());
+ QVERIFY(ctx.makeCurrent(&window));
if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects())
QSKIP("QOpenGLFramebufferObject not supported on this platform");
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index fff8884d67..a99b041bfc 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -228,8 +228,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
fmt.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
fmt.setSamples(4);
QOpenGLContext ctx;
- ctx.create();
- ctx.makeCurrent(&win);
+ QVERIFY(ctx.create());
+ QVERIFY(ctx.makeCurrent(&win));
QOpenGLFramebufferObject fbo(800, 800, fmt);
fbo.bind();
QOpenGLPaintDevice pdv(800, 800);
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 0a705949f3..092995c0aa 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -3181,11 +3181,16 @@ void tst_QAccessibility::comboBoxTest()
void tst_QAccessibility::labelTest()
{
+ QWidget *window = new QWidget;
QString text = "Hello World";
- QLabel *label = new QLabel(text);
+ QLabel *label = new QLabel(text, window);
setFrameless(label);
- label->show();
+ QLineEdit *buddy = new QLineEdit(window);
+ label->setBuddy(buddy);
+ window->resize(320, 200);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
#if defined(Q_OS_UNIX)
QCoreApplication::processEvents();
#endif
@@ -3196,7 +3201,15 @@ void tst_QAccessibility::labelTest()
QCOMPARE(acc_label->text(QAccessible::Name), text);
- delete label;
+ QVector<QPair<QAccessibleInterface *, QAccessible::Relation> > rels = acc_label->relations();
+ QCOMPARE(rels.count(), 1);
+ QAccessibleInterface *iface = rels.first().first;
+ QAccessible::Relation rel = rels.first().second;
+
+ QCOMPARE(rel, QAccessible::Labelled);
+ QCOMPARE(iface->role(), QAccessible::EditableText);
+
+ delete window;
QTestAccessibility::clearEvents();
QPixmap testPixmap(50, 50);
@@ -3313,9 +3326,13 @@ void tst_QAccessibility::bridgeTest()
tableWidget->setFixedSize(600, 600);
+ QLabel *label = new QLabel(tr("Push my buddy"));
+ label->setBuddy(button);
+
lay->addWidget(button);
lay->addWidget(te);
lay->addWidget(tableWidget);
+ lay->addWidget(label);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -3387,9 +3404,47 @@ void tst_QAccessibility::bridgeTest()
BSTR actionName;
ia2Action->get_name(0, &actionName);
QString name((QChar*)actionName);
+ ::SysFreeString(actionName);
QCOMPARE(name, QAccessibleActionInterface::pressAction());
ia2Action->Release();
+ /***** Test IAccessibleRelation *****/
+ long nRelations = 0;
+ hr = ia2Button->get_nRelations(&nRelations);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(nRelations, (long)1);
+
+ IAccessibleRelation **relations = (IAccessibleRelation **)::CoTaskMemAlloc(sizeof(IAccessibleRelation *) * 4);
+ hr = ia2Button->get_relations(4, relations, &nRelations);
+ QVERIFY(SUCCEEDED(hr));
+ QCOMPARE(nRelations, (long)1);
+
+ IAccessibleRelation *relation = relations[0];
+ BSTR relType;
+ hr = relation->get_relationType(&relType);
+ QCOMPARE(QString::fromWCharArray(relType), QLatin1String("labelFor"));
+ ::SysFreeString(relType);
+
+ long nTargets;
+ relation->get_nTargets(&nTargets);
+ QCOMPARE(nTargets, (long)1);
+ IAccessible *target; // target is the label
+ hr = relation->get_target(0, (IUnknown**)&target);
+ QVERIFY(SUCCEEDED(hr));
+
+ VARIANT varRole;
+ hr = target->get_accRole(varSELF, &varRole);
+ QVERIFY(SUCCEEDED(hr));
+ Q_ASSERT(varRole.vt == (VARTYPE)VT_I4);
+ QCOMPARE(varRole.lVal, (LONG)ROLE_SYSTEM_STATICTEXT);
+
+ BSTR buttonName;
+ hr = target->get_accName(varSELF, &buttonName);
+ QVERIFY(SUCCEEDED(hr));
+
+ QCOMPARE(QString::fromWCharArray(buttonName), QLatin1String("Push my buddy"));
+ ::SysFreeString(buttonName);
+ ::CoTaskMemFree(relations);
// Done testing
ia2Button->Release();
@@ -3416,7 +3471,7 @@ void tst_QAccessibility::bridgeTest()
long nChildren;
hr = iaccWindow->get_accChildCount(&nChildren);
QVERIFY(SUCCEEDED(hr));
- QCOMPARE(nChildren, (long)3);
+ QCOMPARE(nChildren, (long)4);
/**************************************************
* QTextEdit
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 98b096031e..b9e6c82d84 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -1199,10 +1199,9 @@ void tst_QFileDialog2::task259105_filtersCornerCases()
void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
{
QString tempPath = tempDir.path();
- QTemporaryFile *t;
- t = new QTemporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
- t->open();
- QNonNativeFileDialog fd(0, "TestFileDialog", t->fileName());
+ QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
+ QVERIFY(temporaryFile.open());
+ QNonNativeFileDialog fd(0, "TestFileDialog", temporaryFile.fileName());
fd.setDirectory(tempPath);
fd.setViewMode(QFileDialog::List);
@@ -1218,8 +1217,8 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
QVERIFY(lineEdit);
- QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName());
- QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
+ QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), temporaryFile.fileName());
+ QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), temporaryFile.fileName());
}
void tst_QFileDialog2::QTBUG6558_showDirsOnly()