From 19a1c115e0bbeda0c8dd7bcb18e82427db9b7751 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Feb 2025 11:46:19 -0500 Subject: cmake-gui: Fix integer conversion warnings with Qt 6 --- Source/QtDialog/QCMakeCacheView.cxx | 6 +++--- Source/QtDialog/QCMakeCacheView.h | 5 +++-- Source/QtDialog/QCMakePresetItemModel.cxx | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 90f5ac2..8c7801b 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -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; } diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 4df17f7..879caf5 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -3,6 +3,7 @@ #pragma once #include "QCMake.h" +#include "QCMakeSizeType.h" #include #include #include @@ -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; diff --git a/Source/QtDialog/QCMakePresetItemModel.cxx b/Source/QtDialog/QCMakePresetItemModel.cxx index ac071f2..4df9b1c 100644 --- a/Source/QtDialog/QCMakePresetItemModel.cxx +++ b/Source/QtDialog/QCMakePresetItemModel.cxx @@ -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(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(this->m_presets.size() + 1); } -- cgit v0.12