From 90ff5a834138c9473b06520a0ab41308af039ee1 Mon Sep 17 00:00:00 2001 From: Simon Friedel Date: Mon, 20 Nov 2023 13:07:45 +0100 Subject: [PATCH] Show root feature in treeview --- tools/fm-editor/tree/FeatureTreeViewModel.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/fm-editor/tree/FeatureTreeViewModel.h b/tools/fm-editor/tree/FeatureTreeViewModel.h index a60bbc1e5..7277f20bf 100644 --- a/tools/fm-editor/tree/FeatureTreeViewModel.h +++ b/tools/fm-editor/tree/FeatureTreeViewModel.h @@ -11,11 +11,15 @@ class FeatureTreeViewModel : public QAbstractItemModel { FeatureTreeViewModel(vara::feature::FeatureModel *Model, QObject *Parent) : QAbstractItemModel(Parent) { auto UniqueRoot = FeatureTreeItem::createFeatureTreeItem(Model->getRoot()); - RootItem = UniqueRoot.get(); + RootItem = new FeatureTreeItemFeature(nullptr); + RootItem->addChild(UniqueRoot.get()); + auto RawRoot = UniqueRoot.get(); Items.push_back(std::move(UniqueRoot)); - buildRecursive(RootItem); + buildRecursive(RawRoot); } - ~FeatureTreeViewModel() override { std::destroy(Items.begin(), Items.end()); } + ~FeatureTreeViewModel() override { + delete RootItem; + std::destroy(Items.begin(), Items.end()); } std::vector> *getItems(); [[nodiscard]] QVariant data(const QModelIndex &Index,