cmake-gui: Fix integer conversion warnings with Qt 6

This commit is contained in:
Brad King 2025-02-21 11:46:19 -05:00
parent cbf0d3da52
commit 19a1c115e0
3 changed files with 10 additions and 7 deletions

View File

@ -187,7 +187,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p)
QCMakeCacheModel::~QCMakeCacheModel() = default;
static uint qHash(QCMakeProperty const& p)
static size_t qHash(QCMakeProperty const& p)
{
return qHash(p.Key);
}
@ -349,7 +349,7 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
QCMakePropertyList props = this->properties();
QCMakePropertyList oldProps;
int numNew = this->NewPropertyCount;
cm_qsizetype numNew = this->NewPropertyCount;
cm_qsizetype numTotal = props.count();
for (cm_qsizetype i = numNew; i < numTotal; i++) {
oldProps.append(props[i]);
@ -530,7 +530,7 @@ bool QCMakeCacheModel::editEnabled() const
return this->EditEnabled;
}
int QCMakeCacheModel::newPropertyCount() const
cm_qsizetype QCMakeCacheModel::newPropertyCount() const
{
return this->NewPropertyCount;
}

View File

@ -3,6 +3,7 @@
#pragma once
#include "QCMake.h"
#include "QCMakeSizeType.h"
#include <QItemDelegate>
#include <QSet>
#include <QStandardItemModel>
@ -99,7 +100,7 @@ public:
bool editEnabled() const;
// returns how many new properties there are
int newPropertyCount() const;
cm_qsizetype newPropertyCount() const;
// return flags (overloaded to modify flag based on EditEnabled flag)
Qt::ItemFlags flags(QModelIndex const& index) const;
@ -114,7 +115,7 @@ public:
protected:
bool EditEnabled;
int NewPropertyCount;
cm_qsizetype NewPropertyCount;
bool ShowNewProperties;
ViewType View;

View File

@ -83,7 +83,8 @@ int QCMakePresetItemModel::rowCount(QModelIndex const& parent) const
if (this->m_presets.empty()) {
return 1;
}
return this->m_presets.size() + 2;
// NOLINTNEXTLINE(readability-redundant-casting)
return static_cast<int>(this->m_presets.size() + 2);
}
int QCMakePresetItemModel::columnCount(QModelIndex const& parent) const
@ -144,5 +145,6 @@ int QCMakePresetItemModel::presetNameToRow(QString const& name) const
index++;
}
return this->m_presets.size() + 1;
// NOLINTNEXTLINE(readability-redundant-casting)
return static_cast<int>(this->m_presets.size() + 1);
}