From 41a2da2faf06545d355d5be74152e56a37971191 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 21 Dec 2023 17:14:25 +0100 Subject: [PATCH] InstrumentLibraryEditor rm parameter preview --- .../Instrument/InstrumentLibraryEditor.cpp | 74 ------------------- GUI/View/Instrument/InstrumentLibraryEditor.h | 2 - 2 files changed, 76 deletions(-) diff --git a/GUI/View/Instrument/InstrumentLibraryEditor.cpp b/GUI/View/Instrument/InstrumentLibraryEditor.cpp index 73d6691a05c..90c8f941dc7 100644 --- a/GUI/View/Instrument/InstrumentLibraryEditor.cpp +++ b/GUI/View/Instrument/InstrumentLibraryEditor.cpp @@ -57,14 +57,6 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent, m_treeView = new QTreeView; splitter->addWidget(m_treeView); - m_scrollArea = new QScrollArea; - splitter->addWidget(m_scrollArea); - m_scrollArea->setWidgetResizable(true); - - auto* scrollAreaWidgetContents = new QWidget; - scrollAreaWidgetContents->setGeometry(0, 0, 69, 380); - m_scrollArea->setWidget(scrollAreaWidgetContents); - m_buttonBox = new QDialogButtonBox; verticalLayout->addWidget(m_buttonBox); m_buttonBox->setOrientation(Qt::Horizontal); @@ -166,14 +158,11 @@ void InstrumentLibraryEditor::execAdd(const InstrumentItem& instrumentToAdd) ItemViewOverlayButtons::install( m_treeView, [this](const QModelIndex& i, bool h) { return getOverlayActions(i, h); }); m_treeView->setItemDelegate(new ItemDelegateForHTML(this)); - connect(m_treeView->selectionModel(), &QItemSelectionModel::currentChanged, this, - &InstrumentLibraryEditor::createWidgetsForCurrentInstrument); QModelIndex index = m_treeModel->indexForItem(addedInstrument); m_treeView->expandAll(); m_treeView->setCurrentIndex(index); m_treeView->scrollTo(index, QAbstractItemView::PositionAtTop); - createWidgetsForCurrentInstrument(); exec(); } @@ -188,7 +177,6 @@ void InstrumentLibraryEditor::onCurrentChangedForChoose() { m_chosenItem = m_treeModel->itemForIndex(m_treeView->currentIndex()); m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_chosenItem != nullptr); - createWidgetsForCurrentInstrument(); } QList<QAction*> InstrumentLibraryEditor::getOverlayActions(const QModelIndex& index, bool asHover) @@ -214,68 +202,6 @@ QList<QAction*> InstrumentLibraryEditor::getOverlayActions(const QModelIndex& in return {removeAction}; } -void InstrumentLibraryEditor::createWidgetsForCurrentInstrument() -{ - auto* currentInstrument = m_treeModel->itemForIndex(m_treeView->currentIndex()); - if (!currentInstrument) { - m_scrollArea->setWidget(new QWidget(m_scrollArea)); // blank widget - return; - } - - auto* w = new QWidget(m_scrollArea); - auto* layout = new QVBoxLayout(w); - - auto title = QString("Summary (%1 instrument)").arg(currentInstrument->instrumentType()); - auto* g = new CollapsibleGroupBox(title, m_scrollArea, currentInstrument->expandInfo); - g->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - auto* formLayout = new QFormLayout(g->body()); - formLayout->setContentsMargins(17, 17, 17, 17); - layout->addWidget(g); - - auto* nameEdit = new QLineEdit(g); - formLayout->addRow("Name:", nameEdit); - nameEdit->setText(currentInstrument->instrumentName()); - connect(nameEdit, &QLineEdit::textEdited, this, - &InstrumentLibraryEditor::onInstrumentNameEdited); - - auto* descriptionEdit = new QTextEdit(g); - descriptionEdit->setMinimumWidth(300); - descriptionEdit->setFixedHeight(60); // TODO replace by 2*line_height - descriptionEdit->setAcceptRichText(false); - descriptionEdit->setTabChangesFocus(true); - descriptionEdit->setPlainText(currentInstrument->description()); - formLayout->addRow("Description:", descriptionEdit); - connect(descriptionEdit, &QTextEdit::textChanged, [this, descriptionEdit] { - onInstrumentDescriptionEdited(descriptionEdit->toPlainText()); - }); - - auto* ec = m_instrumentLibrary->editController(); - if (auto* sp = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) { - auto* editor = new SpecularInstrumentEditor(m_scrollArea, sp, ec); - connect(editor, &SpecularInstrumentEditor::dataChanged, this, - &InstrumentLibraryEditor::onInstrumentChangedByEditor); - layout->addWidget(editor); - } else if (auto* os = dynamic_cast<OffspecInstrumentItem*>(currentInstrument)) { - auto* editor = new OffspecInstrumentEditor(m_scrollArea, os, ec); - connect(editor, &OffspecInstrumentEditor::dataChanged, this, - &InstrumentLibraryEditor::onInstrumentChangedByEditor); - layout->addWidget(editor); - } else if (auto* gisas = dynamic_cast<GISASInstrumentItem*>(currentInstrument)) { - auto* editor = new GISASInstrumentEditor(m_scrollArea, gisas); - connect(editor, &GISASInstrumentEditor::dataChanged, this, - &InstrumentLibraryEditor::onInstrumentChangedByEditor); - layout->addWidget(editor); - } else if (auto* dp = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) { - auto* editor = new DepthprobeInstrumentEditor(m_scrollArea, dp, ec); - connect(editor, &DepthprobeInstrumentEditor::dataChanged, this, - &InstrumentLibraryEditor::onInstrumentChangedByEditor); - layout->addWidget(editor); - } else - ASSERT_NEVER; - - m_scrollArea->setWidget(w); -} - void InstrumentLibraryEditor::onInstrumentNameEdited(const QString& newName) { QModelIndex index = m_treeView->currentIndex(); diff --git a/GUI/View/Instrument/InstrumentLibraryEditor.h b/GUI/View/Instrument/InstrumentLibraryEditor.h index 059f6bafdb2..0ad971fcab4 100644 --- a/GUI/View/Instrument/InstrumentLibraryEditor.h +++ b/GUI/View/Instrument/InstrumentLibraryEditor.h @@ -42,7 +42,6 @@ private: void onItemDoubleClickedForChoose(const QModelIndex& index); void onCurrentChangedForChoose(); QList<QAction*> getOverlayActions(const QModelIndex& index, bool asHover); - void createWidgetsForCurrentInstrument(); void onInstrumentNameEdited(const QString& newName); void onInstrumentDescriptionEdited(const QString& t); @@ -56,7 +55,6 @@ private: InstrumentItem* m_chosenItem; QTreeView* m_treeView; - QScrollArea* m_scrollArea; QDialogButtonBox* m_buttonBox; }; -- GitLab