From 98ff50ceba9a2ade7a287177c2439c935093ead7 Mon Sep 17 00:00:00 2001 From: svnhieber Date: Tue, 30 Nov 2010 17:10:11 +0000 Subject: [PATCH] Qt fixes for pre-4.5 git-svn-id: https://svn.itm.uni-luebeck.de/wisebed/wiselib/trunk/pc_apps/roomba_tests@3643 f8795833-4959-0410-8ae9-8bcb0cfab428 --- main.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/main.cc b/main.cc index 1a181fe..cfba07b 100644 --- a/main.cc +++ b/main.cc @@ -36,6 +36,12 @@ #include #include +#if QT_VERSION < 0x040500 +#define getInt QInputDialog::getInteger +#else // QT_VERSION > 0x040500 +#define getInt QInputDialog::getInt +#endif // QT_VERSION + using namespace std; // UART port on which we communicate with the Roomba @@ -60,12 +66,12 @@ void drive(Roomba& roomba, ControlledMotion& ctrl_motion) { / float(roomba().capacity) * 100.0)); // new distance to drive - input_distance = QInputDialog::getInt(0, "Input distance", chargeText + input_distance = getInt(0, "Input distance", chargeText + "Input new distance in mm:", input_distance, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { // new turn velocity - velocity = QInputDialog::getInt(0, "Input velocity", chargeText + velocity = getInt(0, "Input velocity", chargeText + "Input drive velocity in mm/sec:", velocity, -500, 500, 10, &ok); if(ok) { ctrl_motion.move_distance(input_distance, velocity); @@ -78,11 +84,11 @@ void drive(Roomba& roomba, ControlledMotion& ctrl_motion) { } // measured deviation - deviation_x = QInputDialog::getInt(0, "Input x deviation", chargeText + deviation_x = getInt(0, "Input x deviation", chargeText + "Input travelled distance on x axis in mm:", deviation_x, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { - deviation_y = QInputDialog::getInt(0, "Input y deviation", chargeText + deviation_y = getInt(0, "Input y deviation", chargeText + "Input travelled distance on y axis in mm:", deviation_y, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { @@ -115,12 +121,12 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) { / float(roomba().capacity) * 100.0)); // new angle to turn about - input_angle = QInputDialog::getInt(0, "Input angle", chargeText + input_angle = getInt(0, "Input angle", chargeText + "Input new angle in degree to turn about:", input_angle, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { // new turn velocity - velocity = QInputDialog::getInt(0, "Input velocity", chargeText + velocity = getInt(0, "Input velocity", chargeText + "Input turn velocity in mm/sec:", velocity, -500, 500, 10, &ok); if(ok) { ctrl_motion.turn_about(Math::degrees_to_radians(input_angle), velocity); @@ -133,7 +139,7 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) { } // measured angle - measured_angle = QInputDialog::getInt(0, "Input measured angle", chargeText + measured_angle = getInt(0, "Input measured angle", chargeText + "Input measured angle in degree:", input_angle, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { -- 2.20.1