Author: mir3x Date: Mon May 15 19:36:22 2017 New Revision: 35592 URL: http://svn.gna.org/viewcvs/freeciv?rev=35592&view=rev Log: Qt client - dont pass by value in foreach macro.
See hrm Bug #658868 Modified: branches/S2_6/client/gui-qt/cityrep.cpp branches/S2_6/client/gui-qt/menu.cpp Modified: branches/S2_6/client/gui-qt/cityrep.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/cityrep.cpp?rev=35592&r1=35591&r2=35592&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/cityrep.cpp (original) +++ branches/S2_6/client/gui-qt/cityrep.cpp Mon May 15 19:36:22 2017 @@ -1074,6 +1074,8 @@ ***************************************************************************/ void city_widget::update_model() { + QFont f = QApplication::font(); + QFontMetrics fm(f); QStringList sl; QString s, str; int width; @@ -1088,8 +1090,6 @@ sl = str.split('\n'); width = 0; foreach (s, sl) { - QFont f = QApplication::font(); - QFontMetrics fm(f); width = qMax(width, fm.width(s)); } header()->resizeSection(j, width + 10); Modified: branches/S2_6/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=35592&r1=35591&r2=35592&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/menu.cpp (original) +++ branches/S2_6/client/gui-qt/menu.cpp Mon May 15 19:36:22 2017 @@ -1467,8 +1467,6 @@ void mr_menu::execute_shortcut(int sid) { QList<QMenu*> menu_list; - QMenu *m; - QAction* a; QKeySequence seq; fc_shortcut *fcs; @@ -1481,8 +1479,8 @@ seq = QKeySequence(shortcut_to_string(fcs)); menu_list = findChildren<QMenu*>(); - foreach (m, menu_list) { - foreach (a, m->actions()) { + foreach (const QMenu *m, menu_list) { + foreach (QAction *a, m->actions()) { if (a->shortcut() == seq && a->isEnabled()) { a->activate(QAction::Trigger); return; @@ -1497,14 +1495,12 @@ QString mr_menu::shortcut_exist(fc_shortcut *fcs) { QList<QMenu*> menu_list; - QMenu *m; QKeySequence seq; - QAction* a; seq = QKeySequence(shortcut_to_string(fcs)); menu_list = findChildren<QMenu *>(); - foreach (m, menu_list) { - foreach (a, m->actions()) { + foreach (const QMenu *m, menu_list) { + foreach (QAction *a, m->actions()) { if (a->shortcut() == seq && fcs->mouse == Qt::AllButtons) { return a->text(); } @@ -1520,8 +1516,6 @@ QString mr_menu::shortcut_2_menustring(int sid) { QList<QMenu *> menu_list; - QMenu *m; - QAction *a; QKeySequence seq; fc_shortcut *fcs; @@ -1529,8 +1523,8 @@ seq = QKeySequence(shortcut_to_string(fcs)); menu_list = findChildren<QMenu *>(); - foreach (m, menu_list) { - foreach (a, m->actions()) { + foreach (const QMenu *m, menu_list) { + foreach (QAction *a, m->actions()) { if (a->shortcut() == seq) { return (a->text() + " (" + a->shortcut().toString(QKeySequence::NativeText) + ")"); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits