forked from qt-creator/qt-creator
Work around QHash::unite deprecation
Change-Id: Ibf199b5e3f2ca99b7e0cafe20893a509d9eab906 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -1298,4 +1299,14 @@ QList<T> toList(const QSet<T> &set)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Key, class T>
|
||||||
|
void addToHash(QHash<Key, T> *result, const QHash<Key, T> &additionalContents)
|
||||||
|
{
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||||
|
result->unite(additionalContents);
|
||||||
|
#else
|
||||||
|
result->insert(additionalContents);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -319,7 +319,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
|||||||
|
|
||||||
QHash<QString, QtTestCodeLocationList> dataTags;
|
QHash<QString, QtTestCodeLocationList> dataTags;
|
||||||
for (const QString &file : files)
|
for (const QString &file : files)
|
||||||
dataTags.unite(checkForDataTags(file, snapshot));
|
Utils::addToHash(&dataTags, checkForDataTags(file, snapshot));
|
||||||
|
|
||||||
QtTestParseResult *parseResult = new QtTestParseResult(id);
|
QtTestParseResult *parseResult = new QtTestParseResult(id);
|
||||||
parseResult->itemType = TestTreeItem::TestCase;
|
parseResult->itemType = TestTreeItem::TestCase;
|
||||||
|
@@ -165,7 +165,7 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
QHash<int, QByteArray> SessionModel::roleNames() const
|
QHash<int, QByteArray> SessionModel::roleNames() const
|
||||||
{
|
{
|
||||||
static QHash<int, QByteArray> extraRoles{
|
static const QHash<int, QByteArray> extraRoles{
|
||||||
{Qt::DisplayRole, "sessionName"},
|
{Qt::DisplayRole, "sessionName"},
|
||||||
{DefaultSessionRole, "defaultSession"},
|
{DefaultSessionRole, "defaultSession"},
|
||||||
{ActiveSessionRole, "activeSession"},
|
{ActiveSessionRole, "activeSession"},
|
||||||
@@ -173,7 +173,9 @@ QHash<int, QByteArray> SessionModel::roleNames() const
|
|||||||
{ProjectsPathRole, "projectsPath"},
|
{ProjectsPathRole, "projectsPath"},
|
||||||
{ProjectsDisplayRole, "projectsName"}
|
{ProjectsDisplayRole, "projectsName"}
|
||||||
};
|
};
|
||||||
return QAbstractTableModel::roleNames().unite(extraRoles);
|
QHash<int, QByteArray> roles = QAbstractTableModel::roleNames();
|
||||||
|
Utils::addToHash(&roles, extraRoles);
|
||||||
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionModel::sort(int column, Qt::SortOrder order)
|
void SessionModel::sort(int column, Qt::SortOrder order)
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -193,7 +194,7 @@ void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
|
|||||||
|
|
||||||
void ItemLibraryEntry::addHints(const QHash<QString, QString> &hints)
|
void ItemLibraryEntry::addHints(const QHash<QString, QString> &hints)
|
||||||
{
|
{
|
||||||
m_data->hints.unite(hints);
|
Utils::addToHash(&m_data->hints, hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value)
|
void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value)
|
||||||
|
@@ -610,7 +610,7 @@ void SemanticHighlighter::reportMessagesInfo(const QVector<QTextLayout::FormatRa
|
|||||||
// but will use them only after a signal sent by that same thread, maybe we should transfer
|
// but will use them only after a signal sent by that same thread, maybe we should transfer
|
||||||
// them more explicitly
|
// them more explicitly
|
||||||
m_extraFormats = formats;
|
m_extraFormats = formats;
|
||||||
m_extraFormats.unite(m_formats);
|
Utils::addToHash(&m_extraFormats, m_formats);
|
||||||
m_diagnosticRanges = diagnosticRanges;
|
m_diagnosticRanges = diagnosticRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -312,7 +312,7 @@ QVariant FlameGraphModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
QHash<int, QByteArray> FlameGraphModel::roleNames() const
|
QHash<int, QByteArray> FlameGraphModel::roleNames() const
|
||||||
{
|
{
|
||||||
static QHash<int, QByteArray> extraRoles{
|
static const QHash<int, QByteArray> extraRoles{
|
||||||
{TypeIdRole, "typeId"},
|
{TypeIdRole, "typeId"},
|
||||||
{TypeRole, "type"},
|
{TypeRole, "type"},
|
||||||
{DurationRole, "duration"},
|
{DurationRole, "duration"},
|
||||||
@@ -328,7 +328,9 @@ QHash<int, QByteArray> FlameGraphModel::roleNames() const
|
|||||||
{AllocationsRole, "allocations" },
|
{AllocationsRole, "allocations" },
|
||||||
{MemoryRole, "memory" }
|
{MemoryRole, "memory" }
|
||||||
};
|
};
|
||||||
return QAbstractItemModel::roleNames().unite(extraRoles);
|
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
|
||||||
|
Utils::addToHash(&roles, extraRoles);
|
||||||
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerModelManager *FlameGraphModel::modelManager() const
|
QmlProfilerModelManager *FlameGraphModel::modelManager() const
|
||||||
|
Reference in New Issue
Block a user