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 } |