on xenial help sign in
Make setCountry a little more correct
commit6d064623adde6fa51380ba347c60dbfb157dca2e authorMichael Terry <michael.terry@canonical.com> dateMon 21 Mar 2016, 19:44 (11 years ago) parent4e4caca
1 file changed+5
plugins/Wizard/timezonemodel.cpp+5
plugins/Wizard/timezonemodel.cpp+5
@@ -203,11 +203,14 @@ void TimeZoneLocationModel::setCountry(const QString &country)
203203 if (m_country == country)
204204 return;
205205
206+ beginResetModel();
207+
206208 m_country = country;
207209
208210 Q_FOREACH(GeonamesCity *city, m_countryLocations) {
209211 geonames_city_free(city);
210212 }
213+ m_countryLocations.clear();
211214
212215 gint num_cities = geonames_get_n_cities();
213216 for (gint i = 0; i < num_cities; i++) {
@@ -219,6 +222,8 @@ void TimeZoneLocationModel::setCountry(const QString &country)
219222
220223 std::sort(m_countryLocations.begin(), m_countryLocations.end(), citycmp);
221224
225+ endResetModel();
226+
222227 Q_EMIT countryChanged(country);
223228}
224229