From 09de33f59a29fe5b55b4cd3356f1d3a9d4b69e87 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 28 Feb 2024 09:04:47 +0100 Subject: [PATCH] rename -> InstrumentItem::clone --- GUI/Model/Device/InstrumentItems.cpp | 2 +- GUI/Model/Device/InstrumentItems.h | 2 +- GUI/Model/Job/JobItem.cpp | 2 +- GUI/Model/Type/ModelForSet.cpp | 2 +- GUI/Model/Type/SetWithModel.h | 1 + GUI/View/List/InstrumentsQModel.cpp | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index a5f12b514c6..f5ede570f87 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -109,7 +109,7 @@ InstrumentItem::InstrumentItem() InstrumentItem::~InstrumentItem() = default; -InstrumentItem* InstrumentItem::createItemCopy() const +InstrumentItem* InstrumentItem::clone() const { const auto type = InstrumentsCatalog::type(this); auto* copy = InstrumentsCatalog::create(type); diff --git a/GUI/Model/Device/InstrumentItems.h b/GUI/Model/Device/InstrumentItems.h index 83ee21087ed..5b05bd14cc4 100644 --- a/GUI/Model/Device/InstrumentItems.h +++ b/GUI/Model/Device/InstrumentItems.h @@ -60,7 +60,7 @@ public: virtual void readFrom(QXmlStreamReader* r); //! Creates an exact copy; also ID is the same! - InstrumentItem* createItemCopy() const; + InstrumentItem* clone() const; QString id() const { return m_id; } void setId(const QString& id) { m_id = id; } diff --git a/GUI/Model/Job/JobItem.cpp b/GUI/Model/Job/JobItem.cpp index 90a7301bd0a..10b5f34ca9b 100644 --- a/GUI/Model/Job/JobItem.cpp +++ b/GUI/Model/Job/JobItem.cpp @@ -134,7 +134,7 @@ void JobItem::createParameterTree() void JobItem::cloneItemIntoJob(const InstrumentItem* instrument) { - m_instrument.setCertainItem(instrument->createItemCopy()); + m_instrument.setCertainItem(instrument->clone()); m_instrument.certainItem()->setId(QUuid::createUuid().toString()); } diff --git a/GUI/Model/Type/ModelForSet.cpp b/GUI/Model/Type/ModelForSet.cpp index d3c6cd3255d..0df1e42145a 100644 --- a/GUI/Model/Type/ModelForSet.cpp +++ b/GUI/Model/Type/ModelForSet.cpp @@ -76,7 +76,7 @@ void ModelForSet::cloneItem() { const InstrumentItem* t = set()->currentItem(); ASSERT(t); - InstrumentItem* t2 = t->createItemCopy(); + InstrumentItem* t2 = t->clone(); t2->setId(QUuid::createUuid().toString()); pushItem(t2); } diff --git a/GUI/Model/Type/SetWithModel.h b/GUI/Model/Type/SetWithModel.h index 40dec4fdfa9..9163d96a74d 100644 --- a/GUI/Model/Type/SetWithModel.h +++ b/GUI/Model/Type/SetWithModel.h @@ -48,6 +48,7 @@ public: if (i != m_current_index) m_current_index = i; } + size_t currentIndex() const { return m_current_index; } const T* currentItem() const { diff --git a/GUI/View/List/InstrumentsQModel.cpp b/GUI/View/List/InstrumentsQModel.cpp index e01afca9cf7..1f19c840d04 100644 --- a/GUI/View/List/InstrumentsQModel.cpp +++ b/GUI/View/List/InstrumentsQModel.cpp @@ -76,7 +76,7 @@ void InstrumentsQModel::cloneItem() { const InstrumentItem* t = set()->currentItem(); ASSERT(t); - InstrumentItem* t2 = t->createItemCopy(); + InstrumentItem* t2 = t->clone(); t2->setId(QUuid::createUuid().toString()); pushItem(t2); } -- GitLab