Author: mir3x
Date: Thu Feb 16 21:01:21 2017
New Revision: 35044

URL: http://svn.gna.org/viewcvs/freeciv?rev=35044&view=rev
Log:
Qt client - fixed player dialog not showing new nations

See gna bug #25506


Modified:
    branches/S2_6/client/gui-qt/plrdlg.cpp

Modified: branches/S2_6/client/gui-qt/plrdlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/plrdlg.cpp?rev=35044&r1=35043&r2=35044&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/plrdlg.cpp      (original)
+++ branches/S2_6/client/gui-qt/plrdlg.cpp      Thu Feb 16 21:01:21 2017
@@ -259,6 +259,10 @@
 void plr_model::populate()
 {
   plr_item *pi;
+
+  qDeleteAll(plr_list);
+  plr_list.clear();
+  beginResetModel();
   players_iterate(pplayer) {
     if ((is_barbarian(pplayer))){
       continue;
@@ -266,6 +270,7 @@
     pi = new plr_item(pplayer);
     plr_list << pi;
   } players_iterate_end;
+  endResetModel();
 }
 
 
@@ -716,7 +721,8 @@
 void plr_report::update_report(bool update_selection)
 {
   QModelIndex qmi;
-
+  int player_count = 0;
+  
   /* Force updating selected player information */
   if (update_selection == true) {
     qmi = plr_wdg->currentIndex();
@@ -724,6 +730,17 @@
       plr_wdg->clearSelection();
       plr_wdg->setCurrentIndex(qmi);
     }
+  }
+
+  players_iterate(pplayer) {
+    if ((is_barbarian(pplayer))){
+      continue;
+    }
+    player_count++;
+  } players_iterate_end;
+
+  if (player_count != plr_wdg->get_model()->rowCount()) {
+    plr_wdg->get_model()->populate();
   }
 
   plr_wdg->header()->resizeSections(QHeaderView::ResizeToContents);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to