diff --git a/src/main-window.cpp b/src/main-window.cpp index 6fd703e..cec8108 100644 --- a/src/main-window.cpp +++ b/src/main-window.cpp @@ -1,6 +1,7 @@ #include "main-window.hpp" #include "fdt/fdt-parser-tokens.hpp" #include "fdt/fdt-property-types.hpp" +#include "qabstractitemview.h" #include "ui_main-window.h" #include @@ -72,6 +73,9 @@ MainWindow::MainWindow(QWidget *parent) }); update_view(); + + if (!m_ui->treeWidget->selectedItems().empty()) + m_ui->treeWidget->scrollToItem(m_ui->treeWidget->selectedItems().first(), QAbstractItemView::PositionAtCenter); }); connect(m_menu.get(), &menu_manager::quit, this, &MainWindow::close);