From 61c49611fc2e999e2f4467b2ebdb0d188de578e6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 26 Sep 2013 16:48:09 +0200 Subject: Windows: Use PostMessage for clipboard notifications for debugged apps. Task-number: QTBUG-33492 Change-Id: I68af5f8ad767c55c95f758259cbb5d8a8080e70e Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsclipboard.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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); } /*! -- cgit v1.2.3 From cf5470e1700e0ca1f5bc828961f19e722fa422fe Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 26 Sep 2013 15:25:31 +0200 Subject: qdoc: Correct location info for typedefs with associated enums For typedef nodes that have an associated enumeration, qdoc generates incorrect location info (written to index files) by simply appending '-typedef' to the node name. The correct location to link to is the associated enumeration, if one exists. Task-number: QTBUG-33684 Change-Id: I749171ccae9ccc10f084a40fda14e72d5f4d44cf Reviewed-by: Jerome Pasion Reviewed-by: Shawn Rutledge Reviewed-by: Martin Smith --- src/tools/qdoc/generator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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(node); + if (tdef->associatedEnum()) { + return fullDocumentLocation(tdef->associatedEnum()); + } anchorRef = QLatin1Char('#') + node->name() + "-typedef"; break; + } case Node::Property: anchorRef = QLatin1Char('#') + node->name() + "-prop"; break; -- cgit v1.2.3 From f911e87345c0fadeef602a6350c2e5db6f5892f2 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 25 Sep 2013 15:33:47 +0200 Subject: Win: Fixed namespaced build with QT_NO_FILESYSTEMWATCHER Change-Id: I70049b90d2071c7a23a8a2804842d70d0f583f19 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/corelib/io/qfilesystemwatcher_win_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- cgit v1.2.3 From bdfbc9e493b4df7da89fb62222dc7cb283b3794a Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Thu, 26 Sep 2013 22:35:33 +0300 Subject: qdbusxml2cpp: Fix annotation value in an introspection string generator Unescaped annotation value causes for harmless values in an XML file, for instance, 'value=\"QList<uint>\"' a DBus exception, like dbus.exceptions.IntrospectionParserException: Error parsing introspect data Task-number: QTBUG-26668 Change-Id: Ie1eb519aec5228da0591d62c3aa5b6dec5790eb9 Reviewed-by: Thiago Macieira --- src/dbus/qdbusxmlparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(" \n"); + ifaceData->introspection += QLatin1String(" \n"); return true; } -- cgit v1.2.3 From d5c729604a18dc0505189d570a5d4baaa4ebaf43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 26 Sep 2013 17:00:19 +0200 Subject: iOS: Always use application bundle when building Qt applications Change-Id: I8fd0f7b43bdcbff0bff2de890fe421eb51233192 Reviewed-by: Joerg Bornemann --- mkspecs/features/ios/default_post.prf | 11 ++++++++++- mkspecs/features/ios/qt.prf | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 4b755ffa6da752d0124c581e781f8a6c81bd7c9e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 27 Sep 2013 11:02:03 +0300 Subject: QWindowsWindow: Output warnings with classname/objectname. Change-Id: I55a165669dbcadf2bd06b2315b1db43b092a1758 Reviewed-by: Joerg Bornemann Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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); -- cgit v1.2.3 From 6afb0579626781ccf6dfd55a8ac1a0bc35e4d9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 27 Sep 2013 12:36:11 +0200 Subject: Clear m_activePopupWindow on popup close. QCocoaWindow keeps track of popup windows in order to close them when appropriate, for example on mouse clicks outside the popup. In this case the mouse click will be used to close the popup, and will not be send to the QCocoaWindow. Clear m_activePopupWindow when the popup is closed to fix a bug where the first mouse click after closing a popup would have no effect. Change-Id: I7a3e850e4fbf4686540d5d89dac6d7b613ed10a4 Reviewed-by: Eike Ziller Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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]; + } } } -- cgit v1.2.3 From 29585ec3d3ba0316d3a28d5fd1c383f2b82f8827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 27 Sep 2013 13:27:59 +0200 Subject: Fix regression in trackpad scroll event handling. bab29dd76 changed scroll event handling to update the keyboard modifier state during scroll event streams and brought back the bug where Qt Creator would suddenly change the font size if you pressed the command key while scrolling. Use momemtumPhase to detect scroll event streams. momemtumPahse will be NSEventPhaseNone as long as there are fingers on the trackpad. After liftoff it will have a different value, and at this point we freeze the keyboard modifier state until the scroll event stream has ended. This approach does not interfere with normal mouse scroll wheels since momentumPhase is PahseNone for all such scroll events. Change-Id: I668ade8e794a97491487c9465366a316a7d6a9c8 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 -- cgit v1.2.3 From 9ff81bdc1ab4e3d14914192cd63ae625a507fe90 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 27 Sep 2013 13:22:59 +0200 Subject: Use a pimpl in QLoggingCategory With the usual pros/cons. Cleans up the publicly visible interface and gives some headroom for further extensions. Change-Id: I7237b1fd2a22c66574d1b7e532d99137bb56ce1d Reviewed-by: Kai Koehne --- src/corelib/io/qloggingcategory.cpp | 30 +++++++++++++++++++++++------- src/corelib/io/qloggingcategory.h | 5 +++-- 2 files changed, 26 insertions(+), 9 deletions(-) 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 @@ -97,6 +97,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, configure categories globally. */ +/*! + \internal +*/ +typedef QVector 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. @@ -104,7 +118,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, 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 Tracers; - Tracers tracers; }; template <> -- cgit v1.2.3 From a94e9329450be060256e5040c095c6175d5ec19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Thu, 26 Sep 2013 15:28:33 +0200 Subject: QVarLengthArray - doc fix. QVarLengthArray actually does support iterators. It was added in Qt 4.8. Change-Id: I9f714a09eab1d2e5dc023bd701ab7c743b078ec0 Reviewed-by: Olivier Goffart Reviewed-by: Giuseppe D'Angelo --- src/corelib/tools/qvarlengtharray.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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.) -- cgit v1.2.3 From ec716cc5bf267e6895f673f4be76e3422cf86d3d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Sep 2013 16:44:06 +0200 Subject: Android: Handle new QtTraceMsg in message handler Change-Id: I3eb6fa42044ff4bdd0219925abf9d18cad60de7c Reviewed-by: hjk --- src/corelib/global/qlogging.cpp | 1 + 1 file changed, 1 insertion(+) 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; -- cgit v1.2.3 From 4aca7847be8bd9e146de876c2b73fa91ef0aa646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 25 Sep 2013 16:05:09 +0000 Subject: Fix open ssl forwarding macros. This patch fixes them in many ways: - use Q_UNLIKELY to mark an error case - reduce QtNetwork library size by 40315 bytes - fix DEFINEFUNC9 which had wrong logic, happily it was not used anywhere Change-Id: Ic46a569f85aa22a00ecd88158e60c52f4665ec4c Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 7 ++++++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 33 +++++++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index a010075436..7c3cfb2012 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -114,6 +114,13 @@ QT_BEGIN_NAMESPACE possibly with a different version of OpenSSL. */ +namespace { +void qsslSocketUnresolvedSymbolWarning(const char *functionName) +{ + qWarning("QSslSocket: cannot call unresolved function %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 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 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); \ -- cgit v1.2.3 From bb26e087bd4693488fd932a209c8b141c6d98546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 25 Sep 2013 16:25:14 +0000 Subject: Reduce QtNetwork lib size by 16111 bytes. Warning message was repeated multiple times inside the library. Change-Id: Idcd417dda22de189893db597acfc36c2aa99d078 Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 7c3cfb2012..2cc474ca74 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -119,6 +119,11 @@ 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 @@ -345,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 -- cgit v1.2.3 From a0792f0e5135588437ed76d4d0e257a276fd80da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 27 Sep 2013 16:36:42 +0200 Subject: iOS: Add explicit dependency on the Foundation framework for QtCore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First of all it needed on both OSX and iOS, and secondly it's required for our Qt APIs, now that we provide conversion functions to Foundation types such as NSURL and NSString, so it should be part of LIBS, not LIBS_PRIVATE. Change-Id: Ida4977d6aa0e76b3d1b8b565672c00a8526e3381 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich --- src/corelib/corelib.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From 3705c1263d4d2232d5527361692d25a8519c222b Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 26 Sep 2013 12:16:39 +0200 Subject: Doc: Add docs for rvalue references and move constructors These members were introduced in 4.8, but left undocumented. Because we consider undocumented API to be internal, the members are \since 5.2. Change-Id: I52e2840a8cfaa7f59f410b3e2a06c0942ea06539 Reviewed-by: Jerome Pasion Reviewed-by: Stephen Kelly --- src/corelib/io/qdir.cpp | 8 +++++++ src/corelib/io/qfileinfo.cpp | 8 +++++++ src/corelib/io/qurl.cpp | 17 ++++++++++++++ src/corelib/io/qurlquery.cpp | 8 +++++++ src/corelib/itemmodels/qabstractitemmodel.cpp | 17 ++++++++++++++ src/corelib/kernel/qvariant.cpp | 17 ++++++++++++++ src/corelib/mimetypes/qmimetype.cpp | 8 +++++++ src/corelib/tools/qbitarray.cpp | 17 ++++++++++++++ src/corelib/tools/qbytearray.cpp | 17 ++++++++++++++ src/corelib/tools/qcommandlineoption.cpp | 8 +++++++ src/corelib/tools/qcontiguouscache.cpp | 8 +++++++ src/corelib/tools/qeasingcurve.cpp | 17 ++++++++++++++ src/corelib/tools/qhash.cpp | 17 ++++++++++++++ src/corelib/tools/qlinkedlist.cpp | 17 ++++++++++++++ src/corelib/tools/qlist.cpp | 17 ++++++++++++++ src/corelib/tools/qmap.cpp | 17 ++++++++++++++ src/corelib/tools/qregexp.cpp | 8 +++++++ src/corelib/tools/qshareddata.cpp | 34 +++++++++++++++++++++++++++ src/corelib/tools/qstring.cpp | 16 +++++++++++++ src/corelib/tools/qtimezone.cpp | 9 +++++++ src/corelib/tools/qvector.cpp | 17 ++++++++++++++ src/gui/image/qicon.cpp | 8 +++++++ src/gui/image/qimage.cpp | 17 ++++++++++++++ src/gui/image/qpicture.cpp | 8 +++++++ src/gui/image/qpixmap.cpp | 8 +++++++ src/gui/kernel/qcursor.cpp | 8 +++++++ src/gui/kernel/qkeysequence.cpp | 8 +++++++ src/gui/kernel/qpalette.cpp | 8 +++++++ src/gui/painting/qbrush.cpp | 7 ++++++ src/gui/painting/qpainterpath.cpp | 8 +++++++ src/gui/painting/qpen.cpp | 8 +++++++ src/gui/painting/qregion.cpp | 8 +++++++ src/gui/text/qfont.cpp | 8 +++++++ src/gui/text/qfontmetrics.cpp | 8 +++++++ 34 files changed, 414 insertions(+) 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 @@ -514,6 +514,14 @@ inline void QDirPrivate::initFileEngine() \sa QFileInfo, QFile, QFileDialog, QCoreApplication::applicationDirPath(), {Find Files Example} */ +/*! + \fn QDir &QDir::operator=(QDir &&other) + + Move-assigns \a other to this QDir instance. + + \since 5.2 +*/ + /*! \internal */ 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 @@ -293,6 +293,14 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) \sa QDir, QFile */ +/*! + \fn QFileInfo &QFileInfo::operator=(QFileInfo &&other) + + Move-assigns \a other to this QFileInfo instance. + + \since 5.2 +*/ + /*! \internal */ 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 > 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/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 75e945a0cc..a7c0bd2321 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1104,6 +1104,23 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names \omitvalue LastType */ +/*! + \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() 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 @@ -108,6 +108,14 @@ void QMimeTypePrivate::addGlobPattern(const QString &pattern) \sa QMimeDatabase */ +/*! + \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 @@ -87,6 +87,14 @@ public: \sa QCommandLineParser */ +/*! + \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. 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 &QContiguousCache::operator=(QContiguousCache &&other) + + Move-assigns \a other to this QContiguousCache instance. + + \since 5.2 +*/ + /*! \fn void QContiguousCache::swap(QContiguousCache &other) \since 4.8 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 @@ -1065,6 +1065,15 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) return curveFunc; } +/*! + \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. */ @@ -1097,6 +1106,14 @@ QEasingCurve::~QEasingCurve() Copy \a other. */ +/*! + \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 &&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 > 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 &QHash::operator=(QHash &&other) + + Move-assigns \a other to this QHash instance. + + \since 5.2 +*/ + /*! \fn void QHash::swap(QHash &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 &&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 &other) Constructs a copy of \a other. @@ -740,6 +749,14 @@ const QLinkedListData QLinkedListData::shared_null = { Assigns \a other to this iterator. */ +/*! + \fn QLinkedList &QLinkedList::operator=(QLinkedList &&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 @@ -479,6 +479,15 @@ void **QListData::erase(void **xi) \sa QListIterator, QMutableListIterator, QLinkedList, QVector */ +/*! + \fn QList::QList(QList &&other) + + Move-constructs a QList instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QList QList::mid(int pos, int length) const @@ -527,6 +536,14 @@ void **QListData::erase(void **xi) list. */ +/*! + \fn QList &QList::operator=(QList &&other) + + Move-assigns \a other to this QList instance. + + \since 5.2 +*/ + /*! \fn void QList::swap(QList &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 &&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 &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 &QMap::operator=(QMap &&other) + + Move-assigns \a other to this QMap instance. + + \since 5.2 +*/ + /*! \fn void QMap::swap(QMap &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 @@ -4012,6 +4012,14 @@ QRegExp &QRegExp::operator=(const QRegExp &rx) return *this; } +/*! + \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/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 &QSharedDataPointer::operator=(QSharedDataPointer &&other) + + Move-assigns \a other to this QSharedDataPointer instance. + + \since 5.2 +*/ + /*! \fn bool QSharedDataPointer::operator==(const QSharedDataPointer& 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 &QExplicitlySharedDataPointer::operator=(QExplicitlySharedDataPointer &&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 cdd0aba102..762ad6fd09 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -422,6 +422,15 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) return *this; } +/*! + \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/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 &&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 &QVector::operator=(QVector &&other) + + Move-assigns \a other to this QVector instance. + + \since 5.2 +*/ + /*! \fn void QVector::swap(QVector &other) \since 4.8 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 @@ -643,6 +643,14 @@ QIcon &QIcon::operator=(const QIcon &other) return *this; } +/*! + \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 @@ -601,6 +601,23 @@ bool QImageData::checkForAlphaPixels() const {Image Viewer Example}, {Scribble Example}, {Pixelator Example} */ +/*! + \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 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 @@ -391,6 +391,14 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap) return *this; } +/*! + \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 @@ -153,6 +153,14 @@ QT_BEGIN_NAMESPACE \sa QWidget, {fowler}{GUI Design Handbook: Cursors} */ +/*! + \fn QCursor &QCursor::operator=(QCursor &&other) + + Move-assigns \a other to this QCursor instance. + + \since 5.2 +*/ + /*! \fn QPoint QCursor::pos(const QScreen *screen) 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 @@ -732,6 +732,14 @@ static const struct { \value FullScreen Toggle the window state to/from full screen. */ +/*! + \fn QKeySequence &QKeySequence::operator=(QKeySequence &&other) + + Move-assigns \a other to this QKeySequence instance. + + \since 5.2 +*/ + /*! \since 4.2 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 @@ -89,6 +89,14 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button) whiteBrush, buttonBrush, buttonBrush); } +/*! + \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 diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 66c3a68c13..4ec47fa4a9 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -631,6 +631,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 @@ -607,6 +607,14 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other) return *this; } +/*! + \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 4122322e36..a7c4a0eae1 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -377,6 +377,14 @@ QPen &QPen::operator=(const QPen &p) return *this; } +/*! + \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 @@ -360,6 +360,14 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt Assigns \a r to this region and returns a reference to the region. */ +/*! + \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 @@ -536,6 +536,14 @@ QFontEngineData::~QFontEngineData() \sa Weight */ +/*! + \fn QFont &QFont::operator=(QFont &&other) + + Move-assigns \a other to this QFont instance. + + \since 5.2 +*/ + /*! \fn QString QFont::rawName() const 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 @@ -212,6 +212,14 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm) return *this; } +/*! + \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 -- cgit v1.2.3 From 475cbed2446d0e3595e7b8ab71dcbc1ae5f59bcf Mon Sep 17 00:00:00 2001 From: John Layt Date: Fri, 27 Sep 2013 14:15:31 +0200 Subject: QDateTime - Fix round-trip of second occurrence times At the Daylight Tme to Standard Time transition, the local time repeats itself, i.e. 2am occurs twice. Qt's behavior when setting this using the local time is ambiguous, as it depends on the system implementation of mktime, which behaves differently on different platforms. Currently this behavior remains undefined. When setting using an msecs or time_t value however we can determine the correct instance to use and cache it to ensure that any conversion back from local time to msecs is performed consistantly on all platforms. Note that caching this value will result in any calculations being wrong should the system time zone change, or its rules change. This will be fixed in Qt 5.3 when the system time zone change signal is implemented and QDateTime switches to using QTimeZone instead of mktime to provide consistnt behavior across platforms. The QTimeZone spec does not require this fix as it already caches the correct offset in setMSecsFromEpoch(). Change-Id: I799588db474e744a6d81e80f6a0442920569ebd3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 54 ++++++++++++++++++---- src/corelib/tools/qdatetime_p.h | 16 +++++-- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 30 +++--------- 3 files changed, 61 insertions(+), 39 deletions(-) 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/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index a282fcabd3..b8b970121c 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2384,8 +2384,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; @@ -2535,10 +2533,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 @@ -2546,7 +2540,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 @@ -2554,10 +2547,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 @@ -2708,10 +2697,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 @@ -2724,11 +2709,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 @@ -2736,15 +2720,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); -- cgit v1.2.3 From 0f3315a4dd843bfd21c398bb077364268eb967e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 25 Sep 2013 16:43:23 +0000 Subject: Remove redundant code. QPair is documented to initialize members Change-Id: I1dccfd265521ca3ca1a648b161c0a163c72e2f2e Reviewed-by: Peter Hartmann Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 2cc474ca74..ddf53f18f4 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -528,8 +528,6 @@ static QPair loadOpenSslWin32() static QPair loadOpenSsl() { QPair pair; - pair.first = 0; - pair.second = 0; # if defined(Q_OS_UNIX) QLibrary *&libssl = pair.first; -- cgit v1.2.3 From f30641a7f8c3e38859a6f05a2c190496338b7e7d Mon Sep 17 00:00:00 2001 From: Mandeep Sandhu Date: Tue, 17 Sep 2013 13:04:39 +0530 Subject: Fix error signal supression for failed DNS lookups Sometimes the signal QNetworkReply::error(QNetworkReply::NetworkError) is not emitted for certain requests. This happens under the following conditions: * The hostname provided in the request is incorrect, i.e it will result in a DNS lookup failure. * There is a previous request, for the _same_ host, already pending. The first request that comes for the (incorrect hostname) url, gets enqueued via QHttpNetworkConnectionPrivate::queueRequest(). Here, after starting a DNS lookup, we mark the network state of this connection as - "InProgress". Now, if a second reuest comes for the same host, we use the existing HTTP connection object as it's present in the cache. However, when enqueing the request (in queueRequest()), we see that the network is NOT in "Unknown" state and return immediately without adding this new request to the list of pending lookups (via QHostInfo::lookupHost()). To fix this issue, we should queue incoming lookup requests, even if the current (HTTP) connection is in the "InProgress" state, so that we can inform the requestor of a failed lookup. Since QHostInfo::lookupHost() handles lookups for duplicate hostnames properly, things should be fine even if multiple requests for the same host have been enqueued. Task-number: QTBUG-32911 Change-Id: I6a9c8430121e9a5a2d45983b6bda70c324437992 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From 248f29075e84cf57529ce7678c21e13a0fbf4a7e Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Sat, 28 Sep 2013 15:47:45 +0300 Subject: qfeatures: Allow QFileSystemModel without QFileSystemWatcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of 373e44d, QFileSystemModel can be built without QFileSystemWatcher support, making this define incorrect. Change-Id: I1c18dc4f323f94b43f4e49646911fd06b0f01f73 Reviewed-by: Sérgio Martins Reviewed-by: Friedemann Kleint --- src/corelib/global/qfeatures.h | 5 ----- src/corelib/global/qfeatures.txt | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) 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: ??? -- cgit v1.2.3 From b32e0da8ebfe3dabb3b18b6d9e4588ec525ed3f2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 29 Sep 2013 23:39:03 -0700 Subject: Fix bootstrapped build of QCoreApplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 696060134d10d44175970ffd38618544ecdd9387 introduced the use of QBasicMutex and QMutexLocker (qmutex.h) but that wasn't #included. I don't know in what way my build is different, though. Change-Id: Ie3df3c746fdf1c4735f298c3578cd93a9a14327e Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcoreapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 3ae4e523c8..71ff47eab8 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From 00a8f0b6439b5fd6011d8bb415852135d98ecc57 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 30 Sep 2013 09:02:45 +0200 Subject: Fix grammar in QScopedPointer. have => has Change-Id: Ib77110b8ffd2f970e15c2159480e56be9ef964ca Reviewed-by: Jerome Pasion --- src/corelib/tools/qscopedpointer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From 14d2c012620254dd18236aa579653bcbfce01904 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Sun, 29 Sep 2013 20:13:32 +0100 Subject: Fix check in texture cleanup code Change-Id: Iaf91cf27d64aedb71a8af7ba318ff1231ff11b0d Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3 From e5ae6d896bd55e7c80083982fe2243a49c2c80f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 27 Sep 2013 16:51:39 +0200 Subject: evdevtouch: Do not print device information by default Do it only when requested by having QT_QPA_EVDEV_DEBUG set. Change-Id: I0e28808ae972bf681db3c0878ee53732611d11af Reviewed-by: Gunnar Sletta --- .../input/evdevtouch/qevdevtouch.cpp | 39 ++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) 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(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(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; -- cgit v1.2.3 From 99b3e68f2070f1d0c0796356d681db528edee688 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Sep 2013 11:39:49 +0200 Subject: tst_qsavefile: Check temporary dir and output open errors. Change-Id: Id28306ad414050a37b7779525f36edc3e15281b5 Reviewed-by: David Faure --- tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp | 39 ++++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp index d9292b8460..44b1e0ec2a 100644 --- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp +++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp @@ -73,13 +73,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 +110,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 +150,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."; @@ -188,6 +199,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir() QTemporaryDir dir; + QVERIFY(dir.isValid()); QVERIFY(QFile(dir.path()).setPermissions(QFile::ReadOwner | QFile::ExeOwner)); PermissionRestorer permissionRestorer(dir.path()); @@ -212,7 +224,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 +234,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 +253,10 @@ 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)); + QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData()); QCOMPARE(file.write("Hello"), Q_INT64_C(5)); file.close(); file.setPermissions(QFile::ReadOwner); @@ -260,10 +273,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,9 +297,10 @@ 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)); @@ -320,7 +335,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)); -- cgit v1.2.3 From 1256ed05b2f38e9e0364244616474e75655b19f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 30 Sep 2013 10:45:28 +0200 Subject: xcb: Don't connect() to event-dispatcher until we are sure we have one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QCoreApplication sets up the event dispatcher in the constructor, through createEventDispatcher(), which is overridden in QGuiApplication to take the platform-integration into account. The problem is that the platform integration is created before the event dispatcher, so when we create the QXcbConnection we are not guaranteed to have an event dispatcher yet. This is not an issue when using xcb_poll_for_queued_event() in a thread, but for the fallback case we connect to the event-dispatcher's awake() and aboutToBlock() signals. To ensure that we do this only when we have an event dispatcher we post a queued method invocation, that will be processed as one of the first events once there is an event-dispatcher. Change-Id: I623011af447b585884b84c7559737f134aab83e8 Reviewed-by: Jędrzej Nowacki Reviewed-by: Uli Schlachter Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 30 ++++++++++++++++------------ src/plugins/platforms/xcb/qxcbconnection.h | 7 ++++++- 2 files changed, 23 insertions(+), 14 deletions(-) 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())) -- cgit v1.2.3 From f08cc1dabe9aba1fbb1ddfa9d9a3f38afac65372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Tue, 27 Aug 2013 06:43:07 +0200 Subject: QMessageBox - make detail text work on set after show Our manual test reveals that a setting a detailed text after it is shown does not work. This patch fixes that minor issue. Change-Id: I4930880def2d8361d247e943e1a848dd49ca3882 Reviewed-by: J-P Nurmi --- src/widgets/dialogs/qmessagebox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index da5ec8dc8a..9101c568e0 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(); -- cgit v1.2.3 From aa5f78cb33404e585a1e511a58a0ca43aa46f421 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 30 Sep 2013 15:07:24 +0300 Subject: OpenGL autotests: verify create()/makeCurrent() If create() or makeCurrent() calls fail, the test should fail fast. Change-Id: I025c541f94c8eee492cf0e1545bfbb8027eff2a7 Reviewed-by: Gunnar Sletta --- tests/auto/gui/qopengl/tst_qopengl.cpp | 28 ++++++++++++++-------------- tests/auto/other/lancelot/tst_lancelot.cpp | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) 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 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 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(ctx); @@ -401,7 +401,7 @@ void tst_QOpenGL::fboSimpleRendering() QScopedPointer surface(createSurface(surfaceClass)); QOpenGLContext ctx; - ctx.create(); + QVERIFY(ctx.create()); ctx.makeCurrent(surface.data()); @@ -449,7 +449,7 @@ void tst_QOpenGL::fboRendering() QScopedPointer 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 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); -- cgit v1.2.3 From a2bf063dd4942a95ffe971aed925afd4ad111ba6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Sep 2013 14:15:52 +0200 Subject: Fix syncqt warning about include in qopenglpixeltransferoptions.h. WARNING: qopenglpixeltransferoptions.h includes QSharedDataPointer when it should include QtCore/QSharedDataPointer Change-Id: I0a84a37d2f4e310535979ef97b81937d2b2b2313 Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglpixeltransferoptions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 +#include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 999e5162ec3e86c9cb84c3ec95dfd0ba4b21277f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 26 Sep 2013 12:14:32 +0200 Subject: QPA: Fix semantics of GUI event dispatcher ownership in platform plugins The QPlatformIntegration::guiThreadEventDispatcher() function acted as an accessor to event dispatchers created in the constructor of each platform plugin, but the logic and semantics of event-dispatcher handling in Qt itself (QCoreApplication/QGuiApplication) still assumed both ownership and control over the event dispatcher, such as when to create one, which one to create, and when to delete it. This conflicted with the explicit calls in the platform plugins to QGuiApplication::setEventDispatcher(), as well as left a possibility that the event-dispatcher created by the platform plugin would never be deleted, as none of the platform plugins actually took full ownership of the dispatcher and deleted it in its destructor. The integration function has now been renamed back to its old name, createEventDispatcher(), and acts as a factory function, leaving the logic and lifetime of event dispatcher to QtCoreApplication. The only platform left with creating the event-dispatcher in the constructor is QNX, where other parts of the platform relies on having an event-dispatcher before their initialization. We then need to manually take care of the ownership transfer, so that the event-dispatcher is still destroyed at some point. Change-Id: I113db97d2545ebda39ebdefa865e488d2ce9368b Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 26 +++++++++------------- src/gui/kernel/qguiapplication_p.h | 3 +-- src/gui/kernel/qplatformintegration.cpp | 22 +++++++++++------- src/gui/kernel/qplatformintegration.h | 2 +- .../android/src/qandroidplatformintegration.cpp | 8 ++----- .../android/src/qandroidplatformintegration.h | 3 +-- src/plugins/platforms/cocoa/qcocoaintegration.h | 3 +-- src/plugins/platforms/cocoa/qcocoaintegration.mm | 5 ++--- .../platforms/directfb/qdirectfbintegration.cpp | 6 ++--- .../platforms/directfb/qdirectfbintegration.h | 3 +-- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 11 ++++----- src/plugins/platforms/eglfs/qeglfsintegration.h | 3 +-- src/plugins/platforms/ios/qiosintegration.h | 2 +- src/plugins/platforms/ios/qiosintegration.mm | 2 +- src/plugins/platforms/kms/qkmsintegration.cpp | 6 ++--- src/plugins/platforms/kms/qkmsintegration.h | 3 +-- .../platforms/linuxfb/qlinuxfbintegration.cpp | 9 +++----- .../platforms/linuxfb/qlinuxfbintegration.h | 3 +-- .../platforms/minimal/qminimalintegration.cpp | 16 ++++++------- .../platforms/minimal/qminimalintegration.h | 5 +---- .../minimalegl/qminimaleglintegration.cpp | 2 +- .../platforms/minimalegl/qminimaleglintegration.h | 2 +- .../platforms/offscreen/qoffscreenintegration.cpp | 13 ++++++----- .../platforms/offscreen/qoffscreenintegration.h | 3 +-- .../platforms/openwfd/qopenwfdintegration.cpp | 6 ++--- .../platforms/openwfd/qopenwfdintegration.h | 3 +-- src/plugins/platforms/qnx/qqnxintegration.cpp | 12 ++++++++-- src/plugins/platforms/qnx/qqnxintegration.h | 4 ++-- .../platforms/windows/qwindowsintegration.cpp | 7 ++---- .../platforms/windows/qwindowsintegration.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 9 +++----- src/plugins/platforms/xcb/qxcbintegration.h | 3 +-- 32 files changed, 91 insertions(+), 116 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b242a3cc68..8e5c290cc6 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) 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/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/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 ¶ { 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 mFontDb; - QAbstractEventDispatcher *mEventDispatcher; QScopedPointer 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/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 m_input; QScopedPointer m_inputRunner; QScopedPointer 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 mFontDb; QScopedPointer mServices; QEglFSScreen *mScreen; diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index 4aaf98f839..a75696625e 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -70,7 +70,7 @@ public: 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); diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index d854bf7723..862e3b4a10 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -113,7 +113,7 @@ QPlatformOpenGLContext *QIOSIntegration::createPlatformOpenGLContext(QOpenGLCont return new QIOSContext(context); } -QAbstractEventDispatcher *QIOSIntegration::guiThreadEventDispatcher() const +QAbstractEventDispatcher *QIOSIntegration::createEventDispatcher() const { if (isQtApplication()) return new QIOSEventDispatcher; 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 m_screens; QList 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 ¶mList) - : 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 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 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 8d0586a5a3..a08cede76a 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -53,14 +53,8 @@ QT_BEGIN_NAMESPACE -QMinimalIntegration::QMinimalIntegration() : -#ifdef 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); @@ -92,9 +86,13 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow * return new QMinimalBackingStore(window); } -QAbstractEventDispatcher *QMinimalIntegration::guiThreadEventDispatcher() const +QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const { - return m_eventDispatcher; +#ifdef Q_OS_WIN + return new QEventDispatcherWin32; +#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 bce52963df..a1da8e3a16 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -95,14 +95,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) - m_eventDispatcher = new QOffscreenEventDispatcher(); m_fontDatabase.reset(new QBasicFontDatabase()); #endif @@ -111,7 +109,6 @@ QOffscreenIntegration::QOffscreenIntegration() #endif m_services.reset(new QPlatformServices); - QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); screenAdded(new QOffscreenScreen); } @@ -141,9 +138,15 @@ 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) + return new QOffscreenEventDispatcher(); +#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 m_fontDatabase; #ifndef QT_NO_DRAGANDDROP QScopedPointer 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/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 ¶mList) QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mList) : m_options(parseOptions(paramList)) , m_fontDatabase(0) - , m_eventDispatcher(new QWindowsGuiEventDispatcher) { } @@ -369,7 +367,6 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate() QWindowsIntegration::QWindowsIntegration(const QStringList ¶mList) : 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/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index cef81ddfec..fc8f37cebe 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 ¶meters, 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 @@ -293,9 +290,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) diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 7ca7befc64..fd63fba5bf 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,7 +112,6 @@ private: QScopedPointer m_nativeInterface; QScopedPointer m_inputContext; - QAbstractEventDispatcher *m_eventDispatcher; #ifndef QT_NO_ACCESSIBILITY QScopedPointer m_accessibility; -- cgit v1.2.3 From 660aed3516f91c047383f9759c286e739da9222e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Sep 2013 11:47:27 +0200 Subject: Remove unused static function msecsToSystemtime() from qtimezoneprivate_win.cpp. Change-Id: I8d6b4c9215fb4499affefd0b892cea1b77aa8ac9 Reviewed-by: John Layt --- src/corelib/tools/qtimezoneprivate_win.cpp | 11 ----------- 1 file changed, 11 deletions(-) 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; -- cgit v1.2.3 From 57e1c9a7bd247e53b7a5f1e7745801e78a9e49fd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 29 Sep 2013 21:13:25 -0700 Subject: Correct the bit field sizes in QTextOption There's an off-by-one error that has been carried over since at least Qt 4.0.0. Because of that, the class is actually 4 bytes bigger than calculated. Change-Id: Iaefdf657fdc780aae16390fde3c01074160e4cd9 Reviewed-by: Lars Knoll --- src/gui/text/qtextoption.cpp | 3 +++ src/gui/text/qtextoption.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3 From 7c3efdfb6ad72955543128a5a13e3f45ef3ee7af Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 24 Sep 2013 15:44:37 +0200 Subject: make it possible to disable debug information in vcxproj files Task-number: QTBUG-32885 Change-Id: I53a2208935a1c52bc7ca757651df6a0125979787 Reviewed-by: Andy Shaw --- qmake/generators/win32/msbuild_objectmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3 From 48061944ef358bbb1e5fd7b582376868f9788c5e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 11:16:23 +0200 Subject: remove usage of qDeleteInEventHandler from QProcess qDeleteInEventHandler is a mere wrapper for delete these days. Change-Id: I0828edf3ca17642b5abf97aab66672490c35f177 Reviewed-by: Friedemann Kleint --- src/corelib/io/qprocess.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 7f4d7f0313..9f5e626243 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -855,7 +855,7 @@ void QProcessPrivate::cleanup() } if (processFinishedNotifier) { processFinishedNotifier->setEnabled(false); - qDeleteInEventHandler(processFinishedNotifier); + delete processFinishedNotifier; processFinishedNotifier = 0; } @@ -866,32 +866,32 @@ void QProcessPrivate::cleanup() 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,10 +1161,9 @@ 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); + delete stdinChannel.notifier; stdinChannel.notifier = 0; } } -- cgit v1.2.3 From d8a489ccc25fa86825eb1c5ad91669c26153cb18 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 1 Oct 2013 10:20:18 +0200 Subject: Fix temporary directory leak in tst_qsavefile. Task-number: QTBUG-33769 Change-Id: I5177f09df22fd2b9b0d9eca4301c383c600d5ab8 Reviewed-by: David Faure --- tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp | 69 ++++++++--------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp index 44b1e0ec2a..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 #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 @@ -177,27 +200,6 @@ 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)); @@ -256,6 +258,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile() QVERIFY(dir.isValid()); const QString targetFile = dir.path() + QString::fromLatin1("/outfile"); QFile file(targetFile); + PermissionRestorer permissionRestorer(targetFile); QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData()); QCOMPARE(file.write("Hello"), Q_INT64_C(5)); file.close(); @@ -303,30 +306,6 @@ void tst_QSaveFile::transactionalWriteErrorRenaming() 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... -- cgit v1.2.3 From 4e20df5fc5bffa661ae44255d9a194cc6e8cf290 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Oct 2013 11:38:40 +0200 Subject: eglfs: Make QML root objects sized to view working again The size is queried from the window before create() is called. Therefore Quick apps were not covering the entire screen as they should. This is now fixed by properly returning the fullscreen geometry from QEglFSWindow::geometry() even when create() has not yet been called. Pre-5.2 this was working because the QEglFSWindow constructor changed the window state. This is not feasible anymore with the recent compositing changes since the second, third, etc. windows are not fullscreen. Task-number: QTBUG-33620 Change-Id: If66d35f6f4768485d4e68c5ad825fe7a9d948a64 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/eglfs/qeglfswindow.cpp | 17 ++++++++++++++--- src/plugins/platforms/eglfs/qeglfswindow.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) 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(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(); -- cgit v1.2.3 From 3bcc44268e532209314b87a4dbd418022e0a8d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 1 Oct 2013 13:45:35 +0200 Subject: xcb: Initialize accessibility lazily, since it requires an event-dispatcher QSpiAccessibleBridge uses a D-BUS connection, which in turn uses socket notifiers and timers internally. Neither of these can be used before a event-dispatcher is in place, so we need to defer creation of the accessibility interface until later. We assume that clients will only call QXcbIntegration::accessibility() when an event-dispatcher is set up, but to be extra safe we do an assert, so that failures of this pre-condition will trigger at the place they are caused -- not as failures to register socket notifiers and timers in the D-BUS code. Change-Id: I4f9d8362a3f285c3da9045d1ff6b8e7b04570488 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/xcb/qxcbintegration.cpp | 11 ++++++++--- src/plugins/platforms/xcb/qxcbintegration.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index fc8f37cebe..2249446242 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -173,9 +173,6 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, 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() @@ -333,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 fd63fba5bf..008d03fbcb 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -114,7 +114,7 @@ private: QScopedPointer m_inputContext; #ifndef QT_NO_ACCESSIBILITY - QScopedPointer m_accessibility; + mutable QScopedPointer m_accessibility; #endif QScopedPointer m_services; -- cgit v1.2.3 From 2c925906f516e7e47db9e82ed8bda1f675ab414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 25 Sep 2013 16:28:24 +0200 Subject: Base tst_QGuiApplication on tst_QCoreApplication to increase GUI ED coverage The QCoreApplication test has quite a few test cases that we would like to exercise using the GUI event-dispatcher. Instead of duplicating the tests for the GUI dispatcher, we inherit tst_QCoreApplication, which also lets us add extra tests that are specific to tst_QGuiApplication. Change-Id: Ib411457131b8d3fed871f682c1c0568577f6127d Reviewed-by: Gabriel de Dietrich --- .../kernel/qcoreapplication/qcoreapplication.pro | 1 + .../qcoreapplication/tst_qcoreapplication.cpp | 82 ++++++++++------------ .../kernel/qcoreapplication/tst_qcoreapplication.h | 73 +++++++++++++++++++ .../gui/kernel/qguiapplication/qguiapplication.pro | 11 ++- .../kernel/qguiapplication/tst_qguiapplication.cpp | 4 +- 5 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h 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 #include @@ -46,31 +48,12 @@ #include #include -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 +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(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(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("tst_qcoreapplication") }; - QCoreApplication app(argc, argv); - QCOMPARE(::qAppName(), QString::fromLatin1("tst_qcoreapplication")); - QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1("tst_qcoreapplication")); + char *argv[] = { const_cast(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(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("arg1"), const_cast("arg2"), const_cast("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(QTest::currentAppName()), const_cast("-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(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(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(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(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(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(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(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(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(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(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(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 + +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/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 +#include "tst_qcoreapplication.h" + enum { spacing = 50, windowSize = 200 }; -class tst_QGuiApplication: public QObject +class tst_QGuiApplication: public tst_QCoreApplication { Q_OBJECT -- cgit v1.2.3 From b906f3919b2d6d411c6f7e0ca3c9e68894a2b7df Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 1 Oct 2013 14:35:37 +0200 Subject: qdoc: Fixed handling of QML references Updated qdoc to handle QML references without using the QML module version. Task-number: QTBUG-32173 Change-Id: Ibfba9bc92458ae04017706e904625e7d32fc0be4 Reviewed-by: Jerome Pasion --- src/tools/qdoc/node.cpp | 71 +++++++++++++++++++++++---------------- src/tools/qdoc/node.h | 40 ++++++++++++++++++---- src/tools/qdoc/qdocdatabase.cpp | 53 +++++++++++++---------------- src/tools/qdoc/qdocdatabase.h | 6 ++-- src/tools/qdoc/qdocindexfiles.cpp | 45 ++++++++++++++++--------- src/tools/qdoc/qmlvisitor.cpp | 3 ++ src/tools/qdoc/tree.cpp | 13 ------- src/tools/qdoc/tree.h | 1 - 8 files changed, 133 insertions(+), 99 deletions(-) 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; } /*! @@ -2258,6 +2241,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 @@ -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 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(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(node); for (int i=0; iname(),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/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index c049857717..b7334dfdda 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -374,6 +374,9 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } else if (command == COMMAND_INQMLMODULE) { qdb->addToQmlModule(args[0].first,node); + if (node->name() == QString("workerscript")) + qDebug() << "INQMLMODULE workerscript:" << node << node->qmlModule() + << node->qmlModule()->isIndexNode() << node->name() << args[0].first; } else if (command == COMMAND_QMLINHERITS) { if (node->name() == args[0].first) 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(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(root()); - return static_cast(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, -- cgit v1.2.3 From 649e0b6002490decfff6477d15229786e9db8f9c Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 25 Sep 2013 17:09:17 +0200 Subject: AccessibleRelation::get_relationType didn't handle all enum values. Add some more tests for relations Change-Id: I934cd6aed36ca5ca88786325ed364fbc3abfc6f7 Reviewed-by: Frederik Gladhorn --- .../platforms/windows/accessible/iaccessible2.h | 12 +++++ .../other/qaccessibility/tst_qaccessibility.cpp | 63 ++++++++++++++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) 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/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 > 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 -- cgit v1.2.3 From c74f60b09dc031b19ebfa11718d44fb06a5569b2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 1 Oct 2013 11:25:48 -0700 Subject: Doc: correct QTimer accuracy information - it depends on the timer type This doc was probably older than the feature of timer types. Task-number: QTBUG-33760 Change-Id: Iff4c9f9bb7287498f1ee80578b500bbde777bc78 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qtimer.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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 -- cgit v1.2.3 From d14abab0d3c4d51077f9169f4a09ba3202eaa4a7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 1 Oct 2013 17:11:53 +0200 Subject: Fix race condition in ~QFileInfoGatherer tst_qfilesystemmodel was hanging regularly. In QFileInfoGatherer::~QFileInfoGatherer() it would be stuck on wait() and in QFileInfoGatherer::run() it would be at condition.wait(&mutex); It looks like while abort was set to true, the while in run() had just entered so that it would wait for condition indefinitely. Task-number: QTBUG-29403 Change-Id: If6cebbc98ec7f54fbdf347804780bbfc5e177b3b Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart Reviewed-by: Gabriel de Dietrich --- src/widgets/dialogs/qfileinfogatherer.cpp | 2 ++ 1 file changed, 2 insertions(+) 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(); } -- cgit v1.2.3 From 17f16c80e5d6b056ccd396bac5278c9e82bde3c5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 30 Sep 2013 16:30:39 +0200 Subject: Android: update copied enum values in Java code The InputMethodHint enum values were changed between Qt 4.8 and 5.1, and the hardcoded copies were not updated. Thanks to Lasconic for finding the solution to this problem. Task-number: QTBUG-32072 Task-number: QTBUG-32710 Change-Id: I3eb1192911a9c48d7720e85b91bee1af693a669d Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtproject/qt5/android/QtActivityDelegate.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) 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; -- cgit v1.2.3 -- cgit v1.2.3 From 803253ba7320970a559d0ea92af7b87f3d7200e4 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 30 Sep 2013 14:21:15 +0200 Subject: qdoc: Use empty common prefix for alphabetical QML type lists This change allows an empty string to be used as a common prefix for class/type compact lists, and uses it for QML types as they do not have a common prefix like public C++ Qt classes do. This fixes the issue with sorting order for QML type lists. Task-number: QTBUG-33715 Change-Id: I28ab689d28017ae28eccbf590d1dbbe107665e33 Reviewed-by: Jerome Pasion Reviewed-by: Martin Smith --- src/tools/qdoc/htmlgenerator.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 << "\">\n"; out() << "

" << protectEnc((*s).name) << "

\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 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(); -- cgit v1.2.3 From 8388b40108eb3f78531dac2af07eef0e89a44c03 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 15:37:10 +0200 Subject: QProcess: remove now superfluous calls to setEnabled(false) This amends 48061944ef358bbb1e5fd7b582376868f9788c5e. Change-Id: Ie5b56c1499a10594b4a4b3c02d5704226ef971ba Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 9f5e626243..fb86b053e9 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -854,7 +854,6 @@ void QProcessPrivate::cleanup() pid = 0; } if (processFinishedNotifier) { - processFinishedNotifier->setEnabled(false); delete processFinishedNotifier; processFinishedNotifier = 0; } @@ -865,27 +864,22 @@ void QProcessPrivate::cleanup() dying = false; if (stdoutChannel.notifier) { - stdoutChannel.notifier->setEnabled(false); delete stdoutChannel.notifier; stdoutChannel.notifier = 0; } if (stderrChannel.notifier) { - stderrChannel.notifier->setEnabled(false); delete stderrChannel.notifier; stderrChannel.notifier = 0; } if (stdinChannel.notifier) { - stdinChannel.notifier->setEnabled(false); delete stdinChannel.notifier; stdinChannel.notifier = 0; } if (startupSocketNotifier) { - startupSocketNotifier->setEnabled(false); delete startupSocketNotifier; startupSocketNotifier = 0; } if (deathNotifier) { - deathNotifier->setEnabled(false); delete deathNotifier; deathNotifier = 0; } @@ -1161,11 +1155,8 @@ void QProcessPrivate::closeWriteChannel() qDebug("QProcessPrivate::closeWriteChannel()"); #endif if (stdinChannel.notifier) { - stdinChannel.notifier->setEnabled(false); - if (stdinChannel.notifier) { - delete 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 -- cgit v1.2.3 From 5ad1e2578bb3eaa7da6aefa1f96d79947216d509 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 1 Oct 2013 15:00:55 +0200 Subject: Windows/Linux: Cache cursors by mask/pixmap keys and shape. Task-number: QTBUG-33383 Change-Id: I65a5a0870f50f42c26a4d297331224b3597a36e0 Reviewed-by: Andy Shaw Reviewed-by: Shawn Rutledge --- src/plugins/platforms/windows/qwindowscursor.cpp | 41 +++++++++++++++++++----- src/plugins/platforms/windows/qwindowscursor.h | 27 +++++++++++++--- src/plugins/platforms/xcb/qxcbcursor.cpp | 40 +++++++++++++++-------- src/plugins/platforms/xcb/qxcbcursor.h | 30 +++++++++++++++-- 4 files changed, 111 insertions(+), 27 deletions(-) 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 +#include #include #include #include @@ -60,6 +60,30 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); 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 StandardCursorCache; - typedef QHash PixmapCursorCache; + typedef QHash CursorCache; - StandardCursorCache m_standardCursorCache; - PixmapCursorCache m_pixmapCursorCache; + CursorCache m_cursorCache; }; QT_END_NAMESPACE 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 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 m_shapeCursorMap; - QMap m_bitmapCursorMap; + CursorHash m_cursorHash; #endif #ifdef XCB_USE_XLIB static void cursorThemePropertyChanged(QXcbScreen *screen, -- cgit v1.2.3 From 8dc8fe53f9b27a27230945a98b08570cfc1b4d0f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 1 Oct 2013 11:03:32 +0200 Subject: QProcess/Win: fix crash in drainOutputPipes stdoutReader->waitForReadyRead() can synchronously trigger the deletion of stdoutreader (via signal readyRead(), _q_canReadStandardOutput(), destroyChannel()). Analoguous for stderrReader. Task-number: QTBUG-33730 Change-Id: I8badac53e92a979c437838b2959b4c0445c8de81 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) -- cgit v1.2.3 From 35f8bcd4388f4f7c466d5e8d91c3cb6898f83602 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 2 Oct 2013 10:40:15 +0200 Subject: qdoc: Remove debug code Remove a piece a debug code from qmlvisitor.cpp Change-Id: I3a1a72d11597c36d277310c92bf9590633844d03 Reviewed-by: Martin Smith --- src/tools/qdoc/qmlvisitor.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index b7334dfdda..c049857717 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -374,9 +374,6 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } else if (command == COMMAND_INQMLMODULE) { qdb->addToQmlModule(args[0].first,node); - if (node->name() == QString("workerscript")) - qDebug() << "INQMLMODULE workerscript:" << node << node->qmlModule() - << node->qmlModule()->isIndexNode() << node->name() << args[0].first; } else if (command == COMMAND_QMLINHERITS) { if (node->name() == args[0].first) -- cgit v1.2.3 From 04acfea2d24c4b467e463741bdd6014aa2b6cca9 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 30 Sep 2013 22:20:50 +0200 Subject: Fix QStandardPath test on some linuxes On one suse box I have both /usr/bin/sh and /bin/sh which means that the test should prefer the one first in the path instead of random order. Change-Id: Ie94bf8404479fa42a36a8ee45e09986114693871 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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(); } -- cgit v1.2.3 From bc962256b41ebbf656a8d533397d1776c43a719e Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 16 Dec 2009 15:03:20 +0100 Subject: Remove a duplicate conversion to QLatin1String Change-Id: I9641090406be2d4bad2b703594e404b4934cbc0b Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- cgit v1.2.3 From 56cd9cc2b085c1a2152831d47bb8fd9607d7500e Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 27 Sep 2013 21:53:12 +0200 Subject: Update QSessionManager and related classes documentation Update the Qt 4 documentation of QSessionManager to reflect the changes in Qt 5 Task-number: QTBUG-33528 Change-Id: I74286134155efc2781f9f6fc505fb6cf736d814e Reviewed-by: Martin Smith --- .../snippets/code/src_gui_kernel_qapplication.cpp | 69 +------------- .../code/src_gui_kernel_qapplication_x11.cpp | 45 --------- .../code/src_gui_kernel_qguiapplication.cpp | 102 +++++++++++++++++++++ .../code/src_gui_kernel_qguiapplication_x11.cpp | 45 +++++++++ src/gui/kernel/qguiapplication.cpp | 4 +- src/gui/kernel/qsessionmanager.cpp | 50 +++++----- src/gui/kernel/qstylehints.cpp | 2 +- src/plugins/platforms/xcb/qxcbsessionmanager.h | 9 ++ src/widgets/kernel/qapplication.cpp | 2 +- 9 files changed, 192 insertions(+), 136 deletions(-) delete mode 100644 src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp create mode 100644 src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp create mode 100644 src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp 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_qapplication_x11.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp deleted file mode 100644 index b136c2ad51..0000000000 --- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication_x11.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the 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] -QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); -calculateHugeMandelbrot(); // lunch time... -QApplication::restoreOverrideCursor(); -//! [0] 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_qguiapplication_x11.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp new file mode 100644 index 0000000000..b136c2ad51 --- /dev/null +++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication_x11.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** 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] +QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); +calculateHugeMandelbrot(); // lunch time... +QApplication::restoreOverrideCursor(); +//! [0] diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8e5c290cc6..bde8d99a1c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2935,7 +2935,7 @@ static inline void applyWindowCursor(const QList &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() @@ -2995,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/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/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 QT_BEGIN_NAMESPACE 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. -- cgit v1.2.3 From 4106d0c2d740480c16cadfe636c2fc472c17f8f0 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 2 Oct 2013 11:08:32 +0200 Subject: Add to 5.2 changelog QPlatformSessionManager related entry This patch adds a brief description of the return of session management because the changelog entries weres missing in the commit messages related to the various parts of the related works Change-Id: I20e6a20a63f1a38c6b1a7c9f147737688cd7ddf4 Reviewed-by: Stephen Kelly --- dist/changes-5.2.0 | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- cgit v1.2.3 -- cgit v1.2.3 -- cgit v1.2.3 From 2b01ffe5526ff90b3cad85b2430825f0a0733651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 3 Oct 2013 15:17:41 +0200 Subject: iOS: Use PROT_READ, not PROT_NONE, for custom stack memory guard This allows V4 and other garbage collectors to pass through our custom stack during the mark-phase without triggering access violations. Change-Id: Icafcf4df3537c628c641fe694bb9fe2016519a83 Reviewed-by: Simon Hausmann --- src/plugins/platforms/ios/qioseventdispatcher.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 08f685e8652a5d47bcf337ae1230ec19f23be9fb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 21 Sep 2013 13:36:01 -0700 Subject: Add two enums that weren't handled in the ibase SQL driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qsql_ibase.cpp:1155:23: error: enumeration value ‘LowPrecisionDouble’ not handled in switch [-Werror=switch] qsql_ibase.cpp:1419:12: error: enumeration value ‘CancelQuery’ not handled in switch [-Werror=switch] Change-Id: I3c6102051cde80c81948f5a64f9addcf7a371136 Reviewed-by: Mark Brand --- src/sql/drivers/ibase/qsql_ibase.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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: -- cgit v1.2.3 From d2649c50e0db1092aa0e0a0c0e3965ce9d52faf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 1 Oct 2013 17:26:21 +0200 Subject: testlib: Don't link to IOKit on iOS, it's not part of the SDK IOKit used to be part of the 5.x and 6.x iOS SDKs, but not officially, so when Apple in the iOS 7 SDK removed IOKit headers and the library symlink, our builds started failing. Change-Id: I631cab7c106559968c06977fa25157a57402594c Reviewed-by: Richard Moe Gustavsen --- src/testlib/testlib.pro | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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) -- cgit v1.2.3 From 5f4c75a50e8268d9bba20a6ad8fbdcf1b081005d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Oct 2013 12:14:17 +0200 Subject: qdoc: ignore Q_WINEXTRAS_EXPORT This is required for functions in the QtWin namespace. Change-Id: I6c38c8ef262377050a75861435da381863340f33 Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- doc/global/qt-cpp-defines.qdocconf | 1 + 1 file changed, 1 insertion(+) 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 \ -- cgit v1.2.3 From b3535f3926a42a254985c456e9231768aade3595 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 2 Oct 2013 10:57:22 +0200 Subject: Android: Don't throw away slow-moving mouse/touch events When doing slow, precise movements, some devices will report differences of less than 1 pixel. This would mark the points as stationary, meaning that Qt would discard them without reporting. On the three devices I have tested, stationary points are reported with a 0.0 difference. If any devices are reporting noisy values, it is still safer to test for equality, since it is much better to report too many move events than to not report any. Task-number: QTBUG-33729 Change-Id: If20f2758f5a5ec0917184345b558f55a3d383807 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- cgit v1.2.3 From f331f0ee28e3014376bb3b4ffe9edded1c09c012 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 2 Oct 2013 21:32:23 +0200 Subject: move android-specific feature files to android/ Change-Id: I1f2b345b1dfad544d53dbf7e17b12c75a2cc7668 Reviewed-by: Eskil Abrahamsen Blomfeldt --- mkspecs/features/android.prf | 11 ---- mkspecs/features/android/android.prf | 11 ++++ .../android/android_deployment_settings.prf | 70 ++++++++++++++++++++++ mkspecs/features/android_deployment_settings.prf | 70 ---------------------- 4 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 mkspecs/features/android.prf create mode 100644 mkspecs/features/android/android.prf create mode 100644 mkspecs/features/android/android_deployment_settings.prf delete mode 100644 mkspecs/features/android_deployment_settings.prf diff --git a/mkspecs/features/android.prf b/mkspecs/features/android.prf deleted file mode 100644 index 5e21f0b845..0000000000 --- a/mkspecs/features/android.prf +++ /dev/null @@ -1,11 +0,0 @@ -contains(TEMPLATE, ".*app") { - !android_app { - !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so - QMAKE_LFLAGS += -Wl,-soname,$$TARGET - - android_install: { - target.path=/libs/$$ANDROID_TARGET_ARCH/ - INSTALLS *= target - } - } -} diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf new file mode 100644 index 0000000000..5e21f0b845 --- /dev/null +++ b/mkspecs/features/android/android.prf @@ -0,0 +1,11 @@ +contains(TEMPLATE, ".*app") { + !android_app { + !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so + QMAKE_LFLAGS += -Wl,-soname,$$TARGET + + android_install: { + target.path=/libs/$$ANDROID_TARGET_ARCH/ + INSTALLS *= target + } + } +} diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf new file mode 100644 index 0000000000..1e54b67789 --- /dev/null +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -0,0 +1,70 @@ +contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk { + FILE_CONTENT = "{" + FILE_CONTENT += " \"description\": \"This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.\"," + + FILE_CONTENT += " \"qt\": \"$$[QT_INSTALL_PREFIX]\"," + + # Settings from mkspecs/environment + isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT) + isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT + FILE_CONTENT += " \"sdk\": \"$$SDK_ROOT\"," + + isEmpty(NDK_ROOT): NDK_ROOT = $$(ANDROID_NDK_ROOT) + isEmpty(NDK_ROOT): NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT + FILE_CONTENT += " \"ndk\": \"$$NDK_ROOT\"," + + NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX) + isEmpty(NDK_TOOLCHAIN_PREFIX) { + equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86 + else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android + else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi + } + FILE_CONTENT += " \"toolchain-prefix\": \"$$NDK_TOOLCHAIN_PREFIX\"," + + NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION) + isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION + FILE_CONTENT += " \"toolchain-version\": \"$$NDK_TOOLCHAIN_VERSION\"," + + NDK_HOST = $$(ANDROID_NDK_HOST) + isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST + FILE_CONTENT += " \"ndk-host\": \"$$NDK_HOST\"," + + ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH) + isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARCH + FILE_CONTENT += " \"target-architecture\": \"$$ANDROID_TARGET_ARCH\"," + + # Explicitly set dependencies of application for deployment + !isEmpty(ANDROID_DEPLOYMENT_DEPENDENCIES): \ + FILE_CONTENT += " \"deployment-dependencies\": \""$$join(ANDROID_DEPLOYMENT_DEPENDENCIES, ",")"\"," + + # Android-specific settings of Project + !isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \ + FILE_CONTENT += " \"android-package-source-directory\": \"$$ANDROID_PACKAGE_SOURCE_DIR\"," + + !isEmpty(ANDROID_PACKAGE): \ + FILE_CONTENT += " \"android-package\": \"$$ANDROID_PACKAGE\"," + + !isEmpty(ANDROID_MINIMUM_VERSION): \ + FILE_CONTENT += " \"android-minimum-version\": $$ANDROID_MINIMUM_VERSION," + + !isEmpty(ANDROID_TARGET_VERSION): \ + FILE_CONTENT += " \"android-target-version\": $$ANDROID_TARGET_VERSION," + + !isEmpty(ANDROID_APP_NAME): \ + FILE_CONTENT += " \"android-app-name\": \"$$ANDROID_APP_NAME\"," + + !isEmpty(ANDROID_EXTRA_LIBS): \ + FILE_CONTENT += " \"android-extra-libs\": \""$$join(ANDROID_EXTRA_LIBS, ",")"\"," + + !isEmpty(QMAKE_SUPPORTED_ORIENTATIONS): \ + FILE_CONTENT += " \"supported-orientations\": \""$$join(QMAKE_SUPPORTED_ORIENTATIONS, ",")"\"," + + + FILE_CONTENT += " \"application-binary\": \"$$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET\"" + FILE_CONTENT += "}" + + isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json + + write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT) | error("Aborting.") +} + diff --git a/mkspecs/features/android_deployment_settings.prf b/mkspecs/features/android_deployment_settings.prf deleted file mode 100644 index 1e54b67789..0000000000 --- a/mkspecs/features/android_deployment_settings.prf +++ /dev/null @@ -1,70 +0,0 @@ -contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk { - FILE_CONTENT = "{" - FILE_CONTENT += " \"description\": \"This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.\"," - - FILE_CONTENT += " \"qt\": \"$$[QT_INSTALL_PREFIX]\"," - - # Settings from mkspecs/environment - isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT) - isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT - FILE_CONTENT += " \"sdk\": \"$$SDK_ROOT\"," - - isEmpty(NDK_ROOT): NDK_ROOT = $$(ANDROID_NDK_ROOT) - isEmpty(NDK_ROOT): NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT - FILE_CONTENT += " \"ndk\": \"$$NDK_ROOT\"," - - NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX) - isEmpty(NDK_TOOLCHAIN_PREFIX) { - equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86 - else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android - else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi - } - FILE_CONTENT += " \"toolchain-prefix\": \"$$NDK_TOOLCHAIN_PREFIX\"," - - NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION) - isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION - FILE_CONTENT += " \"toolchain-version\": \"$$NDK_TOOLCHAIN_VERSION\"," - - NDK_HOST = $$(ANDROID_NDK_HOST) - isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST - FILE_CONTENT += " \"ndk-host\": \"$$NDK_HOST\"," - - ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH) - isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARCH - FILE_CONTENT += " \"target-architecture\": \"$$ANDROID_TARGET_ARCH\"," - - # Explicitly set dependencies of application for deployment - !isEmpty(ANDROID_DEPLOYMENT_DEPENDENCIES): \ - FILE_CONTENT += " \"deployment-dependencies\": \""$$join(ANDROID_DEPLOYMENT_DEPENDENCIES, ",")"\"," - - # Android-specific settings of Project - !isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \ - FILE_CONTENT += " \"android-package-source-directory\": \"$$ANDROID_PACKAGE_SOURCE_DIR\"," - - !isEmpty(ANDROID_PACKAGE): \ - FILE_CONTENT += " \"android-package\": \"$$ANDROID_PACKAGE\"," - - !isEmpty(ANDROID_MINIMUM_VERSION): \ - FILE_CONTENT += " \"android-minimum-version\": $$ANDROID_MINIMUM_VERSION," - - !isEmpty(ANDROID_TARGET_VERSION): \ - FILE_CONTENT += " \"android-target-version\": $$ANDROID_TARGET_VERSION," - - !isEmpty(ANDROID_APP_NAME): \ - FILE_CONTENT += " \"android-app-name\": \"$$ANDROID_APP_NAME\"," - - !isEmpty(ANDROID_EXTRA_LIBS): \ - FILE_CONTENT += " \"android-extra-libs\": \""$$join(ANDROID_EXTRA_LIBS, ",")"\"," - - !isEmpty(QMAKE_SUPPORTED_ORIENTATIONS): \ - FILE_CONTENT += " \"supported-orientations\": \""$$join(QMAKE_SUPPORTED_ORIENTATIONS, ",")"\"," - - - FILE_CONTENT += " \"application-binary\": \"$$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET\"" - FILE_CONTENT += "}" - - isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json - - write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT) | error("Aborting.") -} - -- cgit v1.2.3 From 2844be2434c720e17ec1aaaf1ea9b555e8e04fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 3 Oct 2013 16:33:56 +0200 Subject: iOS: Delete members in platform integration Change-Id: Ibb1bf2bf4a1ced897172facbc9027402adfe6f08 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosintegration.h | 1 + src/plugins/platforms/ios/qiosintegration.mm | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index a75696625e..af99dc4b93 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -54,6 +54,7 @@ class QIOSIntegration : public QPlatformIntegration, public QPlatformNativeInter { public: QIOSIntegration(); + ~QIOSIntegration(); bool hasCapability(Capability cap) const; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 862e3b4a10..acf33d5e1c 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -81,6 +81,18 @@ 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; +} + bool QIOSIntegration::hasCapability(Capability cap) const { switch (cap) { -- cgit v1.2.3 From f6dc1316289542280d6cac4898458f28157999f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 3 Oct 2013 16:38:18 +0200 Subject: iOS: Implement QPlatformServices to handle opening URLs Change-Id: Ie644df16b919d6def1435dc5f3665ba3f62fb055 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/ios.pro | 6 ++- src/plugins/platforms/ios/qiosintegration.h | 4 ++ src/plugins/platforms/ios/qiosintegration.mm | 10 ++++ src/plugins/platforms/ios/qiosservices.h | 57 +++++++++++++++++++++++ src/plugins/platforms/ios/qiosservices.mm | 69 ++++++++++++++++++++++++++++ 5 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/ios/qiosservices.h create mode 100644 src/plugins/platforms/ios/qiosservices.mm 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/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index af99dc4b93..c655d8d3bf 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +class QIOSServices; + class QIOSIntegration : public QPlatformIntegration, public QPlatformNativeInterface { public: @@ -65,6 +67,7 @@ public: QPlatformFontDatabase *fontDatabase() const; QPlatformInputContext *inputContext() const; + QPlatformServices *services() const Q_DECL_OVERRIDE; QVariant styleHint(StyleHint hint) const; @@ -83,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 acf33d5e1c..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 #include @@ -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() @@ -91,6 +93,9 @@ QIOSIntegration::~QIOSIntegration() delete m_screen; m_screen = 0; + + delete m_platformServices; + m_platformServices = 0; } bool QIOSIntegration::hasCapability(Capability cap) const @@ -143,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 + +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 + +#import + +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 -- cgit v1.2.3 From 7d4236d28133519c30d1c500442393c87439b1f9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 2 Oct 2013 12:24:14 +0200 Subject: QTemporaryDir: Output warnings on removal failure. Change-Id: I38d0a07c355f73899cc5f6eac60bd8cbedc73cb2 Reviewed-by: David Faure --- src/corelib/io/qtemporarydir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From cdf0c5905b3477c6cd01c519f883b7bb55447120 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 2 Oct 2013 11:37:33 +0200 Subject: Fix temporary file leak in tst_qfiledialog2. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5a1e601e3aa6e84300efa09bfbd9232fecab903e Reviewed-by: Oliver Wolff Reviewed-by: Tony Sarajärvi Reviewed-by: David Faure --- tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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("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() -- cgit v1.2.3