aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-11-11 13:26:33 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2018-11-11 13:26:33 +0100
commit5d11af5a251850576431d4ac210d9ca1af375888 (patch)
treee1c3980da90b8568abdc8079a47cdcfccb27bce9 /gui
parenta445ae37ee3c485495170ccadd7b0ce71297019f (diff)
downloadnextpnr-5d11af5a251850576431d4ac210d9ca1af375888.tar.gz
nextpnr-5d11af5a251850576431d4ac210d9ca1af375888.tar.bz2
nextpnr-5d11af5a251850576431d4ac210d9ca1af375888.zip
multiple selection fix
Diffstat (limited to 'gui')
-rw-r--r--gui/designwidget.cc15
1 files changed, 14 insertions, 1 deletions
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 <QAction>
+#include <QApplication>
#include <QGridLayout>
#include <QLineEdit>
#include <QMenu>
@@ -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();