From a48a4453e2565627c4561b0dad3df0c4c7a6adb1 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 25 Jan 2024 22:05:57 +0100 Subject: [PATCH] corr writing instrument item --- GUI/View/Instrument/InstrumentsQListView.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/GUI/View/Instrument/InstrumentsQListView.cpp b/GUI/View/Instrument/InstrumentsQListView.cpp index 351a497c1d0..1daa97d34cd 100644 --- a/GUI/View/Instrument/InstrumentsQListView.cpp +++ b/GUI/View/Instrument/InstrumentsQListView.cpp @@ -23,8 +23,10 @@ #include <QMessageBox> #include <QVBoxLayout> +#include "GUI/Model/Descriptor/SelectionProperty.h" #include "GUI/Model/Device/InstrumentItems.h" #include "GUI/Model/Device/InstrumentItemCatalog.h" +#include "GUI/Support/XML/UtilXML.h" namespace { @@ -173,15 +175,14 @@ void InstrumentsQListView::onStoreInLibrary() w.setAutoFormatting(true); w.writeStartDocument(); w.writeStartElement(XML_ROOT_TAG); - w.writeAttribute(XML_VERSION_TAG, "2"); - const uint typeIndex = static_cast<uint>(Catalog::type(ii)); - XML::writeAttribute(w, XML::Attrib::type, typeIndex); + const uint typeIndex = static_cast<uint>(InstrumentItemCatalog::type(ii)); + XML::writeAttribute(&w, XML::Attrib::type, typeIndex); // The next line allows to see the name of item type in XML. May be skipped while reading. - XML::writeAttribute(w, XML::Attrib::name, - Catalog::uiInfo(Catalog::type(m_p.get())).menuEntry); + XML::writeAttribute(&w, XML::Attrib::name, + InstrumentItemCatalog::uiInfo(InstrumentItemCatalog::type(ii)).menuEntry); - instrument->writeTo(&w); + ii->writeTo(&w); w.writeEndElement(); w.writeEndDocument(); @@ -194,6 +195,7 @@ void InstrumentsQListView::onLoadFromLibrary() if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) throw std::runtime_error("Cannot open instrument file for reading"); + /* InstrumentItem ii; QXmlStreamReader r(&file); @@ -213,11 +215,11 @@ void InstrumentsQListView::onLoadFromLibrary() } if (r.hasError()) throw std::runtime_error("Error while reading instrument file"); - - file.close(); - QModelIndex idx = m_model->copyInstrument(&ii); selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect); + */ + file.close(); + } void InstrumentsQListView::updateActions() -- GitLab