multiple selection fix

This commit is contained in:
Miodrag Milanovic 2018-11-11 13:26:33 +01:00
parent a445ae37ee
commit 5d11af5a25

View File

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