Use QStringBuilder more to optimize memory allocations
Change-Id: I2939ffa10496fdc59e0402a9cb54458565ccd657 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bee70b24c1
commit
6b2071c697
@ -616,10 +616,10 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
|
||||
#if !defined(QT_BUILD_QMAKE) && !defined(QT_NO_SETTINGS)
|
||||
QScopedPointer<const QSettings> settings(QLibraryInfoPrivate::findConfiguration());
|
||||
if (!settings.isNull()) {
|
||||
QString key = QLatin1String(platformsSection);
|
||||
key += QLatin1Char('/');
|
||||
key += platformName;
|
||||
key += QLatin1String("Arguments");
|
||||
const QString key = QLatin1String(platformsSection)
|
||||
+ QLatin1Char('/')
|
||||
+ platformName
|
||||
+ QLatin1String("Arguments");
|
||||
return settings->value(key).toStringList();
|
||||
}
|
||||
#endif // !QT_BUILD_QMAKE && !QT_NO_SETTINGS
|
||||
|
@ -663,11 +663,8 @@ struct QtFontDesc
|
||||
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
|
||||
{
|
||||
fontDef->family = desc.family->name;
|
||||
if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
|
||||
fontDef->family += QString::fromLatin1(" [");
|
||||
fontDef->family += desc.foundry->name;
|
||||
fontDef->family += QLatin1Char(']');
|
||||
}
|
||||
if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
|
||||
fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
|
||||
|
||||
if (desc.style->smoothScalable
|
||||
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
|
||||
|
@ -395,10 +395,8 @@ void QPlatformFontDatabase::releaseHandle(void *handle)
|
||||
QString QPlatformFontDatabase::fontDir() const
|
||||
{
|
||||
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
|
||||
if (fontpath.isEmpty()) {
|
||||
fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
|
||||
fontpath += QLatin1String("/fonts");
|
||||
}
|
||||
if (fontpath.isEmpty())
|
||||
fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
|
||||
|
||||
return fontpath;
|
||||
}
|
||||
|
@ -73,8 +73,7 @@ QPixmap QAbstractFileIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
|
||||
if (key.isEmpty())
|
||||
return filePixmap(size, mode, state);
|
||||
|
||||
key += QLatin1Char('_');
|
||||
key += QString::number(size.width());
|
||||
key += QLatin1Char('_') + QString::number(size.width());
|
||||
|
||||
QPixmap result;
|
||||
if (!QPixmapCache::find(key, result)) {
|
||||
|
@ -121,9 +121,7 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
|
||||
// so QXcbConnection::atomName() has to be used.
|
||||
if (atomName == QLatin1String("text/uri-list")
|
||||
&& connection->atomName(a) == "text/x-moz-url") {
|
||||
const QByteArray uri = data->split('\n').first();
|
||||
QString mozUri = QString::fromLatin1(uri, uri.size());
|
||||
mozUri += QLatin1Char('\n');
|
||||
const QString mozUri = QLatin1String(data->split('\n').constFirst()) + QLatin1Char('\n');
|
||||
*data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()),
|
||||
mozUri.length() * 2);
|
||||
} else if (atomName == QLatin1String("application/x-color"))
|
||||
|
@ -61,8 +61,7 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
|
||||
, m_number(number)
|
||||
, m_xSettings(Q_NULLPTR)
|
||||
{
|
||||
QByteArray cmAtomName("_NET_WM_CM_S");
|
||||
cmAtomName += QByteArray::number(m_number);
|
||||
const QByteArray cmAtomName = "_NET_WM_CM_S" + QByteArray::number(m_number);
|
||||
m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData());
|
||||
m_compositingActive = connection->getSelectionOwner(m_net_wm_cm_atom);
|
||||
|
||||
|
@ -705,9 +705,7 @@ static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QStrin
|
||||
const ChildConstIterator cend = m_root->m_children.constEnd();
|
||||
for (ChildConstIterator it = m_root->m_children.constBegin(); it != cend; ++it) {
|
||||
const RCCFileInfo *child = it.value();
|
||||
QString childName = path;
|
||||
childName += slash;
|
||||
childName += child->m_name;
|
||||
const QString childName = path + slash + child->m_name;
|
||||
if (child->m_flags & RCCFileInfo::Directory) {
|
||||
resourceDataFileMapRecursion(child, childName, m);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user