From e40030ed3a6459013a349a8c597ccb59242e82dd Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Mon, 6 Feb 2023 19:13:28 +0100 Subject: [PATCH] RealModel is not SessionModel --- GUI/Model/Model/ApplicationModels.cpp | 1 - GUI/Model/Model/RealModel.cpp | 2 +- GUI/Model/Model/RealModel.h | 8 +++++--- GUI/View/Import/RealDataTreeModel.cpp | 12 ------------ GUI/View/Import/RealDataTreeModel.h | 1 - 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/GUI/Model/Model/ApplicationModels.cpp b/GUI/Model/Model/ApplicationModels.cpp index e35dfb90ad4..6495c8d5491 100644 --- a/GUI/Model/Model/ApplicationModels.cpp +++ b/GUI/Model/Model/ApplicationModels.cpp @@ -37,7 +37,6 @@ ApplicationModels::ApplicationModels() m_realDataModel = std::make_unique<RealModel>(this); m_jobModel = std::make_unique<JobModel>(this); - connectModel(m_realDataModel.get()); connectModel(m_jobModel.get()); } diff --git a/GUI/Model/Model/RealModel.cpp b/GUI/Model/Model/RealModel.cpp index dccd1eee95f..9e005bd1ef5 100644 --- a/GUI/Model/Model/RealModel.cpp +++ b/GUI/Model/Model/RealModel.cpp @@ -29,7 +29,7 @@ const QString SelectedRank("SelectedRank"); } // namespace RealModel::RealModel(QObject* parent) - : SessionModel("no_model_tag", parent) + : QObject(parent) { setObjectName("RealModel"); } diff --git a/GUI/Model/Model/RealModel.h b/GUI/Model/Model/RealModel.h index 07eadb28fbd..6ace34638db 100644 --- a/GUI/Model/Model/RealModel.h +++ b/GUI/Model/Model/RealModel.h @@ -15,13 +15,15 @@ #ifndef BORNAGAIN_GUI_MODEL_MODEL_REALMODEL_H #define BORNAGAIN_GUI_MODEL_MODEL_REALMODEL_H -#include "GUI/Model/Model/SessionModel.h" +#include <QObject> +#include <QXmlStreamWriter> class RealItem; class DataItem; +class MessageService; //! The RealModel class is a model to store all imported RealItem's. -class RealModel : public SessionModel { +class RealModel : public QObject { Q_OBJECT public: @@ -29,7 +31,7 @@ public: ~RealModel(); QVector<DataItem*> dataItems() const; - void clear() override; + void clear(); void writeToProject(QXmlStreamWriter* w, const QString& projectDir); void readFromProject(QXmlStreamReader* r, const QString& projectDir, MessageService* messageService = nullptr); diff --git a/GUI/View/Import/RealDataTreeModel.cpp b/GUI/View/Import/RealDataTreeModel.cpp index 309254b6af8..295b0ef7307 100644 --- a/GUI/View/Import/RealDataTreeModel.cpp +++ b/GUI/View/Import/RealDataTreeModel.cpp @@ -29,9 +29,6 @@ RealDataTreeModel::RealDataTreeModel(QObject* parent, RealModel* model) m_items[rank - 1] = model->realItems(rank); updateSubscriptions(); - - connect(m_model, &RealModel::modelAboutToBeReset, this, &RealDataTreeModel::clear, - Qt::UniqueConnection); } void RealDataTreeModel::setVisibleRanks(QSet<int> visibleRanks) @@ -62,15 +59,6 @@ void RealDataTreeModel::refreshAfterModelChange() updateSubscriptions(); } -void RealDataTreeModel::clear() -{ - beginResetModel(); - m_items[0].clear(); - m_items[1].clear(); - endResetModel(); - updateSubscriptions(); -} - void RealDataTreeModel::removeItem(RealItem* item) { QModelIndex index = indexForItem(item); diff --git a/GUI/View/Import/RealDataTreeModel.h b/GUI/View/Import/RealDataTreeModel.h index 977ce72dedd..64fe7dc099f 100644 --- a/GUI/View/Import/RealDataTreeModel.h +++ b/GUI/View/Import/RealDataTreeModel.h @@ -55,7 +55,6 @@ public: private: void updateSubscriptions(); void onContentsProcessed(RealItem* item); - void clear(); private: RealModel* m_model = nullptr; -- GitLab