From d603455129429ad08d261e43e6de2044c9bdfda2 Mon Sep 17 00:00:00 2001 From: HerrKermet Date: Wed, 29 Nov 2023 18:00:42 +0100 Subject: [PATCH] Added TabWidgetPlaceholder --- .../gatelibrary_manager.h | 10 +++- .../gatelibrary_manager.cpp | 58 +++++++++++++++++-- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/plugins/gui/include/gui/gatelibrary_management/gatelibrary_manager.h b/plugins/gui/include/gui/gatelibrary_management/gatelibrary_manager.h index 03503382651..6ecf8aba1a4 100644 --- a/plugins/gui/include/gui/gatelibrary_management/gatelibrary_manager.h +++ b/plugins/gui/include/gui/gatelibrary_management/gatelibrary_manager.h @@ -31,6 +31,8 @@ #include #include #include +#include +#include namespace hal { @@ -57,8 +59,14 @@ namespace hal private: + QWidget* createGeneralWidget(); + QWidget* createPinWidget(); + QWidget* createFlipFlopWidget(); + QWidget* createBooleanFunctionWidget(); + QTabWidget* mTabWidget; QGridLayout* mLayout; - + QPushButton* mEditBtn; + QPushButton* mAddBtn; QTableView* mTableView; GatelibraryTableModel* mTableModel; diff --git a/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp b/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp index 5fbf79aaa31..df9f8bf912b 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp @@ -14,23 +14,50 @@ #include #include -#include - -#include namespace hal { GateLibraryManager::GateLibraryManager(QWidget* parent) : QFrame(parent), mLayout(new QGridLayout()) { //TODO create layout and widgets + + mLayout->setSpacing(20); + mTableView = new QTableView(this); mTableModel = new GatelibraryTableModel(this); mTableView->verticalHeader()->setVisible(false); + + auto* generalPage = createGeneralWidget(); + auto* pinPage = createPinWidget(); + auto* flipFlopPage = createFlipFlopWidget(); + auto* booleanFunctionPage = createBooleanFunctionWidget(); + + + mEditBtn = new QPushButton("Edit", this); + mAddBtn = new QPushButton("Add", this); + + mTabWidget = new QTabWidget(this); + mTabWidget->addTab(generalPage, "General"); + mTabWidget->addTab(pinPage, "Pins"); + mTabWidget->addTab(flipFlopPage, "Flip Flops"); + mTabWidget->addTab(booleanFunctionPage, "Boolean Functions"); + mTableView->setModel(mTableModel); - mLayout->addWidget(mTableView); + + mEditBtn->setText("Edit"); + mAddBtn->setText("Add"); + + + // Add widgets to the layout + mLayout->addWidget(mTableView,0,0,1,2); + mLayout->addWidget(mEditBtn,1,0); + mLayout->addWidget(mAddBtn,1,1); + mLayout->addWidget(mTabWidget,0,2); + setLayout(mLayout); + repolish(); // CALL FROM PARENT } @@ -78,8 +105,29 @@ namespace hal mGateLibrary = gateLibrary; } mTableModel->loadFile(mGateLibrary); - + mEditBtn->setEnabled(!mReadOnly); + mAddBtn->setEnabled(!mReadOnly); } return true; } + QWidget* GateLibraryManager::createGeneralWidget() + { + return new QWidget(this); + } + + QWidget* GateLibraryManager::createPinWidget() + { + return new QWidget(this); + } + + QWidget* GateLibraryManager::createFlipFlopWidget() + { + return new QWidget(this); + } + + QWidget* GateLibraryManager::createBooleanFunctionWidget() + { + return new QWidget(this); + } + }