vvim / routetool

Using Google Maps API to add locations and calculate the shortest route by Traveling Salesman Algorithm
1 stars 0 forks source link

Best way to iterate through a QStandardItemModel? #28

Open vvim opened 8 years ago

vvim commented 8 years ago

in OphaalpuntenWidget::OphaalpuntHasAanmeldingPresent(int ophaalpunt_id)

is the for-loop the correct way to iterate through listOfLocationsModel? Better ask at StackExchange, maybe an Iterator is better? But can't find any for StandardItemModel?

for(i = 0; i < listOfLocationsModel->rowCount(); i++)
{
    if(listOfLocationsModel->data(listOfLocationsModel->index(i, OPHAALPUNTQTREEVIEW_OPHAALPUNT_ID)).toInt() == ophaalpunt_id)
    {
        row = i;
        break;
    }
}
NelDav commented 5 years ago

There is an entry at StackOverflow: https://stackoverflow.com/questions/33124903/how-to-iterate-through-a-qstandarditemmodel-completely

vvim commented 5 years ago

@NelDav thank you for the link !