aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-18 17:33:04 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-18 17:33:04 +0200
commit19828bdf455d9e7d554cab639a2cd045c897b671 (patch)
treed7dcea03e92862a847fe702eb93fb922aafa63f7 /gui
parent34772634317972aa4f816b6010a273bd7f3d17f3 (diff)
downloadnextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.tar.gz
nextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.tar.bz2
nextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.zip
added clear action for browsing history
Diffstat (limited to 'gui')
-rw-r--r--gui/base.qrc1
-rw-r--r--gui/designwidget.cc16
-rw-r--r--gui/designwidget.h1
-rw-r--r--gui/resources/cross.pngbin0 -> 655 bytes
4 files changed, 18 insertions, 0 deletions
diff --git a/gui/base.qrc b/gui/base.qrc
index 8f07aabe..1a848f54 100644
--- a/gui/base.qrc
+++ b/gui/base.qrc
@@ -9,5 +9,6 @@
<file>resources/resultset_previous.png</file>
<file>resources/resultset_next.png</file>
<file>resources/resultset_last.png</file>
+ <file>resources/cross.png</file>
</qresource>
</RCC>
diff --git a/gui/designwidget.cc b/gui/designwidget.cc
index 5181cd23..93f71355 100644
--- a/gui/designwidget.cc
+++ b/gui/designwidget.cc
@@ -125,11 +125,27 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
updateButtons();
});
+ actionClear = new QAction("", this);
+ actionClear->setIcon(QIcon(":/icons/resources/cross.png"));
+ actionClear->setEnabled(true);
+ connect(actionClear, &QAction::triggered, this, [this] {
+ history_index = -1;
+ history.clear();
+ QTreeWidgetItem *clickItem = treeWidget->selectedItems().at(0);
+ if (clickItem->parent()) {
+ ElementType type = static_cast<ElementTreeItem *>(clickItem)->getType();
+ if (type != ElementType::NONE)
+ addToHistory(treeWidget->selectedItems().at(0));
+ }
+ updateButtons();
+ });
+
QToolBar *toolbar = new QToolBar();
toolbar->addAction(actionFirst);
toolbar->addAction(actionPrev);
toolbar->addAction(actionNext);
toolbar->addAction(actionLast);
+ toolbar->addAction(actionClear);
QWidget *topWidget = new QWidget();
QVBoxLayout *vbox1 = new QVBoxLayout();
diff --git a/gui/designwidget.h b/gui/designwidget.h
index 269e32fa..b5877f60 100644
--- a/gui/designwidget.h
+++ b/gui/designwidget.h
@@ -102,6 +102,7 @@ class DesignWidget : public QWidget
QAction *actionPrev;
QAction *actionNext;
QAction *actionLast;
+ QAction *actionClear;
QColor highlightColors[8];
QMap<QTreeWidgetItem *, int> highlightSelected;
diff --git a/gui/resources/cross.png b/gui/resources/cross.png
new file mode 100644
index 00000000..1514d51a
--- /dev/null
+++ b/gui/resources/cross.png
Binary files differ