From bd78753d625c573eef587fc0b8e767cffb99c2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 24 Mar 2020 09:39:06 +0100 Subject: widgets: Re-calculate focus frame style option after setting new geometry Fixes: QTBUG-83019 Change-Id: I75d3d93732cb0c5a5b7350f19f0227998bda4791 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qfocusframe.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index c5b2a32aec..6e453a92e9 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -99,6 +99,8 @@ void QFocusFramePrivate::updateSize() return; q->setGeometry(geom); + + opt.rect = q->rect(); QStyleHintReturnMask mask; if (q->style()->styleHint(QStyle::SH_FocusFrame_Mask, &opt, q, &mask)) q->setMask(mask.region); -- cgit v1.2.3 From 3a6d8df5219653b043bd642668cee193f563ec84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 27 Mar 2020 10:49:31 +0100 Subject: Revert "wasm: Specify event targets by CSS selectors; Support emsdk >= 1.39.5" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c6da278271a2a3627b7a9933776cbdffc5bd2f23. This was a 5.15-only change which should not go into 5.14 since it raises the minimum supported emsdk version. Task-number: QTBUG-83098 Change-Id: I9e15952803f9dfff89b5b4e9caeff5c03dabca27 Reviewed-by: Morten Johan Sørvig --- .../platforms/wasm/qwasmeventtranslator.cpp | 25 +++++++++++----------- src/plugins/platforms/wasm/qwasmintegration.cpp | 9 ++++---- src/plugins/platforms/wasm/qwasmopenglcontext.cpp | 3 +-- src/plugins/platforms/wasm/qwasmscreen.cpp | 4 ++-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index 62ada796db..d99c202c48 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -339,7 +339,8 @@ QWasmEventTranslator::QWasmEventTranslator(QWasmScreen *screen) void QWasmEventTranslator::initEventHandlers() { - QByteArray canvasSelector = "#" + screen()->canvasId().toUtf8(); + QByteArray _canvasId = screen()->canvasId().toUtf8(); + const char *canvasId = _canvasId.constData(); // The Platform Detect: expand coverage and move as needed enum Platform { @@ -363,21 +364,21 @@ void QWasmEventTranslator::initEventHandlers() } } - emscripten_set_keydown_callback(canvasSelector.constData(), (void *)this, 1, &keyboard_cb); - emscripten_set_keyup_callback(canvasSelector.constData(), (void *)this, 1, &keyboard_cb); + emscripten_set_keydown_callback(canvasId, (void *)this, 1, &keyboard_cb); + emscripten_set_keyup_callback(canvasId, (void *)this, 1, &keyboard_cb); - emscripten_set_mousedown_callback(canvasSelector.constData(), (void *)this, 1, &mouse_cb); - emscripten_set_mouseup_callback(canvasSelector.constData(), (void *)this, 1, &mouse_cb); - emscripten_set_mousemove_callback(canvasSelector.constData(), (void *)this, 1, &mouse_cb); + emscripten_set_mousedown_callback(canvasId, (void *)this, 1, &mouse_cb); + emscripten_set_mouseup_callback(canvasId, (void *)this, 1, &mouse_cb); + emscripten_set_mousemove_callback(canvasId, (void *)this, 1, &mouse_cb); - emscripten_set_focus_callback(canvasSelector.constData(), (void *)this, 1, &focus_cb); + emscripten_set_focus_callback(canvasId, (void *)this, 1, &focus_cb); - emscripten_set_wheel_callback(canvasSelector.constData(), (void *)this, 1, &wheel_cb); + emscripten_set_wheel_callback(canvasId, (void *)this, 1, &wheel_cb); - emscripten_set_touchstart_callback(canvasSelector.constData(), (void *)this, 1, &touchCallback); - emscripten_set_touchend_callback(canvasSelector.constData(), (void *)this, 1, &touchCallback); - emscripten_set_touchmove_callback(canvasSelector.constData(), (void *)this, 1, &touchCallback); - emscripten_set_touchcancel_callback(canvasSelector.constData(), (void *)this, 1, &touchCallback); + emscripten_set_touchstart_callback(canvasId, (void *)this, 1, &touchCallback); + emscripten_set_touchend_callback(canvasId, (void *)this, 1, &touchCallback); + emscripten_set_touchmove_callback(canvasId, (void *)this, 1, &touchCallback); + emscripten_set_touchcancel_callback(canvasId, (void *)this, 1, &touchCallback); } template diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index f8eaa39f76..69f58013e7 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -108,8 +108,9 @@ QWasmIntegration::QWasmIntegration() s_instance = this; // We expect that qtloader.js has populated Module.qtCanvasElements with one or more canvases. + // Also check Module.canvas, which may be set if the emscripen or a custom loader is used. emscripten::val qtCanvaseElements = val::module_property("qtCanvasElements"); - emscripten::val canvas = val::module_property("canvas"); // TODO: remove for Qt 6.0 + emscripten::val canvas = val::module_property("canvas"); if (!qtCanvaseElements.isUndefined()) { int screenCount = qtCanvaseElements["length"].as(); @@ -118,9 +119,7 @@ QWasmIntegration::QWasmIntegration() QString canvasId = QWasmString::toQString(canvas["id"]); addScreen(canvasId); } - } else if (!canvas.isUndefined()) { - qWarning() << "Module.canvas is deprecated. A future version of Qt will stop reading this property. " - << "Instead, set Module.qtCanvasElements to be an array of canvas elements, or use qtloader.js."; + } else if (!canvas.isUndefined()){ QString canvasId = QWasmString::toQString(canvas["id"]); addScreen(canvasId); } @@ -140,7 +139,7 @@ QWasmIntegration::QWasmIntegration() integration->resizeAllScreens(); return 0; }; - emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, 1, onWindowResize); + emscripten_set_resize_callback(nullptr, nullptr, 1, onWindowResize); } QWasmIntegration::~QWasmIntegration() diff --git a/src/plugins/platforms/wasm/qwasmopenglcontext.cpp b/src/plugins/platforms/wasm/qwasmopenglcontext.cpp index 4ddd56fd8c..501ab99116 100644 --- a/src/plugins/platforms/wasm/qwasmopenglcontext.cpp +++ b/src/plugins/platforms/wasm/qwasmopenglcontext.cpp @@ -106,8 +106,7 @@ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QWasmOpenGLContext::createEmscriptenContext(cons attributes.depth = useDepthStencil; attributes.stencil = useDepthStencil; - QByteArray convasSelector = "#" + canvasId.toUtf8(); - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(convasSelector.constData(), &attributes); + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvasId.toUtf8().constData(), &attributes); return context; } diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index 2788f1ac19..d407111c2f 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -178,10 +178,10 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize() // Setting the render size to a value larger than the CSS size enables high-dpi // rendering. - QByteArray canvasSelector = "#" + m_canvasId.toUtf8(); + QByteArray canvasId = m_canvasId.toUtf8(); double css_width; double css_height; - emscripten_get_element_css_size(canvasSelector.constData(), &css_width, &css_height); + emscripten_get_element_css_size(canvasId.constData(), &css_width, &css_height); QSizeF cssSize(css_width, css_height); QSizeF canvasSize = cssSize * devicePixelRatio(); -- cgit v1.2.3 From e03a3882bea83d19879b30e312cc1d24520ed540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 14 Apr 2020 16:44:42 +0200 Subject: QAuthenticator: Reset the authentication challenge Both Negotiate and NTLM are conditioned on the 'challenge' being empty when starting the authentication process. So let's reset it when we start the authentication process. Fixes: QTBUG-83370 Change-Id: I41af6d5bcfe3dd980ca2bedce10ceff4f61047ff Reviewed-by: Andy Shaw Reviewed-by: Timur Pocheptsov --- src/network/kernel/qauthenticator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 33a30eb1cd..4cc70b8d11 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -531,6 +531,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet response = qNtlmPhase3(this, QByteArray::fromBase64(challenge)).toBase64(); phase = Done; } + challenge = ""; } break; @@ -560,6 +561,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet if (!phase3Token.isEmpty()) { response = phase3Token.toBase64(); phase = Done; + challenge = ""; } } -- cgit v1.2.3 From 6c45b1817f1f56207dae8aa028b9cbb922dc8008 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 20 Apr 2020 12:51:15 +0200 Subject: SslSocketClient - fix example not to crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to the bug related to the 'new syntax' signal/slot connections, it's unfortunately possible to have a connection not deleted properly by the moment children objects get deleted. Then, as a result, in e.g. QSslSocket's destructor the socket will change its state, triggering the (now deleted) UI elements' access. Note - the original bug was reported, the patch (only possible?) was not accepted. Fixes: QTBUG-83659 Change-Id: I2965532485bcd46f93f8449e4d0a30da92b572c5 Reviewed-by: Mårten Nordheim --- examples/network/securesocketclient/sslclient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/network/securesocketclient/sslclient.cpp b/examples/network/securesocketclient/sslclient.cpp index d6c52a1c66..949edd39c7 100644 --- a/examples/network/securesocketclient/sslclient.cpp +++ b/examples/network/securesocketclient/sslclient.cpp @@ -63,6 +63,7 @@ SslClient::SslClient(QWidget *parent) SslClient::~SslClient() { + delete socket; delete form; } -- cgit v1.2.3 From 76054516047d8efb8529443830bb4d9ddf01010f Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Wed, 25 Mar 2020 15:48:52 +0100 Subject: Handle specified time-spec in date-time parsing When a date-time was parsed from a string, the result was equal (as a date-time) to the correct value, but had (at least in some cases) the wrong spec, where it should have had a spec reflecting the zone specifier parsed. The time-spec imposed for the benefit of QDateTimeEdit is now moved from QDateTimeParser to QDateTimeEditPrivate, which takes over responsibility for imposing it. QDateTimeParser assumes Qt::LocalTime in member functions (where applicable) and uses the time-spec parsed from the string when constructing the date-time. QDateTime::fromString() and QLocale::toDateTime() are updated to use the full QDateTime returned by QDateTimeParser. Fixes: QTBUG-83075 Done-With: Edward Welbourne Change-Id: I8b79add2c7fc13a200e1252d48dbfa70b36757bf Reviewed-by: Qt CI Bot Reviewed-by: Edward Welbourne --- src/corelib/text/qlocale.cpp | 9 ++- src/corelib/time/qdatetime.cpp | 7 +- src/corelib/time/qdatetimeparser.cpp | 74 ++++++++++++++-------- src/corelib/time/qdatetimeparser_p.h | 4 +- src/widgets/widgets/qdatetimeedit.cpp | 7 ++ src/widgets/widgets/qdatetimeedit_p.h | 6 ++ .../auto/corelib/time/qdatetime/tst_qdatetime.cpp | 5 ++ 7 files changed, 73 insertions(+), 39 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 6e33e27276..60bfac62ab 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -2559,19 +2559,18 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCalendar cal) const { #if QT_CONFIG(datetimeparser) - QTime time; - QDate date; + QDateTime datetime; QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); - if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) - return QDateTime(date, time); + if (dt.parseFormat(format) && dt.fromString(string, &datetime)) + return datetime; #else Q_UNUSED(string); Q_UNUSED(format); Q_UNUSED(cal); #endif - return QDateTime(QDate(), QTime(-1, -1, -1)); + return QDateTime(); } #endif // datestring diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 9d95f6eb1c..36942bf68e 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -5537,13 +5537,12 @@ QT_WARNING_POP QDateTime QDateTime::fromString(const QString &string, const QString &format, QCalendar cal) { #if QT_CONFIG(datetimeparser) - QTime time; - QDate date; + QDateTime datetime; QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 - if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) - return QDateTime(date, time); + if (dt.parseFormat(format) && dt.fromString(string, &datetime)) + return datetime; #else Q_UNUSED(string); Q_UNUSED(format); diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 2a19611493..3374b28b69 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -1207,12 +1207,16 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, Q_ASSERT(!zoneName.isEmpty()); // sect.used > 0 const QByteArray latinZone(zoneName == QLatin1String("Z") ? QByteArray("UTC") : zoneName.toLatin1()); - timeZone = QTimeZone(latinZone); - tspec = timeZone.isValid() - ? (QTimeZone::isTimeZoneIdAvailable(latinZone) - ? Qt::TimeZone - : Qt::OffsetFromUTC) - : (Q_ASSERT(startsWithLocalTimeZone(zoneName)), Qt::LocalTime); + if (latinZone.startsWith("UTC") && + (latinZone.size() == 3 || latinZone.at(3) == '+' || latinZone.at(3) == '-' )) { + timeZone = QTimeZone(sect.value); + tspec = sect.value ? Qt::OffsetFromUTC : Qt::UTC; + } else { + timeZone = QTimeZone(latinZone); + tspec = timeZone.isValid() + ? Qt::TimeZone + : (Q_ASSERT(startsWithLocalTimeZone(zoneName)), Qt::LocalTime); + } #else tspec = Qt::LocalTime; #endif @@ -1537,12 +1541,10 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu } } text = scan.input = input; - // Set spec *after* all checking, so validity is a property of the string: - scan.value = scan.value.toTimeSpec(spec); /* - However, even with a valid string we might have ended up with an invalid datetime: - the non-existent hour during dst changes, for instance. + We might have ended up with an invalid datetime: the non-existent hour + during dst changes, for instance. */ if (!scan.value.isValid() && scan.state == Acceptable) scan.state = Intermediate; @@ -2018,13 +2020,12 @@ QString QDateTimeParser::stateName(State s) const #if QT_CONFIG(datestring) bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const { - QDateTime val(QDate(1900, 1, 1).startOfDay()); - const StateNode tmp = parse(t, -1, val, false); - if (tmp.state != Acceptable || tmp.conflicts) { + QDateTime datetime; + if (!fromString(t, &datetime)) return false; - } + if (time) { - const QTime t = tmp.value.time(); + const QTime t = datetime.time(); if (!t.isValid()) { return false; } @@ -2032,7 +2033,7 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con } if (date) { - const QDate d = tmp.value.date(); + const QDate d = datetime.date(); if (!d.isValid()) { return false; } @@ -2040,26 +2041,43 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con } return true; } + +bool QDateTimeParser::fromString(const QString &t, QDateTime* datetime) const +{ + QDateTime val(QDate(1900, 1, 1).startOfDay()); + const StateNode tmp = parse(t, -1, val, false); + if (tmp.state != Acceptable || tmp.conflicts) + return false; + if (datetime) { + if (!tmp.value.isValid()) + return false; + *datetime = tmp.value; + } + + return true; +} #endif // datestring QDateTime QDateTimeParser::getMinimum() const { - // Cache the most common case - if (spec == Qt::LocalTime) { - static const QDateTime localTimeMin(QDATETIMEEDIT_DATE_MIN.startOfDay(Qt::LocalTime)); - return localTimeMin; - } - return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec)); + // NB: QDateTimeParser always uses Qt::LocalTime time spec by default. If + // any subclass needs a changing time spec, it must override this + // method. At the time of writing, this is done by QDateTimeEditPrivate. + + // Cache the only case + static const QDateTime localTimeMin(QDATETIMEEDIT_DATE_MIN.startOfDay(Qt::LocalTime)); + return localTimeMin; } QDateTime QDateTimeParser::getMaximum() const { - // Cache the most common case - if (spec == Qt::LocalTime) { - static const QDateTime localTimeMax(QDATETIMEEDIT_DATE_MAX.endOfDay(Qt::LocalTime)); - return localTimeMax; - } - return QDateTime(QDATETIMEEDIT_DATE_MAX.endOfDay(spec)); + // NB: QDateTimeParser always uses Qt::LocalTime time spec by default. If + // any subclass needs a changing time spec, it must override this + // method. At the time of writing, this is done by QDateTimeEditPrivate. + + // Cache the only case + static const QDateTime localTimeMax(QDATETIMEEDIT_DATE_MAX.endOfDay(Qt::LocalTime)); + return localTimeMax; } QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const diff --git a/src/corelib/time/qdatetimeparser_p.h b/src/corelib/time/qdatetimeparser_p.h index 5c612ef6a4..f2795c31f0 100644 --- a/src/corelib/time/qdatetimeparser_p.h +++ b/src/corelib/time/qdatetimeparser_p.h @@ -85,7 +85,7 @@ public: }; QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar()) : currentSectionIndex(-1), cachedDay(-1), parserType(t), - fixday(false), spec(Qt::LocalTime), context(ctx), calendar(cal) + fixday(false), context(ctx), calendar(cal) { defaultLocale = QLocale::system(); first.type = FirstSection; @@ -181,6 +181,7 @@ public: #if QT_CONFIG(datestring) StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const; bool fromString(const QString &text, QDate *date, QTime *time) const; + bool fromString(const QString &text, QDateTime* datetime) const; #endif bool parseFormat(const QString &format); @@ -297,7 +298,6 @@ protected: // for the benefit of QDateTimeEditPrivate QLocale defaultLocale; QMetaType::Type parserType; bool fixday; - Qt::TimeSpec spec; // spec if used by QDateTimeEdit Context context; QCalendar calendar; }; diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index d145985c1d..deb4dc36ba 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1976,7 +1976,14 @@ QDateTime QDateTimeEditPrivate::validateAndInterpret(QString &input, int &positi return minimum.toDateTime(); } } + StateNode tmp = parse(input, position, value.toDateTime(), fixup); + // Impose this widget's spec: + tmp.value = tmp.value.toTimeSpec(spec); + // ... but that might turn a valid datetime into an invalid one: + if (!tmp.value.isValid() && tmp.state == Acceptable) + tmp.state = Intermediate; + input = tmp.input; position += tmp.padded; state = QValidator::State(int(tmp.state)); diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 323246a87b..7df2b59710 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -98,12 +98,16 @@ public: { if (keyboardTracking) return minimum.toDateTime(); + if (spec != Qt::LocalTime) + return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec)); return QDateTimeParser::getMinimum(); } QDateTime getMaximum() const override { if (keyboardTracking) return maximum.toDateTime(); + if (spec != Qt::LocalTime) + return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec)); return QDateTimeParser::getMaximum(); } QLocale locale() const override { return q_func()->locale(); } @@ -148,6 +152,8 @@ public: #ifdef QT_KEYPAD_NAVIGATION bool focusOnButton; #endif + + Qt::TimeSpec spec = Qt::LocalTime; }; diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index 26ad91271d..08196d8377 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -2554,6 +2554,11 @@ void tst_QDateTime::fromStringStringFormat() QDateTime dt = QDateTime::fromString(string, format); + if (expected.isValid()) { + QCOMPARE(dt.timeSpec(), expected.timeSpec()); + if (expected.timeSpec() == Qt::TimeZone) + QCOMPARE(dt.timeZone(), expected.timeZone()); + } QCOMPARE(dt, expected); } -- cgit v1.2.3 From 0be6a98ab60f378ba6b2def43ab9729b38530bb0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 25 Mar 2020 15:44:55 +0100 Subject: Standardise language about quoted text in date/time format strings Change-Id: Iaaeff8cd28a23b878ca07d716e67d4bd9fbb8176 Reviewed-by: Paul Wicking --- src/corelib/time/qdatetime.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 36942bf68e..8553f79d90 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -1762,9 +1762,9 @@ QT_WARNING_POP be given in the user's local language. It is only possible to use the English names if the user's language is English. - All other input characters will be treated as text. Any sequence - of characters that are enclosed in single quotes will also be - treated as text and will not be used as an expression. For example: + 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. For example: \snippet code/src_corelib_tools_qdatetime.cpp 1 @@ -2132,11 +2132,11 @@ QT_WARNING_POP \row \li t \li The timezone (for example "CEST") \endtable - Any sequence of characters enclosed in single quotes will be included - verbatim in the output string (stripped of the quotes), even if it contains - formatting characters. Two consecutive single quotes ("''") are replaced by - a single quote in the output. All other characters in the format string are - included verbatim in the output string. + Any non-empty sequence of characters enclosed in single quotes will be + included verbatim in the output string (stripped of the quotes), even if it + contains formatting characters. Two consecutive single quotes ("''") are + replaced by a single quote in the output. All other characters in the format + string are included verbatim in the output string. Formats without separators (e.g. "ddMM") are supported but must be used with care, as the resulting strings aren't always reliably readable (e.g. if "dM" @@ -2536,9 +2536,9 @@ QT_WARNING_POP \row \li t \li the timezone (for example "CEST") \endtable - All other input characters will be treated as text. Any sequence - of characters that are enclosed in single quotes will also be - treated as text and not be used as an expression. + 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. \snippet code/src_corelib_tools_qdatetime.cpp 6 @@ -5480,9 +5480,9 @@ QT_WARNING_POP See QDate::fromString() and QTime::fromString() for the expressions recognized in the format string to represent parts of the date and time. - All other input characters will be treated as text. Any sequence of - characters that are enclosed in single quotes will also be treated as text - and not be used as an expression. + 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. \snippet code/src_corelib_tools_qdatetime.cpp 12 -- cgit v1.2.3