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