From 2596b9fe17fbf0a08ff234c7798a32429d27640b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 25 Jul 2018 19:10:45 +0200 Subject: Add ability for multiple selection, enable for select only items that make sense --- gui/designwidget.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 7e8e2840..33a8ed93 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -35,6 +35,7 @@ class ElementTreeItem : public QTreeWidgetItem ElementTreeItem(ElementType t, QString str, QTreeWidgetItem *parent) : QTreeWidgetItem(parent, QStringList(str)), type(t) { + this->setFlags(this->flags() & ~Qt::ItemIsSelectable); } virtual ~ElementTreeItem(){}; @@ -49,6 +50,7 @@ class IdStringTreeItem : public ElementTreeItem public: IdStringTreeItem(IdString d, ElementType t, QString str, QTreeWidgetItem *parent) : ElementTreeItem(t, str, parent) { + this->setFlags(this->flags() | Qt::ItemIsSelectable); this->data = d; } virtual ~IdStringTreeItem(){}; @@ -68,6 +70,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net treeWidget->setColumnCount(1); treeWidget->setHeaderLabel("Items"); treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); + treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); // Add property view variantManager = new QtVariantPropertyManager(this); @@ -79,6 +82,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net propertyEditor->setPropertiesWithoutValueMarked(true); propertyEditor->show(); propertyEditor->treeWidget()->setContextMenuPolicy(Qt::CustomContextMenu); + propertyEditor->treeWidget()->setSelectionMode(QAbstractItemView::ExtendedSelection); QLineEdit *lineEdit = new QLineEdit(); lineEdit->setClearButtonEnabled(true); @@ -248,6 +252,7 @@ void DesignWidget::newContext(Context *ctx) QTreeWidgetItem *bel_root = new QTreeWidgetItem(treeWidget); QMap bel_items; bel_root->setText(0, "Bels"); + bel_root->setFlags(bel_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, bel_root); if (ctx) { for (auto bel : ctx->getBels()) { @@ -280,6 +285,7 @@ void DesignWidget::newContext(Context *ctx) QTreeWidgetItem *wire_root = new QTreeWidgetItem(treeWidget); QMap wire_items; wire_root->setText(0, "Wires"); + wire_root->setFlags(wire_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, wire_root); if (ctx) { for (auto wire : ctx->getWires()) { @@ -311,6 +317,7 @@ void DesignWidget::newContext(Context *ctx) QTreeWidgetItem *pip_root = new QTreeWidgetItem(treeWidget); QMap pip_items; pip_root->setText(0, "Pips"); + pip_root->setFlags(pip_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, pip_root); #ifndef ARCH_ECP5 if (ctx) { @@ -343,10 +350,12 @@ void DesignWidget::newContext(Context *ctx) nets_root = new QTreeWidgetItem(treeWidget); nets_root->setText(0, "Nets"); + nets_root->setFlags(nets_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, nets_root); cells_root = new QTreeWidgetItem(treeWidget); cells_root->setText(0, "Cells"); + cells_root->setFlags(cells_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, cells_root); updateTree(); @@ -418,6 +427,7 @@ QtProperty *DesignWidget::addTopLevelProperty(const QString &id) QtProperty *topItem = groupManager->addProperty(id); propertyToId[topItem] = id; idToProperty[id] = topItem; + topItem->setSelectable(false); propertyEditor->addProperty(topItem); return topItem; } @@ -485,12 +495,14 @@ void DesignWidget::addProperty(QtProperty *topItem, int propertyType, const QStr QtVariantProperty *item = readOnlyManager->addProperty(propertyType, name); item->setValue(value); item->setPropertyId(getElementTypeName(type)); + item->setSelectable(type != ElementType::NONE); topItem->addSubProperty(item); } QtProperty *DesignWidget::addSubGroup(QtProperty *topItem, const QString &name) { QtProperty *item = groupManager->addProperty(name); + item->setSelectable(false); topItem->addSubProperty(item); return item; } -- cgit v1.2.3 From 9a4bdbe4b6481e6548ec8391dabb512ccc674b6e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 25 Jul 2018 19:21:46 +0200 Subject: made select multiple to work --- gui/designwidget.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 33a8ed93..93b53926 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -512,6 +512,19 @@ void DesignWidget::onItemSelectionChanged() if (treeWidget->selectedItems().size() == 0) return; + if (treeWidget->selectedItems().size() > 1) + { + std::vector decals; + for (auto clickItem : treeWidget->selectedItems()) { + IdString value = static_cast(clickItem)->getData(); + ElementType type = static_cast(clickItem)->getType(); + std::vector d = getDecals(type, value); + std::move(d.begin(), d.end(), std::back_inserter(decals)); + } + Q_EMIT selected(decals); + return; + } + QTreeWidgetItem *clickItem = treeWidget->selectedItems().at(0); if (!clickItem->parent()) -- cgit v1.2.3 From 950f33c1bb6260f830e6974583d0e1424146b386 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Wed, 25 Jul 2018 17:53:01 -0700 Subject: clangformat --- gui/designwidget.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 93b53926..c17990a5 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -319,7 +319,7 @@ void DesignWidget::newContext(Context *ctx) pip_root->setText(0, "Pips"); pip_root->setFlags(pip_root->flags() & ~Qt::ItemIsSelectable); treeWidget->insertTopLevelItem(0, pip_root); -#ifndef ARCH_ECP5 +#ifndef ARCH_ECP5 if (ctx) { for (auto pip : ctx->getPips()) { auto id = ctx->getPipName(pip); @@ -346,7 +346,7 @@ void DesignWidget::newContext(Context *ctx) for (auto pip : nameToItem[2].toStdMap()) { pip_root->addChild(pip.second); } -#endif +#endif nets_root = new QTreeWidgetItem(treeWidget); nets_root->setText(0, "Nets"); @@ -512,8 +512,7 @@ void DesignWidget::onItemSelectionChanged() if (treeWidget->selectedItems().size() == 0) return; - if (treeWidget->selectedItems().size() > 1) - { + if (treeWidget->selectedItems().size() > 1) { std::vector decals; for (auto clickItem : treeWidget->selectedItems()) { IdString value = static_cast(clickItem)->getData(); -- cgit v1.2.3 From c9b9d9b22754778beaa1a922f0df3dac42dd8867 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 26 Jul 2018 11:42:05 +0200 Subject: highlight operation on multiple items --- gui/designwidget.cc | 104 ++++++++++++++++++++++++++-------------------------- gui/designwidget.h | 3 +- 2 files changed, 52 insertions(+), 55 deletions(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index c17990a5..f9d231c1 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -775,54 +775,55 @@ std::vector DesignWidget::getDecals(ElementType type, IdString value) return decals; } -void DesignWidget::updateHighlightGroup(QTreeWidgetItem *item, int group) +void DesignWidget::updateHighlightGroup(QList items, int group) { - if (highlightSelected.contains(item)) { - if (highlightSelected[item] == group) { - highlightSelected.remove(item); - } else - highlightSelected[item] = group; - } else - highlightSelected.insert(item, group); - - std::vector decals; - - for (auto it : highlightSelected.toStdMap()) { - if (it.second == group) { - ElementType type = static_cast(it.first)->getType(); - IdString value = static_cast(it.first)->getData(); - std::vector d = getDecals(type, value); - std::move(d.begin(), d.end(), std::back_inserter(decals)); + const bool shouldClear = items.size() == 1; + for (auto item : items) { + if (highlightSelected.contains(item)) { + if (shouldClear && highlightSelected[item] == group) { + highlightSelected.remove(item); + } + else + highlightSelected[item] = group; } + else + highlightSelected.insert(item, group); } + std::vector decals[8]; - Q_EMIT highlight(decals, group); + for (auto it : highlightSelected.toStdMap()) { + ElementType type = static_cast(it.first)->getType(); + IdString value = static_cast(it.first)->getData(); + std::vector d = getDecals(type, value); + std::move(d.begin(), d.end(), std::back_inserter(decals[it.second])); + } + for (int i=0;i<8;i++) + Q_EMIT highlight(decals[i], i); } void DesignWidget::prepareMenuProperty(const QPoint &pos) { QTreeWidget *tree = propertyEditor->treeWidget(); - - itemContextMenu = tree->itemAt(pos); - if (itemContextMenu->parent() == nullptr) - return; - - QtBrowserItem *browserItem = propertyEditor->itemToBrowserItem(itemContextMenu); - if (!browserItem) - return; - QtProperty *selectedProperty = browserItem->property(); - ElementType type = getElementTypeByName(selectedProperty->propertyId()); - if (type == ElementType::NONE) - return; - IdString value = ctx->id(selectedProperty->valueText().toStdString()); - - QTreeWidgetItem *item = nameToItem[getElementIndex(type)].value(value.c_str(ctx)); + QList items; + for (auto itemContextMenu : tree->selectedItems()) { + QtBrowserItem *browserItem = propertyEditor->itemToBrowserItem(itemContextMenu); + if (!browserItem) + continue; + QtProperty *selectedProperty = browserItem->property(); + ElementType type = getElementTypeByName(selectedProperty->propertyId()); + if (type == ElementType::NONE) + continue; + IdString value = ctx->id(selectedProperty->valueText().toStdString()); + items.append(nameToItem[getElementIndex(type)].value(value.c_str(ctx))); + } + int selectedIndex = -1; + if (items.size() == 1) { + QTreeWidgetItem *item = items.at(0); + if (highlightSelected.contains(item)) + selectedIndex = highlightSelected[item]; + } QMenu menu(this); - QAction *selectAction = new QAction("&Select", this); - connect(selectAction, &QAction::triggered, this, [this, type, value] { Q_EMIT selected(getDecals(type, value)); }); - menu.addAction(selectAction); - QMenu *subMenu = menu.addMenu("Highlight"); QActionGroup *group = new QActionGroup(this); group->setExclusive(true); @@ -833,27 +834,24 @@ void DesignWidget::prepareMenuProperty(const QPoint &pos) action->setCheckable(true); subMenu->addAction(action); group->addAction(action); - if (highlightSelected.contains(item) && highlightSelected[item] == i) + if (selectedIndex == i) action->setChecked(true); - connect(action, &QAction::triggered, this, [this, i, item] { updateHighlightGroup(item, i); }); + connect(action, &QAction::triggered, this, [this, i, items] { updateHighlightGroup(items, i); }); } menu.exec(tree->mapToGlobal(pos)); } void DesignWidget::prepareMenuTree(const QPoint &pos) { - QTreeWidget *tree = treeWidget; - - itemContextMenu = tree->itemAt(pos); - - ElementType type = static_cast(itemContextMenu)->getType(); - IdString value = static_cast(itemContextMenu)->getData(); - - if (type == ElementType::NONE) + if (treeWidget->selectedItems().size() == 0) return; - - QTreeWidgetItem *item = nameToItem[getElementIndex(type)].value(value.c_str(ctx)); - + int selectedIndex = -1; + QList items = treeWidget->selectedItems(); + if (treeWidget->selectedItems().size() == 1) { + QTreeWidgetItem *item = treeWidget->selectedItems().at(0); + if (highlightSelected.contains(item)) + selectedIndex = highlightSelected[item]; + } QMenu menu(this); QMenu *subMenu = menu.addMenu("Highlight"); QActionGroup *group = new QActionGroup(this); @@ -865,11 +863,11 @@ void DesignWidget::prepareMenuTree(const QPoint &pos) action->setCheckable(true); subMenu->addAction(action); group->addAction(action); - if (highlightSelected.contains(item) && highlightSelected[item] == i) + if (selectedIndex == i) action->setChecked(true); - connect(action, &QAction::triggered, this, [this, i, item] { updateHighlightGroup(item, i); }); + connect(action, &QAction::triggered, this, [this, i, items] { updateHighlightGroup(items, i); }); } - menu.exec(tree->mapToGlobal(pos)); + menu.exec(treeWidget->mapToGlobal(pos)); } void DesignWidget::onItemDoubleClicked(QTreeWidgetItem *item, int column) diff --git a/gui/designwidget.h b/gui/designwidget.h index b5877f60..fe340237 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -60,7 +60,7 @@ class DesignWidget : public QWidget void updateButtons(); void addToHistory(QTreeWidgetItem *item); std::vector getDecals(ElementType type, IdString value); - void updateHighlightGroup(QTreeWidgetItem *item, int group); + void updateHighlightGroup(QList item, int group); Q_SIGNALS: void info(std::string text); void selected(std::vector decal); @@ -85,7 +85,6 @@ class DesignWidget : public QWidget QtGroupPropertyManager *groupManager; QtVariantEditorFactory *variantFactory; QtTreePropertyBrowser *propertyEditor; - QTreeWidgetItem *itemContextMenu; QMap propertyToId; QMap idToProperty; -- cgit v1.2.3 From 4587b8c0001d853ab2fb6f820627f1508e28e316 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 26 Jul 2018 13:21:46 +0200 Subject: added buttons for new zoom operations --- gui/base.qrc | 4 ++++ gui/basewindow.cc | 29 +++++++++++++++++++++++++++-- gui/basewindow.h | 4 ++++ gui/fpgaviewwidget.cc | 39 +++++++++++++++++++++++++-------------- gui/fpgaviewwidget.h | 6 +++++- gui/ice40/mainwindow.cc | 2 ++ gui/resources/shape_handles.png | Bin 0 -> 538 bytes gui/resources/shape_square.png | Bin 0 -> 353 bytes gui/resources/zoom_in.png | Bin 0 -> 725 bytes gui/resources/zoom_out.png | Bin 0 -> 708 bytes 10 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 gui/resources/shape_handles.png create mode 100644 gui/resources/shape_square.png create mode 100644 gui/resources/zoom_in.png create mode 100644 gui/resources/zoom_out.png (limited to 'gui') diff --git a/gui/base.qrc b/gui/base.qrc index 1a848f54..7b3fa55c 100644 --- a/gui/base.qrc +++ b/gui/base.qrc @@ -10,5 +10,9 @@ resources/resultset_next.png resources/resultset_last.png resources/cross.png + resources/zoom_in.png + resources/zoom_out.png + resources/shape_handles.png + resources/shape_square.png diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 78c2fe3a..11a7fe8d 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -25,7 +25,6 @@ #include #include "designwidget.h" #include "fpgaviewwidget.h" -#include "jsonparse.h" #include "log.h" #include "mainwindow.h" #include "pythontab.h" @@ -76,7 +75,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr context, QWidget *parent centralTabWidget->setTabsClosable(true); connect(centralTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); - FPGAViewWidget *fpgaView = new FPGAViewWidget(); + fpgaView = new FPGAViewWidget(); centralTabWidget->addTab(fpgaView, "Graphics"); centralTabWidget->tabBar()->tabButton(0, QTabBar::RightSide)->resize(0, 0); @@ -163,4 +162,30 @@ void BaseMainWindow::createMenusAndBars() mainToolBar->addAction(actionSave); } +void BaseMainWindow::createGraphicsBar() +{ + QAction *actionZoomIn = new QAction("Zoom In", this); + actionZoomIn->setIcon(QIcon(":/icons/resources/zoom_in.png")); + connect(actionZoomIn, SIGNAL(triggered()), fpgaView, SLOT(zoom_in())); + + QAction *actionZoomOut = new QAction("Zoom Out", this); + actionZoomOut->setIcon(QIcon(":/icons/resources/zoom_out.png")); + connect(actionZoomOut, SIGNAL(triggered()), fpgaView, SLOT(zoom_out())); + + QAction *actionZoomSelected = new QAction("Zoom Selected", this); + actionZoomSelected->setIcon(QIcon(":/icons/resources/shape_handles.png")); + connect(actionZoomSelected, SIGNAL(triggered()), fpgaView, SLOT(zoom_selected())); + + QAction *actionZoomOutbound = new QAction("Zoom Outbound", this); + actionZoomOutbound->setIcon(QIcon(":/icons/resources/shape_square.png")); + connect(actionZoomOutbound, SIGNAL(triggered()), fpgaView, SLOT(zoom_outbound())); + + graphicsToolBar = new QToolBar(); + addToolBar(Qt::TopToolBarArea, graphicsToolBar); + graphicsToolBar->addAction(actionZoomIn); + graphicsToolBar->addAction(actionZoomOut); + graphicsToolBar->addAction(actionZoomSelected); + graphicsToolBar->addAction(actionZoomOutbound); +} + NEXTPNR_NAMESPACE_END diff --git a/gui/basewindow.h b/gui/basewindow.h index 1184fa80..a25a2854 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -37,6 +37,7 @@ NEXTPNR_NAMESPACE_BEGIN class PythonTab; class DesignWidget; +class FPGAViewWidget; class BaseMainWindow : public QMainWindow { @@ -49,6 +50,7 @@ class BaseMainWindow : public QMainWindow protected: void createMenusAndBars(); + void createGraphicsBar(); protected Q_SLOTS: void writeInfo(std::string text); @@ -70,12 +72,14 @@ class BaseMainWindow : public QMainWindow QMenuBar *menuBar; QToolBar *mainToolBar; + QToolBar *graphicsToolBar; QStatusBar *statusBar; QAction *actionNew; QAction *actionOpen; QAction *actionSave; QProgressBar *progressBar; DesignWidget *designview; + FPGAViewWidget *fpgaView; }; NEXTPNR_NAMESPACE_END diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index 15f37ce0..e08667f6 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -580,21 +580,32 @@ void FPGAViewWidget::wheelEvent(QWheelEvent *event) { QPoint degree = event->angleDelta() / 8; - if (!degree.isNull()) { - - if (zoom_ < zoomNear_) { - zoom_ = zoomNear_; - } else if (zoom_ < zoomLvl1_) { - zoom_ -= degree.y() / 10.0; - } else if (zoom_ < zoomLvl2_) { - zoom_ -= degree.y() / 5.0; - } else if (zoom_ < zoomFar_) { - zoom_ -= degree.y(); - } else { - zoom_ = zoomFar_; - } - update(); + if (!degree.isNull()) + zoom(degree.y()); +} + +void FPGAViewWidget::zoom(int level) +{ + if (zoom_ < zoomNear_) { + zoom_ = zoomNear_; + } else if (zoom_ < zoomLvl1_) { + zoom_ -= level / 10.0; + } else if (zoom_ < zoomLvl2_) { + zoom_ -= level / 5.0; + } else if (zoom_ < zoomFar_) { + zoom_ -= level; + } else { + zoom_ = zoomFar_; } + update(); } +void FPGAViewWidget::zoom_in() { zoom(10); } + +void FPGAViewWidget::zoom_out() { zoom(-10); } + +void FPGAViewWidget::zoom_selected() {} + +void FPGAViewWidget::zoom_outbound() {} + NEXTPNR_NAMESPACE_END diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index b87c5d0a..636d5672 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -292,9 +292,13 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions void onSelectedArchItem(std::vector decals); void onHighlightGroupChanged(std::vector decals, int group); void pokeRenderer(void); - + void zoom_in(); + void zoom_out(); + void zoom_selected(); + void zoom_outbound(); private: void renderLines(void); + void zoom(int level); QPoint lastPos_; LineShader lineShader_; diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 810a98ae..f06971b6 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -159,6 +159,8 @@ void MainWindow::createMenu() taskToolBar->addAction(actionPlay); taskToolBar->addAction(actionPause); taskToolBar->addAction(actionStop); + + createGraphicsBar(); } #if defined(_MSC_VER) diff --git a/gui/resources/shape_handles.png b/gui/resources/shape_handles.png new file mode 100644 index 00000000..ce27fe3a Binary files /dev/null and b/gui/resources/shape_handles.png differ diff --git a/gui/resources/shape_square.png b/gui/resources/shape_square.png new file mode 100644 index 00000000..33af0460 Binary files /dev/null and b/gui/resources/shape_square.png differ diff --git a/gui/resources/zoom_in.png b/gui/resources/zoom_in.png new file mode 100644 index 00000000..cdf0a52f Binary files /dev/null and b/gui/resources/zoom_in.png differ diff --git a/gui/resources/zoom_out.png b/gui/resources/zoom_out.png new file mode 100644 index 00000000..07bf98a7 Binary files /dev/null and b/gui/resources/zoom_out.png differ -- cgit v1.2.3 From 467e0926f920f23b7cb2241cf52dbcfe84646fed Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 26 Jul 2018 16:38:11 +0200 Subject: Add getWireType()/getPipType() API Signed-off-by: Clifford Wolf --- gui/designwidget.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index f9d231c1..4086fd63 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -567,6 +567,7 @@ void DesignWidget::onItemSelectionChanged() QtProperty *topItem = addTopLevelProperty("Wire"); addProperty(topItem, QVariant::String, "Name", c.c_str(ctx)); + addProperty(topItem, QVariant::String, "Type", ctx->getWireType(wire).c_str(ctx)); addProperty(topItem, QVariant::Bool, "Available", ctx->checkWireAvail(wire)); addProperty(topItem, QVariant::String, "Bound Net", ctx->getBoundWireNet(wire).c_str(ctx), ElementType::NET); addProperty(topItem, QVariant::String, "Conflicting Net", ctx->getConflictingWireNet(wire).c_str(ctx), @@ -618,6 +619,7 @@ void DesignWidget::onItemSelectionChanged() QtProperty *topItem = addTopLevelProperty("Pip"); addProperty(topItem, QVariant::String, "Name", c.c_str(ctx)); + addProperty(topItem, QVariant::String, "Type", ctx->getPipType(pip).c_str(ctx)); addProperty(topItem, QVariant::Bool, "Available", ctx->checkPipAvail(pip)); addProperty(topItem, QVariant::String, "Bound Net", ctx->getBoundPipNet(pip).c_str(ctx), ElementType::NET); addProperty(topItem, QVariant::String, "Conflicting Net", ctx->getConflictingPipNet(pip).c_str(ctx), -- cgit v1.2.3 From 03f92948d1504c32049da065c0e73e01f96d8033 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 26 Jul 2018 17:14:56 +0200 Subject: clangformat and GraphicElement::style comments Signed-off-by: Clifford Wolf --- gui/designwidget.cc | 14 ++++++-------- gui/designwidget.h | 2 +- gui/fpgaviewwidget.h | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 4086fd63..2bba8532 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -777,18 +777,16 @@ std::vector DesignWidget::getDecals(ElementType type, IdString value) return decals; } -void DesignWidget::updateHighlightGroup(QList items, int group) +void DesignWidget::updateHighlightGroup(QList items, int group) { const bool shouldClear = items.size() == 1; for (auto item : items) { if (highlightSelected.contains(item)) { if (shouldClear && highlightSelected[item] == group) { highlightSelected.remove(item); - } - else + } else highlightSelected[item] = group; - } - else + } else highlightSelected.insert(item, group); } std::vector decals[8]; @@ -799,14 +797,14 @@ void DesignWidget::updateHighlightGroup(QList items, int group std::vector d = getDecals(type, value); std::move(d.begin(), d.end(), std::back_inserter(decals[it.second])); } - for (int i=0;i<8;i++) + for (int i = 0; i < 8; i++) Q_EMIT highlight(decals[i], i); } void DesignWidget::prepareMenuProperty(const QPoint &pos) { QTreeWidget *tree = propertyEditor->treeWidget(); - QList items; + QList items; for (auto itemContextMenu : tree->selectedItems()) { QtBrowserItem *browserItem = propertyEditor->itemToBrowserItem(itemContextMenu); if (!browserItem) @@ -848,7 +846,7 @@ void DesignWidget::prepareMenuTree(const QPoint &pos) if (treeWidget->selectedItems().size() == 0) return; int selectedIndex = -1; - QList items = treeWidget->selectedItems(); + QList items = treeWidget->selectedItems(); if (treeWidget->selectedItems().size() == 1) { QTreeWidgetItem *item = treeWidget->selectedItems().at(0); if (highlightSelected.contains(item)) diff --git a/gui/designwidget.h b/gui/designwidget.h index fe340237..6d4b7fe1 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -60,7 +60,7 @@ class DesignWidget : public QWidget void updateButtons(); void addToHistory(QTreeWidgetItem *item); std::vector getDecals(ElementType type, IdString value); - void updateHighlightGroup(QList item, int group); + void updateHighlightGroup(QList item, int group); Q_SIGNALS: void info(std::string text); void selected(std::vector decal); diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 636d5672..36d4a3f2 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -296,6 +296,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions void zoom_out(); void zoom_selected(); void zoom_outbound(); + private: void renderLines(void); void zoom(int level); -- cgit v1.2.3