From 1e5fe1b150eb837b5484327356d6e97747e527a5 Mon Sep 17 00:00:00 2001 From: Matthias Puchner <github@mpuchner.de> Date: Mon, 15 Nov 2021 14:43:16 +0100 Subject: [PATCH] rm obsolete code --- GUI/View/PropertyEditor/ComponentEditor.cpp | 67 +++---------------- GUI/View/PropertyEditor/ComponentEditor.h | 23 +------ GUI/View/PropertyEditor/ComponentFlatView.cpp | 13 +--- GUI/View/PropertyEditor/ComponentFlatView.h | 3 - GUI/View/Toplevel/SessionModelView.h | 2 - 5 files changed, 13 insertions(+), 95 deletions(-) diff --git a/GUI/View/PropertyEditor/ComponentEditor.cpp b/GUI/View/PropertyEditor/ComponentEditor.cpp index 49f665fdf27..7b4092422fb 100644 --- a/GUI/View/PropertyEditor/ComponentEditor.cpp +++ b/GUI/View/PropertyEditor/ComponentEditor.cpp @@ -15,48 +15,22 @@ #include "GUI/View/PropertyEditor/ComponentEditor.h" #include "GUI/View/PropertyEditor/ComponentFlatView.h" #include "GUI/View/PropertyEditor/ComponentTreeView.h" -#include "GUI/View/PropertyEditor/GroupInfoBox.h" #include <QBoxLayout> -#include <QGroupBox> -namespace { - -template <typename T> T* createGroupBox(ComponentView* componentView, QString title) +ComponentEditor::ComponentEditor(EditorType editorType) : m_componentView(nullptr), m_item(nullptr) { - auto* box = new T(title); - auto* boxlayout = new QVBoxLayout; - boxlayout->setContentsMargins(0, 0, 0, 0); - boxlayout->addWidget(componentView); - box->setLayout(boxlayout); - return box; -} -} // namespace - -ComponentEditor::ComponentEditor(EditorType editorType, const QString& title) - : m_type(editorType), m_componentView(nullptr), m_item(nullptr), m_title(title) -{ - m_componentView = createComponentView(); + if (editorType.testFlag(Tree)) { + auto* view = new ComponentTreeView; + view->setShowHeader(editorType.testFlag(T_Header)); + view->setShowRootItem(editorType.testFlag(T_Root)); + m_componentView = view; + } else + m_componentView = new ComponentFlatView; auto* mainLayout = new QVBoxLayout; mainLayout->setSpacing(0); mainLayout->setMargin(0); - - if (m_type.testFlag(GroupLayout)) { - auto* box = createGroupBox<QGroupBox>(m_componentView, title); - mainLayout->addWidget(box); - mainLayout->setMargin(4); - mainLayout->addStretch(); - - } else if (m_type.testFlag(InfoLayout)) { - auto* box = createGroupBox<GroupInfoBox>(m_componentView, title); - connect(box, &GroupInfoBox::clicked, this, &ComponentEditor::onDialogRequest); - mainLayout->addWidget(box); - mainLayout->setMargin(4); - mainLayout->addStretch(); - - } else { - mainLayout->addWidget(m_componentView); - } + mainLayout->addWidget(m_componentView); setLayout(mainLayout); } @@ -79,26 +53,3 @@ void ComponentEditor::addItem(SessionItem* item) m_item = item; m_componentView->addItem(item); } - -void ComponentEditor::onDialogRequest() -{ - emit dialogRequest(m_item, m_title); -} - -ComponentView* ComponentEditor::createComponentView() -{ - ComponentView* result(nullptr); - - if (m_type.testFlag(Tree)) { - auto* view = new ComponentTreeView; - view->setShowHeader(m_type.testFlag(T_Header)); - view->setShowRootItem(m_type.testFlag(T_Root)); - result = view; - } else { - auto* view = new ComponentFlatView; - view->setShowChildren(!m_type.testFlag(W_NoChildren)); - result = view; - } - - return result; -} diff --git a/GUI/View/PropertyEditor/ComponentEditor.h b/GUI/View/PropertyEditor/ComponentEditor.h index 6c6827c8000..b3592d7f01a 100644 --- a/GUI/View/PropertyEditor/ComponentEditor.h +++ b/GUI/View/PropertyEditor/ComponentEditor.h @@ -29,44 +29,27 @@ class ComponentEditor : public QWidget { public: enum EditorFlags { Tree = 0x1000, - Widget = 0x2000, PlainLayout = 0x0010, // editor embedded in standard box layout - GroupLayout = 0x0020, // editor embedded in QGroupBox - InfoLayout = 0x0040, // editor embedded in GroupInfoBox - T_Header = 0x0100, // to show QTreeView header (Tree mode only) - T_Root = 0x0200, // to show root item (Tree mode only) - W_NoChildren = 0x0400, // show no children (Widget mode only) + T_Header = 0x0100, // to show QTreeView header (Tree mode only) + T_Root = 0x0200, // to show root item (Tree mode only) FullTree = Tree | PlainLayout | T_Header | T_Root, HeaderTree = Tree | PlainLayout | T_Header, MiniTree = Tree | PlainLayout, - PlainWidget = Widget | PlainLayout, - GroupWidget = Widget | GroupLayout, - InfoWidget = Widget | InfoLayout, }; Q_DECLARE_FLAGS(EditorType, EditorFlags) - ComponentEditor(EditorType editorType = HeaderTree, const QString& title = ""); + ComponentEditor(EditorType editorType = HeaderTree); void setItem(SessionItem* item); void clearEditor(); void addItem(SessionItem* item); -signals: - void dialogRequest(SessionItem* item, const QString& names); - -private slots: - void onDialogRequest(); - private: - ComponentView* createComponentView(); - - EditorType m_type; ComponentView* m_componentView; SessionItem* m_item; - QString m_title; }; Q_DECLARE_OPERATORS_FOR_FLAGS(ComponentEditor::EditorType) diff --git a/GUI/View/PropertyEditor/ComponentFlatView.cpp b/GUI/View/PropertyEditor/ComponentFlatView.cpp index 4c2738d506d..cc63d43b30a 100644 --- a/GUI/View/PropertyEditor/ComponentFlatView.cpp +++ b/GUI/View/PropertyEditor/ComponentFlatView.cpp @@ -29,11 +29,7 @@ #include <QVBoxLayout> ComponentFlatView::ComponentFlatView(QWidget* parent) - : ComponentView(parent) - , m_mainLayout(nullptr) - , m_gridLayout(nullptr) - , m_model(nullptr) - , m_show_children(true) + : ComponentView(parent), m_mainLayout(nullptr), m_gridLayout(nullptr), m_model(nullptr) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -88,11 +84,6 @@ void ComponentFlatView::clearLayout() m_widgetItems.clear(); } -void ComponentFlatView::setShowChildren(bool show) -{ - m_show_children = show; -} - void ComponentFlatView::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles) { @@ -127,8 +118,6 @@ void ComponentFlatView::updateItemProperties() continue; widget->addToGrid(m_gridLayout, nrow++); m_widgetItems.push_back(widget); - if (!m_show_children) - break; } } diff --git a/GUI/View/PropertyEditor/ComponentFlatView.h b/GUI/View/PropertyEditor/ComponentFlatView.h index cfc643d0d02..7419c1e169b 100644 --- a/GUI/View/PropertyEditor/ComponentFlatView.h +++ b/GUI/View/PropertyEditor/ComponentFlatView.h @@ -41,8 +41,6 @@ public: void clearEditor() override; - void setShowChildren(bool show); - public slots: void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles); @@ -58,7 +56,6 @@ private: QGridLayout* m_gridLayout; QVector<PropertyWidgetItem*> m_widgetItems; SessionModel* m_model; - bool m_show_children; QVector<const SessionItem*> m_topItems; }; diff --git a/GUI/View/Toplevel/SessionModelView.h b/GUI/View/Toplevel/SessionModelView.h index 4edc248ea88..a3dff751c5e 100644 --- a/GUI/View/Toplevel/SessionModelView.h +++ b/GUI/View/Toplevel/SessionModelView.h @@ -35,8 +35,6 @@ class SessionModelView : public QWidget { public: SessionModelView(QWidget* parent, ProjectDocument* document); - void setViewActive(bool is_active); - private slots: void onExpandCollapseTree(); -- GitLab