QtGui: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
2e29f55f76
commit
a5b9600356
@ -855,7 +855,7 @@ QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) c
|
||||
if (dbusPath == QLatin1String(QSPI_OBJECT_PATH_ROOT))
|
||||
return QAccessible::queryAccessibleInterface(qApp);
|
||||
|
||||
QStringList parts = dbusPath.split(QLatin1Char('/'));
|
||||
QStringList parts = dbusPath.split(u'/');
|
||||
if (parts.size() != 6) {
|
||||
qCDebug(lcAccessibilityAtspi) << "invalid path: " << dbusPath;
|
||||
return nullptr;
|
||||
@ -1736,7 +1736,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin
|
||||
keyBindings.append(acc);
|
||||
}
|
||||
if (keyBindings.length() > 0)
|
||||
sendReply(connection, message, keyBindings.join(QLatin1Char(';')));
|
||||
sendReply(connection, message, keyBindings.join(u';'));
|
||||
else
|
||||
sendReply(connection, message, QString());
|
||||
} else {
|
||||
@ -2057,10 +2057,10 @@ QVariantList AtSpiAdaptor::getAttributes(QAccessibleInterface *interface, int of
|
||||
int endOffset;
|
||||
|
||||
QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
|
||||
const QStringList attributes = joined.split (QLatin1Char(';'), Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
const QStringList attributes = joined.split(u';', Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
for (const QString &attr : attributes) {
|
||||
QStringList items;
|
||||
items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
|
||||
if (!attribute.isNull())
|
||||
set[attribute.name] = attribute.value;
|
||||
@ -2081,10 +2081,10 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in
|
||||
int endOffset;
|
||||
|
||||
joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
|
||||
const QStringList attributes = joined.split (QLatin1Char(';'), Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
const QStringList attributes = joined.split (u';', Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
for (const QString& attr : attributes) {
|
||||
QStringList items;
|
||||
items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
items = attr.split(u':', Qt::SkipEmptyParts, Qt::CaseSensitive);
|
||||
AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
|
||||
if (!attribute.isNull())
|
||||
map[attribute.name] = attribute.value;
|
||||
|
@ -1850,7 +1850,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
|
||||
stateStrings << QLatin1String("invisible");
|
||||
|
||||
if (!stateStrings.isEmpty())
|
||||
d << stateStrings.join(QLatin1Char('|'));
|
||||
d << stateStrings.join(u'|');
|
||||
|
||||
if (!st.invisible)
|
||||
d << "rect=" << iface->rect();
|
||||
|
@ -73,7 +73,7 @@ QPixmap QAbstractFileIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
|
||||
if (key.isEmpty())
|
||||
return filePixmap(size, mode, state);
|
||||
|
||||
key += QLatin1Char('_') + QString::number(size.width());
|
||||
key += u'_' + QString::number(size.width());
|
||||
|
||||
QPixmap result;
|
||||
if (!QPixmapCache::find(key, &result)) {
|
||||
|
@ -450,7 +450,7 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
const QString abs = fileName.startsWith(QLatin1Char(':')) ? fileName : QFileInfo(fileName).absoluteFilePath();
|
||||
const QString abs = fileName.startsWith(u':') ? fileName : QFileInfo(fileName).absoluteFilePath();
|
||||
const bool ignoreSize = !size.isValid();
|
||||
ImageReader imageReader(abs);
|
||||
const QByteArray format = imageReader.format();
|
||||
@ -1557,11 +1557,11 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
|
||||
if (disableNxImageLoading)
|
||||
return baseFileName;
|
||||
|
||||
int dotIndex = baseFileName.lastIndexOf(QLatin1Char('.'));
|
||||
int dotIndex = baseFileName.lastIndexOf(u'.');
|
||||
if (dotIndex == -1) { /* no dot */
|
||||
dotIndex = baseFileName.size(); /* append */
|
||||
} else if (dotIndex >= 2 && baseFileName[dotIndex - 1] == QLatin1Char('9')
|
||||
&& baseFileName[dotIndex - 2] == QLatin1Char('.')) {
|
||||
} else if (dotIndex >= 2 && baseFileName[dotIndex - 1] == u'9'
|
||||
&& baseFileName[dotIndex - 2] == u'.') {
|
||||
// If the file has a .9.* (9-patch image) extension, we must ensure that the @nx goes before it.
|
||||
dotIndex -= 2;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
|
||||
quint32 dirListLen = read32(dirListOffset);
|
||||
for (uint i = 0; i < dirListLen; ++i) {
|
||||
quint32 offset = read32(dirListOffset + 4 + 4 * i);
|
||||
if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dirName + QLatin1Char('/')
|
||||
if (!m_isValid || offset >= m_size || lastModified < QFileInfo(dirName + u'/'
|
||||
+ QString::fromUtf8(reinterpret_cast<const char*>(m_data + offset))).lastModified()) {
|
||||
m_isValid = false;
|
||||
return;
|
||||
@ -348,7 +348,7 @@ QIconTheme::QIconTheme(const QString &themeName)
|
||||
const QStringList iconDirs = QIcon::themeSearchPaths();
|
||||
for ( int i = 0 ; i < iconDirs.size() ; ++i) {
|
||||
QDir iconDir(iconDirs[i]);
|
||||
QString themeDir = iconDir.path() + QLatin1Char('/') + themeName;
|
||||
QString themeDir = iconDir.path() + u'/' + themeName;
|
||||
QFileInfo themeDirInfo(themeDir);
|
||||
|
||||
if (themeDirInfo.isDir()) {
|
||||
@ -475,10 +475,10 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
|
||||
}
|
||||
}
|
||||
|
||||
QString contentDir = contentDirs.at(i) + QLatin1Char('/');
|
||||
QString contentDir = contentDirs.at(i) + u'/';
|
||||
for (int j = 0; j < subDirs.size() ; ++j) {
|
||||
const QIconDirInfo &dirInfo = subDirs.at(j);
|
||||
const QString subDir = contentDir + dirInfo.path + QLatin1Char('/');
|
||||
const QString subDir = contentDir + dirInfo.path + u'/';
|
||||
const QString pngPath = subDir + pngIconName;
|
||||
if (QFile::exists(pngPath)) {
|
||||
auto iconEntry = std::make_unique<PixmapEntry>();
|
||||
@ -505,7 +505,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
|
||||
}
|
||||
|
||||
// If it's possible - find next fallback for the icon
|
||||
const int indexOfDash = iconNameFallback.lastIndexOf(QLatin1Char('-'));
|
||||
const int indexOfDash = iconNameFallback.lastIndexOf(u'-');
|
||||
if (indexOfDash == -1)
|
||||
break;
|
||||
|
||||
|
@ -5704,8 +5704,8 @@ QMap<QString, QString> qt_getImageTextFromDescription(const QString &description
|
||||
QMap<QString, QString> text;
|
||||
const auto pairs = QStringView{description}.split(u"\n\n");
|
||||
for (const auto &pair : pairs) {
|
||||
int index = pair.indexOf(QLatin1Char(':'));
|
||||
if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
|
||||
int index = pair.indexOf(u':');
|
||||
if (index >= 0 && pair.indexOf(u' ') < index) {
|
||||
if (!pair.trimmed().isEmpty())
|
||||
text.insert(QLatin1String("Description"), pair.toString().simplified());
|
||||
} else {
|
||||
|
@ -564,7 +564,7 @@ bool QImageReaderPrivate::initHandler()
|
||||
QString fileName = file->fileName();
|
||||
|
||||
do {
|
||||
file->setFileName(fileName + QLatin1Char('.')
|
||||
file->setFileName(fileName + u'.'
|
||||
+ QLatin1String(extensions.at(currentExtension++).constData()));
|
||||
file->open(QIODevice::ReadOnly);
|
||||
} while (!file->isOpen() && currentExtension < extensions.size());
|
||||
|
@ -769,7 +769,7 @@ static QString fbname(const QString &fileName) // get file basename (sort of)
|
||||
{
|
||||
QString s = fileName;
|
||||
if (!s.isEmpty()) {
|
||||
int i = qMax(s.lastIndexOf(QLatin1Char('/')), s.lastIndexOf(QLatin1Char('\\')));
|
||||
int i = qMax(s.lastIndexOf(u'/'), s.lastIndexOf(u'\\'));
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
auto isAsciiLetterOrNumber = [](QChar ch) -> bool {
|
||||
|
@ -68,9 +68,9 @@ static QString translateDriveName(const QFileInfo &drive)
|
||||
{
|
||||
QString driveName = drive.absoluteFilePath();
|
||||
#ifdef Q_OS_WIN
|
||||
if (driveName.startsWith(QLatin1Char('/'))) // UNC host
|
||||
if (driveName.startsWith(u'/')) // UNC host
|
||||
return drive.fileName();
|
||||
if (driveName.endsWith(QLatin1Char('/')))
|
||||
if (driveName.endsWith(u'/'))
|
||||
driveName.chop(1);
|
||||
#endif // Q_OS_WIN
|
||||
return driveName;
|
||||
@ -176,7 +176,7 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr
|
||||
*/
|
||||
void QFileInfoGatherer::updateFile(const QString &filePath)
|
||||
{
|
||||
QString dir = filePath.mid(0, filePath.lastIndexOf(QLatin1Char('/')));
|
||||
QString dir = filePath.mid(0, filePath.lastIndexOf(u'/'));
|
||||
QString fileName = filePath.mid(dir.length() + 1);
|
||||
fetchExtendedInformation(dir, QStringList(fileName));
|
||||
}
|
||||
|
@ -316,13 +316,13 @@ static QString qt_GetLongPathName(const QString &strShortPath)
|
||||
if (strShortPath.isEmpty()
|
||||
|| strShortPath == QLatin1String(".") || strShortPath == QLatin1String(".."))
|
||||
return strShortPath;
|
||||
if (strShortPath.length() == 2 && strShortPath.endsWith(QLatin1Char(':')))
|
||||
if (strShortPath.length() == 2 && strShortPath.endsWith(u':'))
|
||||
return strShortPath.toUpper();
|
||||
const QString absPath = QDir(strShortPath).absolutePath();
|
||||
if (absPath.startsWith(QLatin1String("//"))
|
||||
|| absPath.startsWith(QLatin1String("\\\\"))) // unc
|
||||
return QDir::fromNativeSeparators(absPath);
|
||||
if (absPath.startsWith(QLatin1Char('/')))
|
||||
if (absPath.startsWith(u'/'))
|
||||
return QString();
|
||||
const QString inputString = QLatin1String("\\\\?\\") + QDir::toNativeSeparators(absPath);
|
||||
QVarLengthArray<TCHAR, MAX_PATH> buffer(MAX_PATH);
|
||||
@ -354,7 +354,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
{
|
||||
Q_Q(const QFileSystemModel);
|
||||
Q_UNUSED(q);
|
||||
if (path.isEmpty() || path == myComputer() || path.startsWith(QLatin1Char(':')))
|
||||
if (path.isEmpty() || path == myComputer() || path.startsWith(u':'))
|
||||
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
|
||||
// Construct the nodes up to the new root path if they need to be built
|
||||
@ -370,7 +370,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
absolutePath = QDir(longPath).absolutePath();
|
||||
|
||||
// ### TODO can we use bool QAbstractFileEngine::caseSensitive() const?
|
||||
QStringList pathElements = absolutePath.split(QLatin1Char('/'), Qt::SkipEmptyParts);
|
||||
QStringList pathElements = absolutePath.split(u'/', Qt::SkipEmptyParts);
|
||||
if ((pathElements.isEmpty())
|
||||
#if !defined(Q_OS_WIN)
|
||||
&& QDir::fromNativeSeparators(longPath) != QLatin1String("/")
|
||||
@ -379,16 +379,16 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
QModelIndex index = QModelIndex(); // start with "My Computer"
|
||||
QString elementPath;
|
||||
QChar separator = QLatin1Char('/');
|
||||
QChar separator = u'/';
|
||||
QString trailingSeparator;
|
||||
#if defined(Q_OS_WIN)
|
||||
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
|
||||
QString host = QLatin1String("\\\\") + pathElements.constFirst();
|
||||
if (absolutePath == QDir::fromNativeSeparators(host))
|
||||
absolutePath.append(QLatin1Char('/'));
|
||||
if (longPath.endsWith(QLatin1Char('/')) && !absolutePath.endsWith(QLatin1Char('/')))
|
||||
absolutePath.append(QLatin1Char('/'));
|
||||
if (absolutePath.endsWith(QLatin1Char('/')))
|
||||
absolutePath.append(u'/');
|
||||
if (longPath.endsWith(u'/') && !absolutePath.endsWith(u'/'))
|
||||
absolutePath.append(u'/');
|
||||
if (absolutePath.endsWith(u'/'))
|
||||
trailingSeparator = QLatin1String("\\");
|
||||
int r = 0;
|
||||
auto rootNode = const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
@ -396,7 +396,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
if (it != root.children.cend()) {
|
||||
host = it.key(); // Normalize case for lookup in visibleLocation()
|
||||
} else {
|
||||
if (pathElements.count() == 1 && !absolutePath.endsWith(QLatin1Char('/')))
|
||||
if (pathElements.count() == 1 && !absolutePath.endsWith(u'/'))
|
||||
return rootNode;
|
||||
QFileInfo info(host);
|
||||
if (!info.exists())
|
||||
@ -409,20 +409,20 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
r = translateVisibleLocation(rootNode, r);
|
||||
index = q->index(r, 0, QModelIndex());
|
||||
pathElements.pop_front();
|
||||
separator = QLatin1Char('\\');
|
||||
separator = u'\\';
|
||||
elementPath = host;
|
||||
elementPath.append(separator);
|
||||
} else {
|
||||
if (!pathElements.at(0).contains(QLatin1Char(':'))) {
|
||||
if (!pathElements.at(0).contains(u':')) {
|
||||
QString rootPath = QDir(longPath).rootPath();
|
||||
pathElements.prepend(rootPath);
|
||||
}
|
||||
if (pathElements.at(0).endsWith(QLatin1Char('/')))
|
||||
if (pathElements.at(0).endsWith(u'/'))
|
||||
pathElements[0].chop(1);
|
||||
}
|
||||
#else
|
||||
// add the "/" item, since it is a valid path element on Unix
|
||||
if (absolutePath[0] == QLatin1Char('/'))
|
||||
if (absolutePath[0] == u'/')
|
||||
pathElements.prepend(QLatin1String("/"));
|
||||
#endif
|
||||
|
||||
@ -443,7 +443,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
||||
// If after stripping the characters there is nothing left then we
|
||||
// just return the parent directory as it is assumed that the path
|
||||
// is referring to the parent
|
||||
while (element.endsWith(QLatin1Char('.')) || element.endsWith(QLatin1Char(' ')))
|
||||
while (element.endsWith(u'.') || element.endsWith(u' '))
|
||||
element.chop(1);
|
||||
// Only filenames that can't possibly exist will be end up being empty
|
||||
if (element.isEmpty())
|
||||
@ -1414,11 +1414,11 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const
|
||||
}
|
||||
QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator()));
|
||||
#if !defined(Q_OS_WIN)
|
||||
if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/'))
|
||||
if ((fullPath.length() > 2) && fullPath[0] == u'/' && fullPath[1] == u'/')
|
||||
fullPath = fullPath.mid(1);
|
||||
#else
|
||||
if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':')))
|
||||
fullPath.append(QLatin1Char('/'));
|
||||
if (fullPath.length() == 2 && fullPath.endsWith(u':'))
|
||||
fullPath.append(u'/');
|
||||
#endif
|
||||
return fullPath;
|
||||
}
|
||||
@ -2051,7 +2051,7 @@ QStringList QFileSystemModelPrivate::unwatchPathsAt(const QModelIndex &index)
|
||||
if (pathSize == watchedPath.size()) {
|
||||
return path.compare(watchedPath, caseSensitivity) == 0;
|
||||
} else if (watchedPath.size() > pathSize) {
|
||||
return watchedPath.at(pathSize) == QLatin1Char('/')
|
||||
return watchedPath.at(pathSize) == u'/'
|
||||
&& watchedPath.startsWith(path, caseSensitivity);
|
||||
}
|
||||
return false;
|
||||
|
@ -182,10 +182,10 @@ public:
|
||||
for (QFileSystemNode *child : qAsConst(children)) {
|
||||
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
||||
if (!path.isEmpty()) {
|
||||
if (path.endsWith(QLatin1Char('/')))
|
||||
if (path.endsWith(u'/'))
|
||||
child->updateIcon(iconProvider, path + child->fileName);
|
||||
else
|
||||
child->updateIcon(iconProvider, path + QLatin1Char('/') + child->fileName);
|
||||
child->updateIcon(iconProvider, path + u'/' + child->fileName);
|
||||
} else
|
||||
child->updateIcon(iconProvider, child->fileName);
|
||||
}
|
||||
@ -197,10 +197,10 @@ public:
|
||||
for (QFileSystemNode *child : qAsConst(children)) {
|
||||
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
||||
if (!path.isEmpty()) {
|
||||
if (path.endsWith(QLatin1Char('/')))
|
||||
if (path.endsWith(u'/'))
|
||||
child->retranslateStrings(iconProvider, path + child->fileName);
|
||||
else
|
||||
child->retranslateStrings(iconProvider, path + QLatin1Char('/') + child->fileName);
|
||||
child->retranslateStrings(iconProvider, path + u'/' + child->fileName);
|
||||
} else
|
||||
child->retranslateStrings(iconProvider, child->fileName);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ static QString qt_strippedText(QString s)
|
||||
{
|
||||
s.remove(QLatin1String("..."));
|
||||
for (int i = 0; i < s.size(); ++i) {
|
||||
if (s.at(i) == QLatin1Char('&'))
|
||||
if (s.at(i) == u'&')
|
||||
s.remove(i, 1);
|
||||
}
|
||||
return s.trimmed();
|
||||
@ -654,7 +654,7 @@ QString QAction::text() const
|
||||
QString s = d->text;
|
||||
if (s.isEmpty()) {
|
||||
s = d->iconText;
|
||||
s.replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
s.replace(u'&', QLatin1String("&&"));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -1205,12 +1205,12 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
||||
<< "platformPluginPath" << platformPluginPath
|
||||
<< "platformThemeName" << platformThemeName;
|
||||
|
||||
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), Qt::SkipEmptyParts);
|
||||
QStringList plugins = pluginNamesWithArguments.split(u';', Qt::SkipEmptyParts);
|
||||
QStringList platformArguments;
|
||||
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
|
||||
for (const auto &pluginArgument : plugins) {
|
||||
// Split into platform name and arguments
|
||||
QStringList arguments = pluginArgument.split(QLatin1Char(':'), Qt::SkipEmptyParts);
|
||||
QStringList arguments = pluginArgument.split(u':', Qt::SkipEmptyParts);
|
||||
if (arguments.isEmpty())
|
||||
continue;
|
||||
const QString name = arguments.takeFirst().toLower();
|
||||
@ -1314,7 +1314,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
||||
if (!platformArguments.isEmpty()) {
|
||||
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
|
||||
for (const QString &argument : qAsConst(platformArguments)) {
|
||||
const int equalsPos = argument.indexOf(QLatin1Char('='));
|
||||
const int equalsPos = argument.indexOf(u'=');
|
||||
const QByteArray name =
|
||||
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
|
||||
const QVariant value =
|
||||
@ -1591,7 +1591,7 @@ void QGuiApplicationPrivate::init()
|
||||
QString qbundlePath = QCFString(CFURLCopyFileSystemPath(bundleURL,
|
||||
kCFURLPOSIXPathStyle));
|
||||
if (qbundlePath.endsWith(QLatin1String(".app")))
|
||||
QDir::setCurrent(qbundlePath.section(QLatin1Char('/'), 0, -2));
|
||||
QDir::setCurrent(qbundlePath.section(u'/', 0, -2));
|
||||
}
|
||||
#endif
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
@ -1599,7 +1599,7 @@ void QGuiApplicationPrivate::init()
|
||||
++i;
|
||||
if (argv[i] && *argv[i]) {
|
||||
session_id = QString::fromLatin1(argv[i]);
|
||||
int p = session_id.indexOf(QLatin1Char('_'));
|
||||
int p = session_id.indexOf(u'_');
|
||||
if (p >= 0) {
|
||||
session_key = session_id.mid(p +1);
|
||||
session_id = session_id.left(p);
|
||||
|
@ -714,7 +714,7 @@ QVector<QHighDpiScaling::ScreenFactor> QHighDpiScaling::parseScreenScaleFactorsS
|
||||
// - a semicolon-separated name=factor list: "foo=1.5;bar=2;baz=3"
|
||||
const auto specs = screenScaleFactors.split(u';');
|
||||
for (const auto &spec : specs) {
|
||||
const int equalsPos = spec.lastIndexOf(QLatin1Char('='));
|
||||
const int equalsPos = spec.lastIndexOf(u'=');
|
||||
if (equalsPos == -1) {
|
||||
// screens in order
|
||||
bool ok;
|
||||
|
@ -225,7 +225,7 @@ QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QM
|
||||
QImage image = qvariant_cast<QImage>(data->imageData());
|
||||
QBuffer buf(&ba);
|
||||
buf.open(QBuffer::WriteOnly);
|
||||
image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
|
||||
image.save(&buf, mimeType.mid(mimeType.indexOf(u'/') + 1).toLatin1().toUpper());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -970,10 +970,10 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
|
||||
bool found = false;
|
||||
int p = 0;
|
||||
while (p >= 0) {
|
||||
p = text.indexOf(QLatin1Char('&'), p) + 1;
|
||||
p = text.indexOf(u'&', p) + 1;
|
||||
if (p <= 0 || p >= (int)text.length())
|
||||
break;
|
||||
if (text.at(p) != QLatin1Char('&')) {
|
||||
if (text.at(p) != u'&') {
|
||||
QChar c = text.at(p);
|
||||
if (c.isPrint()) {
|
||||
if (!found) {
|
||||
@ -1029,14 +1029,14 @@ int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format)
|
||||
// We MUST use something to separate each sequence, and space
|
||||
// does not cut it, since some of the key names have space
|
||||
// in them.. (Let's hope no one translate with a comma in it:)
|
||||
p = keyseq.indexOf(QLatin1Char(','));
|
||||
p = keyseq.indexOf(u',');
|
||||
if (-1 != p) {
|
||||
if (p == keyseq.length() - 1) { // Last comma 'Ctrl+,'
|
||||
p = -1;
|
||||
} else {
|
||||
if (QLatin1Char(',') == keyseq.at(p+1)) // e.g. 'Ctrl+,, Shift+,,'
|
||||
if (u',' == keyseq.at(p+1)) // e.g. 'Ctrl+,, Shift+,,'
|
||||
p++;
|
||||
if (QLatin1Char(' ') == keyseq.at(p+1)) { // Space after comma
|
||||
if (u' ' == keyseq.at(p+1)) { // Space after comma
|
||||
diff = 1;
|
||||
p++;
|
||||
} else {
|
||||
@ -1117,11 +1117,11 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
|
||||
QList<QModifKeyName> modifs;
|
||||
if (nativeText) {
|
||||
modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+')))
|
||||
<< QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+')))
|
||||
<< QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+')))
|
||||
<< QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+')))
|
||||
<< QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(QLatin1Char('+')));
|
||||
modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(u'+'))
|
||||
<< QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(u'+'))
|
||||
<< QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(u'+'))
|
||||
<< QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(u'+'))
|
||||
<< QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(u'+'));
|
||||
}
|
||||
modifs += *gmodifs; // Test non-translated ones last
|
||||
|
||||
@ -1141,7 +1141,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
|
||||
int i = 0;
|
||||
int lastI = 0;
|
||||
while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
|
||||
while ((i = sl.indexOf(u'+', i + 1)) != -1) {
|
||||
const QStringView sub = QStringView{sl}.mid(lastI, i - lastI + 1);
|
||||
// If we get here the shortcuts contains at least one '+'. We break up
|
||||
// along the following strategy:
|
||||
@ -1154,7 +1154,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
// Only '+' can have length 1.
|
||||
if (sub.length() == 1) {
|
||||
// Make sure we only encounter a single '+' at the end of the accel
|
||||
if (accel.lastIndexOf(QLatin1Char('+')) != accel.length()-1)
|
||||
if (accel.lastIndexOf(u'+') != accel.length()-1)
|
||||
return Qt::Key_unknown;
|
||||
} else {
|
||||
// Identify the modifier
|
||||
@ -1174,7 +1174,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
lastI = i + 1;
|
||||
}
|
||||
|
||||
int p = accel.lastIndexOf(QLatin1Char('+'), accel.length() - 2); // -2 so that Ctrl++ works
|
||||
int p = accel.lastIndexOf(u'+', accel.length() - 2); // -2 so that Ctrl++ works
|
||||
QStringView accelRef(accel);
|
||||
if (p > 0)
|
||||
accelRef = accelRef.mid(p + 1);
|
||||
@ -1190,7 +1190,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
|
||||
{
|
||||
ret |= accelRef.at(0).toUpper().unicode();
|
||||
}
|
||||
} else if (accelRef.at(0) == QLatin1Char('f') && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
|
||||
} else if (accelRef.at(0) == u'f' && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
|
||||
ret |= Qt::Key_F1 + fnum - 1;
|
||||
} else {
|
||||
// For NativeText, check the translation table first,
|
||||
@ -1237,7 +1237,7 @@ static inline void addKey(QString &str, const QString &theKey, QKeySequence::Seq
|
||||
//: Key separator in shortcut string
|
||||
str += QCoreApplication::translate("QShortcut", "+");
|
||||
} else {
|
||||
str += QLatin1Char('+');
|
||||
str += u'+';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1220,8 +1220,8 @@ static QString groupsToString(const QPalette &p, QPalette::ColorRole cr)
|
||||
|
||||
if (p.isBrushSet(cg, cr)) {
|
||||
const auto &color = p.color(cg, cr);
|
||||
groupString += QString::fromUtf8(groupEnum.valueToKey(cg)) + QLatin1Char(':') +
|
||||
color.name(QColor::HexArgb) + QLatin1Char(',');
|
||||
groupString += QString::fromUtf8(groupEnum.valueToKey(cg)) + u':' +
|
||||
color.name(QColor::HexArgb) + u',';
|
||||
}
|
||||
}
|
||||
groupString.chop(1);
|
||||
|
@ -648,7 +648,7 @@ QStringList QFileDialogOptions::mimeTypeFilters() const
|
||||
void QFileDialogOptions::setDefaultSuffix(const QString &suffix)
|
||||
{
|
||||
d->defaultSuffix = suffix;
|
||||
if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(QLatin1Char('.')))
|
||||
if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(u'.'))
|
||||
d->defaultSuffix.remove(0, 1); // Silently change ".txt" -> "txt".
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
|
||||
QRegularExpressionMatch match = regexp.match(filter);
|
||||
if (match.hasMatch())
|
||||
f = match.captured(2);
|
||||
return f.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
return f.split(u' ', Qt::SkipEmptyParts);
|
||||
#else
|
||||
Q_UNUSED(filter);
|
||||
return QStringList();
|
||||
|
@ -72,7 +72,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
|
||||
{
|
||||
#if QT_CONFIG(settings)
|
||||
if (!key.isEmpty()) {
|
||||
QStringList paramList = key.split(QLatin1Char(':'));
|
||||
QStringList paramList = key.split(u':');
|
||||
const QString platform = paramList.takeFirst().toLower();
|
||||
|
||||
QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
|
||||
|
@ -765,15 +765,15 @@ QString QPlatformTheme::removeMnemonics(const QString &original)
|
||||
int currPos = 0;
|
||||
int l = original.length();
|
||||
while (l) {
|
||||
if (original.at(currPos) == QLatin1Char('&')) {
|
||||
if (original.at(currPos) == u'&') {
|
||||
++currPos;
|
||||
--l;
|
||||
if (l == 0)
|
||||
break;
|
||||
} else if (original.at(currPos) == QLatin1Char('(') && l >= 4 &&
|
||||
original.at(currPos + 1) == QLatin1Char('&') &&
|
||||
original.at(currPos + 2) != QLatin1Char('&') &&
|
||||
original.at(currPos + 3) == QLatin1Char(')')) {
|
||||
} else if (original.at(currPos) == u'(' && l >= 4 &&
|
||||
original.at(currPos + 1) == u'&' &&
|
||||
original.at(currPos + 2) != u'&' &&
|
||||
original.at(currPos + 3) == u')') {
|
||||
/* remove mnemonics its format is "\s*(&X)" */
|
||||
int n = 0;
|
||||
while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
|
||||
|
@ -53,7 +53,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||
|
||||
QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
|
||||
{
|
||||
QStringList paramList = key.split(QLatin1Char(':'));
|
||||
QStringList paramList = key.split(u':');
|
||||
const QString platform = paramList.takeFirst().toLower();
|
||||
loader->setExtraSearchPath(platformPluginPath);
|
||||
return qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList);
|
||||
|
@ -117,7 +117,7 @@ static inline bool qt_ensureWritableDir(const QString &name)
|
||||
QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache()
|
||||
: m_cacheWritable(false)
|
||||
{
|
||||
const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/');
|
||||
const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + u'/';
|
||||
const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
|
||||
m_globalCacheDir = sharedCachePath + subPath;
|
||||
m_localCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath;
|
||||
|
@ -878,10 +878,10 @@ QString QColor::name(NameFormat format) const
|
||||
{
|
||||
switch (format) {
|
||||
case HexRgb:
|
||||
return QLatin1Char('#') + QStringView{QString::number(rgba() | 0x1000000, 16)}.right(6);
|
||||
return u'#' + QStringView{QString::number(rgba() | 0x1000000, 16)}.right(6);
|
||||
case HexArgb:
|
||||
// it's called rgba() but it does return AARRGGBB
|
||||
return QLatin1Char('#') + QStringView{QString::number(rgba() | Q_INT64_C(0x100000000), 16)}.right(8);
|
||||
return u'#' + QStringView{QString::number(rgba() | Q_INT64_C(0x100000000), 16)}.right(8);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ QPageRanges QPageRanges::fromString(const QString &ranges)
|
||||
if (item.isEmpty())
|
||||
return QPageRanges();
|
||||
|
||||
if (item.contains(QLatin1Char('-'))) {
|
||||
if (item.contains(u'-')) {
|
||||
const QStringList rangeItems = item.split(u'-');
|
||||
if (rangeItems.count() != 2)
|
||||
return QPageRanges();
|
||||
@ -246,7 +246,7 @@ QString QPageRanges::toString() const
|
||||
QString result;
|
||||
for (const Range &range : d->intervals) {
|
||||
if (!result.isEmpty())
|
||||
result += QLatin1Char(',');
|
||||
result += u',';
|
||||
|
||||
if (range.from == range.to)
|
||||
result += QString::number(range.from);
|
||||
|
@ -7160,17 +7160,17 @@ start_lengthVariant:
|
||||
int old_offset = offset;
|
||||
for (; offset < text.length(); offset++) {
|
||||
QChar chr = text.at(offset);
|
||||
if (chr == QLatin1Char('\r') || (singleline && chr == QLatin1Char('\n'))) {
|
||||
text[offset] = QLatin1Char(' ');
|
||||
} else if (chr == QLatin1Char('\n')) {
|
||||
if (chr == u'\r' || (singleline && chr == u'\n')) {
|
||||
text[offset] = u' ';
|
||||
} else if (chr == u'\n') {
|
||||
text[offset] = QChar::LineSeparator;
|
||||
} else if (chr == QLatin1Char('&')) {
|
||||
} else if (chr == u'&') {
|
||||
++maxUnderlines;
|
||||
} else if (chr == QLatin1Char('\t')) {
|
||||
} else if (chr == u'\t') {
|
||||
if (!expandtabs) {
|
||||
text[offset] = QLatin1Char(' ');
|
||||
text[offset] = u' ';
|
||||
} else if (!tabarraylen && !tabstops) {
|
||||
tabstops = qRound(fm.horizontalAdvance(QLatin1Char('x'))*8);
|
||||
tabstops = qRound(fm.horizontalAdvance(u'x')*8);
|
||||
}
|
||||
} else if (chr == u'\x9c') {
|
||||
// string with multiple length variants
|
||||
@ -7187,13 +7187,13 @@ start_lengthVariant:
|
||||
QChar *cin = cout;
|
||||
int l = length;
|
||||
while (l) {
|
||||
if (*cin == QLatin1Char('&')) {
|
||||
if (*cin == u'&') {
|
||||
++cin;
|
||||
--length;
|
||||
--l;
|
||||
if (!l)
|
||||
break;
|
||||
if (*cin != QLatin1Char('&') && !hidemnmemonic && !(tf & Qt::TextDontPrint)) {
|
||||
if (*cin != u'&' && !hidemnmemonic && !(tf & Qt::TextDontPrint)) {
|
||||
QTextLayout::FormatRange range;
|
||||
range.start = cout - cout0;
|
||||
range.length = 1;
|
||||
@ -7201,9 +7201,9 @@ start_lengthVariant:
|
||||
underlineFormats.append(range);
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (hidemnmemonic && *cin == QLatin1Char('(') && l >= 4 &&
|
||||
cin[1] == QLatin1Char('&') && cin[2] != QLatin1Char('&') &&
|
||||
cin[3] == QLatin1Char(')')) {
|
||||
} else if (hidemnmemonic && *cin == u'(' && l >= 4 &&
|
||||
cin[1] == u'&' && cin[2] != u'&' &&
|
||||
cin[3] == u')') {
|
||||
int n = 0;
|
||||
while ((cout - n) > cout0 && (cout - n - 1)->isSpace())
|
||||
++n;
|
||||
|
@ -212,7 +212,7 @@ QString QMacPasteboardMimeAny::flavorFor(const QString &mime)
|
||||
if (mime == QLatin1String("application/x-qt-mime-type-name"))
|
||||
return QString();
|
||||
QString ret = QLatin1String("com.trolltech.anymime.") + mime;
|
||||
return ret.replace(QLatin1Char('/'), QLatin1String("--"));
|
||||
return ret.replace(u'/', QLatin1String("--"));
|
||||
}
|
||||
|
||||
QString QMacPasteboardMimeAny::mimeFor(QString flav)
|
||||
@ -389,7 +389,7 @@ QString QMacPasteboardMimeUnicodeText::flavorFor(const QString &mime)
|
||||
int i = mime.indexOf(QLatin1String("charset="));
|
||||
if (i >= 0) {
|
||||
QString cs(mime.mid(i+8).toLower());
|
||||
i = cs.indexOf(QLatin1Char(';'));
|
||||
i = cs.indexOf(u';');
|
||||
if (i>=0)
|
||||
cs = cs.left(i);
|
||||
if (cs == QLatin1String("system"))
|
||||
|
@ -237,11 +237,11 @@ QString QDBusMenuItem::convertMnemonic(const QString &label)
|
||||
{
|
||||
// convert only the first occurrence of ampersand which is not at the end
|
||||
// dbusmenu uses underscore instead of ampersand
|
||||
int idx = label.indexOf(QLatin1Char('&'));
|
||||
int idx = label.indexOf(u'&');
|
||||
if (idx < 0 || idx == label.length() - 1)
|
||||
return label;
|
||||
QString ret(label);
|
||||
ret[idx] = QLatin1Char('_');
|
||||
ret[idx] = u'_';
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ static inline bool detectWebBrowser(const QByteArray &desktop,
|
||||
|
||||
static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
{
|
||||
const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded());
|
||||
const QString command = launcher + u' ' + QLatin1String(url.toEncoded());
|
||||
if (debug)
|
||||
qDebug("Launching %s", qPrintable(command));
|
||||
#if !QT_CONFIG(process)
|
||||
|
@ -523,7 +523,7 @@ QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue)
|
||||
const QStringList list = fontValue.toStringList();
|
||||
if (!list.isEmpty()) {
|
||||
fontFamily = list.first();
|
||||
fontDescription = list.join(QLatin1Char(','));
|
||||
fontDescription = list.join(u',');
|
||||
}
|
||||
} else {
|
||||
fontDescription = fontFamily = fontValue.toString();
|
||||
@ -643,7 +643,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
||||
|
||||
const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS"));
|
||||
if (!kdeDirsVar.isEmpty())
|
||||
kdeDirs += kdeDirsVar.split(QLatin1Char(':'), Qt::SkipEmptyParts);
|
||||
kdeDirs += kdeDirsVar.split(u':', Qt::SkipEmptyParts);
|
||||
|
||||
const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionHomePath).isDir())
|
||||
|
@ -653,7 +653,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
|
||||
|
||||
bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const
|
||||
{
|
||||
if (family.startsWith(QLatin1Char('.')) || family == QLatin1String("LastResort"))
|
||||
if (family.startsWith(u'.') || family == QLatin1String("LastResort"))
|
||||
return true;
|
||||
|
||||
return QPlatformFontDatabase::isPrivateFontFamily(family);
|
||||
|
@ -749,7 +749,7 @@ static ColorData parseColorValue(QCss::Value v)
|
||||
if (!rgb && !hsv && !hsl)
|
||||
return ColorData();
|
||||
|
||||
const bool hasAlpha = identifier.size() == 4 && identifier.at(3) == QLatin1Char('a');
|
||||
const bool hasAlpha = identifier.size() == 4 && identifier.at(3) == u'a';
|
||||
if (identifier.size() > 3 && !hasAlpha)
|
||||
return ColorData();
|
||||
|
||||
@ -777,11 +777,11 @@ static ColorData parseColorValue(QCss::Value v)
|
||||
return ColorData();
|
||||
|
||||
if (hasAlpha && tokenCount != 7) {
|
||||
qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
|
||||
qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(u' ')));
|
||||
return ColorData();
|
||||
}
|
||||
if (!hasAlpha && tokenCount != 5) {
|
||||
qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
|
||||
qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(u' ')));
|
||||
return ColorData();
|
||||
}
|
||||
|
||||
@ -1228,7 +1228,7 @@ static bool setFontFamilyFromValues(const QList<QCss::Value> &values, QFont *fon
|
||||
if (str.isEmpty())
|
||||
break;
|
||||
if (shouldAddSpace)
|
||||
family += QLatin1Char(' ');
|
||||
family += u' ';
|
||||
family += str;
|
||||
shouldAddSpace = true;
|
||||
}
|
||||
@ -1652,7 +1652,7 @@ QRect Declaration::rectValue() const
|
||||
const QStringList func = v.variant.toStringList();
|
||||
if (func.count() != 2 || func.at(0).compare(QLatin1String("rect")) != 0)
|
||||
return QRect();
|
||||
const auto args = QStringView{func[1]}.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts);
|
||||
if (args.count() != 4)
|
||||
return QRect();
|
||||
QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
|
||||
@ -2090,7 +2090,7 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
|
||||
break;
|
||||
}
|
||||
case QCss::AttributeSelector::MatchDashMatch: {
|
||||
const QString dashPrefix = a.value + QLatin1Char('-');
|
||||
const QString dashPrefix = a.value + u'-';
|
||||
if (attrValue != a.value && !attrValue.startsWith(dashPrefix))
|
||||
return false;
|
||||
break;
|
||||
@ -2244,7 +2244,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
|
||||
|
||||
int i = 0;
|
||||
while (i < output.size()) {
|
||||
if (output.at(i) == QLatin1Char('\\')) {
|
||||
if (output.at(i) == u'\\') {
|
||||
|
||||
++i;
|
||||
// test for unicode hex escape
|
||||
@ -2281,8 +2281,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
|
||||
int QCssScanner_Generated::handleCommentStart()
|
||||
{
|
||||
while (pos < input.size() - 1) {
|
||||
if (input.at(pos) == QLatin1Char('*')
|
||||
&& input.at(pos + 1) == QLatin1Char('/')) {
|
||||
if (input.at(pos) == u'*' && input.at(pos + 1) == u'/') {
|
||||
pos += 2;
|
||||
break;
|
||||
}
|
||||
@ -2312,7 +2311,7 @@ QString Symbol::lexem() const
|
||||
if (len > 0)
|
||||
result.reserve(len);
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (text.at(start + i) == QLatin1Char('\\') && i < len - 1)
|
||||
if (text.at(start + i) == u'\\' && i < len - 1)
|
||||
++i;
|
||||
result += text.at(start + i);
|
||||
}
|
||||
@ -2337,7 +2336,7 @@ void Parser::init(const QString &css, bool isFile)
|
||||
if (isFile) {
|
||||
QFile file(css);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
sourcePath = QFileInfo(styleSheet).absolutePath() + QLatin1Char('/');
|
||||
sourcePath = QFileInfo(styleSheet).absolutePath() + u'/';
|
||||
QTextStream stream(&file);
|
||||
styleSheet = stream.readAll();
|
||||
} else {
|
||||
@ -2405,8 +2404,7 @@ Symbol Parser::errorSymbol()
|
||||
|
||||
static inline void removeOptionalQuotes(QString *str)
|
||||
{
|
||||
if (!str->startsWith(QLatin1Char('\''))
|
||||
&& !str->startsWith(QLatin1Char('\"')))
|
||||
if (!str->startsWith(u'\'') && !str->startsWith(u'\"'))
|
||||
return;
|
||||
str->remove(0, 1);
|
||||
str->chop(1);
|
||||
|
@ -208,13 +208,13 @@ static QStringList splitIntoFamilies(const QString &family)
|
||||
QStringList familyList;
|
||||
if (family.isEmpty())
|
||||
return familyList;
|
||||
const auto list = QStringView{family}.split(QLatin1Char(','));
|
||||
const auto list = QStringView{family}.split(u',');
|
||||
const int numFamilies = list.size();
|
||||
familyList.reserve(numFamilies);
|
||||
for (int i = 0; i < numFamilies; ++i) {
|
||||
auto str = list.at(i).trimmed();
|
||||
if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"')))
|
||||
|| (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) {
|
||||
if ((str.startsWith(u'"') && str.endsWith(u'"'))
|
||||
|| (str.startsWith(u'\'') && str.endsWith(u'\''))) {
|
||||
str = str.mid(1, str.length() - 2);
|
||||
}
|
||||
familyList << str.toString();
|
||||
@ -844,7 +844,7 @@ QString QFont::family() const
|
||||
void QFont::setFamily(const QString &family)
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
if (family.contains(QLatin1Char(','))) {
|
||||
if (family.contains(u',')) {
|
||||
qWarning("From Qt 6.2, QFont::setFamily() will no long split the family string on the comma"
|
||||
" and will keep it as a single family");
|
||||
}
|
||||
@ -2123,7 +2123,7 @@ QString QFont::key() const
|
||||
*/
|
||||
QString QFont::toString() const
|
||||
{
|
||||
const QChar comma(QLatin1Char(','));
|
||||
const QChar comma(u',');
|
||||
QString fontDescription = family() + comma +
|
||||
QString::number( pointSizeF()) + comma +
|
||||
QString::number( pixelSize()) + comma +
|
||||
@ -2171,7 +2171,7 @@ size_t qHash(const QFont &font, size_t seed) noexcept
|
||||
bool QFont::fromString(const QString &descrip)
|
||||
{
|
||||
const auto sr = QStringView(descrip).trimmed();
|
||||
const auto l = sr.split(QLatin1Char(','));
|
||||
const auto l = sr.split(u',');
|
||||
const int count = l.count();
|
||||
if (!count || (count > 2 && count < 9) || count == 9 || count > 17 ||
|
||||
l.first().isEmpty()) {
|
||||
@ -2793,7 +2793,7 @@ bool QFontInfo::fixedPitch() const
|
||||
Q_ASSERT(engine != nullptr);
|
||||
#ifdef Q_OS_MAC
|
||||
if (!engine->fontDef.fixedPitchComputed) {
|
||||
QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') };
|
||||
QChar ch[2] = { u'i', u'm' };
|
||||
QGlyphLayoutArray<2> g;
|
||||
int l = 2;
|
||||
if (!engine->stringToCMap(ch, 2, &g, &l, {}))
|
||||
|
@ -450,11 +450,11 @@ Q_GUI_EXPORT QFontDatabase::WritingSystem qt_writing_system_for_script(int scrip
|
||||
*/
|
||||
static void parseFontName(const QString &name, QString &foundry, QString &family)
|
||||
{
|
||||
int i = name.indexOf(QLatin1Char('['));
|
||||
int li = name.lastIndexOf(QLatin1Char(']'));
|
||||
int i = name.indexOf(u'[');
|
||||
int li = name.lastIndexOf(u']');
|
||||
if (i >= 0 && li >= 0 && i < li) {
|
||||
foundry = name.mid(i + 1, li - i - 1);
|
||||
if (i > 0 && name[i - 1] == QLatin1Char(' '))
|
||||
if (i > 0 && name[i - 1] == u' ')
|
||||
i--;
|
||||
family = name.left(i);
|
||||
} else {
|
||||
@ -497,7 +497,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
|
||||
QString family;
|
||||
family = desc.family->name;
|
||||
if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
|
||||
family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
|
||||
family += QLatin1String(" [") + desc.foundry->name + u']';
|
||||
fontDef->families = QStringList(family);
|
||||
|
||||
if (desc.style->smoothScalable
|
||||
@ -664,7 +664,7 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
for (int k = 0; k < foundry->count; ++k) {
|
||||
QString name = foundry->name.isEmpty()
|
||||
? f->name
|
||||
: f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');
|
||||
: f->name + QLatin1String(" [") + foundry->name + u']';
|
||||
if (style == foundry->styles[k]->key.style)
|
||||
preferredFallbacks.append(name);
|
||||
else
|
||||
@ -1136,9 +1136,9 @@ static QString styleStringHelper(int weight, QFont::Style style)
|
||||
}
|
||||
|
||||
if (style == QFont::StyleItalic)
|
||||
result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
|
||||
result += u' ' + QCoreApplication::translate("QFontDatabase", "Italic");
|
||||
else if (style == QFont::StyleOblique)
|
||||
result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
|
||||
result += u' ' + QCoreApplication::translate("QFontDatabase", "Oblique");
|
||||
|
||||
if (result.isEmpty())
|
||||
result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
|
||||
@ -1456,7 +1456,7 @@ QStringList QFontDatabase::families(WritingSystem writingSystem)
|
||||
if (!foundry.isEmpty()) {
|
||||
str += QLatin1String(" [");
|
||||
str += foundry;
|
||||
str += QLatin1Char(']');
|
||||
str += u']';
|
||||
}
|
||||
flist.append(str);
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ static QTtfTable generateName(const qttf_name_table &name)
|
||||
rec.nameId = 4;
|
||||
rec.value = name.family;
|
||||
if (name.subfamily != QLatin1String("Regular"))
|
||||
rec.value += QLatin1Char(' ') + name.subfamily;
|
||||
rec.value += u' ' + name.subfamily;
|
||||
list.append(rec);
|
||||
rec.nameId = 6;
|
||||
rec.value = name.postscript_name;
|
||||
|
@ -82,7 +82,7 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
|
||||
if (c.isHighSurrogate() && text.length() > 1 && text.at(1).isLowSurrogate())
|
||||
return true;
|
||||
|
||||
if (m_type == TextEdit && c == QLatin1Char('\t'))
|
||||
if (m_type == TextEdit && c == u'\t')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1469,18 +1469,18 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format
|
||||
|
||||
const int blockEnd = i;
|
||||
|
||||
if (ch == QLatin1Char('\r')
|
||||
if (ch == u'\r'
|
||||
&& (i + 1) < text.length()
|
||||
&& text.at(i + 1) == QLatin1Char('\n')) {
|
||||
&& text.at(i + 1) == u'\n') {
|
||||
++i;
|
||||
ch = text.at(i);
|
||||
}
|
||||
|
||||
if (ch == QLatin1Char('\n')
|
||||
if (ch == u'\n'
|
||||
|| ch == QChar::ParagraphSeparator
|
||||
|| ch == QTextBeginningOfFrame
|
||||
|| ch == QTextEndOfFrame
|
||||
|| ch == QLatin1Char('\r')) {
|
||||
|| ch == u'\r') {
|
||||
|
||||
if (!hasEditBlock) {
|
||||
hasEditBlock = true;
|
||||
|
@ -107,9 +107,9 @@ bool Qt::mightBeRichText(const QString& text)
|
||||
// skip a leading <?xml ... ?> as for example with xhtml
|
||||
if (QStringView{text}.mid(start, 5).compare(QLatin1String("<?xml")) == 0) {
|
||||
while (start < text.length()) {
|
||||
if (text.at(start) == QLatin1Char('?')
|
||||
if (text.at(start) == u'?'
|
||||
&& start + 2 < text.length()
|
||||
&& text.at(start + 1) == QLatin1Char('>')) {
|
||||
&& text.at(start + 1) == u'>') {
|
||||
start += 2;
|
||||
break;
|
||||
}
|
||||
@ -123,14 +123,14 @@ bool Qt::mightBeRichText(const QString& text)
|
||||
if (QStringView{text}.mid(start, 5).compare(QLatin1String("<!doc"), Qt::CaseInsensitive) == 0)
|
||||
return true;
|
||||
int open = start;
|
||||
while (open < text.length() && text.at(open) != QLatin1Char('<')
|
||||
&& text.at(open) != QLatin1Char('\n')) {
|
||||
if (text.at(open) == QLatin1Char('&') && QStringView{text}.mid(open + 1, 3) == QLatin1String("lt;"))
|
||||
while (open < text.length() && text.at(open) != u'<'
|
||||
&& text.at(open) != u'\n') {
|
||||
if (text.at(open) == u'&' && QStringView{text}.mid(open + 1, 3) == QLatin1String("lt;"))
|
||||
return true; // support desperate attempt of user to see <...>
|
||||
++open;
|
||||
}
|
||||
if (open < text.length() && text.at(open) == QLatin1Char('<')) {
|
||||
const int close = text.indexOf(QLatin1Char('>'), open);
|
||||
if (open < text.length() && text.at(open) == u'<') {
|
||||
const int close = text.indexOf(u'>', open);
|
||||
if (close > -1) {
|
||||
QString tag;
|
||||
for (int i = open+1; i < close; ++i) {
|
||||
@ -138,9 +138,9 @@ bool Qt::mightBeRichText(const QString& text)
|
||||
tag += text[i];
|
||||
else if (!tag.isEmpty() && text[i].isSpace())
|
||||
break;
|
||||
else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
|
||||
else if (!tag.isEmpty() && text[i] == u'/' && i + 1 == close)
|
||||
break;
|
||||
else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
|
||||
else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != u'!'))
|
||||
return false; // that's not a tag
|
||||
}
|
||||
#ifndef QT_NO_TEXTHTMLPARSER
|
||||
@ -169,9 +169,9 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
|
||||
QString rich;
|
||||
rich += QLatin1String("<p>");
|
||||
for (int i = 0; i < plain.length(); ++i) {
|
||||
if (plain[i] == QLatin1Char('\n')){
|
||||
if (plain[i] == u'\n'){
|
||||
int c = 1;
|
||||
while (i+1 < plain.length() && plain[i+1] == QLatin1Char('\n')) {
|
||||
while (i+1 < plain.length() && plain[i+1] == u'\n') {
|
||||
i++;
|
||||
c++;
|
||||
}
|
||||
@ -185,7 +185,7 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
|
||||
}
|
||||
col = 0;
|
||||
} else {
|
||||
if (mode == Qt::WhiteSpacePre && plain[i] == QLatin1Char('\t')){
|
||||
if (mode == Qt::WhiteSpacePre && plain[i] == u'\t'){
|
||||
rich += QChar::Nbsp;
|
||||
++col;
|
||||
while (col % 8) {
|
||||
@ -195,11 +195,11 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
|
||||
}
|
||||
else if (mode == Qt::WhiteSpacePre && plain[i].isSpace())
|
||||
rich += QChar::Nbsp;
|
||||
else if (plain[i] == QLatin1Char('<'))
|
||||
else if (plain[i] == u'<')
|
||||
rich += QLatin1String("<");
|
||||
else if (plain[i] == QLatin1Char('>'))
|
||||
else if (plain[i] == u'>')
|
||||
rich += QLatin1String(">");
|
||||
else if (plain[i] == QLatin1Char('&'))
|
||||
else if (plain[i] == u'&')
|
||||
rich += QLatin1String("&");
|
||||
else
|
||||
rich += plain[i];
|
||||
@ -817,7 +817,7 @@ void QTextDocument::adjustSize()
|
||||
// Pull this private function in from qglobal.cpp
|
||||
QFont f = defaultFont();
|
||||
QFontMetrics fm(f);
|
||||
int mw = fm.horizontalAdvance(QLatin1Char('x')) * 80;
|
||||
int mw = fm.horizontalAdvance(u'x') * 80;
|
||||
int w = mw;
|
||||
setTextWidth(w);
|
||||
QSizeF size = documentLayout()->documentSize();
|
||||
@ -1209,10 +1209,10 @@ QString QTextDocument::toPlainText() const
|
||||
case 0xfdd1: // QTextEndOfFrame
|
||||
case QChar::ParagraphSeparator:
|
||||
case QChar::LineSeparator:
|
||||
*uc = QLatin1Char('\n');
|
||||
*uc = u'\n';
|
||||
break;
|
||||
case QChar::Nbsp:
|
||||
*uc = QLatin1Char(' ');
|
||||
*uc = u' ';
|
||||
break;
|
||||
default:
|
||||
;
|
||||
@ -1306,7 +1306,7 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
|
||||
QTextDocument::FindFlags options, QTextCursor *cursor)
|
||||
{
|
||||
QString text = block.text();
|
||||
text.replace(QChar::Nbsp, QLatin1Char(' '));
|
||||
text.replace(QChar::Nbsp, u' ');
|
||||
Qt::CaseSensitivity sensitivity = options & QTextDocument::FindCaseSensitively ? Qt::CaseSensitive : Qt::CaseInsensitive;
|
||||
int idx = -1;
|
||||
|
||||
@ -1426,7 +1426,7 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expr,
|
||||
QTextDocument::FindFlags options, QTextCursor *cursor)
|
||||
{
|
||||
QString text = block.text();
|
||||
text.replace(QChar::Nbsp, QLatin1Char(' '));
|
||||
text.replace(QChar::Nbsp, u' ');
|
||||
QRegularExpressionMatch match;
|
||||
int idx = -1;
|
||||
|
||||
@ -2323,9 +2323,9 @@ static QString colorValue(QColor color)
|
||||
result = color.name();
|
||||
} else if (color.alpha()) {
|
||||
QString alphaValue = QString::number(color.alphaF(), 'f', 6);
|
||||
while (alphaValue.length() > 1 && alphaValue.at(alphaValue.size() - 1) == QLatin1Char('0'))
|
||||
while (alphaValue.length() > 1 && alphaValue.at(alphaValue.size() - 1) == u'0')
|
||||
alphaValue.chop(1);
|
||||
if (alphaValue.at(alphaValue.size() - 1) == QLatin1Char('.'))
|
||||
if (alphaValue.at(alphaValue.size() - 1) == u'.')
|
||||
alphaValue.chop(1);
|
||||
result = QString::fromLatin1("rgba(%1,%2,%3,%4)").arg(color.red())
|
||||
.arg(color.green())
|
||||
@ -2392,11 +2392,11 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
|
||||
|
||||
html += QLatin1String(" font-weight:");
|
||||
html += QString::number(defaultCharFormat.fontWeight());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
|
||||
html += QLatin1String(" font-style:");
|
||||
html += (defaultCharFormat.fontItalic() ? QLatin1String("italic") : QLatin1String("normal"));
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
|
||||
const bool percentSpacing = (defaultCharFormat.fontLetterSpacingType() == QFont::PercentageSpacing);
|
||||
if (defaultCharFormat.hasProperty(QTextFormat::FontLetterSpacing) &&
|
||||
@ -2437,9 +2437,9 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
|
||||
}
|
||||
}
|
||||
if (atLeastOneDecorationSet)
|
||||
html += decorationTag + QLatin1Char(';');
|
||||
html += decorationTag + u';';
|
||||
|
||||
html += QLatin1Char('\"');
|
||||
html += u'\"';
|
||||
|
||||
const QTextFrameFormat fmt = doc->rootFrame()->frameFormat();
|
||||
emitBackgroundAttribute(fmt);
|
||||
@ -2447,7 +2447,7 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
|
||||
} else {
|
||||
defaultCharFormat = QTextCharFormat();
|
||||
}
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
|
||||
QTextFrameFormat rootFmt = doc->rootFrame()->frameFormat();
|
||||
rootFmt.clearProperty(QTextFormat::BackgroundBrush);
|
||||
@ -2466,11 +2466,11 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
|
||||
|
||||
void QTextHtmlExporter::emitAttribute(const char *attribute, const QString &value)
|
||||
{
|
||||
html += QLatin1Char(' ');
|
||||
html += u' ';
|
||||
html += QLatin1String(attribute);
|
||||
html += QLatin1String("=\"");
|
||||
html += value.toHtmlEscaped();
|
||||
html += QLatin1Char('"');
|
||||
html += u'"';
|
||||
}
|
||||
|
||||
bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
@ -2511,7 +2511,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
if (name) {
|
||||
html += QLatin1String(" font-size:");
|
||||
html += QLatin1String(name);
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
} else if (format.hasProperty(QTextFormat::FontPixelSize)) {
|
||||
@ -2525,7 +2525,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
&& format.fontWeight() != defaultCharFormat.fontWeight()) {
|
||||
html += QLatin1String(" font-weight:");
|
||||
html += QString::number(format.fontWeight());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
|
||||
@ -2533,7 +2533,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
&& format.fontItalic() != defaultCharFormat.fontItalic()) {
|
||||
html += QLatin1String(" font-style:");
|
||||
html += (format.fontItalic() ? QLatin1String("italic") : QLatin1String("normal"));
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
|
||||
@ -2572,11 +2572,11 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
if (hasDecoration) {
|
||||
if (!atLeastOneDecorationSet)
|
||||
html += QLatin1String("none");
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
if (format.hasProperty(QTextFormat::TextUnderlineColor)) {
|
||||
html += QLatin1String(" text-decoration-color:");
|
||||
html += colorValue(format.underlineColor());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
attributesEmitted = true;
|
||||
} else {
|
||||
@ -2596,7 +2596,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
} else {
|
||||
html += QLatin1String(" color:");
|
||||
html += colorValue(brush.color());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
attributesEmitted = true;
|
||||
}
|
||||
@ -2605,7 +2605,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
&& format.background().style() == Qt::SolidPattern) {
|
||||
html += QLatin1String(" background-color:");
|
||||
html += colorValue(format.background().color());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
|
||||
@ -2626,7 +2626,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
else if (valign == QTextCharFormat::AlignBottom)
|
||||
html += QLatin1String("bottom");
|
||||
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
|
||||
@ -2656,7 +2656,7 @@ void QTextHtmlExporter::emitTextLength(const char *attribute, const QTextLength
|
||||
if (length.type() == QTextLength::VariableLength) // default
|
||||
return;
|
||||
|
||||
html += QLatin1Char(' ');
|
||||
html += u' ';
|
||||
html += QLatin1String(attribute);
|
||||
html += QLatin1String("=\"");
|
||||
html += QString::number(length.rawValue());
|
||||
@ -2664,7 +2664,7 @@ void QTextHtmlExporter::emitTextLength(const char *attribute, const QTextLength
|
||||
if (length.type() == QTextLength::PercentageLength)
|
||||
html += QLatin1String("%\"");
|
||||
else
|
||||
html += QLatin1Char('\"');
|
||||
html += u'\"';
|
||||
}
|
||||
|
||||
void QTextHtmlExporter::emitAlignment(Qt::Alignment align)
|
||||
@ -2697,7 +2697,7 @@ void QTextHtmlExporter::emitFloatStyle(QTextFrameFormat::Position pos, StyleMode
|
||||
Q_ASSERT_X(0, "QTextHtmlExporter::emitFloatStyle()", "pos should be a valid enum type");
|
||||
|
||||
if (mode == EmitStyleTag)
|
||||
html += QLatin1Char('\"');
|
||||
html += u'\"';
|
||||
}
|
||||
|
||||
static QLatin1String richtextBorderStyleToHtmlBorderStyle(QTextFrameFormat::BorderStyle style)
|
||||
@ -2737,7 +2737,7 @@ void QTextHtmlExporter::emitBorderStyle(QTextFrameFormat::BorderStyle style)
|
||||
|
||||
html += QLatin1String(" border-style:");
|
||||
html += richtextBorderStyleToHtmlBorderStyle(style);
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
|
||||
void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags policy)
|
||||
@ -2756,7 +2756,7 @@ void QTextHtmlExporter::emitFontFamily(const QStringList &families)
|
||||
bool first = true;
|
||||
for (const QString &family : families) {
|
||||
QLatin1String quote("\'");
|
||||
if (family.contains(QLatin1Char('\'')))
|
||||
if (family.contains(u'\''))
|
||||
quote = QLatin1String(""");
|
||||
|
||||
if (!first)
|
||||
@ -2767,7 +2767,7 @@ void QTextHtmlExporter::emitFontFamily(const QStringList &families)
|
||||
html += family.toHtmlEscaped();
|
||||
html += quote;
|
||||
}
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
|
||||
void QTextHtmlExporter::emitMargins(const QString &top, const QString &bottom, const QString &left, const QString &right)
|
||||
@ -2864,7 +2864,7 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
|
||||
|
||||
// split for [\n{LineSeparator}]
|
||||
// space in BR on purpose for compatibility with old-fashioned browsers
|
||||
txt.replace(QLatin1Char('\n'), QLatin1String("<br />"));
|
||||
txt.replace(u'\n', QLatin1String("<br />"));
|
||||
txt.replace(QChar::LineSeparator, QLatin1String("<br />"));
|
||||
html += txt;
|
||||
}
|
||||
@ -2910,7 +2910,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
|
||||
|
||||
html += QLatin1String(" -qt-block-indent:");
|
||||
html += QString::number(format.indent());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
|
||||
html += QLatin1String(" text-indent:");
|
||||
html += QString::number(format.textIndent());
|
||||
@ -2919,7 +2919,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
|
||||
if (block.userState() != -1) {
|
||||
html += QLatin1String(" -qt-user-state:");
|
||||
html += QString::number(block.userState());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
|
||||
if (format.lineHeightType() != QTextBlockFormat::SingleHeight) {
|
||||
@ -2962,7 +2962,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
|
||||
if (!diff.properties().isEmpty())
|
||||
emitCharFormatStyle(diff);
|
||||
|
||||
html += QLatin1Char('"');
|
||||
html += u'"';
|
||||
|
||||
}
|
||||
|
||||
@ -2981,7 +2981,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
return;
|
||||
}
|
||||
|
||||
html += QLatin1Char('\n');
|
||||
html += u'\n';
|
||||
|
||||
// save and later restore, in case we 'change' the default format by
|
||||
// emitting block char format information
|
||||
@ -3009,30 +3009,30 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
if (format.hasProperty(QTextFormat::ListIndent)) {
|
||||
styleString += QLatin1String(" -qt-list-indent: ");
|
||||
styleString += QString::number(format.indent());
|
||||
styleString += QLatin1Char(';');
|
||||
styleString += u';';
|
||||
}
|
||||
|
||||
if (format.hasProperty(QTextFormat::ListNumberPrefix)) {
|
||||
QString numberPrefix = format.numberPrefix();
|
||||
numberPrefix.replace(QLatin1Char('"'), QLatin1String("\\22"));
|
||||
numberPrefix.replace(QLatin1Char('\''), QLatin1String("\\27")); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
|
||||
numberPrefix.replace(u'"', QLatin1String("\\22"));
|
||||
numberPrefix.replace(u'\'', QLatin1String("\\27")); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
|
||||
styleString += QLatin1String(" -qt-list-number-prefix: ");
|
||||
styleString += QLatin1Char('\'');
|
||||
styleString += u'\'';
|
||||
styleString += numberPrefix;
|
||||
styleString += QLatin1Char('\'');
|
||||
styleString += QLatin1Char(';');
|
||||
styleString += u'\'';
|
||||
styleString += u';';
|
||||
}
|
||||
|
||||
if (format.hasProperty(QTextFormat::ListNumberSuffix)) {
|
||||
if (format.numberSuffix() != QLatin1String(".")) { // this is our default
|
||||
QString numberSuffix = format.numberSuffix();
|
||||
numberSuffix.replace(QLatin1Char('"'), QLatin1String("\\22"));
|
||||
numberSuffix.replace(QLatin1Char('\''), QLatin1String("\\27")); // see above
|
||||
numberSuffix.replace(u'"', QLatin1String("\\22"));
|
||||
numberSuffix.replace(u'\'', QLatin1String("\\27")); // see above
|
||||
styleString += QLatin1String(" -qt-list-number-suffix: ");
|
||||
styleString += QLatin1Char('\'');
|
||||
styleString += u'\'';
|
||||
styleString += numberSuffix;
|
||||
styleString += QLatin1Char('\'');
|
||||
styleString += QLatin1Char(';');
|
||||
styleString += u'\'';
|
||||
styleString += u';';
|
||||
}
|
||||
}
|
||||
|
||||
@ -3047,7 +3047,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
if (!blockFmt.properties().isEmpty()) {
|
||||
html += QLatin1String(" style=\"");
|
||||
emitCharFormatStyle(blockFmt);
|
||||
html += QLatin1Char('\"');
|
||||
html += u'\"';
|
||||
|
||||
defaultCharFormat.merge(block.charFormat());
|
||||
}
|
||||
@ -3060,14 +3060,14 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
QTextLength width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth);
|
||||
if (width.type() != QTextLength::VariableLength)
|
||||
emitTextLength("width", width);
|
||||
html += QLatin1Char(' ');
|
||||
html += u' ';
|
||||
|
||||
if (blockFormat.hasProperty(QTextFormat::BackgroundBrush)) {
|
||||
html += QLatin1String("style=\"");
|
||||
html += QLatin1String("background-color:");
|
||||
html += colorValue(qvariant_cast<QBrush>(blockFormat.property(QTextFormat::BackgroundBrush)).color());
|
||||
html += QLatin1Char(';');
|
||||
html += QLatin1Char('\"');
|
||||
html += u';';
|
||||
html += u'\"';
|
||||
}
|
||||
|
||||
html += QLatin1String("/>");
|
||||
@ -3077,7 +3077,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
const bool pre = blockFormat.nonBreakableLines();
|
||||
if (pre) {
|
||||
if (list)
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
html += QLatin1String("<pre");
|
||||
} else if (!list) {
|
||||
int headingLevel = blockFormat.headingLevel();
|
||||
@ -3089,7 +3089,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
|
||||
emitBlockAttributes(block);
|
||||
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
if (block.begin().atEnd())
|
||||
html += QLatin1String("<br />");
|
||||
|
||||
@ -3112,7 +3112,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
||||
else {
|
||||
int headingLevel = blockFormat.headingLevel();
|
||||
if (headingLevel > 0 && headingLevel <= 6)
|
||||
html += QLatin1String("</h") + QString::number(headingLevel) + QLatin1Char('>');
|
||||
html += QLatin1String("</h") + QString::number(headingLevel) + u'>';
|
||||
else
|
||||
html += QLatin1String("</p>");
|
||||
}
|
||||
@ -3235,7 +3235,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
|
||||
|
||||
emitBackgroundAttribute(format);
|
||||
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
|
||||
const int rows = table->rows();
|
||||
const int columns = table->columns();
|
||||
@ -3304,7 +3304,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
styleString += QLatin1Char(';');
|
||||
styleString += u';';
|
||||
|
||||
QTextCharFormat temp;
|
||||
temp.setVerticalAlignment(valign);
|
||||
@ -3312,13 +3312,13 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
|
||||
}
|
||||
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellLeftPadding))
|
||||
styleString += QLatin1String(" padding-left:") + QString::number(cellFormat.leftPadding()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" padding-left:") + QString::number(cellFormat.leftPadding()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellRightPadding))
|
||||
styleString += QLatin1String(" padding-right:") + QString::number(cellFormat.rightPadding()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" padding-right:") + QString::number(cellFormat.rightPadding()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellTopPadding))
|
||||
styleString += QLatin1String(" padding-top:") + QString::number(cellFormat.topPadding()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" padding-top:") + QString::number(cellFormat.topPadding()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellBottomPadding))
|
||||
styleString += QLatin1String(" padding-bottom:") + QString::number(cellFormat.bottomPadding()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" padding-bottom:") + QString::number(cellFormat.bottomPadding()) + u';';
|
||||
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorder))
|
||||
styleString += QLatin1String(" border-top:") + QString::number(cellFormat.topBorder()) + QLatin1String("px;");
|
||||
@ -3330,27 +3330,27 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
|
||||
styleString += QLatin1String(" border-left:") + QString::number(cellFormat.leftBorder()) + QLatin1String("px;");
|
||||
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorderBrush))
|
||||
styleString += QLatin1String(" border-top-color:") + cellFormat.topBorderBrush().color().name() + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-top-color:") + cellFormat.topBorderBrush().color().name() + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellRightBorderBrush))
|
||||
styleString += QLatin1String(" border-right-color:") + cellFormat.rightBorderBrush().color().name() + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-right-color:") + cellFormat.rightBorderBrush().color().name() + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellBottomBorderBrush))
|
||||
styleString += QLatin1String(" border-bottom-color:") + cellFormat.bottomBorderBrush().color().name() + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-bottom-color:") + cellFormat.bottomBorderBrush().color().name() + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellLeftBorderBrush))
|
||||
styleString += QLatin1String(" border-left-color:") + cellFormat.leftBorderBrush().color().name() + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-left-color:") + cellFormat.leftBorderBrush().color().name() + u';';
|
||||
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellTopBorderStyle))
|
||||
styleString += QLatin1String(" border-top-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.topBorderStyle()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-top-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.topBorderStyle()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellRightBorderStyle))
|
||||
styleString += QLatin1String(" border-right-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.rightBorderStyle()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-right-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.rightBorderStyle()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellBottomBorderStyle))
|
||||
styleString += QLatin1String(" border-bottom-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.bottomBorderStyle()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-bottom-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.bottomBorderStyle()) + u';';
|
||||
if (cellFormat.hasProperty(QTextFormat::TableCellLeftBorderStyle))
|
||||
styleString += QLatin1String(" border-left-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.leftBorderStyle()) + QLatin1Char(';');
|
||||
styleString += QLatin1String(" border-left-style:") + richtextBorderStyleToHtmlBorderStyle(cellFormat.leftBorderStyle()) + u';';
|
||||
|
||||
if (!styleString.isEmpty())
|
||||
html += QLatin1String(" style=\"") + styleString + QLatin1Char('\"');
|
||||
html += QLatin1String(" style=\"") + styleString + u'\"';
|
||||
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
|
||||
emitFrame(cell.begin());
|
||||
|
||||
@ -3412,7 +3412,7 @@ void QTextHtmlExporter::emitTextFrame(const QTextFrame *f)
|
||||
if (frameType != RootFrame)
|
||||
emitBackgroundAttribute(format);
|
||||
|
||||
html += QLatin1Char('>');
|
||||
html += u'>';
|
||||
html += QLatin1String("\n<tr>\n<td style=\"border: none;\">");
|
||||
emitFrame(f->begin());
|
||||
html += QLatin1String("</td></tr></table>");
|
||||
@ -3437,7 +3437,7 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
|
||||
if (format.borderBrush() != defaultFormat.borderBrush()) {
|
||||
html += QLatin1String(" border-color:");
|
||||
html += colorValue(format.borderBrush().color());
|
||||
html += QLatin1Char(';');
|
||||
html += u';';
|
||||
}
|
||||
|
||||
if (format.borderStyle() != defaultFormat.borderStyle())
|
||||
@ -3459,7 +3459,7 @@ void QTextHtmlExporter::emitFrameStyle(const QTextFrameFormat &format, FrameType
|
||||
if (html.length() == originalHtmlLength) // nothing emitted?
|
||||
html.chop(styleAttribute.size());
|
||||
else
|
||||
html += QLatin1Char('\"');
|
||||
html += u'\"';
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -596,7 +596,7 @@ bool QTextHtmlImporter::appendNodeText()
|
||||
&& ch != QChar::Nbsp
|
||||
&& ch != QChar::ParagraphSeparator) {
|
||||
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == QLatin1Char('\n') || ch == QLatin1Char('\r')))
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == u'\n' || ch == u'\r'))
|
||||
compressNextWhitespace = PreserveWhiteSpace;
|
||||
|
||||
if (compressNextWhitespace == CollapseWhiteSpace)
|
||||
@ -607,30 +607,30 @@ bool QTextHtmlImporter::appendNodeText()
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePre
|
||||
|| textEditMode
|
||||
) {
|
||||
if (ch == QLatin1Char('\n')) {
|
||||
if (ch == u'\n') {
|
||||
if (textEditMode)
|
||||
continue;
|
||||
} else if (ch == QLatin1Char('\r')) {
|
||||
} else if (ch == u'\r') {
|
||||
continue;
|
||||
}
|
||||
} else if (wsm != QTextHtmlParserNode::WhiteSpacePreWrap) {
|
||||
compressNextWhitespace = RemoveWhiteSpace;
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == QLatin1Char('\n') || ch == QLatin1Char('\r')))
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && (ch == u'\n' || ch == u'\r'))
|
||||
{ }
|
||||
else if (wsm == QTextHtmlParserNode::WhiteSpaceNoWrap)
|
||||
ch = QChar::Nbsp;
|
||||
else
|
||||
ch = QLatin1Char(' ');
|
||||
ch = u' ';
|
||||
}
|
||||
} else {
|
||||
compressNextWhitespace = PreserveWhiteSpace;
|
||||
}
|
||||
|
||||
if (ch == QLatin1Char('\n')
|
||||
if (ch == u'\n'
|
||||
|| ch == QChar::ParagraphSeparator) {
|
||||
|
||||
if (!textToInsert.isEmpty()) {
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && textToInsert.at(textToInsert.length() - 1) == QLatin1Char(' '))
|
||||
if (wsm == QTextHtmlParserNode::WhiteSpacePreLine && textToInsert.at(textToInsert.length() - 1) == u' ')
|
||||
textToInsert = textToInsert.chopped(1);
|
||||
cursor.insertText(textToInsert, format);
|
||||
textToInsert.clear();
|
||||
|
@ -2182,7 +2182,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
|
||||
|
||||
QRectF r(pos, size);
|
||||
|
||||
qreal xoff = fontMetrics.horizontalAdvance(QLatin1Char(' '));
|
||||
qreal xoff = fontMetrics.horizontalAdvance(u' ');
|
||||
if (dir == Qt::LeftToRight)
|
||||
xoff = -xoff - size.width();
|
||||
r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2));
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
for (int i = start + 1; i < end; ++i) {
|
||||
if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
|
||||
&& m_analysis[i].flags == m_analysis[start].flags
|
||||
&& (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.'))
|
||||
&& (m_analysis[i].script == m_analysis[start].script || m_string[i] == u'.')
|
||||
&& m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
|
||||
&& i - start < MaxItemLength)
|
||||
continue;
|
||||
@ -2982,14 +2982,14 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
|
||||
|
||||
const int end = si.position + length(&si);
|
||||
for (int i = si.position; i < end - 1; ++i) {
|
||||
if (layoutData->string.at(i) == QLatin1Char('&')
|
||||
if (layoutData->string.at(i) == u'&'
|
||||
&& !attributes[i + 1].whiteSpace && attributes[i + 1].graphemeBoundary) {
|
||||
const int gp = logClusters[i - si.position];
|
||||
glyphs.attributes[gp].dontPrint = true;
|
||||
// emulate grapheme cluster
|
||||
attributes[i] = attributes[i + 1];
|
||||
memset(attributes + i + 1, 0, sizeof(QCharAttributes));
|
||||
if (layoutData->string.at(i + 1) == QLatin1Char('&'))
|
||||
if (layoutData->string.at(i + 1) == u'&')
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ int QTextHtmlParser::lookupElement(const QString &element)
|
||||
static QString quoteNewline(const QString &s)
|
||||
{
|
||||
QString n = s;
|
||||
n.replace(QLatin1Char('\n'), QLatin1String("\\n"));
|
||||
n.replace(u'\n', QLatin1String("\\n"));
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -509,10 +509,9 @@ QTextHtmlParserNode::QTextHtmlParserNode()
|
||||
void QTextHtmlParser::dumpHtml()
|
||||
{
|
||||
for (int i = 0; i < count(); ++i) {
|
||||
qDebug().nospace() << qPrintable(QString(depth(i)*4, QLatin1Char(' ')))
|
||||
qDebug().nospace() << qPrintable(QString(depth(i) * 4, u' '))
|
||||
<< qPrintable(at(i).tag) << ':'
|
||||
<< quoteNewline(at(i).text);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,9 +636,9 @@ void QTextHtmlParser::parse()
|
||||
{
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
if (c == QLatin1Char('<')) {
|
||||
if (c == u'<') {
|
||||
parseTag();
|
||||
} else if (c == QLatin1Char('&')) {
|
||||
} else if (c == u'&') {
|
||||
nodes.last()->text += parseEntity();
|
||||
} else {
|
||||
nodes.last()->text += c;
|
||||
@ -653,7 +652,7 @@ void QTextHtmlParser::parseTag()
|
||||
eatSpace();
|
||||
|
||||
// handle comments and other exclamation mark declarations
|
||||
if (hasPrefix(QLatin1Char('!'))) {
|
||||
if (hasPrefix(u'!')) {
|
||||
parseExclamationTag();
|
||||
if (nodes.last()->wsm != QTextHtmlParserNode::WhiteSpacePre
|
||||
&& nodes.last()->wsm != QTextHtmlParserNode::WhiteSpacePreWrap
|
||||
@ -663,7 +662,7 @@ void QTextHtmlParser::parseTag()
|
||||
}
|
||||
|
||||
// if close tag just close
|
||||
if (hasPrefix(QLatin1Char('/'))) {
|
||||
if (hasPrefix(u'/')) {
|
||||
if (nodes.last()->id == Html_style) {
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
QCss::Parser parser(nodes.constLast()->text);
|
||||
@ -714,8 +713,8 @@ void QTextHtmlParser::parseTag()
|
||||
|
||||
// finish tag
|
||||
bool tagClosed = false;
|
||||
while (pos < len && txt.at(pos) != QLatin1Char('>')) {
|
||||
if (txt.at(pos) == QLatin1Char('/'))
|
||||
while (pos < len && txt.at(pos) != u'>') {
|
||||
if (txt.at(pos) == u'/')
|
||||
tagClosed = true;
|
||||
|
||||
pos++;
|
||||
@ -728,7 +727,7 @@ void QTextHtmlParser::parseTag()
|
||||
|| node->wsm == QTextHtmlParserNode::WhiteSpacePreWrap
|
||||
|| node->wsm == QTextHtmlParserNode::WhiteSpacePreLine)
|
||||
&& node->isBlock()) {
|
||||
if (pos < len - 1 && txt.at(pos) == QLatin1Char('\n'))
|
||||
if (pos < len - 1 && txt.at(pos) == u'\n')
|
||||
++pos;
|
||||
}
|
||||
|
||||
@ -745,7 +744,7 @@ void QTextHtmlParser::parseCloseTag()
|
||||
QString tag = parseWord().toLower().trimmed();
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
if (c == QLatin1Char('>'))
|
||||
if (c == u'>')
|
||||
break;
|
||||
}
|
||||
|
||||
@ -773,7 +772,7 @@ void QTextHtmlParser::parseCloseTag()
|
||||
|| at(p).wsm == QTextHtmlParserNode::WhiteSpacePreWrap
|
||||
|| at(p).wsm == QTextHtmlParserNode::WhiteSpacePreLine)
|
||||
&& at(p).isBlock()) {
|
||||
if (at(last()).text.endsWith(QLatin1Char('\n')))
|
||||
if (at(last()).text.endsWith(u'\n'))
|
||||
nodes[last()]->text.chop(1);
|
||||
}
|
||||
|
||||
@ -785,7 +784,7 @@ void QTextHtmlParser::parseCloseTag()
|
||||
void QTextHtmlParser::parseExclamationTag()
|
||||
{
|
||||
++pos;
|
||||
if (hasPrefix(QLatin1Char('-')) && hasPrefix(QLatin1Char('-'), 1)) {
|
||||
if (hasPrefix(u'-') && hasPrefix(u'-', 1)) {
|
||||
pos += 2;
|
||||
// eat comments
|
||||
int end = txt.indexOf(QLatin1String("-->"), pos);
|
||||
@ -794,7 +793,7 @@ void QTextHtmlParser::parseExclamationTag()
|
||||
// eat internal tags
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
if (c == QLatin1Char('>'))
|
||||
if (c == u'>')
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -806,13 +805,13 @@ QString QTextHtmlParser::parseEntity(QStringView entity)
|
||||
if (!resolved.isNull())
|
||||
return QString(resolved);
|
||||
|
||||
if (entity.length() > 1 && entity.at(0) == QLatin1Char('#')) {
|
||||
if (entity.length() > 1 && entity.at(0) == u'#') {
|
||||
entity = entity.mid(1); // removing leading #
|
||||
|
||||
int base = 10;
|
||||
bool ok = false;
|
||||
|
||||
if (entity.at(0).toLower() == QLatin1Char('x')) { // hex entity?
|
||||
if (entity.at(0).toLower() == u'x') { // hex entity?
|
||||
entity = entity.mid(1);
|
||||
base = 16;
|
||||
}
|
||||
@ -837,7 +836,7 @@ QString QTextHtmlParser::parseEntity()
|
||||
if (c.isSpace() || pos - recover > 9) {
|
||||
goto error;
|
||||
}
|
||||
if (c == QLatin1Char(';'))
|
||||
if (c == u';')
|
||||
break;
|
||||
++entityLen;
|
||||
}
|
||||
@ -857,23 +856,23 @@ error:
|
||||
QString QTextHtmlParser::parseWord()
|
||||
{
|
||||
QString word;
|
||||
if (hasPrefix(QLatin1Char('\"'))) { // double quotes
|
||||
if (hasPrefix(u'\"')) { // double quotes
|
||||
++pos;
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
if (c == QLatin1Char('\"'))
|
||||
if (c == u'\"')
|
||||
break;
|
||||
else if (c == QLatin1Char('&'))
|
||||
else if (c == u'&')
|
||||
word += parseEntity();
|
||||
else
|
||||
word += c;
|
||||
}
|
||||
} else if (hasPrefix(QLatin1Char('\''))) { // single quotes
|
||||
} else if (hasPrefix(u'\'')) { // single quotes
|
||||
++pos;
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
// Allow for escaped single quotes as they may be part of the string
|
||||
if (c == QLatin1Char('\'') && (txt.length() > 1 && txt.at(pos - 2) != QLatin1Char('\\')))
|
||||
if (c == u'\'' && (txt.length() > 1 && txt.at(pos - 2) != u'\\'))
|
||||
break;
|
||||
else
|
||||
word += c;
|
||||
@ -881,15 +880,12 @@ QString QTextHtmlParser::parseWord()
|
||||
} else { // normal text
|
||||
while (pos < len) {
|
||||
QChar c = txt.at(pos++);
|
||||
if (c == QLatin1Char('>')
|
||||
|| (c == QLatin1Char('/') && hasPrefix(QLatin1Char('>')))
|
||||
|| c == QLatin1Char('<')
|
||||
|| c == QLatin1Char('=')
|
||||
|| c.isSpace()) {
|
||||
if (c == u'>' || (c == u'/' && hasPrefix(u'>'))
|
||||
|| c == u'<' || c == u'=' || c.isSpace()) {
|
||||
--pos;
|
||||
break;
|
||||
}
|
||||
if (c == QLatin1Char('&'))
|
||||
if (c == u'&')
|
||||
word += parseEntity();
|
||||
else
|
||||
word += c;
|
||||
@ -1559,7 +1555,7 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr)
|
||||
*width = QTextLength(QTextLength::FixedLength, realVal);
|
||||
} else {
|
||||
auto value = QStringView(valueStr).trimmed();
|
||||
if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) {
|
||||
if (!value.isEmpty() && value.endsWith(u'%')) {
|
||||
value.truncate(value.size() - 1);
|
||||
realVal = value.toDouble(&ok);
|
||||
if (ok)
|
||||
@ -1571,7 +1567,7 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr)
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
void QTextHtmlParserNode::parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider)
|
||||
{
|
||||
const QString css = QLatin1String("* {") + value + QLatin1Char('}');
|
||||
const QString css = QLatin1String("* {") + value + u'}';
|
||||
QCss::Parser parser(css);
|
||||
QCss::StyleSheet sheet;
|
||||
parser.parse(&sheet, Qt::CaseInsensitive);
|
||||
@ -1586,14 +1582,14 @@ QStringList QTextHtmlParser::parseAttributes()
|
||||
|
||||
while (pos < len) {
|
||||
eatSpace();
|
||||
if (hasPrefix(QLatin1Char('>')) || hasPrefix(QLatin1Char('/')))
|
||||
if (hasPrefix(u'>') || hasPrefix(u'/'))
|
||||
break;
|
||||
QString key = parseWord().toLower();
|
||||
QString value = QLatin1String("1");
|
||||
if (key.size() == 0)
|
||||
break;
|
||||
eatSpace();
|
||||
if (hasPrefix(QLatin1Char('='))){
|
||||
if (hasPrefix(u'=')){
|
||||
pos++;
|
||||
eatSpace();
|
||||
value = parseWord();
|
||||
@ -1627,12 +1623,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
// the infamous font tag
|
||||
if (key == QLatin1String("size") && value.size()) {
|
||||
int n = value.toInt();
|
||||
if (value.at(0) != QLatin1Char('+') && value.at(0) != QLatin1Char('-'))
|
||||
if (value.at(0) != u'+' && value.at(0) != u'-')
|
||||
n -= 3;
|
||||
node->charFormat.setProperty(QTextFormat::FontSizeAdjustment, n);
|
||||
} else if (key == QLatin1String("face")) {
|
||||
if (value.contains(QLatin1Char(','))) {
|
||||
const QStringList values = value.split(QLatin1Char(','));
|
||||
if (value.contains(u',')) {
|
||||
const QStringList values = value.split(u',');
|
||||
QStringList families;
|
||||
for (const QString &family : values)
|
||||
families << family.trimmed();
|
||||
|
@ -2523,7 +2523,7 @@ void QTextLine::draw_internal(QPainter *p, const QPointF &pos,
|
||||
|
||||
const qreal lineHeight = line.height().toReal();
|
||||
QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(),
|
||||
lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(QLatin1Char(' ')));
|
||||
lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(u' '));
|
||||
setPenAndDrawBackground(p, QPen(), selection->format, r);
|
||||
p->setPen(pen);
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcMD, "qt.text.markdown")
|
||||
|
||||
static const QChar Newline = QLatin1Char('\n');
|
||||
static const QChar Space = QLatin1Char(' ');
|
||||
static const QChar Newline = u'\n';
|
||||
static const QChar Space = u' ';
|
||||
|
||||
// TODO maybe eliminate the margins after all views recognize BlockQuoteLevel, CSS can format it, etc.
|
||||
static const int BlockQuoteIndent = 40; // pixels, same as in QTextHtmlParserNode::initializeProperties
|
||||
|
@ -55,15 +55,15 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer")
|
||||
|
||||
static const QChar Space = QLatin1Char(' ');
|
||||
static const QChar Tab = QLatin1Char('\t');
|
||||
static const QChar Newline = QLatin1Char('\n');
|
||||
static const QChar CarriageReturn = QLatin1Char('\r');
|
||||
static const QChar Space = u' ';
|
||||
static const QChar Tab = u'\t';
|
||||
static const QChar Newline = u'\n';
|
||||
static const QChar CarriageReturn = u'\r';
|
||||
static const QChar LineBreak = u'\x2028';
|
||||
static const QChar DoubleQuote = QLatin1Char('"');
|
||||
static const QChar Backtick = QLatin1Char('`');
|
||||
static const QChar Backslash = QLatin1Char('\\');
|
||||
static const QChar Period = QLatin1Char('.');
|
||||
static const QChar DoubleQuote = u'"';
|
||||
static const QChar Backtick = u'`';
|
||||
static const QChar Backslash = u'\\';
|
||||
static const QChar Period = u'.';
|
||||
|
||||
QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features)
|
||||
: m_stream(stream), m_features(features)
|
||||
@ -95,7 +95,7 @@ void QTextMarkdownWriter::writeTable(const QAbstractItemModel *table)
|
||||
}
|
||||
m_stream << "|" << Qt::endl;
|
||||
for (int col = 0; col < tableColumnWidths.length(); ++col)
|
||||
m_stream << '|' << QString(tableColumnWidths[col], QLatin1Char('-'));
|
||||
m_stream << '|' << QString(tableColumnWidths[col], u'-');
|
||||
m_stream << '|'<< Qt::endl;
|
||||
|
||||
// write the body
|
||||
@ -166,7 +166,7 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
|
||||
if (tableRow == 0) {
|
||||
m_stream << Newline;
|
||||
for (int col = 0; col < tableColumnWidths.length(); ++col)
|
||||
m_stream << '|' << QString(tableColumnWidths[col], QLatin1Char('-'));
|
||||
m_stream << '|' << QString(tableColumnWidths[col], u'-');
|
||||
m_stream << '|';
|
||||
}
|
||||
m_stream << Newline << "|";
|
||||
@ -252,11 +252,11 @@ static int nearestWordWrapIndex(const QString &s, int before)
|
||||
if (lcMDW().isDebugEnabled()) {
|
||||
QString frag = s.mid(fragBegin, 30);
|
||||
qCDebug(lcMDW) << frag << before;
|
||||
qCDebug(lcMDW) << QString(before - fragBegin, Period) + QLatin1Char('<');
|
||||
qCDebug(lcMDW) << QString(before - fragBegin, Period) + u'<';
|
||||
}
|
||||
for (int i = before - 1; i >= 0; --i) {
|
||||
if (s.at(i).isSpace()) {
|
||||
qCDebug(lcMDW) << QString(i - fragBegin, Period) + QLatin1Char('^') << i;
|
||||
qCDebug(lcMDW) << QString(i - fragBegin, Period) + u'^' << i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -290,7 +290,7 @@ static void maybeEscapeFirstChar(QString &s)
|
||||
char firstChar = sTrimmed.at(0).toLatin1();
|
||||
if (firstChar == '*' || firstChar == '+' || firstChar == '-') {
|
||||
int i = s.indexOf(QLatin1Char(firstChar));
|
||||
s.insert(i, QLatin1Char('\\'));
|
||||
s.insert(i, u'\\');
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
QString title = ifmt.stringProperty(QTextFormat::ImageTitle);
|
||||
if (!title.isEmpty())
|
||||
s += Space + DoubleQuote + title + DoubleQuote;
|
||||
s += QLatin1Char(')');
|
||||
s += u')';
|
||||
if (wrap && col + s.length() > ColumnLimit) {
|
||||
m_stream << Newline << wrapIndentString;
|
||||
col = m_wrappedLineIndent;
|
||||
@ -517,13 +517,13 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
m_stream << s;
|
||||
col += s.length();
|
||||
} else if (fmt.hasProperty(QTextFormat::AnchorHref)) {
|
||||
QString s = QLatin1Char('[') + fragmentText + QLatin1String("](") +
|
||||
QString s = u'[' + fragmentText + QLatin1String("](") +
|
||||
fmt.property(QTextFormat::AnchorHref).toString();
|
||||
if (fmt.hasProperty(QTextFormat::TextToolTip)) {
|
||||
s += Space;
|
||||
s += createLinkTitle(fmt.property(QTextFormat::TextToolTip).toString());
|
||||
}
|
||||
s += QLatin1Char(')');
|
||||
s += u')';
|
||||
if (wrap && col + s.length() > ColumnLimit) {
|
||||
m_stream << Newline << wrapIndentString;
|
||||
col = m_wrappedLineIndent;
|
||||
@ -549,7 +549,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
bold = fontInfo.bold();
|
||||
}
|
||||
if (fontInfo.italic() != italic) {
|
||||
markers += QLatin1Char('*');
|
||||
markers += u'*';
|
||||
italic = fontInfo.italic();
|
||||
}
|
||||
if (fontInfo.strikeOut() != strikeOut) {
|
||||
@ -560,7 +560,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
// Markdown doesn't support underline, but the parser will treat a single underline
|
||||
// the same as a single asterisk, and the marked fragment will be rendered in italics.
|
||||
// That will have to do.
|
||||
markers += QLatin1Char('_');
|
||||
markers += u'_';
|
||||
underline = fontInfo.underline();
|
||||
}
|
||||
}
|
||||
|
@ -500,9 +500,9 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
|
||||
// fix the file path, if broken (convert separators, eat leading and trailing ones)
|
||||
fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
|
||||
QStringView filePathRef(fileInfo.filePath);
|
||||
while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
|
||||
while (filePathRef.startsWith(u'.') || filePathRef.startsWith(u'/'))
|
||||
filePathRef = filePathRef.mid(1);
|
||||
while (filePathRef.endsWith(QLatin1Char('/')))
|
||||
while (filePathRef.endsWith(u'/'))
|
||||
filePathRef.chop(1);
|
||||
|
||||
fileInfo.filePath = filePathRef.toString();
|
||||
@ -1330,8 +1330,8 @@ void QZipWriter::addDirectory(const QString &dirName)
|
||||
{
|
||||
QString name(QDir::fromNativeSeparators(dirName));
|
||||
// separator is mandatory
|
||||
if (!name.endsWith(QLatin1Char('/')))
|
||||
name.append(QLatin1Char('/'));
|
||||
if (!name.endsWith(u'/'))
|
||||
name.append(u'/');
|
||||
d->addEntry(QZipWriterPrivate::Directory, name, QByteArray());
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ QString qt_getEnglishName(const QString &familyName, bool includeStyle)
|
||||
const QFontNames names = qt_getCanonicalFontNames(table, bytes);
|
||||
i18n_name = names.name;
|
||||
if (includeStyle)
|
||||
i18n_name += QLatin1Char(' ') + names.style;
|
||||
i18n_name += u' ' + names.style;
|
||||
}
|
||||
error:
|
||||
delete [] table;
|
||||
@ -509,7 +509,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
StoreFontPayload *sfp)
|
||||
{
|
||||
// the "@family" fonts are just the same as "family". Ignore them.
|
||||
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_")))
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_")))
|
||||
return false;
|
||||
|
||||
uchar charSet = logFont.lfCharSet;
|
||||
@ -782,10 +782,10 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wstrict-aliasing")
|
||||
QString uniqueFamilyName = QLatin1Char('f')
|
||||
+ QString::number(guid.Data1, 36) + QLatin1Char('-')
|
||||
+ QString::number(guid.Data2, 36) + QLatin1Char('-')
|
||||
+ QString::number(guid.Data3, 36) + QLatin1Char('-')
|
||||
QString uniqueFamilyName = u'f'
|
||||
+ QString::number(guid.Data1, 36) + u'-'
|
||||
+ QString::number(guid.Data2, 36) + u'-'
|
||||
+ QString::number(guid.Data3, 36) + u'-'
|
||||
+ QString::number(*reinterpret_cast<quint64 *>(guid.Data4), 36);
|
||||
QT_WARNING_POP
|
||||
|
||||
|
@ -140,7 +140,7 @@ static FontKeys &fontKeys()
|
||||
#if QT_CONFIG(regularexpression)
|
||||
realKey.remove(sizeListMatch);
|
||||
#endif
|
||||
const auto fontNames = QStringView(realKey).trimmed().split(QLatin1Char('&'));
|
||||
const auto fontNames = QStringView(realKey).trimmed().split(u'&');
|
||||
fontKey.fontNames.reserve(fontNames.size());
|
||||
for (const auto &fontName : fontNames)
|
||||
fontKey.fontNames.append(fontName.trimmed().toString());
|
||||
@ -176,7 +176,7 @@ static bool addFontToDatabase(QString familyName,
|
||||
int type)
|
||||
{
|
||||
// the "@family" fonts are just the same as "family". Ignore them.
|
||||
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_")))
|
||||
if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_")))
|
||||
return false;
|
||||
|
||||
uchar charSet = logFont.lfCharSet;
|
||||
|
@ -1190,9 +1190,9 @@ void QGridLayoutEngine::dump(int indent) const
|
||||
QString message = QLatin1String("[ ");
|
||||
for (int column = 0; column < internalGridColumnCount(); ++column) {
|
||||
message += QString::number(q_items.indexOf(itemAt(row, column))).rightJustified(3);
|
||||
message += QLatin1Char(' ');
|
||||
message += u' ';
|
||||
}
|
||||
message += QLatin1Char(']');
|
||||
message += u']';
|
||||
qDebug("%*s %s", indent, "", qPrintable(message));
|
||||
}
|
||||
|
||||
@ -1217,7 +1217,7 @@ void QGridLayoutEngine::dump(int indent) const
|
||||
message += QLatin1String((message.isEmpty() ? "[" : ", "));
|
||||
message += QString::number(cellPos->at(i));
|
||||
}
|
||||
message += QLatin1Char(']');
|
||||
message += u']';
|
||||
qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message));
|
||||
cellPos = &q_xx;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
#define KTX_IDENTIFIER_LENGTH 12
|
||||
static const char ktxIdentifier[KTX_IDENTIFIER_LENGTH] = { '\xAB', 'K', 'T', 'X', ' ', '1', '1', '\xBB', '\r', '\n', '\x1A', '\n' };
|
||||
static const quint32 platformEndianIdentifier = 0x04030201;
|
||||
@ -237,7 +239,7 @@ QMap<QByteArray, QByteArray> QKtxHandler::decodeKeyValues(QByteArrayView view) c
|
||||
// To separate the key and value we convert the complete data to utf-8 and find the first
|
||||
// null terminator from the left, here we split the data into two.
|
||||
const auto str = QString::fromUtf8(view.constData() + offset, keyAndValueByteSize);
|
||||
const int idx = str.indexOf(QLatin1Char('\0'));
|
||||
const int idx = str.indexOf('\0'_L1);
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
|
@ -302,7 +302,7 @@ QString QUndoCommand::actionText() const
|
||||
|
||||
void QUndoCommand::setText(const QString &text)
|
||||
{
|
||||
int cdpos = text.indexOf(QLatin1Char('\n'));
|
||||
int cdpos = text.indexOf(u'\n');
|
||||
if (cdpos > 0) {
|
||||
d->text = text.left(cdpos);
|
||||
d->actionText = text.mid(cdpos + 1);
|
||||
@ -1044,7 +1044,7 @@ void QUndoStackPrivate::setPrefixedText(QAction *action, const QString &prefix,
|
||||
if (defaultText.isEmpty()) {
|
||||
QString s = prefix;
|
||||
if (!prefix.isEmpty() && !text.isEmpty())
|
||||
s.append(QLatin1Char(' '));
|
||||
s.append(u' ');
|
||||
s.append(text);
|
||||
action->setText(s);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user