View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015786ParaView(No Category)public2015-10-16 10:372016-08-12 09:59
ReporterCory Quammen 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version4.4 
Target VersionFixed in Version 
Summary0015786: QString.toDouble() does not parse locale-specific number strings
DescriptionReport from Gerald Lodron on the paraview mailing list.

-------

I noticed a bug in paraview on parsing double values in QLineEdits, e.g. in pqDoubleEdit:
 
double pqDoubleEdit::value()
{
  QString currentText = this->text();
  int currentPos = this->cursorPosition();
  QDoubleValidator dvalidator(NULL);
  QValidator::State state = dvalidator.validate(currentText, currentPos);
  if (state == QValidator::Acceptable || state == QValidator::Intermediate)
    {
    return currentText.toDouble();
    }
  return 0.0;
}
 
The Problem is that QDoubleValidator uses the current locale. If the current locale is e.g. German that e.g. “0.1” is not allowed, only “0,1”. On the other side the QString function toDouble cannot parse it correctly, see documentation http://doc.qt.io/qt-5/qstring.html#toDouble [^] , here the http://doc.qt.io/qt-5/qlocale.html#toDouble [^] is recommended…. So all QLineEdit functions with toDouble must be replaced by
QLocale oL;
Double dValue = oL.toDouble( lineEdit->text())
 
Nasty….Other solution would be to set the locale to English for whole paraview regardless to the system locale, but I don’t know if that is possible (also not very beautiful)…
TagsNo tags attached.
ProjectTBD
Topic Name
Typeincorrect functionality
Attached Files

 Relationships

  Notes
(0035314)
Lodron Gerald (reporter)
2015-10-20 03:32

Other solution:
Write an own subclass of QValidator with internal QString::toDouble() check for validity...
(0038910)
Kitware Robot (administrator)
2016-08-12 09:59

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current ParaView Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-10-16 10:37 Cory Quammen New Issue
2015-10-20 03:32 Lodron Gerald Note Added: 0035314
2016-08-12 09:59 Kitware Robot Note Added: 0038910
2016-08-12 09:59 Kitware Robot Status backlog => closed
2016-08-12 09:59 Kitware Robot Resolution open => moved
2016-08-12 09:59 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team