From 7c3e1e72f5eebd1e2f045f59032593cfcc7e7a2b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 12 Jun 2018 15:36:20 +0200 Subject: [PATCH] Add QTreeWidget and fill with bels --- gui/mainwindow.cc | 12 ++++++++++++ gui/mainwindow.ui | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 31ce8fae..c436fd6c 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -16,6 +16,18 @@ MainWindow::MainWindow(Design *_design, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), design(_design) { ui->setupUi(this); + ui->treeWidget->setColumnCount(1); + ui->treeWidget->setHeaderLabel(QString("Items")); + QTreeWidgetItem *belroot = new QTreeWidgetItem(ui->treeWidget); + belroot->setText(0, QString("Bels")); + ui->treeWidget->insertTopLevelItem(0, belroot); + QList items; + for (auto bel : design->chip.getBels()) { + auto name = design->chip.getBelName(bel); + items.append(new QTreeWidgetItem((QTreeWidget *)nullptr, + QStringList(QString(name.c_str())))); + } + belroot->addChildren(items); PyImport_ImportModule("emb"); write = [this](std::string s) { diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 3fe0f400..7352af1f 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -64,7 +64,7 @@ Qt::Vertical - + 300