src/model.cpp

changeset 1247
7e1ce2fc066b
parent 1245
338d66111168
child 1249
6a8f76f0f4d1
--- a/src/model.cpp	Thu Feb 15 11:34:04 2018 +0200
+++ b/src/model.cpp	Thu Feb 15 12:18:57 2018 +0200
@@ -638,6 +638,17 @@
 		return nullptr;
 }
 
+QModelIndex Model::indexFromId(qint32 id) const
+{
+	for (int row = 0; row < this->size(); ++row)
+	{
+		if (this->objects()[row]->id() == id)
+			return index(row);
+	}
+
+	return {};
+}
+
 int countof(Model& model)
 {
 	return model.size();

mercurial