added clear action for browsing history
This commit is contained in:
parent
3477263431
commit
19828bdf45
@ -9,5 +9,6 @@
|
|||||||
<file>resources/resultset_previous.png</file>
|
<file>resources/resultset_previous.png</file>
|
||||||
<file>resources/resultset_next.png</file>
|
<file>resources/resultset_next.png</file>
|
||||||
<file>resources/resultset_last.png</file>
|
<file>resources/resultset_last.png</file>
|
||||||
|
<file>resources/cross.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -125,11 +125,27 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
|
|||||||
updateButtons();
|
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();
|
QToolBar *toolbar = new QToolBar();
|
||||||
toolbar->addAction(actionFirst);
|
toolbar->addAction(actionFirst);
|
||||||
toolbar->addAction(actionPrev);
|
toolbar->addAction(actionPrev);
|
||||||
toolbar->addAction(actionNext);
|
toolbar->addAction(actionNext);
|
||||||
toolbar->addAction(actionLast);
|
toolbar->addAction(actionLast);
|
||||||
|
toolbar->addAction(actionClear);
|
||||||
|
|
||||||
QWidget *topWidget = new QWidget();
|
QWidget *topWidget = new QWidget();
|
||||||
QVBoxLayout *vbox1 = new QVBoxLayout();
|
QVBoxLayout *vbox1 = new QVBoxLayout();
|
||||||
|
@ -102,6 +102,7 @@ class DesignWidget : public QWidget
|
|||||||
QAction *actionPrev;
|
QAction *actionPrev;
|
||||||
QAction *actionNext;
|
QAction *actionNext;
|
||||||
QAction *actionLast;
|
QAction *actionLast;
|
||||||
|
QAction *actionClear;
|
||||||
|
|
||||||
QColor highlightColors[8];
|
QColor highlightColors[8];
|
||||||
QMap<QTreeWidgetItem *, int> highlightSelected;
|
QMap<QTreeWidgetItem *, int> highlightSelected;
|
||||||
|
BIN
gui/resources/cross.png
Normal file
BIN
gui/resources/cross.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 655 B |
Loading…
Reference in New Issue
Block a user