From e079f0d1eb6be5d04de71f14f5174fbb3ebdcf50 Mon Sep 17 00:00:00 2001
From: Scott Giese <scttgs0@gmail.com>
Date: Sat, 29 Aug 2020 10:15:02 -0500
Subject: [PATCH] Resolve warnings: comparison between unsigned and signed
 types

---
 src/GUI/FGQQWindowManager.cxx | 10 ++++++----
 src/GUI/PropertyItemModel.cxx |  2 +-
 src/GUI/QmlPropertyModel.cxx  |  2 +-
 src/GUI/UnitsModel.cxx        |  6 +++---
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/GUI/FGQQWindowManager.cxx b/src/GUI/FGQQWindowManager.cxx
index b6b9ac19b..3f7b5bd85 100644
--- a/src/GUI/FGQQWindowManager.cxx
+++ b/src/GUI/FGQQWindowManager.cxx
@@ -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());
diff --git a/src/GUI/PropertyItemModel.cxx b/src/GUI/PropertyItemModel.cxx
index ef2e520c8..dee619d52 100644
--- a/src/GUI/PropertyItemModel.cxx
+++ b/src/GUI/PropertyItemModel.cxx
@@ -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());
diff --git a/src/GUI/QmlPropertyModel.cxx b/src/GUI/QmlPropertyModel.cxx
index 846934536..070d5fd8d 100644
--- a/src/GUI/QmlPropertyModel.cxx
+++ b/src/GUI/QmlPropertyModel.cxx
@@ -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;
diff --git a/src/GUI/UnitsModel.cxx b/src/GUI/UnitsModel.cxx
index 121f16dcd..c329bd784 100644
--- a/src/GUI/UnitsModel.cxx
+++ b/src/GUI/UnitsModel.cxx
@@ -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;