From 36d41915d7e29da83bddc7b5ad54e7c4180a6d95 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Thu, 23 Nov 2023 10:57:55 +0100
Subject: [PATCH] select at opening

---
 GUI/View/Instrument/InstrumentLibraryEditor.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/GUI/View/Instrument/InstrumentLibraryEditor.cpp b/GUI/View/Instrument/InstrumentLibraryEditor.cpp
index 751e19ae02e..7f9ae3d2441 100644
--- a/GUI/View/Instrument/InstrumentLibraryEditor.cpp
+++ b/GUI/View/Instrument/InstrumentLibraryEditor.cpp
@@ -97,7 +97,7 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent,
 
     // ensure a current item when widget is shown
     GUI::Style::setResizable(this);
-    appSettings->loadWindowSizeAndPos(this);    
+    appSettings->loadWindowSizeAndPos(this);
 
     applySplitterPos();
     // unfix m_treeView width only on manual resize
@@ -148,6 +148,10 @@ InstrumentItem* InstrumentLibraryEditor::execChoose()
             &InstrumentLibraryEditor::onCurrentChangedForChoose);
     onCurrentChangedForChoose();
 
+    // select the first instrument
+    QModelIndex index = m_treeModel->indexForItem(m_instrumentLibrary->instrumentItems().first());
+    m_treeView->setCurrentIndex(index);
+
     if (exec() == QDialog::Accepted)
         return m_chosenItem;
 
-- 
GitLab