Skip to content
Snippets Groups Projects

InstrumentLibraryDialog (ex ...Editor) now w/o parameter editor

Merged Wuttke, Joachim requested to merge j.sig2 into main
2 files
+ 5
46
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -17,10 +17,6 @@
#include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/Model/Device/InstrumentLibrary.h"
#include "GUI/Support/Style/Style.h"
#include "GUI/View/Instrument/DepthprobeInstrumentEditor.h"
#include "GUI/View/Instrument/GISASInstrumentEditor.h"
#include "GUI/View/Instrument/OffspecInstrumentEditor.h"
#include "GUI/View/Instrument/SpecularInstrumentEditor.h"
#include "GUI/View/Item/ItemViewOverlayButtons.h"
#include "GUI/View/Tool/ItemDelegateForHTML.h"
#include "GUI/View/Tool/mainwindow_constants.h"
@@ -30,7 +26,6 @@
#include <QInputDialog>
#include <QPushButton>
#include <QSettings>
#include <QSplitter>
#include <QTextEdit>
#include <QVBoxLayout>
@@ -45,20 +40,16 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent,
if (this->objectName().isEmpty())
this->setObjectName("InstrumentLibraryEditor");
setGeometry(0, 0, 780, 429);
setGeometry(0, 0, 320, 429);
auto* verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
auto* splitter = new QSplitter;
verticalLayout->addWidget(splitter);
splitter->setOrientation(Qt::Horizontal);
auto* layout = new QVBoxLayout(this);
setLayout(layout);
m_treeView = new QTreeView;
splitter->addWidget(m_treeView);
layout->addWidget(m_treeView);
m_buttonBox = new QDialogButtonBox;
verticalLayout->addWidget(m_buttonBox);
layout->addWidget(m_buttonBox);
m_buttonBox->setOrientation(Qt::Horizontal);
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
@@ -86,40 +77,11 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent,
// ensure a current item when widget is shown
GUI::Style::setResizable(this);
appSettings->loadWindowSizeAndPos(this);
applySplitterPos();
// unfix m_treeView width only on manual resize
connect(splitter, &QSplitter::splitterMoved, [this] {
m_treeView->setMinimumWidth(0);
m_treeView->setMaximumWidth(QWIDGETSIZE_MAX);
});
}
InstrumentLibraryEditor::~InstrumentLibraryEditor()
{
appSettings->saveWindowSizeAndPos(this);
saveSplitterPos();
}
void InstrumentLibraryEditor::applySplitterPos()
{
QSettings settings;
if (settings.childGroups().contains(GUI::Style::S_INSTRUMENT_LIBRARY_EDITOR)) {
settings.beginGroup(GUI::Style::S_INSTRUMENT_LIBRARY_EDITOR);
m_treeView->setFixedWidth(
settings.value(GUI::Style::S_INSTRUMENT_LIBRARY_EDITOR_TREE_WIDTH).toInt());
settings.endGroup();
} else
m_treeView->setFixedWidth(GUI::Style::INSTRUMENT_LIBRARY_EDITOR_TREE_WIDTH);
}
void InstrumentLibraryEditor::saveSplitterPos()
{
QSettings settings;
settings.beginGroup(GUI::Style::S_INSTRUMENT_LIBRARY_EDITOR);
settings.setValue(GUI::Style::S_INSTRUMENT_LIBRARY_EDITOR_TREE_WIDTH, m_treeView->width());
settings.endGroup();
settings.sync();
}
InstrumentItem* InstrumentLibraryEditor::execChoose()
Loading