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
|
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 {};
|
return {};
|
||||||
|
|
||||||
const auto& d = _windowData.at(static_cast<size_t>(index.row()));
|
const auto& d = _windowData.at(tRow);
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case WindowId:
|
case WindowId:
|
||||||
return d.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)
|
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;
|
return false;
|
||||||
|
|
||||||
auto& d = _windowData[static_cast<size_t>(index.row())];
|
auto& d = _windowData[tRow];
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
if (role == WindowSize) {
|
if (role == WindowSize) {
|
||||||
d.geometry.setSize(value.toSizeF());
|
d.geometry.setSize(value.toSizeF());
|
||||||
|
|
|
@ -67,7 +67,7 @@ QVariant PropertyItemModel::data(const QModelIndex &index, int role) const
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (index.row() >= _nodes.size())
|
if (static_cast<size_t>(index.row()) >= _nodes.size())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
SGPropertyNode_ptr n = _nodes.at(index.row());
|
SGPropertyNode_ptr n = _nodes.at(index.row());
|
||||||
|
|
|
@ -193,7 +193,7 @@ QString FGQmlPropertyModel::childName() const
|
||||||
QHash<int, QByteArray> FGQmlPropertyModel::roleNames() const
|
QHash<int, QByteArray> FGQmlPropertyModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> r;
|
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));
|
r[i] = QByteArray::fromStdString(d->_roles.at(i));
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -126,7 +126,7 @@ int UnitsModel::rowCount(const QModelIndex &) const
|
||||||
QVariant UnitsModel::data(const QModelIndex &index, int role) const
|
QVariant UnitsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
if ((row < 0) || (row >= m_enabledUnits.size()))
|
if ((row < 0) || (static_cast<size_t>(row) >= m_enabledUnits.size()))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const Units::Type u = m_enabledUnits.at(row);
|
const Units::Type u = m_enabledUnits.at(row);
|
||||||
|
@ -267,10 +267,10 @@ void UnitsModel::setMode(Units::Mode mode)
|
||||||
|
|
||||||
void UnitsModel::setSelectedIndex(int selectedIndex)
|
void UnitsModel::setSelectedIndex(int selectedIndex)
|
||||||
{
|
{
|
||||||
if (m_activeIndex == selectedIndex)
|
if (m_activeIndex == static_cast<quint32>(selectedIndex))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((selectedIndex < 0) || (selectedIndex >= m_enabledUnits.size()))
|
if ((selectedIndex < 0) || (static_cast<size_t>(selectedIndex) >= m_enabledUnits.size()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_activeIndex = selectedIndex;
|
m_activeIndex = selectedIndex;
|
||||||
|
|
Loading…
Add table
Reference in a new issue