Changeset View
Changeset View
Standalone View
Standalone View
shell/problemmodelset.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
70 | } | 70 | } | ||
71 | 71 | | |||
72 | if(itr != d->data.end()) | 72 | if(itr != d->data.end()) | ||
73 | d->data.erase(itr); | 73 | d->data.erase(itr); | ||
74 | 74 | | |||
75 | emit removed(name); | 75 | emit removed(name); | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | void ProblemModelSet::showModel(const QString &name) | ||||
79 | { | ||||
80 | for (const ModelData &data : d->data) { | ||||
kfunk: Use foreach (otherwise you're detaching the vector) | |||||
81 | if (data.name == name) { | ||||
82 | emit showRequested(name); | ||||
83 | return; | ||||
84 | } | ||||
85 | } | ||||
86 | } | ||||
87 | | ||||
78 | QVector<ModelData> ProblemModelSet::models() const | 88 | QVector<ModelData> ProblemModelSet::models() const | ||
79 | { | 89 | { | ||
80 | return d->data; | 90 | return d->data; | ||
81 | } | 91 | } | ||
82 | 92 | | |||
83 | } | 93 | } | ||
84 | |
Use foreach (otherwise you're detaching the vector)