mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
Interface mockup 9
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
// This file was generated with the assistance of an AI coding tool.
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the Lesser GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* IfcOpenShell is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* Lesser GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the Lesser GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
#include "../../components/Dialog.h"
|
||||
#include "../../components/Buttons.h"
|
||||
#include "../../components/Section.h"
|
||||
#include "../../components/Style.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace ifcinterface::panels::add_model {
|
||||
|
||||
namespace {
|
||||
|
||||
class HoverDescriptionFilter : public QObject {
|
||||
public:
|
||||
HoverDescriptionFilter(QLabel* label, QString hover_text, QString default_text)
|
||||
: label_(label), hover_text_(std::move(hover_text)), default_text_(std::move(default_text)) {}
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override {
|
||||
Q_UNUSED(watched);
|
||||
if (event->type() == QEvent::Enter) {
|
||||
label_->setText(hover_text_);
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
label_->setText(default_text_);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel* label_ = nullptr;
|
||||
QString hover_text_;
|
||||
QString default_text_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
AddModelDialog::AddModelDialog(QWidget* parent)
|
||||
: components::Dialog(parent)
|
||||
{
|
||||
setObjectName("appDialog");
|
||||
setWindowTitle("Add Model");
|
||||
setModal(true);
|
||||
setStyleSheet(components::style::buildAppStyleSheet());
|
||||
setupUi();
|
||||
}
|
||||
|
||||
void AddModelDialog::setupUi() {
|
||||
if (auto* root = qobject_cast<QVBoxLayout*>(layout())) {
|
||||
root->setSizeConstraint(QLayout::SetFixedSize);
|
||||
}
|
||||
|
||||
const QString default_description = "Choose what to add to the project";
|
||||
auto* description_section = new components::Section("", components::SectionHeaderMode::Hidden, this);
|
||||
auto* description = new QLabel(default_description, description_section);
|
||||
description->setProperty("textRole", "secondary");
|
||||
description->setWordWrap(true);
|
||||
description->setAlignment(Qt::AlignCenter);
|
||||
description->setMinimumWidth((90 * 4) + (components::style::metrics::padding * 3));
|
||||
description->setMinimumHeight(description->fontMetrics().lineSpacing() * 2 + 4);
|
||||
description_section->addBodyWidget(description);
|
||||
|
||||
auto* choices_section = new components::Section("", components::SectionHeaderMode::Hidden, this);
|
||||
auto* choices = new QWidget(choices_section);
|
||||
auto* row = new QHBoxLayout(choices);
|
||||
row->setContentsMargins(0, 0, 0, 0);
|
||||
row->setSpacing(components::style::metrics::padding);
|
||||
|
||||
auto* add_ifc = components::buttons::makeButton("Add IFC File", ":/icons/cube.svg", choices, QSize(90, 68));
|
||||
connect(add_ifc, &QToolButton::clicked, this, [this]() {
|
||||
selected_mode_ = SourceMode::IfcFile;
|
||||
accept();
|
||||
});
|
||||
add_ifc->installEventFilter(new HoverDescriptionFilter(
|
||||
description,
|
||||
"Add IFC files and load both geometry and data.",
|
||||
default_description));
|
||||
|
||||
auto* add_database = components::buttons::makeButton("Add IFC\nDatabase", ":/icons/database.svg", choices, QSize(90, 68));
|
||||
connect(add_database, &QToolButton::clicked, this, [this]() {
|
||||
selected_mode_ = SourceMode::IfcDatabase;
|
||||
accept();
|
||||
});
|
||||
add_database->installEventFilter(new HoverDescriptionFilter(
|
||||
description,
|
||||
"Add IFC RDB databases for optimised performance",
|
||||
default_description));
|
||||
|
||||
auto* add_geometry = components::buttons::makeButton("Add Geometry", ":/icons/cube-bandage.svg", choices, QSize(90, 68));
|
||||
connect(add_geometry, &QToolButton::clicked, this, [this]() {
|
||||
selected_mode_ = SourceMode::GeometryOnly;
|
||||
accept();
|
||||
});
|
||||
add_geometry->installEventFilter(new HoverDescriptionFilter(
|
||||
description,
|
||||
"Add pure geometry for fast visualisation",
|
||||
default_description));
|
||||
|
||||
auto* convert_database = components::buttons::makeButton("Convert IFC File\nto Database", ":/icons/database-restore.svg", choices, QSize(90, 68));
|
||||
connect(convert_database, &QToolButton::clicked, this, [description]() {
|
||||
description->setText("IFC-to-database conversion is coming soon.");
|
||||
});
|
||||
convert_database->installEventFilter(new HoverDescriptionFilter(
|
||||
description,
|
||||
"Convert IFC files to databases for smaller filesizes, reduced memory, and faster access. No data is lost.",
|
||||
default_description));
|
||||
|
||||
row->addWidget(components::buttons::makeButtonGroup("ADD", {add_ifc, add_database, add_geometry}, choices, true, 8));
|
||||
row->addWidget(components::buttons::makeButtonGroup("TOOLS", {convert_database}, choices, false, 8));
|
||||
choices_section->addBodyWidget(choices);
|
||||
|
||||
addBodyWidget(description_section);
|
||||
addBodyWidget(choices_section);
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::panels::add_model
|
||||
@@ -0,0 +1,50 @@
|
||||
// This file was generated with the assistance of an AI coding tool.
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the Lesser GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* IfcOpenShell is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* Lesser GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the Lesser GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef IFCINTERFACE_PANELS_ADDMODELDIALOG_H
|
||||
#define IFCINTERFACE_PANELS_ADDMODELDIALOG_H
|
||||
|
||||
#include "../../components/Dialog.h"
|
||||
|
||||
namespace ifcinterface::panels::add_model {
|
||||
|
||||
enum class SourceMode {
|
||||
None,
|
||||
IfcFile,
|
||||
IfcDatabase,
|
||||
GeometryOnly,
|
||||
};
|
||||
|
||||
class AddModelDialog : public components::Dialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AddModelDialog(QWidget* parent = nullptr);
|
||||
|
||||
SourceMode selectedMode() const { return selected_mode_; }
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
|
||||
SourceMode selected_mode_ = SourceMode::None;
|
||||
};
|
||||
|
||||
} // namespace ifcinterface::panels::add_model
|
||||
|
||||
#endif
|
||||
@@ -40,6 +40,10 @@ PropertiesPanelView::PropertiesPanelView(PropertiesPanelWidget* widget,
|
||||
refresh(0);
|
||||
}
|
||||
|
||||
void PropertiesPanelView::clearSelection() {
|
||||
refresh(0);
|
||||
}
|
||||
|
||||
void PropertiesPanelView::refresh(uint32_t object_id) {
|
||||
PropertiesPanelState state;
|
||||
state.entity = {"IfcWall", "SOLIDWALL"};
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
ViewportWindow* viewport,
|
||||
ifcinterface::ElementRegistry* registry,
|
||||
QObject* parent = nullptr);
|
||||
void clearSelection();
|
||||
|
||||
private:
|
||||
void refresh(uint32_t object_id);
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
|
||||
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");
|
||||
@@ -91,6 +98,34 @@ QWidget* makeFilterWrapper(QLineEdit** field_out, QWidget* parent = nullptr) {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
QFrame* makeEntityBox(const ifcinterface::panels::properties::EntitySummary& entity, QWidget* parent = nullptr) {
|
||||
auto* entity_box = new QFrame(parent);
|
||||
entity_box->setObjectName("entityClassBox");
|
||||
auto* entity_layout = new QHBoxLayout(entity_box);
|
||||
entity_layout->setContentsMargins(10, 8, 10, 8);
|
||||
entity_layout->setSpacing(10);
|
||||
|
||||
auto* entity_icon = new QLabel(entity_box);
|
||||
entity_icon->setPixmap(ifcinterface::components::icons::makeSvgPixmap(":/icons/cube-dots.svg", QSize(28, 28)));
|
||||
entity_icon->setAlignment(Qt::AlignCenter);
|
||||
|
||||
auto* entity_text = new QWidget(entity_box);
|
||||
auto* entity_text_layout = new QVBoxLayout(entity_text);
|
||||
entity_text_layout->setContentsMargins(0, 0, 0, 0);
|
||||
entity_text_layout->setSpacing(2);
|
||||
|
||||
auto* entity_class_label = new QLabel(entity.entity_class, entity_text);
|
||||
entity_class_label->setObjectName("entityClassLabel");
|
||||
auto* entity_type_label = new QLabel(entity.predefined_type, entity_text);
|
||||
entity_type_label->setProperty("textRole", "secondary");
|
||||
|
||||
entity_text_layout->addWidget(entity_class_label);
|
||||
entity_text_layout->addWidget(entity_type_label);
|
||||
entity_layout->addWidget(entity_icon, 0, Qt::AlignVCenter);
|
||||
entity_layout->addWidget(entity_text, 1, Qt::AlignVCenter);
|
||||
return entity_box;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ifcinterface::panels::properties {
|
||||
@@ -101,93 +136,10 @@ PropertiesPanelWidget::PropertiesPanelWidget(QWidget* parent)
|
||||
content_layout_ = new QVBoxLayout(this);
|
||||
content_layout_->setContentsMargins(0, 0, 0, 0);
|
||||
content_layout_->setSpacing(12);
|
||||
|
||||
auto* entity_box = new QFrame(this);
|
||||
entity_box->setObjectName("entityClassBox");
|
||||
auto* entity_layout = new QHBoxLayout(entity_box);
|
||||
entity_layout->setContentsMargins(10, 8, 10, 8);
|
||||
entity_layout->setSpacing(10);
|
||||
auto* entity_icon = new QLabel(entity_box);
|
||||
entity_icon->setPixmap(components::icons::makeSvgPixmap(":/icons/cube-dots.svg", QSize(28, 28)));
|
||||
entity_icon->setAlignment(Qt::AlignCenter);
|
||||
auto* entity_text = new QWidget(entity_box);
|
||||
auto* entity_text_layout = new QVBoxLayout(entity_text);
|
||||
entity_text_layout->setContentsMargins(0, 0, 0, 0);
|
||||
entity_text_layout->setSpacing(2);
|
||||
entity_class_label_ = new QLabel(entity_text);
|
||||
entity_class_label_->setObjectName("entityClassLabel");
|
||||
entity_type_label_ = new QLabel(entity_text);
|
||||
entity_type_label_->setProperty("textRole", "secondary");
|
||||
entity_text_layout->addWidget(entity_class_label_);
|
||||
entity_text_layout->addWidget(entity_type_label_);
|
||||
entity_layout->addWidget(entity_icon, 0, Qt::AlignVCenter);
|
||||
entity_layout->addWidget(entity_text, 1, Qt::AlignVCenter);
|
||||
|
||||
entity_section_ = new components::Section("", components::SectionHeaderMode::Hidden, this);
|
||||
entity_section_->addBodyWidget(entity_box);
|
||||
attributes_section_ = new components::Section("Attributes", components::SectionHeaderMode::Visible, this);
|
||||
relationships_section_ = new components::Section("Relationships", components::SectionHeaderMode::Visible, this);
|
||||
properties_section_ = new components::Section("Properties", components::SectionHeaderMode::Visible, this);
|
||||
quantities_section_ = new components::Section("Quantities", components::SectionHeaderMode::Visible, this);
|
||||
|
||||
properties_filter_toggle_ = new QToolButton(properties_section_);
|
||||
properties_filter_toggle_->setObjectName("panelSectionFilterToggle");
|
||||
properties_filter_toggle_->setCheckable(true);
|
||||
properties_filter_toggle_->setIcon(components::icons::makeSvgIcon(":/icons/filter.svg"));
|
||||
properties_filter_toggle_->setAutoRaise(true);
|
||||
properties_section_->addHeaderWidget(properties_filter_toggle_);
|
||||
|
||||
quantities_filter_toggle_ = new QToolButton(quantities_section_);
|
||||
quantities_filter_toggle_->setObjectName("panelSectionFilterToggle");
|
||||
quantities_filter_toggle_->setCheckable(true);
|
||||
quantities_filter_toggle_->setIcon(components::icons::makeSvgIcon(":/icons/filter.svg"));
|
||||
quantities_filter_toggle_->setAutoRaise(true);
|
||||
quantities_section_->addHeaderWidget(quantities_filter_toggle_);
|
||||
|
||||
properties_filter_wrapper_ = makeFilterWrapper(&properties_filter_field_, properties_section_);
|
||||
properties_filter_field_->setPlaceholderText("Filter properties or sets");
|
||||
quantities_filter_wrapper_ = makeFilterWrapper(&quantities_filter_field_, quantities_section_);
|
||||
quantities_filter_field_->setPlaceholderText("Filter quantities or sets");
|
||||
|
||||
connect(properties_filter_toggle_, &QToolButton::toggled, properties_filter_field_, [this](bool visible) {
|
||||
properties_filter_field_->setVisible(visible);
|
||||
properties_filter_wrapper_->setVisible(visible);
|
||||
if (visible) properties_filter_field_->setFocus();
|
||||
});
|
||||
connect(quantities_filter_toggle_, &QToolButton::toggled, quantities_filter_field_, [this](bool visible) {
|
||||
quantities_filter_field_->setVisible(visible);
|
||||
quantities_filter_wrapper_->setVisible(visible);
|
||||
if (visible) quantities_filter_field_->setFocus();
|
||||
});
|
||||
|
||||
properties_filter_wrapper_->setVisible(false);
|
||||
quantities_filter_wrapper_->setVisible(false);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void PropertiesPanelWidget::render(const PropertiesPanelState& state) {
|
||||
const bool attributes_expanded = attributes_section_->isExpanded();
|
||||
const bool relationships_expanded = relationships_section_->isExpanded();
|
||||
const bool properties_expanded = properties_section_->isExpanded();
|
||||
const bool quantities_expanded = quantities_section_->isExpanded();
|
||||
const bool properties_filter_visible = properties_filter_toggle_->isChecked();
|
||||
const bool quantities_filter_visible = quantities_filter_toggle_->isChecked();
|
||||
const QString properties_filter_text = properties_filter_field_->text();
|
||||
const QString quantities_filter_text = quantities_filter_field_->text();
|
||||
|
||||
entity_class_label_->setText(state.entity.entity_class);
|
||||
entity_type_label_->setText(state.entity.predefined_type);
|
||||
|
||||
attributes_section_->clearBody();
|
||||
relationships_section_->clearBody();
|
||||
properties_section_->clearBody();
|
||||
quantities_section_->clearBody();
|
||||
clearLayout(content_layout_);
|
||||
|
||||
QList<QWidget*> property_set_widgets;
|
||||
for (const auto& property_set : state.property_sets) {
|
||||
@@ -199,21 +151,98 @@ void PropertiesPanelWidget::render(const PropertiesPanelState& state) {
|
||||
quantity_set_widgets.append(makePropertySetPanel(property_set, this));
|
||||
}
|
||||
|
||||
attributes_section_->addBodyWidget(makeAttributeList(state.attributes, this));
|
||||
relationships_section_->addBodyWidget(makeRelationshipList(state.relationships, this));
|
||||
properties_section_->addBodyWidget(properties_filter_wrapper_);
|
||||
for (auto* widget : property_set_widgets) properties_section_->addBodyWidget(widget);
|
||||
quantities_section_->addBodyWidget(quantities_filter_wrapper_);
|
||||
for (auto* widget : quantity_set_widgets) quantities_section_->addBodyWidget(widget);
|
||||
auto* entity_section = new components::Section("", components::SectionHeaderMode::Hidden, this);
|
||||
entity_section->addBodyWidget(makeEntityBox(state.entity, this));
|
||||
|
||||
attributes_section_->setExpanded(attributes_expanded);
|
||||
relationships_section_->setExpanded(relationships_expanded);
|
||||
properties_section_->setExpanded(properties_expanded);
|
||||
quantities_section_->setExpanded(quantities_expanded);
|
||||
properties_filter_field_->setText(properties_filter_text);
|
||||
quantities_filter_field_->setText(quantities_filter_text);
|
||||
properties_filter_toggle_->setChecked(properties_filter_visible);
|
||||
quantities_filter_toggle_->setChecked(quantities_filter_visible);
|
||||
auto* attributes_section = new components::Section("Attributes", components::SectionHeaderMode::Visible, this);
|
||||
attributes_section->addBodyWidget(makeAttributeList(state.attributes, this));
|
||||
attributes_section->setExpanded(attributes_expanded_);
|
||||
|
||||
auto* relationships_section = new components::Section("Relationships", components::SectionHeaderMode::Visible, this);
|
||||
relationships_section->addBodyWidget(makeRelationshipList(state.relationships, this));
|
||||
relationships_section->setExpanded(relationships_expanded_);
|
||||
|
||||
auto* properties_section = new components::Section("Properties", components::SectionHeaderMode::Visible, this);
|
||||
auto* properties_filter_toggle = new QToolButton(properties_section);
|
||||
properties_filter_toggle->setObjectName("panelSectionFilterToggle");
|
||||
properties_filter_toggle->setCheckable(true);
|
||||
properties_filter_toggle->setIcon(components::icons::makeSvgIcon(":/icons/filter.svg"));
|
||||
properties_filter_toggle->setAutoRaise(true);
|
||||
properties_section->addHeaderWidget(properties_filter_toggle);
|
||||
QLineEdit* properties_filter_field = nullptr;
|
||||
auto* properties_filter_wrapper = makeFilterWrapper(&properties_filter_field, properties_section);
|
||||
properties_filter_field->setPlaceholderText("Filter properties or sets");
|
||||
properties_filter_field->setText(properties_filter_text_);
|
||||
properties_filter_wrapper->setVisible(properties_filter_visible_);
|
||||
properties_filter_field->setVisible(properties_filter_visible_);
|
||||
connect(properties_filter_toggle, &QToolButton::toggled, properties_filter_field, [this, properties_filter_field, properties_filter_wrapper](bool visible) {
|
||||
properties_filter_visible_ = visible;
|
||||
properties_filter_field->setVisible(visible);
|
||||
properties_filter_wrapper->setVisible(visible);
|
||||
if (visible) properties_filter_field->setFocus();
|
||||
});
|
||||
connect(properties_filter_field, &QLineEdit::textChanged, this, [this](const QString& text) {
|
||||
properties_filter_text_ = text;
|
||||
});
|
||||
properties_section->addBodyWidget(properties_filter_wrapper);
|
||||
for (auto* widget : property_set_widgets) properties_section->addBodyWidget(widget);
|
||||
properties_section->setExpanded(properties_expanded_);
|
||||
properties_filter_toggle->setChecked(properties_filter_visible_);
|
||||
|
||||
auto* quantities_section = new components::Section("Quantities", components::SectionHeaderMode::Visible, this);
|
||||
auto* quantities_filter_toggle = new QToolButton(quantities_section);
|
||||
quantities_filter_toggle->setObjectName("panelSectionFilterToggle");
|
||||
quantities_filter_toggle->setCheckable(true);
|
||||
quantities_filter_toggle->setIcon(components::icons::makeSvgIcon(":/icons/filter.svg"));
|
||||
quantities_filter_toggle->setAutoRaise(true);
|
||||
quantities_section->addHeaderWidget(quantities_filter_toggle);
|
||||
QLineEdit* quantities_filter_field = nullptr;
|
||||
auto* quantities_filter_wrapper = makeFilterWrapper(&quantities_filter_field, quantities_section);
|
||||
quantities_filter_field->setPlaceholderText("Filter quantities or sets");
|
||||
quantities_filter_field->setText(quantities_filter_text_);
|
||||
quantities_filter_wrapper->setVisible(quantities_filter_visible_);
|
||||
quantities_filter_field->setVisible(quantities_filter_visible_);
|
||||
connect(quantities_filter_toggle, &QToolButton::toggled, quantities_filter_field, [this, quantities_filter_field, quantities_filter_wrapper](bool visible) {
|
||||
quantities_filter_visible_ = visible;
|
||||
quantities_filter_field->setVisible(visible);
|
||||
quantities_filter_wrapper->setVisible(visible);
|
||||
if (visible) quantities_filter_field->setFocus();
|
||||
});
|
||||
connect(quantities_filter_field, &QLineEdit::textChanged, this, [this](const QString& text) {
|
||||
quantities_filter_text_ = text;
|
||||
});
|
||||
quantities_section->addBodyWidget(quantities_filter_wrapper);
|
||||
for (auto* widget : quantity_set_widgets) quantities_section->addBodyWidget(widget);
|
||||
quantities_section->setExpanded(quantities_expanded_);
|
||||
quantities_filter_toggle->setChecked(quantities_filter_visible_);
|
||||
|
||||
if (auto* button = attributes_section->findChild<QToolButton*>("panelSectionHeaderButton")) {
|
||||
connect(button, &QToolButton::toggled, this, [this](bool expanded) {
|
||||
attributes_expanded_ = expanded;
|
||||
});
|
||||
}
|
||||
if (auto* button = relationships_section->findChild<QToolButton*>("panelSectionHeaderButton")) {
|
||||
connect(button, &QToolButton::toggled, this, [this](bool expanded) {
|
||||
relationships_expanded_ = expanded;
|
||||
});
|
||||
}
|
||||
if (auto* button = properties_section->findChild<QToolButton*>("panelSectionHeaderButton")) {
|
||||
connect(button, &QToolButton::toggled, this, [this](bool expanded) {
|
||||
properties_expanded_ = expanded;
|
||||
});
|
||||
}
|
||||
if (auto* button = quantities_section->findChild<QToolButton*>("panelSectionHeaderButton")) {
|
||||
connect(button, &QToolButton::toggled, this, [this](bool expanded) {
|
||||
quantities_expanded_ = expanded;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::panels::properties
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
class QVBoxLayout;
|
||||
@@ -42,19 +43,14 @@ public:
|
||||
|
||||
private:
|
||||
QVBoxLayout* content_layout_ = nullptr;
|
||||
QLabel* entity_class_label_ = nullptr;
|
||||
QLabel* entity_type_label_ = nullptr;
|
||||
components::Section* entity_section_ = nullptr;
|
||||
components::Section* attributes_section_ = nullptr;
|
||||
components::Section* relationships_section_ = nullptr;
|
||||
components::Section* properties_section_ = nullptr;
|
||||
components::Section* quantities_section_ = nullptr;
|
||||
QWidget* properties_filter_wrapper_ = nullptr;
|
||||
QWidget* quantities_filter_wrapper_ = nullptr;
|
||||
QLineEdit* properties_filter_field_ = nullptr;
|
||||
QLineEdit* quantities_filter_field_ = nullptr;
|
||||
QToolButton* properties_filter_toggle_ = nullptr;
|
||||
QToolButton* quantities_filter_toggle_ = nullptr;
|
||||
bool attributes_expanded_ = true;
|
||||
bool relationships_expanded_ = true;
|
||||
bool properties_expanded_ = true;
|
||||
bool quantities_expanded_ = true;
|
||||
bool properties_filter_visible_ = false;
|
||||
bool quantities_filter_visible_ = false;
|
||||
QString properties_filter_text_;
|
||||
QString quantities_filter_text_;
|
||||
};
|
||||
|
||||
} // namespace ifcinterface::panels::properties
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include "Dialog.h"
|
||||
|
||||
#include "../../../ifcviewer/AppSettings.h"
|
||||
#include "../../components/Dialog.h"
|
||||
#include "../../components/Section.h"
|
||||
#include "../../components/Style.h"
|
||||
#include "../../components/SvgIcon.h"
|
||||
#include "../../components/Tabs.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
@@ -35,13 +37,12 @@
|
||||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
#include <QSpinBox>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace ifcinterface::panels::settings {
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
: components::Dialog(parent)
|
||||
{
|
||||
setObjectName("appDialog");
|
||||
setWindowTitle("Settings");
|
||||
@@ -57,23 +58,12 @@ void SettingsDialog::showEvent(QShowEvent* event) {
|
||||
}
|
||||
|
||||
void SettingsDialog::setupUi() {
|
||||
auto* root = new QVBoxLayout(this);
|
||||
root->setContentsMargins(12, 12, 12, 12);
|
||||
root->setSpacing(0);
|
||||
|
||||
auto* panel = new QFrame(this);
|
||||
panel->setObjectName("panel");
|
||||
auto* panel_layout = new QVBoxLayout(panel);
|
||||
panel_layout->setContentsMargins(0, components::style::metrics::section_body_padding, 0,
|
||||
components::style::metrics::section_body_padding);
|
||||
panel_layout->setSpacing(12);
|
||||
|
||||
auto* tabs = new QTabWidget(panel);
|
||||
auto* tabs = new components::TabWidget(this);
|
||||
|
||||
auto* graphics_tab = new QWidget(tabs);
|
||||
auto* graphics_layout = new QVBoxLayout(graphics_tab);
|
||||
graphics_layout->setContentsMargins(0, 0, 0, 0);
|
||||
graphics_layout->setSpacing(12);
|
||||
graphics_layout->setSpacing(components::style::metrics::padding);
|
||||
|
||||
auto* general_section = new components::Section("General", components::SectionHeaderMode::Visible, graphics_tab);
|
||||
auto* general_body = new QWidget(general_section);
|
||||
@@ -148,7 +138,7 @@ void SettingsDialog::setupUi() {
|
||||
auto* tab = new QWidget(tabs);
|
||||
auto* layout = new QVBoxLayout(tab);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(12);
|
||||
layout->setSpacing(components::style::metrics::padding);
|
||||
|
||||
auto* section = new components::Section(title, components::SectionHeaderMode::Visible, tab);
|
||||
auto* body = new QWidget(section);
|
||||
@@ -179,7 +169,7 @@ void SettingsDialog::setupUi() {
|
||||
tabs->addTab(make_placeholder_tab("About", "Version, credits, and environment information will live here."),
|
||||
"About");
|
||||
|
||||
auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, panel);
|
||||
auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
if (auto* ok = buttons->button(QDialogButtonBox::Ok)) {
|
||||
ok->setText("OK");
|
||||
ok->setIcon(components::icons::makeSvgIcon(":/icons/check.svg"));
|
||||
@@ -191,9 +181,11 @@ void SettingsDialog::setupUi() {
|
||||
connect(buttons, &QDialogButtonBox::accepted, this, &SettingsDialog::onAccepted);
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
panel_layout->addWidget(tabs);
|
||||
panel_layout->addWidget(buttons);
|
||||
root->addWidget(panel);
|
||||
auto* actions_section = new components::Section("", components::SectionHeaderMode::Hidden, this);
|
||||
actions_section->addBodyWidget(buttons);
|
||||
|
||||
addBodyWidget(tabs);
|
||||
addBodyWidget(actions_section);
|
||||
}
|
||||
|
||||
void SettingsDialog::syncFromSettings() {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef IFCINTERFACE_PANELS_SETTINGSDIALOG_H
|
||||
#define IFCINTERFACE_PANELS_SETTINGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../../components/Dialog.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QDoubleSpinBox;
|
||||
@@ -31,7 +31,7 @@ class QSpinBox;
|
||||
|
||||
namespace ifcinterface::panels::settings {
|
||||
|
||||
class SettingsDialog : public QDialog {
|
||||
class SettingsDialog : public components::Dialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsDialog(QWidget* parent = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user