From 5d11af5a251850576431d4ac210d9ca1af375888 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 11 Nov 2018 13:26:33 +0100 Subject: multiple selection fix --- gui/designwidget.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 561d5361..e99637bf 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -20,6 +20,7 @@ #include "designwidget.h" #include +#include #include #include #include @@ -561,10 +562,18 @@ void DesignWidget::onSelectionChanged(int num, const QItemSelection &, const QIt std::move(d.begin(), d.end(), std::back_inserter(decals)); } } - if (num_selected > 1 || (selectionModel[num]->selectedIndexes().size() == 0)) { + + // Keep other tree seleciton only if Control is pressed + if (num_selected > 1 && QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) == true) { Q_EMIT selected(decals, false); return; } + + // For deselect and multiple select just send all + if (selectionModel[num]->selectedIndexes().size() != 1) { + Q_EMIT selected(decals, false); + return; + } QModelIndex index = selectionModel[num]->selectedIndexes().at(0); if (!index.isValid()) @@ -575,6 +584,10 @@ void DesignWidget::onSelectionChanged(int num, const QItemSelection &, const QIt if (type == ElementType::NONE) return; + // Clear other tab selections + for (int i = 0; i <= getIndexByElementType(ElementType::GROUP); i++) + if (i!=num) selectionModel[i]->clearSelection(); + addToHistory(num, index); clearProperties(); -- cgit v1.2.3