Resolve warnings: comparison between unsigned and signed types
This commit is contained in:
parent
8cede3f065
commit
e079f0d1eb
4 changed files with 11 additions and 9 deletions
|
@ -134,10 +134,11 @@ public:
|
|||
|
||||
QVariant WindowsModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if ((index.row() < 0) || (index.row() >= _windowData.size()))
|
||||
auto tRow = static_cast<size_t>(index.row());
|
||||
if ((index.row() < 0) || (tRow >= _windowData.size()))
|
||||
return {};
|
||||
|
||||
const auto& d = _windowData.at(static_cast<size_t>(index.row()));
|
||||
const auto& d = _windowData.at(tRow);
|
||||
switch (role) {
|
||||
case WindowId:
|
||||
return d.windowId;
|
||||
|
@ -157,10 +158,11 @@ QVariant WindowsModel::data(const QModelIndex& index, int role) const
|
|||
|
||||
bool WindowsModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
||||
{
|
||||
if ((index.row() < 0) || (index.row() >= _windowData.size()))
|
||||
auto tRow = static_cast<size_t>(index.row());
|
||||
if ((index.row() < 0) || (tRow >= _windowData.size()))
|
||||
return false;
|
||||
|
||||
auto& d = _windowData[static_cast<size_t>(index.row())];
|
||||
auto& d = _windowData[tRow];
|
||||
QSettings settings;
|
||||
if (role == WindowSize) {
|
||||
d.geometry.setSize(value.toSizeF());
|
||||
|
|
|
@ -67,7 +67,7 @@ QVariant PropertyItemModel::data(const QModelIndex &index, int role) const
|
|||
if (!index.isValid())
|
||||
return {};
|
||||
|
||||
if (index.row() >= _nodes.size())
|
||||
if (static_cast<size_t>(index.row()) >= _nodes.size())
|
||||
return {};
|
||||
|
||||
SGPropertyNode_ptr n = _nodes.at(index.row());
|
||||
|
|
|
@ -193,7 +193,7 @@ QString FGQmlPropertyModel::childName() const
|
|||
QHash<int, QByteArray> FGQmlPropertyModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> r;
|
||||
for (int i = 0; i < d->_roles.size(); ++i) {
|
||||
for (size_t i = 0; i < d->_roles.size(); ++i) {
|
||||
r[i] = QByteArray::fromStdString(d->_roles.at(i));
|
||||
}
|
||||
return r;
|
||||
|
|
|
@ -126,7 +126,7 @@ int UnitsModel::rowCount(const QModelIndex &) const
|
|||
QVariant UnitsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
int row = index.row();
|
||||
if ((row < 0) || (row >= m_enabledUnits.size()))
|
||||
if ((row < 0) || (static_cast<size_t>(row) >= m_enabledUnits.size()))
|
||||
return {};
|
||||
|
||||
const Units::Type u = m_enabledUnits.at(row);
|
||||
|
@ -267,10 +267,10 @@ void UnitsModel::setMode(Units::Mode mode)
|
|||
|
||||
void UnitsModel::setSelectedIndex(int selectedIndex)
|
||||
{
|
||||
if (m_activeIndex == selectedIndex)
|
||||
if (m_activeIndex == static_cast<quint32>(selectedIndex))
|
||||
return;
|
||||
|
||||
if ((selectedIndex < 0) || (selectedIndex >= m_enabledUnits.size()))
|
||||
if ((selectedIndex < 0) || (static_cast<size_t>(selectedIndex) >= m_enabledUnits.size()))
|
||||
return;
|
||||
|
||||
m_activeIndex = selectedIndex;
|
||||
|
|
Loading…
Add table
Reference in a new issue