Skip to content

Commit

Permalink
Added TabWidgetPlaceholder
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrKermet committed Nov 29, 2023
1 parent d59851e commit d603455
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <QFrame>
#include <QGridLayout>
#include <QTableView>
#include <QPushButton>
#include <QTabWidget>

namespace hal
{
Expand All @@ -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;

Expand Down
58 changes: 53 additions & 5 deletions plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,50 @@
#include <QFileDialog>
#include <QHeaderView>

#include <gui/gui_globals.h>

#include <QTableWidget>
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
}

Expand Down Expand Up @@ -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);
}

}

0 comments on commit d603455

Please sign in to comment.