From a340e6cf9a62ec35c8369a84ad8c747f325a44ba Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 7 May 2026 14:12:27 +1000 Subject: [PATCH] Interface mockup 10 --- src/interface/CMakeLists.txt | 8 ++++++ src/interface/MainWindow.cpp | 15 +++++------ src/interface/MainWindow.h | 9 ++++--- src/interface/components/Dialog.cpp | 4 +-- src/interface/components/Panel.cpp | 11 ++++++-- src/interface/components/Panel.h | 1 + src/interface/components/Style.cpp | 6 +++++ src/interface/panels/properties/Widget.cpp | 25 ++++++------------- src/interface/panels/properties/Widget.h | 10 +++----- .../panels/spatial_hierarchy/Widget.cpp | 9 ++----- .../panels/spatial_hierarchy/Widget.h | 4 +-- 11 files changed, 53 insertions(+), 49 deletions(-) diff --git a/src/interface/CMakeLists.txt b/src/interface/CMakeLists.txt index 71460abcf4..d18066b5b6 100644 --- a/src/interface/CMakeLists.txt +++ b/src/interface/CMakeLists.txt @@ -33,12 +33,20 @@ set(INTERFACE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/components/SvgIcon.h ${CMAKE_CURRENT_SOURCE_DIR}/components/Style.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/Style.h + ${CMAKE_CURRENT_SOURCE_DIR}/components/Dialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/components/Dialog.h + ${CMAKE_CURRENT_SOURCE_DIR}/components/Tabs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/components/Tabs.h ${CMAKE_CURRENT_SOURCE_DIR}/components/KeyValueTable.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/KeyValueTable.h + ${CMAKE_CURRENT_SOURCE_DIR}/components/Buttons.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/components/Buttons.h ${CMAKE_CURRENT_SOURCE_DIR}/components/Section.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/Section.h ${CMAKE_CURRENT_SOURCE_DIR}/components/Panel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/Panel.h + ${CMAKE_CURRENT_SOURCE_DIR}/panels/add_model/Dialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/panels/add_model/Dialog.h ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Types.h ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Widget.cpp ${CMAKE_CURRENT_SOURCE_DIR}/panels/models/Widget.h diff --git a/src/interface/MainWindow.cpp b/src/interface/MainWindow.cpp index 4185c2b016..901fcbf806 100644 --- a/src/interface/MainWindow.cpp +++ b/src/interface/MainWindow.cpp @@ -348,23 +348,20 @@ void MainWindow::setupViewport() { } void MainWindow::setupPanels() { - auto* models_widget = new panels::models::ModelsPanelWidget(this); - auto* spatial_widget = new panels::spatial_hierarchy::SpatialHierarchyPanelWidget(this); - auto* properties_widget = new panels::properties::PropertiesPanelWidget(this); + models_panel_ = new panels::models::ModelsPanelWidget(this); + spatial_panel_ = new panels::spatial_hierarchy::SpatialHierarchyPanelWidget(this); + properties_panel_ = new panels::properties::PropertiesPanelWidget(this); - models_view_ = new panels::models::ModelsPanelView(models_widget, this); - spatial_view_ = new panels::spatial_hierarchy::SpatialHierarchyPanelView(spatial_widget, this); + models_view_ = new panels::models::ModelsPanelView(models_panel_, this); + spatial_view_ = new panels::spatial_hierarchy::SpatialHierarchyPanelView(spatial_panel_, this); properties_view_ = new panels::properties::PropertiesPanelView( - properties_widget, viewport_, element_registry_, this); + properties_panel_, viewport_, element_registry_, this); connect(models_view_, &panels::models::ModelsPanelView::statusMessageRequested, this, &MainWindow::setStatusMessage); connect(spatial_view_, &panels::spatial_hierarchy::SpatialHierarchyPanelView::statusMessageRequested, this, &MainWindow::setStatusMessage); - models_panel_ = new components::Panel("Models", models_widget, this, true); - spatial_panel_ = new components::Panel("Spatial Hierarchy", spatial_widget, this); - properties_panel_ = new components::Panel("Properties", properties_widget, this, false, true); layers_panel_ = new components::Panel("Layers", new panels::todo::TodoPanelWidget("Layers", this), this); stored_views_panel_ = new components::Panel( "Stored Views", new panels::todo::TodoPanelWidget("Stored Views", this), this); diff --git a/src/interface/MainWindow.h b/src/interface/MainWindow.h index a50f3da91c..f42f0bb854 100644 --- a/src/interface/MainWindow.h +++ b/src/interface/MainWindow.h @@ -34,8 +34,11 @@ class ViewportWindow; class SceneLoader; namespace ifcinterface { class ElementRegistry; } namespace ifcinterface::components { class TabBar; } +namespace ifcinterface::panels::models { class ModelsPanelWidget; } namespace ifcinterface::panels::models { class ModelsPanelView; } +namespace ifcinterface::panels::spatial_hierarchy { class SpatialHierarchyPanelWidget; } namespace ifcinterface::panels::spatial_hierarchy { class SpatialHierarchyPanelView; } +namespace ifcinterface::panels::properties { class PropertiesPanelWidget; } namespace ifcinterface::panels::properties { class PropertiesPanelView; } namespace ifcinterface::shell { @@ -94,10 +97,10 @@ private: SceneLoader* loader_ = nullptr; ifcinterface::ElementRegistry* element_registry_ = nullptr; QWidget* viewport_container_ = nullptr; - QDockWidget* models_panel_ = nullptr; - QDockWidget* spatial_panel_ = nullptr; + ifcinterface::panels::models::ModelsPanelWidget* models_panel_ = nullptr; + ifcinterface::panels::spatial_hierarchy::SpatialHierarchyPanelWidget* spatial_panel_ = nullptr; QDockWidget* layers_panel_ = nullptr; - QDockWidget* properties_panel_ = nullptr; + ifcinterface::panels::properties::PropertiesPanelWidget* properties_panel_ = nullptr; QDockWidget* stored_views_panel_ = nullptr; QDockWidget* search_panel_ = nullptr; QDockWidget* spreadsheet_panel_ = nullptr; diff --git a/src/interface/components/Dialog.cpp b/src/interface/components/Dialog.cpp index 6b111fcc88..410e3a581b 100644 --- a/src/interface/components/Dialog.cpp +++ b/src/interface/components/Dialog.cpp @@ -57,7 +57,7 @@ Dialog::Dialog(QWidget* parent, bool scrollable) scroll_body->setObjectName("panelScrollBody"); body_layout_ = new QVBoxLayout(scroll_body); body_layout_->setContentsMargins(0, 0, 0, 0); - body_layout_->setSpacing(0); + body_layout_->setSpacing(style::metrics::section_body_padding); scroll->setWidget(scroll_body); frame_layout->addWidget(scroll); @@ -65,7 +65,7 @@ Dialog::Dialog(QWidget* parent, bool scrollable) auto* body = new QWidget(frame); body_layout_ = new QVBoxLayout(body); body_layout_->setContentsMargins(0, 0, 0, 0); - body_layout_->setSpacing(0); + body_layout_->setSpacing(style::metrics::section_body_padding); frame_layout->addWidget(body); } diff --git a/src/interface/components/Panel.cpp b/src/interface/components/Panel.cpp index 96bb2df3d9..7ba96631d6 100644 --- a/src/interface/components/Panel.cpp +++ b/src/interface/components/Panel.cpp @@ -97,7 +97,7 @@ Panel::Panel(const QString& title, QWidget* content, QWidget* parent, bool has_s scroll_body->setObjectName("panelScrollBody"); body_layout_ = new QVBoxLayout(scroll_body); body_layout_->setContentsMargins(0, 0, 0, 0); - body_layout_->setSpacing(0); + body_layout_->setSpacing(style::metrics::section_body_padding); scroll->setWidget(scroll_body); frame_layout->addWidget(scroll); @@ -105,7 +105,7 @@ Panel::Panel(const QString& title, QWidget* content, QWidget* parent, bool has_s auto* body = new QWidget(frame); body_layout_ = new QVBoxLayout(body); body_layout_->setContentsMargins(0, 0, 0, 0); - body_layout_->setSpacing(0); + body_layout_->setSpacing(style::metrics::section_body_padding); frame_layout->addWidget(body); } @@ -126,4 +126,11 @@ void Panel::addBodyWidget(QWidget* widget) { body_layout_->addWidget(widget); } +void Panel::clearBodyWidgets() { + while (auto* item = body_layout_->takeAt(0)) { + if (auto* widget = item->widget()) widget->deleteLater(); + delete item; + } +} + } // namespace ifcinterface::components diff --git a/src/interface/components/Panel.h b/src/interface/components/Panel.h index 70767314f8..fe48df51a5 100644 --- a/src/interface/components/Panel.h +++ b/src/interface/components/Panel.h @@ -39,6 +39,7 @@ public: bool scrollable = false); void addBodyWidget(QWidget* widget); + void clearBodyWidgets(); private: QVBoxLayout* body_layout_ = nullptr; diff --git a/src/interface/components/Style.cpp b/src/interface/components/Style.cpp index e993871c0e..f7b7c5f14b 100644 --- a/src/interface/components/Style.cpp +++ b/src/interface/components/Style.cpp @@ -34,6 +34,12 @@ QString buildAppStyleSheet() { background: ${app_background}; color: ${primary_text}; } + QMessageBox, + QMessageBox QWidget, + QMessageBox QLabel { + background: ${app_background}; + color: ${primary_text}; + } QFileDialog, QFileDialog QWidget, QFileDialog QStackedWidget, diff --git a/src/interface/panels/properties/Widget.cpp b/src/interface/panels/properties/Widget.cpp index 316488c760..515da7554a 100644 --- a/src/interface/panels/properties/Widget.cpp +++ b/src/interface/panels/properties/Widget.cpp @@ -35,13 +35,6 @@ namespace { -void clearLayout(QVBoxLayout* layout) { - while (auto* item = layout->takeAt(0)) { - if (auto* widget = item->widget()) widget->deleteLater(); - delete item; - } -} - QWidget* makePropertySetPanel(const ifcinterface::panels::properties::PropertySet& property_set, QWidget* parent = nullptr) { auto* group = new QGroupBox(property_set.title, parent); group->setObjectName("propertySetBox"); @@ -131,15 +124,12 @@ QFrame* makeEntityBox(const ifcinterface::panels::properties::EntitySummary& ent namespace ifcinterface::panels::properties { PropertiesPanelWidget::PropertiesPanelWidget(QWidget* parent) - : QWidget(parent) + : components::Panel("Properties", nullptr, parent, false, true) { - content_layout_ = new QVBoxLayout(this); - content_layout_->setContentsMargins(0, 0, 0, 0); - content_layout_->setSpacing(12); } void PropertiesPanelWidget::render(const PropertiesPanelState& state) { - clearLayout(content_layout_); + clearBodyWidgets(); QList property_set_widgets; for (const auto& property_set : state.property_sets) { @@ -237,12 +227,11 @@ void PropertiesPanelWidget::render(const PropertiesPanelState& state) { }); } - content_layout_->addWidget(entity_section); - content_layout_->addWidget(attributes_section); - content_layout_->addWidget(relationships_section); - content_layout_->addWidget(properties_section); - content_layout_->addWidget(quantities_section); - content_layout_->addStretch(1); + addBodyWidget(entity_section); + addBodyWidget(attributes_section); + addBodyWidget(relationships_section); + addBodyWidget(properties_section); + addBodyWidget(quantities_section); } } // namespace ifcinterface::panels::properties diff --git a/src/interface/panels/properties/Widget.h b/src/interface/panels/properties/Widget.h index bc15e447ca..752b339a19 100644 --- a/src/interface/panels/properties/Widget.h +++ b/src/interface/panels/properties/Widget.h @@ -23,18 +23,17 @@ #include "Types.h" -#include -#include +#include "../../components/Panel.h" + +#include -class QVBoxLayout; class QLabel; class QLineEdit; class QToolButton; -namespace ifcinterface::components { class Section; } namespace ifcinterface::panels::properties { -class PropertiesPanelWidget : public QWidget { +class PropertiesPanelWidget : public components::Panel { Q_OBJECT public: explicit PropertiesPanelWidget(QWidget* parent = nullptr); @@ -42,7 +41,6 @@ public: void render(const PropertiesPanelState& state); private: - QVBoxLayout* content_layout_ = nullptr; bool attributes_expanded_ = true; bool relationships_expanded_ = true; bool properties_expanded_ = true; diff --git a/src/interface/panels/spatial_hierarchy/Widget.cpp b/src/interface/panels/spatial_hierarchy/Widget.cpp index 72230dd247..39f1efe4d9 100644 --- a/src/interface/panels/spatial_hierarchy/Widget.cpp +++ b/src/interface/panels/spatial_hierarchy/Widget.cpp @@ -26,17 +26,12 @@ #include #include #include -#include namespace ifcinterface::panels::spatial_hierarchy { SpatialHierarchyPanelWidget::SpatialHierarchyPanelWidget(QWidget* parent) - : QWidget(parent) + : components::Panel("Spatial Hierarchy", nullptr, parent) { - auto* layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - auto* section = new components::Section("", components::SectionHeaderMode::Hidden, this); tree_ = new QTreeWidget(section); @@ -51,7 +46,7 @@ SpatialHierarchyPanelWidget::SpatialHierarchyPanelWidget(QWidget* parent) tree_->header()->resizeSection(1, 28); tree_->header()->hide(); section->addBodyWidget(tree_); - layout->addWidget(section); + addBodyWidget(section); connect(tree_, &QTreeWidget::itemClicked, this, [this](QTreeWidgetItem* item, int column) { if (!item || column != 1) return; diff --git a/src/interface/panels/spatial_hierarchy/Widget.h b/src/interface/panels/spatial_hierarchy/Widget.h index 134b78c5ce..5cb9c9610c 100644 --- a/src/interface/panels/spatial_hierarchy/Widget.h +++ b/src/interface/panels/spatial_hierarchy/Widget.h @@ -23,14 +23,14 @@ #include "Types.h" -#include +#include "../../components/Panel.h" class QTreeWidget; class QTreeWidgetItem; namespace ifcinterface::panels::spatial_hierarchy { -class SpatialHierarchyPanelWidget : public QWidget { +class SpatialHierarchyPanelWidget : public components::Panel { Q_OBJECT public: explicit SpatialHierarchyPanelWidget(QWidget* parent = nullptr);