Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Iaa439ba7dff19a17e3716b3d30f49f60fa6e38f8
This commit is contained in:
commit
7f895553ac
@ -63,6 +63,7 @@ SslClient::SslClient(QWidget *parent)
|
|||||||
|
|
||||||
SslClient::~SslClient()
|
SslClient::~SslClient()
|
||||||
{
|
{
|
||||||
|
delete socket;
|
||||||
delete form;
|
delete form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,19 +2567,18 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons
|
|||||||
QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCalendar cal) const
|
QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCalendar cal) const
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(datetimeparser)
|
#if QT_CONFIG(datetimeparser)
|
||||||
QTime time;
|
QDateTime datetime;
|
||||||
QDate date;
|
|
||||||
|
|
||||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||||
dt.setDefaultLocale(*this);
|
dt.setDefaultLocale(*this);
|
||||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
if (dt.parseFormat(format) && dt.fromString(string, &datetime))
|
||||||
return QDateTime(date, time);
|
return datetime;
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(string);
|
Q_UNUSED(string);
|
||||||
Q_UNUSED(format);
|
Q_UNUSED(format);
|
||||||
Q_UNUSED(cal);
|
Q_UNUSED(cal);
|
||||||
#endif
|
#endif
|
||||||
return QDateTime(QDate(), QTime(-1, -1, -1));
|
return QDateTime();
|
||||||
}
|
}
|
||||||
#endif // datestring
|
#endif // datestring
|
||||||
|
|
||||||
|
@ -1860,9 +1860,9 @@ QT_WARNING_POP
|
|||||||
be given in the user's local language. It is only possible to use the English
|
be given in the user's local language. It is only possible to use the English
|
||||||
names if the user's language is English.
|
names if the user's language is English.
|
||||||
|
|
||||||
All other input characters will be treated as text. Any sequence
|
All other input characters will be treated as text. Any non-empty sequence
|
||||||
of characters that are enclosed in single quotes will also be
|
of characters enclosed in single quotes will also be treated (stripped of
|
||||||
treated as text and will not be used as an expression. For example:
|
the quotes) as text and not be interpreted as expressions. For example:
|
||||||
|
|
||||||
\snippet code/src_corelib_tools_qdatetime.cpp 1
|
\snippet code/src_corelib_tools_qdatetime.cpp 1
|
||||||
|
|
||||||
@ -2230,11 +2230,11 @@ QT_WARNING_POP
|
|||||||
\row \li t \li The timezone (for example "CEST")
|
\row \li t \li The timezone (for example "CEST")
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Any sequence of characters enclosed in single quotes will be included
|
Any non-empty sequence of characters enclosed in single quotes will be
|
||||||
verbatim in the output string (stripped of the quotes), even if it contains
|
included verbatim in the output string (stripped of the quotes), even if it
|
||||||
formatting characters. Two consecutive single quotes ("''") are replaced by
|
contains formatting characters. Two consecutive single quotes ("''") are
|
||||||
a single quote in the output. All other characters in the format string are
|
replaced by a single quote in the output. All other characters in the format
|
||||||
included verbatim in the output string.
|
string are included verbatim in the output string.
|
||||||
|
|
||||||
Formats without separators (e.g. "ddMM") are supported but must be used with
|
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"
|
care, as the resulting strings aren't always reliably readable (e.g. if "dM"
|
||||||
@ -2634,9 +2634,9 @@ QT_WARNING_POP
|
|||||||
\row \li t \li the timezone (for example "CEST")
|
\row \li t \li the timezone (for example "CEST")
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
All other input characters will be treated as text. Any sequence
|
All other input characters will be treated as text. Any non-empty sequence
|
||||||
of characters that are enclosed in single quotes will also be
|
of characters enclosed in single quotes will also be treated (stripped of
|
||||||
treated as text and not be used as an expression.
|
the quotes) as text and not be interpreted as expressions.
|
||||||
|
|
||||||
\snippet code/src_corelib_tools_qdatetime.cpp 6
|
\snippet code/src_corelib_tools_qdatetime.cpp 6
|
||||||
|
|
||||||
@ -5556,9 +5556,9 @@ QT_WARNING_POP
|
|||||||
|
|
||||||
See QDate::fromString() and QTime::fromString() for the expressions
|
See QDate::fromString() and QTime::fromString() for the expressions
|
||||||
recognized in the format string to represent parts of the date and time.
|
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
|
All other input characters will be treated as text. Any non-empty sequence
|
||||||
characters that are enclosed in single quotes will also be treated as text
|
of characters enclosed in single quotes will also be treated (stripped of
|
||||||
and not be used as an expression.
|
the quotes) as text and not be interpreted as expressions.
|
||||||
|
|
||||||
\snippet code/src_corelib_tools_qdatetime.cpp 12
|
\snippet code/src_corelib_tools_qdatetime.cpp 12
|
||||||
|
|
||||||
@ -5613,13 +5613,12 @@ QT_WARNING_POP
|
|||||||
QDateTime QDateTime::fromString(const QString &string, const QString &format, QCalendar cal)
|
QDateTime QDateTime::fromString(const QString &string, const QString &format, QCalendar cal)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(datetimeparser)
|
#if QT_CONFIG(datetimeparser)
|
||||||
QTime time;
|
QDateTime datetime;
|
||||||
QDate date;
|
|
||||||
|
|
||||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
if (dt.parseFormat(format) && dt.fromString(string, &datetime))
|
||||||
return QDateTime(date, time);
|
return datetime;
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(string);
|
Q_UNUSED(string);
|
||||||
Q_UNUSED(format);
|
Q_UNUSED(format);
|
||||||
|
@ -1207,12 +1207,16 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
|||||||
Q_ASSERT(!zoneName.isEmpty()); // sect.used > 0
|
Q_ASSERT(!zoneName.isEmpty()); // sect.used > 0
|
||||||
const QByteArray latinZone(zoneName == QLatin1String("Z")
|
const QByteArray latinZone(zoneName == QLatin1String("Z")
|
||||||
? QByteArray("UTC") : zoneName.toLatin1());
|
? QByteArray("UTC") : zoneName.toLatin1());
|
||||||
timeZone = QTimeZone(latinZone);
|
if (latinZone.startsWith("UTC") &&
|
||||||
tspec = timeZone.isValid()
|
(latinZone.size() == 3 || latinZone.at(3) == '+' || latinZone.at(3) == '-' )) {
|
||||||
? (QTimeZone::isTimeZoneIdAvailable(latinZone)
|
timeZone = QTimeZone(sect.value);
|
||||||
? Qt::TimeZone
|
tspec = sect.value ? Qt::OffsetFromUTC : Qt::UTC;
|
||||||
: Qt::OffsetFromUTC)
|
} else {
|
||||||
: (Q_ASSERT(startsWithLocalTimeZone(zoneName)), Qt::LocalTime);
|
timeZone = QTimeZone(latinZone);
|
||||||
|
tspec = timeZone.isValid()
|
||||||
|
? Qt::TimeZone
|
||||||
|
: (Q_ASSERT(startsWithLocalTimeZone(zoneName)), Qt::LocalTime);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
tspec = Qt::LocalTime;
|
tspec = Qt::LocalTime;
|
||||||
#endif
|
#endif
|
||||||
@ -1537,12 +1541,10 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
text = scan.input = input;
|
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:
|
We might have ended up with an invalid datetime: the non-existent hour
|
||||||
the non-existent hour during dst changes, for instance.
|
during dst changes, for instance.
|
||||||
*/
|
*/
|
||||||
if (!scan.value.isValid() && scan.state == Acceptable)
|
if (!scan.value.isValid() && scan.state == Acceptable)
|
||||||
scan.state = Intermediate;
|
scan.state = Intermediate;
|
||||||
@ -2018,13 +2020,12 @@ QString QDateTimeParser::stateName(State s) const
|
|||||||
#if QT_CONFIG(datestring)
|
#if QT_CONFIG(datestring)
|
||||||
bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const
|
bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const
|
||||||
{
|
{
|
||||||
QDateTime val(QDate(1900, 1, 1).startOfDay());
|
QDateTime datetime;
|
||||||
const StateNode tmp = parse(t, -1, val, false);
|
if (!fromString(t, &datetime))
|
||||||
if (tmp.state != Acceptable || tmp.conflicts) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (time) {
|
if (time) {
|
||||||
const QTime t = tmp.value.time();
|
const QTime t = datetime.time();
|
||||||
if (!t.isValid()) {
|
if (!t.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2032,7 +2033,7 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (date) {
|
if (date) {
|
||||||
const QDate d = tmp.value.date();
|
const QDate d = datetime.date();
|
||||||
if (!d.isValid()) {
|
if (!d.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2040,26 +2041,43 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con
|
|||||||
}
|
}
|
||||||
return true;
|
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
|
#endif // datestring
|
||||||
|
|
||||||
QDateTime QDateTimeParser::getMinimum() const
|
QDateTime QDateTimeParser::getMinimum() const
|
||||||
{
|
{
|
||||||
// Cache the most common case
|
// NB: QDateTimeParser always uses Qt::LocalTime time spec by default. If
|
||||||
if (spec == Qt::LocalTime) {
|
// any subclass needs a changing time spec, it must override this
|
||||||
static const QDateTime localTimeMin(QDATETIMEEDIT_DATE_MIN.startOfDay(Qt::LocalTime));
|
// method. At the time of writing, this is done by QDateTimeEditPrivate.
|
||||||
return localTimeMin;
|
|
||||||
}
|
// Cache the only case
|
||||||
return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec));
|
static const QDateTime localTimeMin(QDATETIMEEDIT_DATE_MIN.startOfDay(Qt::LocalTime));
|
||||||
|
return localTimeMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime QDateTimeParser::getMaximum() const
|
QDateTime QDateTimeParser::getMaximum() const
|
||||||
{
|
{
|
||||||
// Cache the most common case
|
// NB: QDateTimeParser always uses Qt::LocalTime time spec by default. If
|
||||||
if (spec == Qt::LocalTime) {
|
// any subclass needs a changing time spec, it must override this
|
||||||
static const QDateTime localTimeMax(QDATETIMEEDIT_DATE_MAX.endOfDay(Qt::LocalTime));
|
// method. At the time of writing, this is done by QDateTimeEditPrivate.
|
||||||
return localTimeMax;
|
|
||||||
}
|
// Cache the only case
|
||||||
return QDateTime(QDATETIMEEDIT_DATE_MAX.endOfDay(spec));
|
static const QDateTime localTimeMax(QDATETIMEEDIT_DATE_MAX.endOfDay(Qt::LocalTime));
|
||||||
|
return localTimeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const
|
QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
};
|
};
|
||||||
QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
||||||
: currentSectionIndex(-1), cachedDay(-1), parserType(t),
|
: currentSectionIndex(-1), cachedDay(-1), parserType(t),
|
||||||
fixday(false), spec(Qt::LocalTime), context(ctx), calendar(cal)
|
fixday(false), context(ctx), calendar(cal)
|
||||||
{
|
{
|
||||||
defaultLocale = QLocale::system();
|
defaultLocale = QLocale::system();
|
||||||
first.type = FirstSection;
|
first.type = FirstSection;
|
||||||
@ -180,6 +180,7 @@ public:
|
|||||||
#if QT_CONFIG(datestring)
|
#if QT_CONFIG(datestring)
|
||||||
StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const;
|
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, QDate *date, QTime *time) const;
|
||||||
|
bool fromString(const QString &text, QDateTime* datetime) const;
|
||||||
#endif
|
#endif
|
||||||
bool parseFormat(const QString &format);
|
bool parseFormat(const QString &format);
|
||||||
|
|
||||||
@ -297,7 +298,6 @@ protected: // for the benefit of QDateTimeEditPrivate
|
|||||||
QLocale defaultLocale;
|
QLocale defaultLocale;
|
||||||
QMetaType::Type parserType;
|
QMetaType::Type parserType;
|
||||||
bool fixday;
|
bool fixday;
|
||||||
Qt::TimeSpec spec; // spec if used by QDateTimeEdit
|
|
||||||
Context context;
|
Context context;
|
||||||
QCalendar calendar;
|
QCalendar calendar;
|
||||||
};
|
};
|
||||||
|
@ -531,6 +531,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet
|
|||||||
response = qNtlmPhase3(this, QByteArray::fromBase64(challenge)).toBase64();
|
response = qNtlmPhase3(this, QByteArray::fromBase64(challenge)).toBase64();
|
||||||
phase = Done;
|
phase = Done;
|
||||||
}
|
}
|
||||||
|
challenge = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -560,6 +561,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet
|
|||||||
if (!phase3Token.isEmpty()) {
|
if (!phase3Token.isEmpty()) {
|
||||||
response = phase3Token.toBase64();
|
response = phase3Token.toBase64();
|
||||||
phase = Done;
|
phase = Done;
|
||||||
|
challenge = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2000,7 +2000,14 @@ QDateTime QDateTimeEditPrivate::validateAndInterpret(QString &input, int &positi
|
|||||||
return minimum.toDateTime();
|
return minimum.toDateTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateNode tmp = parse(input, position, value.toDateTime(), fixup);
|
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;
|
input = tmp.input;
|
||||||
position += tmp.padded;
|
position += tmp.padded;
|
||||||
state = QValidator::State(int(tmp.state));
|
state = QValidator::State(int(tmp.state));
|
||||||
|
@ -98,12 +98,16 @@ public:
|
|||||||
{
|
{
|
||||||
if (keyboardTracking)
|
if (keyboardTracking)
|
||||||
return minimum.toDateTime();
|
return minimum.toDateTime();
|
||||||
|
if (spec != Qt::LocalTime)
|
||||||
|
return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec));
|
||||||
return QDateTimeParser::getMinimum();
|
return QDateTimeParser::getMinimum();
|
||||||
}
|
}
|
||||||
QDateTime getMaximum() const override
|
QDateTime getMaximum() const override
|
||||||
{
|
{
|
||||||
if (keyboardTracking)
|
if (keyboardTracking)
|
||||||
return maximum.toDateTime();
|
return maximum.toDateTime();
|
||||||
|
if (spec != Qt::LocalTime)
|
||||||
|
return QDateTime(QDATETIMEEDIT_DATE_MIN.startOfDay(spec));
|
||||||
return QDateTimeParser::getMaximum();
|
return QDateTimeParser::getMaximum();
|
||||||
}
|
}
|
||||||
QLocale locale() const override { return q_func()->locale(); }
|
QLocale locale() const override { return q_func()->locale(); }
|
||||||
@ -148,6 +152,8 @@ public:
|
|||||||
#ifdef QT_KEYPAD_NAVIGATION
|
#ifdef QT_KEYPAD_NAVIGATION
|
||||||
bool focusOnButton;
|
bool focusOnButton;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Qt::TimeSpec spec = Qt::LocalTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,6 +99,8 @@ void QFocusFramePrivate::updateSize()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
q->setGeometry(geom);
|
q->setGeometry(geom);
|
||||||
|
|
||||||
|
opt.rect = q->rect();
|
||||||
QStyleHintReturnMask mask;
|
QStyleHintReturnMask mask;
|
||||||
if (q->style()->styleHint(QStyle::SH_FocusFrame_Mask, &opt, q, &mask))
|
if (q->style()->styleHint(QStyle::SH_FocusFrame_Mask, &opt, q, &mask))
|
||||||
q->setMask(mask.region);
|
q->setMask(mask.region);
|
||||||
|
@ -2551,6 +2551,11 @@ void tst_QDateTime::fromStringStringFormat()
|
|||||||
|
|
||||||
QDateTime dt = QDateTime::fromString(string, format);
|
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);
|
QCOMPARE(dt, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user