summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/qtcore.qdocconf2
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc2
-rw-r--r--src/corelib/global/qendian.cpp1
-rw-r--r--src/corelib/global/qlibraryinfo.cpp21
-rw-r--r--src/corelib/global/qnamespace.qdoc2
-rw-r--r--src/corelib/serialization/qxmlstream.cpp14
-rw-r--r--src/corelib/serialization/qxmlstream_p.h2
-rw-r--r--src/corelib/text/qlocale.cpp12
-rw-r--r--src/corelib/text/qlocale_win.cpp97
-rw-r--r--src/corelib/text/qregularexpression.cpp8
-rw-r--r--src/corelib/text/text.pri2
-rw-r--r--src/corelib/time/qcalendar.cpp2
-rw-r--r--src/corelib/time/qtimezone.cpp2
-rw-r--r--src/dbus/qdbusabstractinterface.cpp6
-rw-r--r--src/dbus/qdbuspendingcall.cpp5
-rw-r--r--src/dbus/qdbuspendingreply.cpp3
-rw-r--r--src/gui/doc/qtgui.qdocconf1
-rw-r--r--src/gui/doc/src/richtext.qdoc49
-rw-r--r--src/gui/image/qpnghandler.cpp5
-rw-r--r--src/gui/kernel/qevent.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp1
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qcolor.h8
-rw-r--r--src/gui/painting/qpainter.cpp3
-rw-r--r--src/gui/rhi/qrhimetal.mm2
-rw-r--r--src/gui/text/qfontmetrics.cpp70
-rw-r--r--src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc1
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp4
-rw-r--r--src/plugins/platforms/wasm/qwasmclipboard.cpp38
-rw-r--r--src/plugins/platforms/wasm/qwasmcursor.cpp7
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp6
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp11
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp4
-rw-r--r--src/plugins/platforms/wasm/qwasmservices.cpp6
-rw-r--r--src/plugins/platforms/wasm/qwasmstring.cpp61
-rw-r--r--src/plugins/platforms/wasm/qwasmstring.h45
-rw-r--r--src/plugins/platforms/wasm/wasm.pro6
-rw-r--r--src/sql/doc/snippets/sqldatabase/sqldatabase.cpp10
-rw-r--r--src/sql/models/qsqlquerymodel.cpp4
-rw-r--r--src/sql/models/qsqltablemodel.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc12
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp4
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp3
-rw-r--r--src/widgets/widgets/qscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qspinbox.cpp48
47 files changed, 431 insertions, 180 deletions
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 15b1925e51..2b9adabc3a 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtcore/qtcore.tags
-depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras qtqml
+depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras qtqml qtcmake
headerdirs += ..
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
index 29fc25f69d..5838d13914 100644
--- a/src/corelib/doc/src/qtcore-index.qdoc
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -56,7 +56,7 @@
\include module-use.qdocinc using qt module
\quotefile overview/using-qt-core.cmake
- See also the \l[QtDoc]{Build with CMake} overview.
+ See also the \l{Build with CMake} overview.
\section2 Building with qmake
diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp
index 98dc6a9a4b..eb08b2f848 100644
--- a/src/corelib/global/qendian.cpp
+++ b/src/corelib/global/qendian.cpp
@@ -192,7 +192,6 @@ QT_BEGIN_NAMESPACE
an in-place swap (if necessary). If they are not the same, the memory
regions must not overlap.
- \sa qFromLittleEndian()
\sa qToBigEndian()
\sa qToLittleEndian()
*/
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index f0f77fe68e..7d6beaf9c2 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -535,8 +535,25 @@ static QString getRelocatablePrefix()
#if defined(QT_STATIC)
prefixPath = prefixFromAppDirHelper();
#elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
- CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier(
- CFSTR("org.qt-project.QtCore"));
+ auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore"));
+ if (!qtCoreBundle) {
+ // When running Qt apps over Samba shares, CoreFoundation will fail to find
+ // the Resources directory inside the bundle, This directory is a symlink,
+ // and CF relies on readdir() and dtent.dt_type to detect symlinks, which
+ // does not work reliably for Samba shares. We work around it by manually
+ // looking for the QtCore bundle.
+ auto allBundles = CFBundleGetAllBundles();
+ auto bundleCount = CFArrayGetCount(allBundles);
+ for (int i = 0; i < bundleCount; ++i) {
+ auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
+ auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
+ auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
+ if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) {
+ qtCoreBundle = bundle;
+ break;
+ }
+ }
+ }
Q_ASSERT(qtCoreBundle);
QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index bebe67be3f..1908fedead 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1017,7 +1017,7 @@
\value WA_MacNoClickThrough This value is obsolete and has no effect.
- \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
+ \value WA_MacOpaqueSizeGrip Indicates that the native size grip
should be opaque instead of transparent (the default). This attribute
is only applicable to \macos and is set by the widget's author.
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
index 500e0aa6be..7ff87885a5 100644
--- a/src/corelib/serialization/qxmlstream.cpp
+++ b/src/corelib/serialization/qxmlstream.cpp
@@ -50,6 +50,7 @@
#endif
#include <qstack.h>
#include <qbuffer.h>
+#include <qscopeguard.h>
#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
#else
@@ -68,6 +69,8 @@ public: \
{ return QString::fromLatin1(sourceText); } \
private:
#endif
+#include <private/qmemory_p.h>
+
QT_BEGIN_NAMESPACE
#include "qxmlstream_p.h"
@@ -847,7 +850,7 @@ void QXmlStreamReaderPrivate::init()
#endif
attributeStack.clear();
attributeStack.reserve(16);
- entityParser = nullptr;
+ entityParser.reset();
hasCheckedStartDocument = false;
normalizeLiterals = false;
hasSeenTag = false;
@@ -880,7 +883,7 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value)
if (!entityParser)
- entityParser = new QXmlStreamReaderPrivate(q);
+ entityParser = qt_make_unique<QXmlStreamReaderPrivate>(q);
else
entityParser->init();
entityParser->inParseEntity = true;
@@ -910,7 +913,6 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
#endif
free(sym_stack);
free(state_stack);
- delete entityParser;
}
@@ -1582,6 +1584,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
*/
void QXmlStreamReaderPrivate::resolveTag()
{
+ const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); });
int n = attributeStack.size();
if (namespaceProcessing) {
@@ -1649,7 +1652,10 @@ void QXmlStreamReaderPrivate::resolveTag()
if (attributes[j].name() == attribute.name()
&& attributes[j].namespaceUri() == attribute.namespaceUri()
&& (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
+ {
raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName()));
+ return;
+ }
}
}
@@ -1680,8 +1686,6 @@ void QXmlStreamReaderPrivate::resolveTag()
attribute.m_isDefault = true;
attributes.append(attribute);
}
-
- attributeStack.clear();
}
void QXmlStreamReaderPrivate::resolvePublicNamespaces()
diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h
index cde66a48a3..9c94e6d434 100644
--- a/src/corelib/serialization/qxmlstream_p.h
+++ b/src/corelib/serialization/qxmlstream_p.h
@@ -981,7 +981,7 @@ public:
QString resolveUndeclaredEntity(const QString &name);
void parseEntity(const QString &value);
- QXmlStreamReaderPrivate *entityParser;
+ std::unique_ptr<QXmlStreamReaderPrivate> entityParser;
bool scanAfterLangleBang();
bool scanPublicOrSystem();
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index e3530eeee1..26db674a99 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -734,23 +734,23 @@ static void updateSystemPrivate()
globalLocaleData.m_script_id = res.toInt();
res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_decimal = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_group = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_zero = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_minus = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_plus = res.toString().at(0).unicode();
}
#endif // !QT_NO_SYSTEMLOCALE
@@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const
for (const auto entry : qAsConst(uiLanguages))
locales.append(QLocale(entry));
}
+ if (locales.isEmpty())
+ locales.append(systemLocale()->fallbackUiLocale());
} else
#endif
{
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp
index 79ea67f966..4b4152c519 100644
--- a/src/corelib/text/qlocale_win.cpp
+++ b/src/corelib/text/qlocale_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -106,11 +106,11 @@ struct QSystemLocalePrivate
{
QSystemLocalePrivate();
- QChar zeroDigit();
- QChar decimalPoint();
- QChar groupSeparator();
- QChar negativeSign();
- QChar positiveSign();
+ QString zeroDigit();
+ QString decimalPoint();
+ QString groupSeparator();
+ QString negativeSign();
+ QString positiveSign();
QVariant dateFormat(QLocale::FormatType);
QVariant timeFormat(QLocale::FormatType);
QVariant dateTimeFormat(QLocale::FormatType);
@@ -147,12 +147,11 @@ private:
WCHAR lcName[LOCALE_NAME_MAX_LENGTH];
#endif
SubstitutionType substitutionType;
- QChar zero;
+ QString zero; // cached value for zeroDigit()
int getLocaleInfo(LCTYPE type, LPWSTR data, int size);
QString getLocaleInfo(LCTYPE type, int maxlen = 0);
int getLocaleInfo_int(LCTYPE type, int maxlen = 0);
- QChar getLocaleInfo_qchar(LCTYPE type);
int getCurrencyFormat(DWORD flags, LPCWSTR value, const CURRENCYFMTW *format, LPWSTR data, int size);
int getDateFormat(DWORD flags, const SYSTEMTIME * date, LPCWSTR format, LPWSTR data, int size);
@@ -236,12 +235,6 @@ int QSystemLocalePrivate::getLocaleInfo_int(LCTYPE type, int maxlen)
return ok ? v : 0;
}
-QChar QSystemLocalePrivate::getLocaleInfo_qchar(LCTYPE type)
-{
- QString str = getLocaleInfo(type);
- return str.isEmpty() ? QChar() : str.at(0);
-}
-
QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
{
if (substitutionType == SUnknown) {
@@ -257,13 +250,12 @@ QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
else if (buf[0] == '2')
substitutionType = QSystemLocalePrivate::SAlways;
else {
- wchar_t digits[11];
+ wchar_t digits[11]; // See zeroDigit() for why 11.
if (!getLocaleInfo(LOCALE_SNATIVEDIGITS, digits, 11)) {
substitutionType = QSystemLocalePrivate::SNever;
return substitutionType;
}
- const wchar_t zero = digits[0];
- if (buf[0] == zero + 2)
+ if (buf[0] == digits[0] + 2)
substitutionType = QSystemLocalePrivate::SAlways;
else
substitutionType = QSystemLocalePrivate::SNever;
@@ -274,40 +266,75 @@ QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
QString &QSystemLocalePrivate::substituteDigits(QString &string)
{
- ushort zero = zeroDigit().unicode();
- ushort *qch = reinterpret_cast<ushort *>(string.data());
- for (ushort *end = qch + string.size(); qch != end; ++qch) {
- if (*qch >= '0' && *qch <= '9')
- *qch = zero + (*qch - '0');
+ zeroDigit(); // Ensure zero is set.
+ switch (zero.size()) {
+ case 1: {
+ const ushort offset = zero.at(0).unicode() - '0';
+ if (!offset) // Nothing to do
+ break;
+ Q_ASSERT(offset > 9);
+ ushort *const qch = reinterpret_cast<ushort *>(string.data());
+ for (int i = 0, stop = string.size(); i < stop; ++i) {
+ ushort &ch = qch[i];
+ if (ch >= '0' && ch <= '9')
+ ch += offset;
+ }
+ break;
+ }
+ case 2: {
+ // Surrogate pair (high, low):
+ uint digit = QChar::surrogateToUcs4(zero.at(0), zero.at(1));
+ for (int i = 0; i < 10; i++) {
+ const QChar s[2] = { QChar::highSurrogate(digit + i), QChar::lowSurrogate(digit + i) };
+ string.replace(QString(QLatin1Char('0' + i)), QString(s, 2));
+ }
+ break;
+ }
+ default:
+ Q_ASSERT(!"Expected zero digit to be a single UCS2 code-point or a surrogate pair");
+ case 0: // Apparently this locale info was not available.
+ break;
}
return string;
}
-QChar QSystemLocalePrivate::zeroDigit()
+QString QSystemLocalePrivate::zeroDigit()
{
- if (zero.isNull())
- zero = getLocaleInfo_qchar(LOCALE_SNATIVEDIGITS);
+ if (zero.isEmpty()) {
+ /* Ten digits plus a terminator.
+
+ https://docs.microsoft.com/en-us/windows/win32/intl/locale-snative-constants
+ "Native equivalents of ASCII 0 through 9. The maximum number of
+ characters allowed for this string is eleven, including a terminating
+ null character."
+ */
+ wchar_t digits[11];
+ if (getLocaleInfo(LOCALE_SNATIVEDIGITS, digits, 11)) {
+ // assert all(digits[i] == i + digits[0] for i in range(1, 10)), assumed above
+ zero = QString::fromWCharArray(digits, 1);
+ }
+ }
return zero;
}
-QChar QSystemLocalePrivate::decimalPoint()
+QString QSystemLocalePrivate::decimalPoint()
{
- return getLocaleInfo_qchar(LOCALE_SDECIMAL);
+ return getLocaleInfo(LOCALE_SDECIMAL);
}
-QChar QSystemLocalePrivate::groupSeparator()
+QString QSystemLocalePrivate::groupSeparator()
{
- return getLocaleInfo_qchar(LOCALE_STHOUSAND);
+ return getLocaleInfo(LOCALE_STHOUSAND);
}
-QChar QSystemLocalePrivate::negativeSign()
+QString QSystemLocalePrivate::negativeSign()
{
- return getLocaleInfo_qchar(LOCALE_SNEGATIVESIGN);
+ return getLocaleInfo(LOCALE_SNEGATIVESIGN);
}
-QChar QSystemLocalePrivate::positiveSign()
+QString QSystemLocalePrivate::positiveSign()
{
- return getLocaleInfo_qchar(LOCALE_SPOSITIVESIGN);
+ return getLocaleInfo(LOCALE_SPOSITIVESIGN);
}
QVariant QSystemLocalePrivate::dateFormat(QLocale::FormatType type)
@@ -677,7 +704,7 @@ void QSystemLocalePrivate::update()
GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH);
#endif
substitutionType = SUnknown;
- zero = QChar();
+ zero.resize(0);
}
QString QSystemLocalePrivate::winToQtFormat(QStringView sys_fmt)
@@ -749,7 +776,7 @@ QLocale QSystemLocale::fallbackUiLocale() const
return QLocale(QString::fromLatin1(getWinLocaleName()));
}
-QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
+QVariant QSystemLocale::query(QueryType type, QVariant in) const
{
QSystemLocalePrivate *d = systemLocalePrivate();
switch(type) {
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 67be67c243..59d21e0a23 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -1892,6 +1892,10 @@ QString QRegularExpression::escape(const QString &str)
\snippet code/src_corelib_tools_qregularexpression.cpp 31
+ The returned regular expression is already fully anchored. In other
+ words, there is no need of calling anchoredPattern() again on the
+ result.
+
\warning Unlike QRegExp, this implementation follows closely the definition
of wildcard for glob patterns:
\table
@@ -1918,12 +1922,12 @@ QString QRegularExpression::escape(const QString &str)
\note The backslash (\\) character is \e not an escape char in this context.
In order to match one of the special characters, place it in square brackets
- (for example, "[?]").
+ (for example, \c{[?]}).
More information about the implementation can be found in:
\list
\li \l {https://en.wikipedia.org/wiki/Glob_(programming)} {The Wikipedia Glob article}
- \li \c man 7 glob
+ \li \c {man 7 glob}
\endlist
\sa escape()
diff --git a/src/corelib/text/text.pri b/src/corelib/text/text.pri
index 25e281f37a..d2a02059c7 100644
--- a/src/corelib/text/text.pri
+++ b/src/corelib/text/text.pri
@@ -48,7 +48,7 @@ SOURCES += \
NO_PCH_SOURCES += text/qstring_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
-!nacl:macos: {
+!nacl:darwin: {
SOURCES += text/qlocale_mac.mm
}
else:unix {
diff --git a/src/corelib/time/qcalendar.cpp b/src/corelib/time/qcalendar.cpp
index 6a4623ce92..9d485f181e 100644
--- a/src/corelib/time/qcalendar.cpp
+++ b/src/corelib/time/qcalendar.cpp
@@ -723,7 +723,7 @@ QCalendar::QCalendar(QLatin1String name)
QCalendar::QCalendar(QStringView name)
: d(QCalendarBackend::fromName(name)) {}
-/*
+/*!
\fn bool QCalendar::isValid() const
Returns true if this is a valid calendar object.
diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp
index ef323de14a..0bba2afc61 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -217,7 +217,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
This class includes data obtained from the CLDR data files under the terms
of the Unicode Data Files and Software License. See
- \l{Unicode Common Locale Data Repository (CLDR)} for details.
+ \l{unicode-cldr}{Unicode Common Locale Data Repository (CLDR)} for details.
\sa QDateTime
*/
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 87de784fc0..d15496a792 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -696,7 +696,7 @@ void QDBusAbstractInterface::internalPropSet(const char *propname, const QVarian
*/
/*!
- \fn QDBusAbstractInterface::call(const QString &message, Args&&...args)
+ \fn template <typename...Args> QDBusMessage QDBusAbstractInterface::call(const QString &method, Args&&...args)
Calls the method \a method on this interface and passes \a args to the method.
All \a args must be convertible to QVariant.
@@ -745,7 +745,7 @@ QDBusMessage QDBusAbstractInterface::call(const QString &method, const QVariant
*/
/*!
- \fn QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &message, Args&&...args)
+ \fn template <typename...Args> QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &method, Args&&...args)
\overload
@@ -827,7 +827,7 @@ QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &m
*/
/*!
- \fn QDBusAbstractInterface::asyncCall(const QString &message, Args&&...args)
+ \fn template <typename...Args> QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, Args&&...args)
Calls the method \a method on this interface and passes \a args to the method.
All \a args must be convertible to QVariant.
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 8e604d5a77..eeb9c266a3 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -82,8 +82,7 @@ QT_BEGIN_NAMESPACE
provide a method of detaching the copies (since they refer
to the same pending call)
- \sa QDBusPendingReply, QDBusPendingCallWatcher,
- QDBusAbstractInterface::asyncCall()
+ \sa QDBusPendingReply, QDBusPendingCallWatcher
*/
/*!
@@ -115,7 +114,7 @@ QT_BEGIN_NAMESPACE
(one string and one QByteArray), QDBusPendingReply::isError() will
return true.
- \sa QDBusPendingReply, QDBusAbstractInterface::asyncCall()
+ \sa QDBusPendingReply
*/
/*!
diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp
index ec49bafb60..b1b5fb3431 100644
--- a/src/dbus/qdbuspendingreply.cpp
+++ b/src/dbus/qdbuspendingreply.cpp
@@ -91,8 +91,7 @@
QDBusPendingCallWatcher objects, which emit signals when the reply
arrives.
- \sa QDBusPendingCallWatcher, QDBusReply,
- QDBusAbstractInterface::asyncCall()
+ \sa QDBusPendingCallWatcher, QDBusReply
*/
/*!
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 76dd6d7ea1..d149caf069 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -41,6 +41,7 @@ depends += \
qtwidgets \
qtdoc \
qmake \
+ qtcmake \
qttestlib
headerdirs += ..
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc
index 24fd4240b3..31a2ebf05b 100644
--- a/src/gui/doc/src/richtext.qdoc
+++ b/src/gui/doc/src/richtext.qdoc
@@ -1269,6 +1269,55 @@
\row \li \c word-spacing
\li <width>px
\li Specifies an alternate spacing between each word.
+ \row \li \c line-height
+ \li <number>[% | px | pt | cm]
+ \li Specifies the height of a line. It can be one of the
+ following:
+ \list
+ \li fixed line height in pixels, points, or centimeters.
+ \li a percentage of the current font size.
+ \endlist
+ \endtable
+
+ \section1 Qt-specific CSS properties
+
+ Besides the standard CSS properties listed earlier, the following
+ Qt-specific properties can also be used to style a text block:
+
+ \table
+ \header \li Property
+ \li Values
+ \li Description
+ \row
+ \li \c -qt-block-indent
+ \li \c <number>
+ \li Indents the text block by the specified no. spaces.
+ \row
+ \li \c -qt-list-indent
+ \li \c <number>
+ \li Indents the list items by the specified no. of spaces.
+ \row
+ \li \c -qt-list-number-prefix
+ \li \c <string>
+ \li Prefixes the given string to list number in an HTML ordered list.
+ \row
+ \li \c -qt-list-number-suffix
+ \li <string>
+ \li Suffixes the given string to list number in an HTML ordered list.
+ \row
+ \li \c -qt-paragraph-type
+ \li \c empty
+ \li Hides the text block.
+ \row
+ \li \c -qt-table-type
+ \li \c{root | frame}
+ \li \c root renders the text blocks inline without borders and
+ indentation, whereas \c frame renders them on a new line
+ with a frame around.
+ \row
+ \li \c -qt-user-state
+ \li \c <number>
+ \li Adds it as user data for the text block.
\endtable
\section1 Supported CSS Selectors
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 4ab45337b0..fa67d38f7a 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -915,7 +915,10 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_i
return false;
}
- png_set_error_fn(png_ptr, 0, 0, qt_png_warning);
+ png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning);
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ png_set_benign_errors(png_ptr, 1);
+#endif
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 0706ae3e90..de60a66517 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1150,8 +1150,8 @@ QKeyEvent::~QKeyEvent()
Note: The native scan code may be 0, even if the key event contains
extended information.
- Note: On Mac OS/X, this function is not useful, because there is no
- way to get the scan code from Carbon or Cocoa. The function always
+ Note: On \macos, this function is not useful, because there is no
+ way to get the scan code from the system APIs. The function always
returns 1 (or 0 in the case explained above).
*/
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f701755500..0a4277c118 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2690,7 +2690,6 @@ QOpenGLContext *QWindowPrivate::shareContext() const
platform dependent and untested.
\sa setParent()
- \sa setTransientParent()
*/
QWindow *QWindow::fromWinId(WId id)
{
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index b0393aff95..0a49269c36 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -220,8 +220,6 @@ static bool isRasterSurface(QWindow *window)
to the backingstore's top level window.
You should call this function after ending painting with endPaint().
-
- \sa QWindow::transientParent()
*/
void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &offset)
{
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index f0d7dd23ad..0189f4e5f1 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -72,10 +72,10 @@ public:
QColor(Qt::GlobalColor color) noexcept;
Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept
: cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid),
- ct(cspec == Rgb ? a * 0x0101 : 0,
- cspec == Rgb ? r * 0x0101 : 0,
- cspec == Rgb ? g * 0x0101 : 0,
- cspec == Rgb ? b * 0x0101 : 0,
+ ct(ushort(cspec == Rgb ? a * 0x0101 : 0),
+ ushort(cspec == Rgb ? r * 0x0101 : 0),
+ ushort(cspec == Rgb ? g * 0x0101 : 0),
+ ushort(cspec == Rgb ? b * 0x0101 : 0),
0) {}
QColor(QRgb rgb) noexcept;
QColor(QRgba64 rgba64) noexcept;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 3ce54c20be..75e7dc49fd 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1404,8 +1404,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
cases where expensive operations are ok to use, for instance when
the result is cached in a QPixmap.
- \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example},
- {Drawing Utility Functions}
+ \sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example}, {<qdrawutil.h>}{Drawing Utility Functions}
*/
/*!
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 3ecc56d147..83fec31081 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE
recording a frame, that is, between a \l{QRhi::beginFrame()}{beginFrame()}
- \l{QRhi::endFrame()}{endFrame()} or
\l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} -
- \l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair.
+ \l{QRhi::endOffscreenFrame()}{endOffsrceenFrame()} pair.
\note The command encoder is only valid while recording a pass, that is,
between \l{QRhiCommandBuffer::beginPass()} -
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index d3e4f11e8c..b7a3066f3a 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -106,12 +106,12 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
These are by necessity slow, and we recommend avoiding them if
possible.
- For each character, you can get its width(), leftBearing() and
- rightBearing() and find out whether it is in the font using
+ For each character, you can get its horizontalAdvance(), leftBearing(),
+ and rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
- The string functions include width(), to return the width of a
+ The string functions include horizontalAdvance(), to return the width of a
string in pixels (or points, for a printer), boundingRect(), to
return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
@@ -464,9 +464,9 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa rightBearing(), minLeftBearing(), width()
+ \sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
int QFontMetrics::leftBearing(QChar ch) const
{
@@ -495,11 +495,11 @@ int QFontMetrics::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
- extend to the right of the width() of the character.
+ extend to the right of the horizontalAdvance() of the character.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa leftBearing(), minRightBearing(), width()
+ \sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
int QFontMetrics::rightBearing(QChar ch) const
{
@@ -535,7 +535,7 @@ int QFontMetrics::rightBearing(QChar ch) const
\deprecated in Qt 5.11. Use horizontalAdvance() instead.
- \sa boundingRect()
+ \sa boundingRect(), horizontalAdvance()
*/
int QFontMetrics::width(const QString &text, int len) const
{
@@ -601,7 +601,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
- \sa boundingRect()
+ \sa boundingRect(), horizontalAdvance()
*/
int QFontMetrics::width(QChar ch) const
{
@@ -751,7 +751,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -762,7 +763,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
The height of the bounding rectangle is at least as large as the
value returned by height().
- \sa width(), height(), QPainter::boundingRect(), tightBoundingRect()
+ \sa horizontalAdvance(), height(), QPainter::boundingRect(),
+ tightBoundingRect()
*/
QRect QFontMetrics::boundingRect(const QString &text) const
{
@@ -790,7 +792,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
\warning The width of the returned rectangle is not the advance width
of the character. Use boundingRect(const QString &) or horizontalAdvance() instead.
- \sa width()
+ \sa horizontalAdvance()
*/
QRect QFontMetrics::boundingRect(QChar ch) const
{
@@ -864,7 +866,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
- \sa width(), QPainter::boundingRect(), Qt::Alignment
+ \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &text, int tabStops,
int *tabArray) const
@@ -920,7 +922,8 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -930,7 +933,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
\warning Calling this method is very slow on Windows.
- \sa width(), height(), boundingRect()
+ \sa horizontalAdvance(), height(), boundingRect()
*/
QRect QFontMetrics::tightBoundingRect(const QString &text) const
{
@@ -1079,12 +1082,12 @@ qreal QFontMetrics::fontDpi() const
These are by necessity slow, and we recommend avoiding them if
possible.
- For each character, you can get its width(), leftBearing() and
- rightBearing() and find out whether it is in the font using
+ For each character, you can get its horizontalAdvance(), leftBearing(), and
+ rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
- The string functions include width(), to return the width of a
+ The string functions include horizontalAdvance(), to return the width of a
string in pixels (or points, for a printer), boundingRect(), to
return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
@@ -1434,9 +1437,9 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa rightBearing(), minLeftBearing(), width()
+ \sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::leftBearing(QChar ch) const
{
@@ -1465,11 +1468,11 @@ qreal QFontMetricsF::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
- extend to the right of the width() of the character.
+ extend to the right of the horizontalAdvance() of the character.
- See width() for a graphical description of this metric.
+ See horizontalAdvance() for a graphical description of this metric.
- \sa leftBearing(), minRightBearing(), width()
+ \sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::rightBearing(QChar ch) const
{
@@ -1504,7 +1507,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
\deprecated in Qt 5.11. Use horizontalAdvance() instead.
- \sa boundingRect()
+ \sa boundingRect(), horizontalAdvance()
*/
qreal QFontMetricsF::width(const QString &text) const
{
@@ -1535,7 +1538,7 @@ qreal QFontMetricsF::width(const QString &text) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
- \sa boundingRect()
+ \sa boundingRect(), horizontalAdvance()
*/
qreal QFontMetricsF::width(QChar ch) const
{
@@ -1581,7 +1584,7 @@ qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
ch.
Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
+ central dark rectangles cover the logical horizontalAdvance() of each
character. The outer pale rectangles cover the leftBearing() and
rightBearing() of each character. Notice that the bearings of "f"
in this particular font are both negative, while the bearings of
@@ -1632,7 +1635,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -1643,7 +1646,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
The height of the bounding rectangle is at least as large as the
value returned height().
- \sa width(), height(), QPainter::boundingRect()
+ \sa horizontalAdvance(), height(), QPainter::boundingRect()
*/
QRectF QFontMetricsF::boundingRect(const QString &text) const
{
@@ -1669,7 +1672,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
Note that the rectangle usually extends both above and below the
base line.
- \sa width()
+ \sa horizontalAdvance()
*/
QRectF QFontMetricsF::boundingRect(QChar ch) const
{
@@ -1746,7 +1749,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
- \sa width(), QPainter::boundingRect(), Qt::Alignment
+ \sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& text,
int tabStops, int *tabArray) const
@@ -1805,7 +1808,8 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
- rectangle might be different than what the width() method returns.
+ rectangle might be different than what the horizontalAdvance() method
+ returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@@ -1815,7 +1819,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
\warning Calling this method is very slow on Windows.
- \sa width(), height(), boundingRect()
+ \sa horizontalAdvance(), height(), boundingRect()
*/
QRectF QFontMetricsF::tightBoundingRect(const QString &text) const
{
diff --git a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
index 0c52cde753..31a8d40abe 100644
--- a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
+++ b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc
@@ -28,6 +28,7 @@
/*!
\class QWindowsWindowFunctions
\inmodule QtPlatformHeaders
+ \inheaderfile QtPlatformHeaders/QWindowsWindowFunctions
\since 5.5
\brief The QWindowsWindowFunctions class is an inline class containing
miscellaneous functionality for Windows window specific functionality.
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index fd2644717e..1c7800358f 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -900,7 +900,7 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
uenv.venv = nullptr;
m_javaVM = nullptr;
- if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
+ if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) {
__android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed");
return -1;
}
@@ -922,5 +922,5 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
if (threadSetter.thread())
threadSetter.thread()->setObjectName("QtMainLoopThread");
__android_log_print(ANDROID_LOG_INFO, "Qt", "qt started");
- return JNI_VERSION_1_4;
+ return JNI_VERSION_1_6;
}
diff --git a/src/plugins/platforms/wasm/qwasmclipboard.cpp b/src/plugins/platforms/wasm/qwasmclipboard.cpp
index fb46f1534f..f02c2c6ccb 100644
--- a/src/plugins/platforms/wasm/qwasmclipboard.cpp
+++ b/src/plugins/platforms/wasm/qwasmclipboard.cpp
@@ -29,6 +29,7 @@
#include "qwasmclipboard.h"
#include "qwasmwindow.h"
+#include "qwasmstring.h"
#include <emscripten.h>
#include <emscripten/html5.h>
@@ -40,22 +41,22 @@
using namespace emscripten;
// there has got to be a better way...
-static QByteArray g_clipboardArray;
-static QByteArray g_clipboardFormat;
+static QString g_clipboardText;
+static QString g_clipboardFormat;
static val getClipboardData()
{
- return val(g_clipboardArray.constData());
+ return QWasmString::fromQString(g_clipboardText);
}
static val getClipboardFormat()
{
- return val(g_clipboardFormat.constData());
+ return QWasmString::fromQString(g_clipboardFormat);
}
static void pasteClipboardData(emscripten::val format, emscripten::val dataPtr)
{
- QString formatString = QString::fromStdString(format.as<std::string>());
+ QString formatString = QWasmString::toQString(format);
QByteArray dataArray = QByteArray::fromStdString(dataPtr.as<std::string>());
QMimeData *mMimeData = new QMimeData;
mMimeData->setData(formatString, dataArray);
@@ -102,11 +103,10 @@ static void qClipboardPasteTo(val event)
bool hasClipboardApi = QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi;
val clipdata = hasClipboardApi ?
val::global("Module").call<val>("qtGetClipboardData") :
- event["clipboardData"].call<val>("getData", std::string("text"));
+ event["clipboardData"].call<val>("getData", val("text"));
- const std::string data = clipdata.as<std::string>();
- if (data.length() > 0) {
- QString qstr = QString::fromStdString(data);
+ const QString qstr = QWasmString::toQString(clipdata);
+ if (qstr.length() > 0) {
QMimeData *mMimeData = new QMimeData;
mMimeData->setText(qstr);
QWasmClipboard::qWasmClipboardPaste(mMimeData);
@@ -133,7 +133,7 @@ QWasmClipboard::QWasmClipboard()
QWasmClipboard::~QWasmClipboard()
{
- g_clipboardArray.clear();
+ g_clipboardText.clear();
g_clipboardFormat.clear();
}
@@ -148,11 +148,11 @@ QMimeData* QWasmClipboard::mimeData(QClipboard::Mode mode)
void QWasmClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)
{
if (mimeData->hasText()) {
- g_clipboardFormat = mimeData->formats().at(0).toUtf8();
- g_clipboardArray = mimeData->text().toUtf8();
+ g_clipboardFormat = mimeData->formats().at(0);
+ g_clipboardText = mimeData->text();
} else if (mimeData->hasHtml()) {
- g_clipboardFormat =mimeData->formats().at(0).toUtf8();
- g_clipboardArray = mimeData->html().toUtf8();
+ g_clipboardFormat = mimeData->formats().at(0);
+ g_clipboardText = mimeData->html();
}
QPlatformClipboard::setMimeData(mimeData, mode);
@@ -199,13 +199,13 @@ void QWasmClipboard::installEventHandlers(const QString &canvasId)
// Fallback path for browsers which do not support direct clipboard access
val document = val::global("document");
- val canvas = document.call<val>("getElementById", val(canvasId.toUtf8().constData()));
+ val canvas = document.call<val>("getElementById", QWasmString::fromQString(canvasId));
- canvas.call<void>("addEventListener", std::string("cut"),
+ canvas.call<void>("addEventListener", val("cut"),
val::module_property("qtClipboardCutTo"));
- canvas.call<void>("addEventListener", std::string("copy"),
+ canvas.call<void>("addEventListener", val("copy"),
val::module_property("qtClipboardCopyTo"));
- canvas.call<void>("addEventListener", std::string("paste"),
+ canvas.call<void>("addEventListener", val("paste"),
val::module_property("qtClipboardPasteTo"));
}
@@ -226,6 +226,6 @@ void QWasmClipboard::writeTextToClipboard()
val txt = module.call<val>("qtGetClipboardData");
val format = module.call<val>("qtGetClipboardFormat");
val navigator = val::global("navigator");
- navigator["clipboard"].call<void>("writeText", txt.as<std::string>());
+ navigator["clipboard"].call<void>("writeText", txt);
}
}
diff --git a/src/plugins/platforms/wasm/qwasmcursor.cpp b/src/plugins/platforms/wasm/qwasmcursor.cpp
index c04fa6441a..616456b2fa 100644
--- a/src/plugins/platforms/wasm/qwasmcursor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcursor.cpp
@@ -29,6 +29,7 @@
#include "qwasmcursor.h"
#include "qwasmscreen.h"
+#include "qwasmstring.h"
#include <QtCore/qdebug.h>
#include <QtGui/qwindow.h>
@@ -56,11 +57,11 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
htmlCursorName = "auto";
// Set cursor on the canvas
- QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8();
+ val jsCanvasId = QWasmString::fromQString(QWasmScreen::get(screen)->canvasId());
val document = val::global("document");
- val canvas = document.call<val>("getElementById", val(canvasId.constData()));
+ val canvas = document.call<val>("getElementById", jsCanvasId);
val canvasStyle = canvas["style"];
- canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData()));
+ canvasStyle.set("cursor", val(htmlCursorName.constData()));
}
QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index 8b7d00082f..1ccac87afa 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -32,6 +32,7 @@
#include "qwasmcompositor.h"
#include "qwasmintegration.h"
#include "qwasmclipboard.h"
+#include "qwasmstring.h"
#include <QtGui/qevent.h>
#include <qpa/qwindowsysteminterface.h>
@@ -355,9 +356,10 @@ void QWasmEventTranslator::initEventHandlers()
if (emscripten::val::global("window")["safari"].isUndefined()) {
val document = val::global("document");
- val canvas = document.call<val>("getElementById", val(canvasId));
+ val jsCanvasId = QWasmString::fromQString(screen()->canvasId());
+ val canvas = document.call<val>("getElementById", jsCanvasId);
canvas.call<void>("addEventListener",
- std::string("wheel"),
+ val("wheel"),
val::module_property("qtMouseWheelEvent"));
}
}
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 1e9f68027c..fd53cd0bae 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -36,6 +36,7 @@
#include "qwasmclipboard.h"
#include "qwasmservices.h"
#include "qwasmoffscreensurface.h"
+#include "qwasmstring.h"
#include "qwasmwindow.h"
#ifndef QT_NO_OPENGL
@@ -67,19 +68,19 @@ static void browserBeforeUnload(emscripten::val)
static void addCanvasElement(emscripten::val canvas)
{
- QString canvasId = QString::fromStdString(canvas["id"].as<std::string>());
+ QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->addScreen(canvasId);
}
static void removeCanvasElement(emscripten::val canvas)
{
- QString canvasId = QString::fromStdString(canvas["id"].as<std::string>());
+ QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->removeScreen(canvasId);
}
static void resizeCanvasElement(emscripten::val canvas)
{
- QString canvasId = QString::fromStdString(canvas["id"].as<std::string>());
+ QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->resizeScreen(canvasId);
}
@@ -115,11 +116,11 @@ QWasmIntegration::QWasmIntegration()
int screenCount = qtCanvaseElements["length"].as<int>();
for (int i = 0; i < screenCount; ++i) {
emscripten::val canvas = qtCanvaseElements[i].as<emscripten::val>();
- QString canvasId = QString::fromStdString(canvas["id"].as<std::string>());
+ QString canvasId = QWasmString::toQString(canvas["id"]);
addScreen(canvasId);
}
} else if (!canvas.isUndefined()){
- QString canvasId = QString::fromStdString(canvas["id"].as<std::string>());
+ QString canvasId = QWasmString::toQString(canvas["id"]);
addScreen(canvasId);
}
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index fe44fdb096..d407111c2f 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -32,6 +32,8 @@
#include "qwasmeventtranslator.h"
#include "qwasmcompositor.h"
#include "qwasmintegration.h"
+#include "qwasmstring.h"
+
#include <emscripten/bind.h>
#include <emscripten/val.h>
@@ -184,7 +186,7 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
QSizeF canvasSize = cssSize * devicePixelRatio();
val document = val::global("document");
- val canvas = document.call<val>("getElementById", val(canvasId.constData()));
+ val canvas = document.call<val>("getElementById", QWasmString::fromQString(m_canvasId));
canvas.set("width", canvasSize.width());
canvas.set("height", canvasSize.height());
diff --git a/src/plugins/platforms/wasm/qwasmservices.cpp b/src/plugins/platforms/wasm/qwasmservices.cpp
index 9328b8c065..4eee3fe972 100644
--- a/src/plugins/platforms/wasm/qwasmservices.cpp
+++ b/src/plugins/platforms/wasm/qwasmservices.cpp
@@ -28,6 +28,8 @@
****************************************************************************/
#include "qwasmservices.h"
+#include "qwasmstring.h"
+
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -37,8 +39,8 @@ QT_BEGIN_NAMESPACE
bool QWasmServices::openUrl(const QUrl &url)
{
- QByteArray utf8Url = url.toString().toUtf8();
- emscripten::val::global("window").call<void>("open", emscripten::val(utf8Url.constData()), emscripten::val("_blank"));
+ emscripten::val jsUrl = QWasmString::fromQString(url.toString());
+ emscripten::val::global("window").call<void>("open", jsUrl, emscripten::val("_blank"));
return true;
}
diff --git a/src/plugins/platforms/wasm/qwasmstring.cpp b/src/plugins/platforms/wasm/qwasmstring.cpp
new file mode 100644
index 0000000000..05b571c459
--- /dev/null
+++ b/src/plugins/platforms/wasm/qwasmstring.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwasmstring.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace emscripten;
+
+val QWasmString::fromQString(const QString &str)
+{
+ static const val UTF16ToString(
+ val::global("Module")["UTF16ToString"]);
+
+ auto ptr = quintptr(str.utf16());
+ return UTF16ToString(val(ptr));
+}
+
+QString QWasmString::toQString(const val &v)
+{
+ QString result;
+ if (!v.isString())
+ return result;
+
+ static const val stringToUTF16(
+ val::global("Module")["stringToUTF16"]);
+ static const val length("length");
+
+ result.resize(v[length].as<int>());
+ auto ptr = quintptr(result.utf16());
+ stringToUTF16(v, val(ptr));
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmstring.h b/src/plugins/platforms/wasm/qwasmstring.h
new file mode 100644
index 0000000000..de5da92830
--- /dev/null
+++ b/src/plugins/platforms/wasm/qwasmstring.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#pragma once
+
+#include <qstring.h>
+
+#include <emscripten/val.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWasmString
+{
+public:
+ static emscripten::val fromQString(const QString &str);
+ static QString toQString(const emscripten::val &v);
+};
+QT_END_NAMESPACE
+
diff --git a/src/plugins/platforms/wasm/wasm.pro b/src/plugins/platforms/wasm/wasm.pro
index f8c8175525..a12ae06833 100644
--- a/src/plugins/platforms/wasm/wasm.pro
+++ b/src/plugins/platforms/wasm/wasm.pro
@@ -23,7 +23,8 @@ SOURCES = \
qwasmtheme.cpp \
qwasmclipboard.cpp \
qwasmservices.cpp \
- qwasmoffscreensurface.cpp
+ qwasmoffscreensurface.cpp \
+ qwasmstring.cpp
HEADERS = \
qwasmintegration.h \
@@ -39,7 +40,8 @@ HEADERS = \
qwasmtheme.h \
qwasmclipboard.h \
qwasmservices.h \
- qwasmoffscreensurface.h
+ qwasmoffscreensurface.h \
+ qwasmstring.h
wasmfonts.files = \
../../../3rdparty/wasm/Vera.ttf \
diff --git a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
index bba0487452..a45b5f409a 100644
--- a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
+++ b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
@@ -249,16 +249,15 @@ void QSqlQueryModel_snippets()
}
//! [21]
- QSqlTableModel model;
- model.setTable("employee");
- model.select();
+ QSqlQueryModel model;
+ model.setQuery("SELECT name, salary FROM employee");
int salary = model.record(4).value("salary").toInt();
//! [21]
Q_UNUSED(salary);
{
//! [22]
- int salary = model.data(model.index(4, 2)).toInt();
+ int salary = model.data(model.index(4, 1)).toInt();
//! [22]
Q_UNUSED(salary);
}
@@ -308,7 +307,8 @@ void QSqlTableModel_snippets()
//! [25]
QSqlTableModel model;
model.setTable("employee");
- QString name = model.record(4).value("name").toString();
+ model.select();
+ int salary = model.record(4).value("salary").toInt();
//! [25]
}
}
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index c0b1061c6b..31d0ec985d 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -124,8 +124,8 @@ int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const
\snippet sqldatabase/sqldatabase.cpp 21
The code snippet above extracts the \c salary field from record 4 in
- the result set of the query \c{SELECT * from employee}. Assuming
- that \c salary is column 2, we can rewrite the last line as follows:
+ the result set of the \c SELECT query. Since \c salary is the 2nd
+ column (or column index 1), we can rewrite the last line as follows:
\snippet sqldatabase/sqldatabase.cpp 22
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 4bc9a8c2f8..969194983e 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -222,7 +222,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
QSqlTableModel can also be used to access a database
programmatically, without binding it to a view:
- \snippet sqldatabase/sqldatabase.cpp 21
+ \snippet sqldatabase/sqldatabase.cpp 25
The code snippet above extracts the \c salary field from record 4 in
the result set of the query \c{SELECT * from employee}.
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index e20657a0f6..e1cc475a93 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -756,6 +756,12 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
*/
/*!
+ \enum QMessageBox::ButtonRole
+
+ \include qdialogbuttonbox.cpp buttonrole-enum
+*/
+
+/*!
\enum QMessageBox::StandardButton
\since 4.2
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index c8f374a1b1..efe30308f0 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -2526,6 +2526,18 @@
See also \l{#height-prop}{height}.
+ \row
+ \li \b -qt-background-role
+ \li \l{#paletterole}{PaletteRole}
+ \li The \c{background-color} for the subcontrol or widget based on the
+ chosen role.
+
+ \row
+ \li \b -qt-style-features
+ \li \c list
+ \li The list of CSS properties that you want to apply Qt-specific styles on.
+
+ \note The \c list can only include properties that are not pixmap-based.
\endtable
\target list of icons
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index b1dbafa997..9134abe270 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -923,8 +923,8 @@ QTableWidgetSelectionRange::QTableWidgetSelectionRange(int top, int left, int bo
Constructs a the table selection range by copying the given \a
other table selection range.
*/
-QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other) = default;
-QTableWidgetSelectionRange &QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange &other) = default;
+QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &) = default;
+QTableWidgetSelectionRange &QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange &) = default;
/*!
Destroys the table selection range.
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index ef76265f8b..ce32fd39a8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2139,7 +2139,8 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
&& !(!next && focusProxy && test->isAncestorOf(focusProxy))
&& test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
- && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
+ && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))
+ && f != focusProxy) {
w = test;
if (seenWindow)
focusWidgetAfterWindow = true;
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 28f6cdc7bd..7dba6df15c 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -522,8 +522,8 @@ QDialogButtonBox::~QDialogButtonBox()
/*!
\enum QDialogButtonBox::ButtonRole
- \enum QMessageBox::ButtonRole
+//! [buttonrole-enum]
This enum describes the roles that can be used to describe buttons in
the button box. Combinations of these roles are as flags used to
describe different aspects of their behavior.
@@ -546,6 +546,7 @@ QDialogButtonBox::~QDialogButtonBox()
\omitvalue NRoles
\sa StandardButton
+//! [buttonrole-enum]
*/
/*!
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 68aa545082..c36ec98f9a 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -490,14 +490,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
if (focusRect.width() > visibleRect.width())
d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2);
else if (focusRect.right() > visibleRect.right())
- d->hbar->setValue(focusRect.right() - d->viewport->width());
+ d->hbar->setValue(focusRect.right() - d->viewport->width() + 1);
else if (focusRect.left() < visibleRect.left())
d->hbar->setValue(focusRect.left());
if (focusRect.height() > visibleRect.height())
d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2);
else if (focusRect.bottom() > visibleRect.bottom())
- d->vbar->setValue(focusRect.bottom() - d->viewport->height());
+ d->vbar->setValue(focusRect.bottom() - d->viewport->height() + 1);
else if (focusRect.top() < visibleRect.top())
d->vbar->setValue(focusRect.top());
}
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 61ea81c892..ae4394dc97 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -1168,11 +1168,11 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else {
num = locale.toInt(copy, &ok);
if (!ok && (max >= 1000 || min <= -1000)) {
- const QChar sep = locale.groupSeparator();
- const QChar doubleSep[2] = {sep, sep};
- if (copy.contains(sep) && !copy.contains(QString(doubleSep, 2))) {
+ const QString sep(locale.groupSeparator());
+ const QString doubleSep = sep + sep;
+ if (copy.contains(sep) && !copy.contains(doubleSep)) {
QString copy2 = copy;
- copy2.remove(locale.groupSeparator());
+ copy2.remove(sep);
num = locale.toInt(copy2, &ok);
}
}
@@ -1314,6 +1314,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
const bool plus = max >= 0;
const bool minus = min <= 0;
+ const QString group(locale.groupSeparator());
+ const uint groupUcs = (group.size() > 1 && group.at(0).isHighSurrogate()
+ ? QChar::surrogateToUcs4(group.at(0), group.at(1))
+ : group.at(0).unicode());
switch (len) {
case 0:
state = max != min ? QValidator::Intermediate : QValidator::Invalid;
@@ -1360,14 +1364,15 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
}
}
} else {
- const QChar last = copy.at(len - 1);
- const QChar secondLast = copy.at(len - 2);
- if ((last == locale.groupSeparator() || last.isSpace())
- && (secondLast == locale.groupSeparator() || secondLast.isSpace())) {
+ const QChar last = copy.back();
+ const bool groupEnd = copy.endsWith(group);
+ const QStringView head(copy.constData(), groupEnd ? len - group.size() : len - 1);
+ const QChar secondLast = head.back();
+ if ((groupEnd || last.isSpace()) && (head.endsWith(group) || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
- } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) {
+ } else if (last.isSpace() && (!QChar::isSpace(groupUcs) || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
@@ -1381,26 +1386,31 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
if (!ok) {
- if (locale.groupSeparator().isPrint()) {
- if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) {
+ if (QChar::isPrint(groupUcs)) {
+ if (max < 1000 && min > -1000 && copy.contains(group)) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
}
const int len = copy.size();
- for (int i=0; i<len- 1; ++i) {
- if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) {
- QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
- state = QValidator::Invalid;
- goto end;
+ for (int i = 0; i < len - 1;) {
+ if (QStringView(copy).mid(i).startsWith(group)) {
+ if (QStringView(copy).mid(i + group.size()).startsWith(group)) {
+ QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
+ state = QValidator::Invalid;
+ goto end;
+ }
+ i += group.size();
+ } else {
+ i++;
}
}
QString copy2 = copy;
- copy2.remove(locale.groupSeparator());
+ copy2.remove(group);
num = locale.toDouble(copy2, &ok);
- QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok;
+ QSBDEBUG() << group << num << copy2 << ok;
if (!ok) {
state = QValidator::Invalid;