mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-24 13:35:00 +00:00
parent
403bb6c716
commit
172dcfa775
4 changed files with 17 additions and 3 deletions
|
@ -341,13 +341,25 @@ using ModelPeer = std::weak_ptr<ModelChangeListener>;
|
|||
template<typename M>
|
||||
auto access_array_index(const M &model, size_t index)
|
||||
{
|
||||
if (const auto v = model->row_data_tracked(index)) {
|
||||
if (!model) {
|
||||
return decltype(*model->row_data_tracked(index)) {};
|
||||
} else if (const auto v = model->row_data_tracked(index)) {
|
||||
return *v;
|
||||
} else {
|
||||
return decltype(*v) {};
|
||||
}
|
||||
}
|
||||
|
||||
template<typename M>
|
||||
long int model_length(const M &model) {
|
||||
if (!model) {
|
||||
return 0;
|
||||
} else {
|
||||
model->track_row_count_changes();
|
||||
return model->row_count();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace private_api
|
||||
|
||||
/// \rst
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue