From 65636ed06069fe7cc83ad159a0f48e4d3d7aba48 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Apr 2020 10:17:43 +0200 Subject: Documentation: Add examples for Q_NAMESPACE(_EXPORT) It is not obvious how to use them. Change-Id: I60fdfb95f4c29cbc310d149495ebb38964e5a9ac Reviewed-by: Paul Wicking --- src/corelib/kernel/qobject.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 23e4e1163c..3765e19184 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4614,6 +4614,14 @@ QDebug operator<<(QDebug dbg, const QObject *o) \c{staticMetaObject} is of type QMetaObject and provides access to the enums declared with Q_ENUM_NS/Q_FLAG_NS. + For example: + + \code + namespace test { + Q_NAMESPACE + ... + \endcode + \sa Q_NAMESPACE_EXPORT */ @@ -4630,6 +4638,14 @@ QDebug operator<<(QDebug dbg, const QObject *o) is declared with the supplied \a EXPORT_MACRO qualifier. This is useful if the object needs to be exported from a dynamic library. + For example: + + \code + namespace test { + Q_NAMESPACE_EXPORT(EXPORT_MACRO) + ... + \endcode + \sa Q_NAMESPACE, {Creating Shared Libraries} */ -- cgit v1.2.3 From 871e2981dde9836311bbc560f58805c4b0d61839 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 20 Apr 2020 14:42:02 +0200 Subject: QStringLiteral: Remove const temporary that may prevent optimization clang-tidy 10 was complaining about http://clang.llvm.org/extra/clang-tidy/checks/performance-no-automatic-move.html Change-Id: Iea5276e401a10f3ead8599e135dec1f0fa63a0dc Reviewed-by: Thiago Macieira --- src/corelib/text/qstringliteral.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/text/qstringliteral.h b/src/corelib/text/qstringliteral.h index 2a7e607c63..ab2a5f83f7 100644 --- a/src/corelib/text/qstringliteral.h +++ b/src/corelib/text/qstringliteral.h @@ -69,8 +69,7 @@ Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2, Q_STATIC_STRING_DATA_HEADER_INITIALIZER(Size), \ QT_UNICODE_LITERAL(str) }; \ QStringDataPtr holder = { qstring_literal.data_ptr() }; \ - const QString qstring_literal_temp(holder); \ - return qstring_literal_temp; \ + return QString(holder); \ }()) \ /**/ -- cgit v1.2.3 From 89dc1a1865dd8ed277b88a53262b79a93c2ba8dc Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 25 Mar 2020 15:46:32 +0100 Subject: Make t specifier for time-zone only apply to date-time It previously applied to dates and date-times, but was documented as applying to times (and date-times then included it by reference). It's only meaningful for a date-time. Change-Id: Id9e8e8cb987b03e5ddc77b05c581b9b6944065fc Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetime.cpp | 12 +++++++++--- src/corelib/time/qdatetimeparser.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 8553f79d90..c2b741f7ca 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2533,7 +2533,6 @@ QT_WARNING_POP \row \li ap or a \li Interpret as an am/pm time. \e a/ap will match a lower-case version of either QLocale::amText() or QLocale::pmText(). - \row \li t \li the timezone (for example "CEST") \endtable All other input characters will be treated as text. Any non-empty sequence @@ -5478,8 +5477,15 @@ QT_WARNING_POP Uses the calendar \a cal if supplied, else Gregorian. - See QDate::fromString() and QTime::fromString() for the expressions - recognized in the format string to represent parts of the date and time. + In addition to the expressions, recognized in the format string to represent + parts of the date and time, by QDate::fromString() and QTime::fromString(), + this method supports: + + \table + \header \li Expression \li Output + \row \li t \li the timezone (for example "CEST") + \endtable + All other input characters will be treated as text. Any non-empty sequence of characters enclosed in single quotes will also be treated (stripped of the quotes) as text and not be interpreted as expressions. diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 3374b28b69..bc3d9b992e 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -525,7 +525,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) } break; case 't': - if (parserType != QMetaType::QTime) { + if (parserType == QMetaType::QDateTime) { const SectionNode sn = { TimeZoneSection, i - add, countRepeat(newFormat, i, 4), 0 }; newSectionNodes.append(sn); appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); -- cgit v1.2.3