Author: mir3x
Date: Wed Nov 16 10:07:38 2016
New Revision: 34522

URL: http://svn.gna.org/viewcvs/freeciv?rev=34522&view=rev
Log:
Qt client - sort items vertically in city production chooser.

See patch #7982


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

Modified: branches/S2_6/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/citydlg.cpp?rev=34522&r1=34521&r2=34522&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/citydlg.cpp     (original)
+++ branches/S2_6/client/gui-qt/citydlg.cpp     Wed Nov 16 10:07:38 2016
@@ -3755,12 +3755,20 @@
   if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0
       && index.column() < columnCount()
       && (index.column() + index.row() * 3 < city_target_list.count())) {
+    int r, c, t ,new_index;
+    r = index.row();
+    c = index.column();
+    t = r * 3 + c;
+    new_index = t / 3 + rowCount() * c;
+    /* Exception, shift whole column */
+    if ((c == 2) && city_target_list.count() % 3 == 1) {
+      new_index = t / 3 + rowCount() * c - 1;
+    }
     if (role == Qt::ToolTipRole) {
-      return get_tooltip(city_target_list[index.row() * 3
-                                          + index.column()]->data());
-    }
-
-    return city_target_list[index.row() * 3 + index.column()]->data();
+      return get_tooltip(city_target_list[new_index]->data());
+    }
+
+    return city_target_list[new_index]->data();
   }
 
   return QVariant();
@@ -3777,7 +3785,7 @@
   struct universal *renegade;
   int item, targets_used;
   QString str;
-  QFont f = QApplication::font();
+  QFont f = *fc_font::instance()->get_font(fonts::default_font);
   QFontMetrics fm(f);
 
   sh.setY(fm.height() * 2);


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

Reply via email to