From 0fd0f8dfa05b9832f93cb8c1bc82220dd8d78eb2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Jan 2013 14:33:42 -0200 Subject: Declare the QMetaType::WasDeclaredAsMetaType enum as private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Omit its value in the documentation. Change-Id: I474faefde23b0e2e0a77a9e6391fd556a6523128 Reviewed-by: Jędrzej Nowacki Reviewed-by: Stephen Kelly --- src/corelib/kernel/qmetatype.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 6194f20912..0d737ac1a3 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -240,6 +240,7 @@ struct DefinedTypesFilter { \omitvalue PointerToQObject \omitvalue WeakPointerToQObject \omitvalue TrackingPointerToQObject + \omitvalue WasDeclaredAsMetaType */ /*! -- cgit v1.2.3 From 418489266598724d03380c2943038e7df30d1534 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 Jan 2013 16:06:44 +0100 Subject: Fix copy-pasto in QMetaObject::methodCount docs. Copy-pasto'ed from the propertyCount docs. Change-Id: Iddb4ce9c9559ca274a80deb0785424df108af762 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qmetaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 3616d0e825..b9bd74c2bd 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -472,7 +472,7 @@ int QMetaObject::constructorCount() const /*! Returns the number of methods in this class, including the number of - properties provided by each base class. These include signals and slots + methods provided by each base class. These include signals and slots as well as normal member functions. Use code like the following to obtain a QStringList containing the methods -- cgit v1.2.3 From 1b47059c886d76cc1a403e74abd034cce3b53a34 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 3 Jan 2013 13:01:17 +0100 Subject: Clarify how two digit years are parsed by QDateTime::fromString(). It's currently not obvious that two digit years will always be in the 20th century (1900's). Task-number: QTBUG-28797 Change-Id: I7dee9a46e0cb803a8f097debc5443d1789c2f16c Reviewed-by: Thiago Macieira Reviewed-by: Venugopal Shivashankar --- .../doc/snippets/code/src_corelib_tools_qdatetime.cpp | 16 +++++++++++++++- src/corelib/tools/qdatetime.cpp | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp index a2b128800e..d57c1314a8 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp @@ -143,6 +143,8 @@ QDateTime dateTime = QDateTime::fromString("130", "Mm"); // invalid //! [14] QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s"); // dateTime is January 30 in 1900 at 00:00:01. +dateTime = QDateTime::fromString("12", "yy"); +// dateTime is January 1 in 1912 at 00:00:00. //! [14] //! [15] @@ -191,4 +193,16 @@ UTC.setTimeSpec(Qt::UTC); qDebug() << "UTC time is:" << UTC; qDebug() << "There are" << local.secsTo(UTC) << "seconds difference between the datetimes."; -//! [19] \ No newline at end of file +//! [19] + +//! [20] +QString string = "Monday, 23 April 12 22:51:41"; +QString format = "dddd, d MMMM yy hh:mm:ss"; +QDateTime invalid = QDateTime::fromString(string, format); +//! [20] + +//! [21] +QString string = "Tuesday, 23 April 12 22:51:41"; +QString format = "dddd, d MMMM yy hh:mm:ss"; +QDateTime valid = QDateTime::fromString(string, format); +//! [21] diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9ac4c1a87f..9949aeb7a1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3533,6 +3533,18 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) This could have meant 1 January 00:30.00 but the M will grab two digits. + Incorrectly specified fields of the \a string will cause an invalid + QDateTime to be returned. For example, consider the following code, + where the two digit year 12 is read as 1912 (see the table below for all + field defaults); the resulting datetime is invalid because 23 April 1912 + was a Tuesday, not a Monday: + + \snippet code/src_corelib_tools_qdatetime.cpp 20 + + The correct code is: + + \snippet code/src_corelib_tools_qdatetime.cpp 21 + For any field that is not represented in the format, the following defaults are used: -- cgit v1.2.3 From 9cfce43f19af87bc0a929b917da2901de7dbc193 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Thu, 3 Jan 2013 14:47:51 +0100 Subject: BlackBerry: Reevaluation of timer list in event dispatcher In the event dispatcher the timer list has to be reevaluated after each call to filterEvent, because timers could be started in event filters. Change-Id: I1a275845fb74c63441f2301555f3459f8295af27 Reviewed-by: Rafael Roquetto Reviewed-by: Sean Harmer --- src/corelib/kernel/qeventdispatcher_blackberry.cpp | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index 69b4a8b172..3e958ee277 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -271,6 +271,11 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif } } +static inline int timevalToMillisecs(const timeval &tv) +{ + return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); +} + int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { @@ -279,9 +284,6 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); - // Make a note of the start time - timeval startTime = qt_gettime(); - // prepare file sets for bps callback d->ioData->count = 0; d->ioData->readfds = readfds; @@ -298,15 +300,15 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (exceptfds) FD_ZERO(exceptfds); + bps_event_t *event = 0; + unsigned int eventCount = 0; + // Convert timeout to milliseconds int timeoutTotal = -1; if (timeout) - timeoutTotal = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); - + timeoutTotal = timevalToMillisecs(*timeout); int timeoutLeft = timeoutTotal; - - bps_event_t *event = 0; - unsigned int eventCount = 0; + timeval startTime = qt_gettime(); // This loop exists such that we can drain the bps event queue of all native events // more efficiently than if we were to return control to Qt after each event. This @@ -331,11 +333,20 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef // Clock source is monotonic, so we can recalculate how much timeout is left if (timeoutTotal != -1) { timeval t2 = qt_gettime(); - timeoutLeft = timeoutTotal - ((t2.tv_sec * 1000 + t2.tv_usec / 1000) - - (startTime.tv_sec * 1000 + startTime.tv_usec / 1000)); + timeoutLeft = timeoutTotal + - (timevalToMillisecs(t2) - timevalToMillisecs(startTime)); if (timeoutLeft < 0) timeoutLeft = 0; } + + timeval tnext; + if (d->timerList.timerWait(tnext)) { + int timeoutNext = timevalToMillisecs(tnext); + if (timeoutNext < timeoutLeft || timeoutTotal == -1) { + timeoutTotal = timeoutLeft = timeoutNext; + startTime = qt_gettime(); + } + } } // Wait for event or file to be ready -- cgit v1.2.3 From a094bf5a893c3cccffff10c1420bfbe3a3c02a7c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 Jan 2013 15:17:21 -0200 Subject: Don't increase the reference count if dynamic_cast failed If the dynamic_cast failed in QSharedPointer::dynamicCast or qSharedPointerDynamicCast, we should avoid creating the QSharedPointer that shares the weak and strong reference counts. In Qt 5, this does not imply a leak since the original pointer is stored internally for deletion. In Qt 4 it implies a leak under certain circumstances, which this change fixes. Task-number: QTBUG-28924 Change-Id: Id2de140de4cf676461e14b201ad250c53666b79d Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 6f3e577e55..cce48e0d07 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -786,6 +786,8 @@ template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &src) { register X *ptr = dynamic_cast(src.data()); // if you get an error in this line, the cast is invalid + if (!ptr) + return QSharedPointer(); return QtSharedPointer::copyAndSetPointer(ptr, src); } template -- cgit v1.2.3 From faaaa68db4d36efa239025fc6f9bdbe5d1112eff Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 2 Jan 2013 17:28:43 -0200 Subject: Remove redundant Q_OS_BLACKBERRY define check. Q_OS_QNX is always implied by Q_OS_BLACKBERRY Change-Id: Ic07a967ab9a45b3c6c088aa8399bab823b9a413e Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 7fae3d9dbc..f65fa01538 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -693,7 +693,7 @@ #endif /* Q_CC_MSVC */ #ifdef __cplusplus -# if defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) +# if defined(Q_OS_QNX) # include # if defined(_YVALS) || defined(_LIBCPP_VER) // QNX: libcpp (Dinkumware-based) doesn't have the @@ -704,7 +704,7 @@ # endif # endif # endif -#endif // Q_OS_BLACKBERRY || Q_OS_QNX +#endif // Q_OS_QNX /* * C++11 keywords and expressions -- cgit v1.2.3 From fbd3cd867952a43d008dcfe6ae5657387603283a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 4 Jan 2013 15:04:54 +0100 Subject: remove unused member from QSystemLocalePrivate This is a refactoring leftover from commit bb86e77cc437b92d49692bb7026c57626d77079f in qt/qt.git. Change-Id: I04993faca44ad0ffca2ae163049770c29d232a47 Reviewed-by: Zeno Albisser Reviewed-by: Denis Dzyubenko --- src/corelib/tools/qlocale_win.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index ec9db24b57..a61f9b39fe 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -113,8 +113,6 @@ struct QSystemLocalePrivate void update(); private: - QByteArray langEnvVar; - enum SubstitutionType { SUnknown, SContext, @@ -142,7 +140,6 @@ Q_GLOBAL_STATIC(QSystemLocalePrivate, systemLocalePrivate) QSystemLocalePrivate::QSystemLocalePrivate() : substitutionType(SUnknown) { - langEnvVar = qgetenv("LANG"); lcid = GetUserDefaultLCID(); } -- cgit v1.2.3 From 91a55c7e7d15ca67d162af52e2332de2d1003490 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 2 Jan 2013 16:14:30 -0200 Subject: Disable Q_COMPILER_RVALUE_REFS on QNX std::forward and std::move are not yet supported by the NDK. Change-Id: I1df1b5e88717c0d27a280862b98eb68262927f2b Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f65fa01538..0ba0d9be63 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -702,6 +702,9 @@ # ifdef Q_COMPILER_INITIALIZER_LISTS # undef Q_COMPILER_INITIALIZER_LISTS # endif +# ifdef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_RVALUE_REFS +# endif # endif # endif #endif // Q_OS_QNX -- cgit v1.2.3