summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-26 12:01:36 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-02-26 09:28:47 +0000
commit13bcdc0f50d04dc5b48ecd1a21da3fa754d10602 (patch)
tree338232e6a081a358a87aea142502458fd6ad7c0c
parent26961e32f34c06f083fe441c23be6874f03446a3 (diff)
ItemModels: replace QLatin1String with QStringLiteral
... wherever it allocates memory. Since the string literal is used in more than one function, to avoid duplication of .rodata, wrap the QStringLiteral in an inline function. Change-Id: If4fca7443b3150b1c8360c850da32f5c567c1065 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 7d80cb0e2b..02b1e1c306 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -1845,7 +1845,7 @@ bool QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, Q
QStringList QAbstractItemModel::mimeTypes() const
{
QStringList types;
- types << QLatin1String("application/x-qabstractitemmodeldatalist");
+ types << QStringLiteral("application/x-qabstractitemmodeldatalist");
return types;
}
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 479a4283b0..9b0c6163b4 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -57,6 +57,11 @@
QT_BEGIN_NAMESPACE
+static inline QString qStandardItemModelDataListMimeType()
+{
+ return QStringLiteral("application/x-qstandarditemmodeldatalist");
+}
+
class QStandardItemModelLessThan
{
public:
@@ -2977,7 +2982,7 @@ void QStandardItemModel::sort(int column, Qt::SortOrder order)
*/
QStringList QStandardItemModel::mimeTypes() const
{
- return QAbstractItemModel::mimeTypes() << QLatin1String("application/x-qstandarditemmodeldatalist");
+ return QAbstractItemModel::mimeTypes() << qStandardItemModelDataListMimeType();
}
/*!
@@ -2989,7 +2994,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
if(!data)
return 0;
- QString format = QLatin1String("application/x-qstandarditemmodeldatalist");
+ const QString format = qStandardItemModelDataListMimeType();
if (!mimeTypes().contains(format))
return data;
QByteArray encoded;
@@ -3084,7 +3089,7 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction))
return false;
// check if the format is supported
- QString format = QLatin1String("application/x-qstandarditemmodeldatalist");
+ const QString format = qStandardItemModelDataListMimeType();
if (!data->hasFormat(format))
return QAbstractItemModel::dropMimeData(data, action, row, column, parent);