diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-18 17:33:04 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-18 17:33:04 +0200 |
commit | 19828bdf455d9e7d554cab639a2cd045c897b671 (patch) | |
tree | d7dcea03e92862a847fe702eb93fb922aafa63f7 /gui/designwidget.cc | |
parent | 34772634317972aa4f816b6010a273bd7f3d17f3 (diff) | |
download | nextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.tar.gz nextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.tar.bz2 nextpnr-19828bdf455d9e7d554cab639a2cd045c897b671.zip |
added clear action for browsing history
Diffstat (limited to 'gui/designwidget.cc')
-rw-r--r-- | gui/designwidget.cc | 16 |
1 files changed, 16 insertions, 0 deletions
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();
|