Author: mir3x
Date: Tue Nov 22 20:43:01 2016
New Revision: 34614

URL: http://svn.gna.org/viewcvs/freeciv?rev=34614&view=rev
Log:
Qt client - allow scrolling map using shift+cursors

See patch #8015


Modified:
    trunk/client/gui-qt/mapctrl.cpp

Modified: trunk/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=34614&r1=34613&r2=34614&view=diff
==============================================================================
--- trunk/client/gui-qt/mapctrl.cpp     (original)
+++ trunk/client/gui-qt/mapctrl.cpp     Tue Nov 22 20:43:01 2016
@@ -125,19 +125,37 @@
     switch (event->key()) {
     case Qt::Key_Up:
     case Qt::Key_8:
-      key_unit_move(DIR8_NORTH);
+      if (is_shift) {
+        recenter_button_pressed(gui()->mapview_wdg->width() / 2, 0);
+      } else {
+        key_unit_move(DIR8_NORTH);
+      }
       return;
     case Qt::Key_Left:
     case Qt::Key_4:
-      key_unit_move(DIR8_WEST);
+      if (is_shift) {
+        recenter_button_pressed(0, gui()->mapview_wdg->height() / 2);
+      } else {
+        key_unit_move(DIR8_WEST);
+      }
       return;
     case Qt::Key_Right:
     case Qt::Key_6:
-      key_unit_move(DIR8_EAST);
+      if (is_shift) {
+        recenter_button_pressed(gui()->mapview_wdg->width(),
+                                gui()->mapview_wdg->height() / 2);
+      } else {
+        key_unit_move(DIR8_EAST);
+      }
       return;
     case Qt::Key_Down:
     case Qt::Key_2:
-      key_unit_move(DIR8_SOUTH);
+      if (is_shift) {
+        recenter_button_pressed(gui()->mapview_wdg->width() / 2,
+                                gui()->mapview_wdg->height());
+      } else {
+        key_unit_move(DIR8_SOUTH);
+      }
       return;
     case Qt::Key_PageUp:
     case Qt::Key_9:


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

Reply via email to