From 413a81dd4594dad346f1773752588889214cb508 Mon Sep 17 00:00:00 2001 From: Thomas Kroes Date: Mon, 2 Dec 2024 12:29:55 +0100 Subject: [PATCH] Work on tree view --- ExampleActions/src/ExampleActionsPlugin.cpp | 15 ++++++++++++++- ExampleActions/src/ExampleActionsTreeModel.cpp | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ExampleActions/src/ExampleActionsPlugin.cpp b/ExampleActions/src/ExampleActionsPlugin.cpp index 8961112..3ee34e8 100644 --- a/ExampleActions/src/ExampleActionsPlugin.cpp +++ b/ExampleActions/src/ExampleActionsPlugin.cpp @@ -5,6 +5,7 @@ #include #include +#include Q_PLUGIN_METADATA(IID "studio.manivault.ExampleActionsPlugin") @@ -27,6 +28,18 @@ ExampleActionsPlugin::ExampleActionsPlugin(const PluginFactory* factory) : if (!hierarchyWidget) return; + auto& treeView = hierarchyWidget->getTreeView(); + + //treeView.setRootIsDecorated(false); + treeView.setTextElideMode(Qt::ElideMiddle); + + treeView.setColumnHidden(static_cast(ExampleActionsTreeModel::Column::ClassName), true); + + auto treeViewHeader = treeView.header(); + + treeViewHeader->setSectionResizeMode(static_cast(ExampleActionsTreeModel::Column::Name), QHeaderView::Stretch); + treeViewHeader->setSectionResizeMode(static_cast(ExampleActionsTreeModel::Column::Description), QHeaderView::Stretch); + auto selectionModel = hierarchyWidget->getTreeView().selectionModel(); connect(selectionModel, &QItemSelectionModel::selectionChanged, hierarchyWidget, [this, selectionModel](const QItemSelection& selected, const QItemSelection& deselected) -> void { @@ -54,7 +67,7 @@ ExampleActionsPlugin::ExampleActionsPlugin(const PluginFactory* factory) : verticalGroupAction->setDefaultWidgetFlag(VerticalGroupAction::WidgetFlag::NoMargins); verticalGroupAction->setShowLabels(false); - verticalGroupAction->addAction(new ExampleProxyAction(verticalGroupAction, "", action)); + verticalGroupAction->addAction(new ExampleProxyAction(verticalGroupAction, "ExampleProxy", action)); _examplesGroupsAction.addGroupAction(verticalGroupAction); } diff --git a/ExampleActions/src/ExampleActionsTreeModel.cpp b/ExampleActions/src/ExampleActionsTreeModel.cpp index 2238e6b..adcde3b 100644 --- a/ExampleActions/src/ExampleActionsTreeModel.cpp +++ b/ExampleActions/src/ExampleActionsTreeModel.cpp @@ -43,6 +43,13 @@ ExampleActionsTreeModel::ExampleActionsTreeModel(QObject* parent /*= nullptr*/) appendRow(CategoryRow("Miscellaneous", { { "Dataset picker", "For picking datasets", "mv::gui::DatasetPickerAction" } })); + + appendRow(CategoryRow("Numerical", { + { "Integral", "For configuring an integral value", "mv::gui::IntegralAction" }, + { "IntegralRange", "For configuring an integral range", "mv::gui::IntegralRangeAction" }, + { "Decimal", "For configuring a decimal value", "mv::gui::DecimalAction" }, + { "DecimalRange", "For configuring a decimal range", "mv::gui::DecimalRangeAction" }, + })); } QVariant ExampleActionsTreeModel::headerData(int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole*/) const