Suppress C4267 conversion warnings (#13307)

- warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data

Caused by mismatch between size_type of std and Qt containers. It is safe to cast to int as all of those containers hold low number of objects.
This commit is contained in:
Kacper Michajłow
2021-06-11 07:51:06 +02:00
committed by GitHub
parent 6c66d02aff
commit ccb59fbad3
7 changed files with 24 additions and 22 deletions

View File

@@ -79,7 +79,7 @@ BaseLogModel::BaseLogModel(QObject *parent)
int BaseLogModel::rowCount(const QModelIndex &) const
{
return m_messages.size();
return static_cast<int>(m_messages.size());
}
int BaseLogModel::columnCount(const QModelIndex &) const
@@ -120,7 +120,7 @@ void BaseLogModel::addNewMessage(const BaseLogModel::Message &message)
// but because of calling of beginInsertRows function we'll have ghost rows.
if (m_messages.size() == MAX_VISIBLE_MESSAGES)
{
const int lastMessage = m_messages.size() - 1;
const int lastMessage = static_cast<int>(m_messages.size()) - 1;
beginRemoveRows(QModelIndex(), lastMessage, lastMessage);
m_messages.pop_back();
endRemoveRows();

View File

@@ -317,7 +317,7 @@ TagModelItem *TagFilterModel::findItem(const QString &tag)
QVector<TagModelItem *> TagFilterModel::findItems(const TagSet &tags)
{
QVector<TagModelItem *> items;
items.reserve(tags.size());
items.reserve(tags.count());
for (const QString &tag : tags)
{
TagModelItem *item = findItem(tag);