mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Interface mockup 9
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
// 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 "Buttons.h"
|
||||
|
||||
#include "SvgIcon.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace ifcinterface::components::buttons {
|
||||
|
||||
QToolButton* makeButton(const QString& text,
|
||||
const QString& icon_path,
|
||||
QWidget* parent,
|
||||
const QSize& minimum_size) {
|
||||
auto* button = new QToolButton(parent);
|
||||
button->setObjectName("ribbonButton");
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
button->setIcon(components::icons::makeTintedSvgIcon(icon_path));
|
||||
button->setIconSize(QSize(20, 20));
|
||||
button->setText(text);
|
||||
button->setMinimumSize(minimum_size);
|
||||
button->setAutoRaise(false);
|
||||
return button;
|
||||
}
|
||||
|
||||
QWidget* makeButtonGroup(const QString& title,
|
||||
const QList<QToolButton*>& buttons,
|
||||
QWidget* parent,
|
||||
bool trailing_separator,
|
||||
int vertical_spacing) {
|
||||
auto* group = new QFrame(parent);
|
||||
group->setObjectName("ribbonGroup");
|
||||
group->setProperty("separator", trailing_separator);
|
||||
|
||||
auto* group_layout = new QVBoxLayout(group);
|
||||
group_layout->setContentsMargins(8, 6, 8, 4);
|
||||
group_layout->setSpacing(vertical_spacing);
|
||||
|
||||
auto* button_row = new QHBoxLayout();
|
||||
button_row->setContentsMargins(0, 0, 0, 0);
|
||||
button_row->setSpacing(4);
|
||||
for (auto* button : buttons) {
|
||||
button_row->addWidget(button);
|
||||
}
|
||||
|
||||
auto* label = new QLabel(title, group);
|
||||
label->setObjectName("ribbonGroupLabel");
|
||||
label->setProperty("textRole", "secondary");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
||||
group_layout->addLayout(button_row);
|
||||
group_layout->addWidget(label);
|
||||
return group;
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::components::buttons
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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_COMPONENTS_BUTTONS_H
|
||||
#define IFCINTERFACE_COMPONENTS_BUTTONS_H
|
||||
|
||||
#include <QList>
|
||||
#include <QSize>
|
||||
|
||||
class QToolButton;
|
||||
class QWidget;
|
||||
|
||||
namespace ifcinterface::components::buttons {
|
||||
|
||||
QToolButton* makeButton(const QString& text,
|
||||
const QString& icon_path,
|
||||
QWidget* parent,
|
||||
const QSize& minimum_size = QSize(90, 54));
|
||||
|
||||
QWidget* makeButtonGroup(const QString& title,
|
||||
const QList<QToolButton*>& buttons,
|
||||
QWidget* parent,
|
||||
bool trailing_separator = true,
|
||||
int vertical_spacing = 4);
|
||||
|
||||
} // namespace ifcinterface::components::buttons
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
// 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 "Style.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFrame>
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace ifcinterface::components {
|
||||
|
||||
Dialog::Dialog(QWidget* parent, bool scrollable)
|
||||
: QDialog(parent)
|
||||
{
|
||||
auto* outer_layout = new QVBoxLayout(this);
|
||||
outer_layout->setContentsMargins(style::metrics::padding,
|
||||
style::metrics::padding,
|
||||
style::metrics::padding,
|
||||
style::metrics::padding);
|
||||
outer_layout->setSpacing(0);
|
||||
|
||||
auto* frame = new QFrame(this);
|
||||
frame->setObjectName("panel");
|
||||
auto* frame_layout = new QVBoxLayout(frame);
|
||||
frame_layout->setContentsMargins(0,
|
||||
style::metrics::section_body_padding,
|
||||
0,
|
||||
style::metrics::section_body_padding);
|
||||
frame_layout->setSpacing(0);
|
||||
|
||||
if (scrollable) {
|
||||
auto* scroll = new QScrollArea(frame);
|
||||
scroll->setWidgetResizable(true);
|
||||
scroll->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
auto* scroll_body = new QWidget(scroll);
|
||||
scroll_body->setObjectName("panelScrollBody");
|
||||
body_layout_ = new QVBoxLayout(scroll_body);
|
||||
body_layout_->setContentsMargins(0, 0, 0, 0);
|
||||
body_layout_->setSpacing(0);
|
||||
|
||||
scroll->setWidget(scroll_body);
|
||||
frame_layout->addWidget(scroll);
|
||||
} else {
|
||||
auto* body = new QWidget(frame);
|
||||
body_layout_ = new QVBoxLayout(body);
|
||||
body_layout_->setContentsMargins(0, 0, 0, 0);
|
||||
body_layout_->setSpacing(0);
|
||||
frame_layout->addWidget(body);
|
||||
}
|
||||
|
||||
outer_layout->addWidget(frame);
|
||||
}
|
||||
|
||||
void Dialog::addBodyWidget(QWidget* widget) {
|
||||
body_layout_->addWidget(widget);
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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_COMPONENTS_DIALOG_H
|
||||
#define IFCINTERFACE_COMPONENTS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QWidget;
|
||||
|
||||
namespace ifcinterface::components {
|
||||
|
||||
class Dialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog(QWidget* parent = nullptr,
|
||||
bool scrollable = false);
|
||||
|
||||
void addBodyWidget(QWidget* widget);
|
||||
|
||||
private:
|
||||
QVBoxLayout* body_layout_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
|
||||
#endif
|
||||
@@ -95,15 +95,22 @@ Panel::Panel(const QString& title, QWidget* content, QWidget* parent, bool has_s
|
||||
|
||||
auto* scroll_body = new QWidget(scroll);
|
||||
scroll_body->setObjectName("panelScrollBody");
|
||||
auto* scroll_body_layout = new QVBoxLayout(scroll_body);
|
||||
scroll_body_layout->setContentsMargins(0, 0, 0, 0);
|
||||
scroll_body_layout->setSpacing(0);
|
||||
scroll_body_layout->addWidget(content);
|
||||
body_layout_ = new QVBoxLayout(scroll_body);
|
||||
body_layout_->setContentsMargins(0, 0, 0, 0);
|
||||
body_layout_->setSpacing(0);
|
||||
|
||||
scroll->setWidget(scroll_body);
|
||||
frame_layout->addWidget(scroll);
|
||||
} else {
|
||||
frame_layout->addWidget(content);
|
||||
auto* body = new QWidget(frame);
|
||||
body_layout_ = new QVBoxLayout(body);
|
||||
body_layout_->setContentsMargins(0, 0, 0, 0);
|
||||
body_layout_->setSpacing(0);
|
||||
frame_layout->addWidget(body);
|
||||
}
|
||||
|
||||
if (content) {
|
||||
body_layout_->addWidget(content);
|
||||
}
|
||||
outer_layout->addWidget(frame);
|
||||
|
||||
@@ -115,4 +122,8 @@ Panel::Panel(const QString& title, QWidget* content, QWidget* parent, bool has_s
|
||||
setWidget(outer);
|
||||
}
|
||||
|
||||
void Panel::addBodyWidget(QWidget* widget) {
|
||||
body_layout_->addWidget(widget);
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QDockWidget>
|
||||
|
||||
class QWidget;
|
||||
class QVBoxLayout;
|
||||
|
||||
namespace ifcinterface::components {
|
||||
|
||||
@@ -32,10 +33,15 @@ class Panel : public QDockWidget {
|
||||
|
||||
public:
|
||||
explicit Panel(const QString& title,
|
||||
QWidget* content,
|
||||
QWidget* content = nullptr,
|
||||
QWidget* parent = nullptr,
|
||||
bool has_settings = false,
|
||||
bool scrollable = false);
|
||||
|
||||
void addBodyWidget(QWidget* widget);
|
||||
|
||||
private:
|
||||
QVBoxLayout* body_layout_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
|
||||
@@ -34,29 +34,39 @@ QString buildAppStyleSheet() {
|
||||
background: ${app_background};
|
||||
color: ${primary_text};
|
||||
}
|
||||
QFileDialog,
|
||||
QFileDialog QWidget,
|
||||
QFileDialog QStackedWidget,
|
||||
QFileDialog QSplitter {
|
||||
background: ${app_background};
|
||||
color: ${primary_text};
|
||||
}
|
||||
QFrame#ribbonShell {
|
||||
background: ${ribbon_shell_background};
|
||||
border-bottom: 1px solid ${border};
|
||||
}
|
||||
QTabBar::tab {
|
||||
QTabBar#appTabBar {
|
||||
background: ${ribbon_shell_background};
|
||||
}
|
||||
QTabBar#appTabBar::tab {
|
||||
background: transparent;
|
||||
color: ${secondary_text};
|
||||
padding: 8px 14px;
|
||||
margin-right: 2px;
|
||||
border-bottom: 2px solid transparent;
|
||||
}
|
||||
QTabBar::tab:selected {
|
||||
QTabBar#appTabBar::tab:selected {
|
||||
color: ${primary_text};
|
||||
border-bottom: 2px solid ${selection_background};
|
||||
}
|
||||
QTabBar::tab:hover {
|
||||
QTabBar#appTabBar::tab:hover {
|
||||
color: ${ribbon_tab_hover_text};
|
||||
}
|
||||
QFrame#ribbonBand {
|
||||
background: ${ribbon_band_background};
|
||||
border-top: 1px solid ${border};
|
||||
}
|
||||
QTabWidget::pane {
|
||||
QTabWidget#appTabWidget::pane {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
@@ -67,6 +77,9 @@ QString buildAppStyleSheet() {
|
||||
background: transparent;
|
||||
border-right: 1px solid ${border};
|
||||
}
|
||||
QFrame#ribbonGroup[separator="false"] {
|
||||
border-right: none;
|
||||
}
|
||||
QLabel#ribbonGroupLabel {
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
@@ -105,6 +118,7 @@ QString buildAppStyleSheet() {
|
||||
QListWidget,
|
||||
QTableWidget,
|
||||
QLineEdit,
|
||||
QComboBox,
|
||||
QSpinBox,
|
||||
QDoubleSpinBox,
|
||||
QCheckBox,
|
||||
@@ -179,6 +193,21 @@ QString buildAppStyleSheet() {
|
||||
QLineEdit:focus {
|
||||
border: 1px solid ${control_border_focus};
|
||||
}
|
||||
QComboBox {
|
||||
background: ${control_background};
|
||||
border: 1px solid ${border};
|
||||
border-radius: ${panel_radius}px;
|
||||
padding: ${padding}px ${padding}px;
|
||||
}
|
||||
QComboBox:focus {
|
||||
border: 1px solid ${control_border_focus};
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
background: ${panel_background};
|
||||
border: 1px solid ${border};
|
||||
selection-background-color: ${selection_background};
|
||||
selection-color: ${selection_text};
|
||||
}
|
||||
QSpinBox, QDoubleSpinBox {
|
||||
background: ${control_background};
|
||||
border: 1px solid ${border};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// 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 "Tabs.h"
|
||||
|
||||
namespace ifcinterface::components {
|
||||
|
||||
TabBar::TabBar(QWidget* parent)
|
||||
: QTabBar(parent)
|
||||
{
|
||||
setObjectName("appTabBar");
|
||||
setExpanding(false);
|
||||
setDrawBase(false);
|
||||
}
|
||||
|
||||
TabWidget::TabWidget(QWidget* parent)
|
||||
: QTabWidget(parent)
|
||||
{
|
||||
setObjectName("appTabWidget");
|
||||
setTabBar(new TabBar(this));
|
||||
}
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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_COMPONENTS_TABS_H
|
||||
#define IFCINTERFACE_COMPONENTS_TABS_H
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QTabWidget>
|
||||
|
||||
namespace ifcinterface::components {
|
||||
|
||||
class TabBar : public QTabBar {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TabBar(QWidget* parent = nullptr);
|
||||
};
|
||||
|
||||
class TabWidget : public QTabWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TabWidget(QWidget* parent = nullptr);
|
||||
};
|
||||
|
||||
} // namespace ifcinterface::components
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user