src/document.cpp

changeset 150
b6cbba6e29a1
parent 148
e1ced2523cad
child 152
03f8e6d42e13
--- a/src/document.cpp	Tue Nov 02 15:43:57 2021 +0200
+++ b/src/document.cpp	Thu Mar 03 11:42:52 2022 +0200
@@ -57,7 +57,7 @@
 		QItemSelection selection;
 		for (ldraw::id_t id : newSelection)
 		{
-			QModelIndex index = this->model->lookup(id);
+			QModelIndex index = this->model->find(id);
 			if (index != QModelIndex{})
 			{
 				selection.select(index, index);
@@ -70,7 +70,7 @@
 	connect(this->ui.listView->selectionModel(), &QItemSelectionModel::selectionChanged,
 		[&](const QItemSelection& selected, const QItemSelection& deselected)
 	{
-		auto resolveIndex = [this](const QModelIndex& index){ return this->model->resolve(index); };
+		auto resolveIndex = [this](const QModelIndex& index){ return (*this->model)[index.row()]->id; };
 		auto resolve = [resolveIndex](const QItemSelection& selection)
 		{
 			return fn::map<QSet<ldraw::id_t>>(selection.indexes(), resolveIndex);

mercurial