From 1e226a6bc26f22cd559e3218ecef7ac014c6fe2d Mon Sep 17 00:00:00 2001 From: Kashyap Ramesh Puranik Date: Mon, 29 Jun 2009 15:07:24 +0000 Subject: [PATCH] Fixing bugs and making the UI of the massCalculator cleaner. svn path=/branches/kalzium/gsoc2009/kalzium/libscience/; revision=989144 --- libscience/moleculeparser.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libscience/moleculeparser.cpp b/libscience/moleculeparser.cpp index 33ae67b..efd8186 100644 --- a/libscience/moleculeparser.cpp +++ b/libscience/moleculeparser.cpp @@ -323,7 +323,7 @@ MoleculeParser::expandFormula( const QString& _shortString) { temp = ""; - // If a character was found + // If a capital letter was found if((*i).category() == QChar::Letter_Uppercase) { temp += (*i); i++; @@ -334,7 +334,7 @@ MoleculeParser::expandFormula( const QString& _shortString) i++; } - // If element is found, return it immediately. + // If element is found, append it if (lookupElement(temp)) { _fullString += temp; } @@ -344,7 +344,7 @@ MoleculeParser::expandFormula( const QString& _shortString) kDebug() << "expanded" << temp << "to" << expandedTerm; _fullString += "("+expandedTerm+")"; } - // invalid term, return it. + // invalid term, append it. ( Validation is done later anyway. ) else { _fullString += temp; } @@ -367,6 +367,8 @@ MoleculeParser::expandFormula( const QString& _shortString) } else { // invalid character, return it, validation is done again later _fullString += *i; + i++; + kDebug() << *i << "invalid character!"; } } -- 2.47.3