src/model.cpp

changeset 1247
7e1ce2fc066b
parent 1245
338d66111168
child 1249
6a8f76f0f4d1
equal deleted inserted replaced
1246:0054d13ed614 1247:7e1ce2fc066b
636 return this->objects()[index.row()]; 636 return this->objects()[index.row()];
637 else 637 else
638 return nullptr; 638 return nullptr;
639 } 639 }
640 640
641 QModelIndex Model::indexFromId(qint32 id) const
642 {
643 for (int row = 0; row < this->size(); ++row)
644 {
645 if (this->objects()[row]->id() == id)
646 return index(row);
647 }
648
649 return {};
650 }
651
641 int countof(Model& model) 652 int countof(Model& model)
642 { 653 {
643 return model.size(); 654 return model.size();
644 } 655 }

mercurial