From 9ec4784492e2c00e77e642a9bb0300ca5be36f86 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 29 Feb 2024 12:41:45 +0100 Subject: [PATCH] rename BaseSet -> AbstractSetModel --- GUI/Model/Type/SetWithModel.cpp | 6 +++--- GUI/Model/Type/SetWithModel.h | 18 +++++++++--------- GUI/View/Widget/SetView.cpp | 2 +- GUI/View/Widget/SetView.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/GUI/Model/Type/SetWithModel.cpp b/GUI/Model/Type/SetWithModel.cpp index 36066d0e22f..dd0a69fa706 100644 --- a/GUI/Model/Type/SetWithModel.cpp +++ b/GUI/Model/Type/SetWithModel.cpp @@ -3,7 +3,7 @@ // BornAgain: simulate and fit reflection and scattering // //! @file GUI/Model/Type/SetWithModel.cpp -//! @brief Implements class BaseSet, to enforce vtable generation. +//! @brief Implements class AbstractSetModel, to enforce vtable generation. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -14,8 +14,8 @@ #include "GUI/Model/Type/SetWithModel.h" -BaseSet::BaseSet(QObject* parent) +AbstractSetModel::AbstractSetModel(QObject* parent) : QObject(parent) { } -BaseSet::~BaseSet() = default; +AbstractSetModel::~AbstractSetModel() = default; diff --git a/GUI/Model/Type/SetWithModel.h b/GUI/Model/Type/SetWithModel.h index a134befa7f8..0c57c403f29 100644 --- a/GUI/Model/Type/SetWithModel.h +++ b/GUI/Model/Type/SetWithModel.h @@ -30,11 +30,11 @@ //! Needed to support Qt signals (the Q_OBJECT macro does not work in templated classes). //! The virtual functions setCurrentIndex(i) and model() are used in class SetView. -class BaseSet : public QObject { +class AbstractSetModel : public QObject { Q_OBJECT public: - explicit BaseSet(QObject* parent = nullptr); - virtual ~BaseSet(); + explicit AbstractSetModel(QObject* parent = nullptr); + virtual ~AbstractSetModel(); virtual void setCurrentIndex(size_t i) = 0; virtual QAbstractListModel* model() = 0; @@ -46,7 +46,7 @@ signals: //! A set of NamedItem%s that has a current item and a QListModel. -template <class T> class SetWithModel : public BaseSet { +template <class T> class SetWithModel : public AbstractSetModel { public: SetWithModel() : m_qmodel(std::make_unique<ModelForSet<T>>(this)) @@ -60,7 +60,7 @@ public: m_vec.clear(); m_idx = -1; m_qmodel->endResetModel(); - emit BaseSet::setChanged(); + emit AbstractSetModel::setChanged(); } void delete_current() { @@ -69,7 +69,7 @@ public: m_vec.delete_at(m_idx); update_current(); m_qmodel->endRemoveRows(); - emit BaseSet::setChanged(); + emit AbstractSetModel::setChanged(); } void add_item(T* t) { @@ -77,7 +77,7 @@ public: m_vec.push_back(t); m_idx = m_vec.size() - 1; m_qmodel->endInsertRows(); - emit BaseSet::setChanged(); + emit AbstractSetModel::setChanged(); } void add_items(std::vector<T*> v) { @@ -86,7 +86,7 @@ public: m_vec.push_back(t); m_idx = m_vec.size() - 1; m_qmodel->endInsertRows(); - emit BaseSet::setChanged(); + emit AbstractSetModel::setChanged(); } void setCurrentIndex(size_t i) override @@ -96,7 +96,7 @@ public: if (i != m_idx) m_idx = i; m_qmodel->endResetModel(); - emit BaseSet::setChanged(); + emit AbstractSetModel::setChanged(); } size_t currentIndex() const { return m_idx; } diff --git a/GUI/View/Widget/SetView.cpp b/GUI/View/Widget/SetView.cpp index dc8573df357..72d209e1c45 100644 --- a/GUI/View/Widget/SetView.cpp +++ b/GUI/View/Widget/SetView.cpp @@ -16,7 +16,7 @@ #include "GUI/Model/Type/SetWithModel.h" #include "GUI/View/Widget/ListItemDelegate.h" -SetView::SetView(BaseSet* set, int minimum_width, QSizePolicy policy) +SetView::SetView(AbstractSetModel* set, int minimum_width, QSizePolicy policy) { setMinimumWidth(minimum_width); setSizePolicy(policy); diff --git a/GUI/View/Widget/SetView.h b/GUI/View/Widget/SetView.h index 1b8135dd6fe..519a0498df3 100644 --- a/GUI/View/Widget/SetView.h +++ b/GUI/View/Widget/SetView.h @@ -17,13 +17,13 @@ #include <QListView> -class BaseSet; +class AbstractSetModel; //! Instrument selector on the left side of InstrumentView. class SetView : public QListView { public: - SetView(BaseSet*, int minimum_width = 200, + SetView(AbstractSetModel*, int minimum_width = 200, QSizePolicy policy = {QSizePolicy::Preferred, QSizePolicy::Expanding}); }; -- GitLab