Not possible to use temperatures below 0 ?

Linus Torvalds torvalds at linux-foundation.org
Thu Nov 28 10:44:22 UTC 2013


On Thu, Nov 28, 2013 at 10:34 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Does adding a "-" to the end of that regex string fix it? Dirk, this
> is all your code (commit a8888eaf26c9)..

Verified.

Something like the attached seems to fix it.

              Linus
-------------- next part --------------
From 2cdc1be020cd87313e4cd3cb22208fd57e481316 Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Thu, 28 Nov 2013 10:42:28 -0800
Subject: [PATCH] Fix editing of negative temperatures

We tried to clean up the temperature string (to remove degree characters
and unit names etc) a bit too aggressively, and removed the sign
character too..

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

diff --git a/qt-gui.cpp b/qt-gui.cpp
index 57e410865bb9..c4624c666d34 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -435,7 +435,7 @@ int parseTemperatureToMkelvin(const QString& text)
 {
 	int mkelvin;
 	QString numOnly = text;
-	numOnly.replace(",",".").remove(QRegExp("[^0-9.]"));
+	numOnly.replace(",",".").remove(QRegExp("[^-0-9.]"));
 	if (numOnly == "")
 		return 0;
 	double number = numOnly.toDouble();


More information about the subsurface mailing list