multiple selection fix
This commit is contained in:
parent
a445ae37ee
commit
5d11af5a25
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "designwidget.h"
|
#include "designwidget.h"
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QApplication>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#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));
|
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);
|
Q_EMIT selected(decals, false);
|
||||||
return;
|
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);
|
QModelIndex index = selectionModel[num]->selectedIndexes().at(0);
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
@ -575,6 +584,10 @@ void DesignWidget::onSelectionChanged(int num, const QItemSelection &, const QIt
|
|||||||
if (type == ElementType::NONE)
|
if (type == ElementType::NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Clear other tab selections
|
||||||
|
for (int i = 0; i <= getIndexByElementType(ElementType::GROUP); i++)
|
||||||
|
if (i!=num) selectionModel[i]->clearSelection();
|
||||||
|
|
||||||
addToHistory(num, index);
|
addToHistory(num, index);
|
||||||
|
|
||||||
clearProperties();
|
clearProperties();
|
||||||
|
Loading…
Reference in New Issue
Block a user