added clear action for browsing history

This commit is contained in:
Miodrag Milanovic 2018-07-18 17:33:04 +02:00
parent 3477263431
commit 19828bdf45
4 changed files with 18 additions and 0 deletions

View File

@ -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>

View File

@ -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();

View File

@ -102,6 +102,7 @@ class DesignWidget : public QWidget
QAction *actionPrev;
QAction *actionNext;
QAction *actionLast;
QAction *actionClear;
QColor highlightColors[8];
QMap<QTreeWidgetItem *, int> highlightSelected;

BIN
gui/resources/cross.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B