// Write out a KConfig containing all the places the user wants to get weather for. // get the TreeView items ui.weathersourceTree->selectAll(); ui.weathersourceTree->selectionModel()->select(ui.weathersourceTree->selectionModel()->currentIndex(), QItemSelectionModel::Rows ); QModelIndexList selectedPlaces = ui.weathersourceTree->selectionModel()->selectedIndexes(); foreach (QModelIndex place, selectedPlaces) { kDebug() << "Visible Data: " << place.data(); }