Iterace přes řádky modelu
Gtk::TreeModel poskytuje přes metodu children() kontejner ve stylu standardní knihovny C++ s jeho potomky. Pro iteraci můžete použít dobře známé metody begin() a end(), nějak takto:
auto children = refModel->children(); for (auto iter = children.begin(), end = children.end(); iter != end; ++iter) { auto row = *iter; //Do something with the row - see above for set/get. }
If you always want to iterate across the entire range, much more succinct syntax is possible using C++'s range-based for loop:
for (auto row: refModel->children()) { //Do something with the row - see above for set/get. }
- 10.3.1. Potomci řádku