Suppress C4267 conversion warnings

- 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
2020-08-27 18:12:08 +02:00
committed by Vladimir Golovnev (glassez)
parent 81de07789a
commit 81ad324209
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();