From a2afaf4401f46f968d63051a9681b2f936afa241 Mon Sep 17 00:00:00 2001 From: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Mon, 8 Jun 2026 22:42:49 -0400 Subject: [PATCH] Added private get function to preserve constness of at() --- KomplexHubPlugin/common/paginator.h | 30 ++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/KomplexHubPlugin/common/paginator.h b/KomplexHubPlugin/common/paginator.h index 6fc58de..737c73a 100644 --- a/KomplexHubPlugin/common/paginator.h +++ b/KomplexHubPlugin/common/paginator.h @@ -131,16 +131,9 @@ public: * @param index * @return */ - auto at(qsizetype index) -> T + auto at(qsizetype index) const -> T { - QMutexLocker dataLocker(&m_dataMutex); - - if(index < 0 || index >= m_data.count()) - { - return {}; - } - - return m_data.at(index); + return get(index); } /** @@ -264,6 +257,25 @@ protected: } private: + /** + * @brief get + * Private thread-safe get operation. This is needed to preserve the constness + * of the at function + * @param index + * @return + */ + auto get(qsizetype index) -> T + { + QMutexLocker dataLocker(&m_dataMutex); + + if(index < 0 || index >= m_data.count()) + { + return {}; + } + + return m_data.at(index); + } + /** * @brief m_offset * Current absolute offset. Used in fetch operations