# HG changeset patch # User Santeri Piippo # Date 1518699544 -7200 # Node ID e2755ccf36679d2e1e2a3c2e09ab4439354cb91a # Parent 6a8f76f0f4d1a3d764b0a11c89f009e3ff756131 more work on mvc diff -r 6a8f76f0f4d1 -r e2755ccf3667 src/mainwindow.cpp --- a/src/mainwindow.cpp Thu Feb 15 14:40:59 2018 +0200 +++ b/src/mainwindow.cpp Thu Feb 15 14:59:04 2018 +0200 @@ -1041,11 +1041,21 @@ */ } +QModelIndexList MainWindow::selectedIndexes() const +{ + return this->ui.objectList->selectionModel()->selectedIndexes(); +} + // --------------------------------------------------------------------------------------------------------------------- // -const QSet& MainWindow::selectedObjects() +QSet MainWindow::selectedObjects() const { - return m_currentDocument->getSelection(); + QSet result; + + for (const QModelIndex& index : this->selectedIndexes()) + result.insert(m_currentDocument->lookup(index)); + + return result; } // --------------------------------------------------------------------------------------------------------------------- diff -r 6a8f76f0f4d1 -r e2755ccf3667 src/mainwindow.h --- a/src/mainwindow.h Thu Feb 15 14:40:59 2018 +0200 +++ b/src/mainwindow.h Thu Feb 15 14:59:04 2018 +0200 @@ -98,7 +98,8 @@ int ringToolSegments() const; bool save (LDDocument* doc, bool saveAs); void saveShortcuts(); - const QSet& selectedObjects(); + QModelIndexList selectedIndexes() const; + QSet selectedObjects() const; void setQuickColors (const QVector &colors); void spawnContextMenu (const QPoint& position); int suggestInsertPoint();