[rkward-cvs] SF.net SVN: rkward: [1324] trunk/rkward/rkward/misc/rkspinbox.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Feb 5 12:20:51 UTC 2007


Revision: 1324
          http://svn.sourceforge.net/rkward/?rev=1324&view=rev
Author:   tfry
Date:     2007-02-05 04:20:51 -0800 (Mon, 05 Feb 2007)

Log Message:
-----------
Fix spinbox step size, when current value is exactly 0

Modified Paths:
--------------
    trunk/rkward/rkward/misc/rkspinbox.cpp

Modified: trunk/rkward/rkward/misc/rkspinbox.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkspinbox.cpp	2007-02-05 12:12:19 UTC (rev 1323)
+++ trunk/rkward/rkward/misc/rkspinbox.cpp	2007-02-05 12:20:51 UTC (rev 1324)
@@ -64,9 +64,14 @@
 			int change = value ();
 			setValue (0);
 
-			int power = (int) log10 (real_value) - default_precision;
-			if (power < (-default_precision)) power = -default_precision;
-			if (power > 10) power = 10;
+			int power;
+			if (real_value != 0) {
+				power = (int) log10 (real_value) - default_precision;
+				if (power < (-default_precision)) power = -default_precision;
+				if (power > 10) power = 10;
+			} else {
+				power = -default_precision;
+			}
 			double step = pow (10, power);
 
 			real_value += change * step;
@@ -80,7 +85,9 @@
 	} else {
 		QSpinBox::updateDisplay ();
 
-		int power = (int) log10 (value ());
+		int power;
+		if (value () != 0) power = (int) log10 (value ());
+		else power = 1;
 		int step = (int) pow (10, power-1);
 		if (step < 1) step = 1;
 		setSteps (step, 10*step);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list