Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • ParaView ParaView
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,961
    • Issues 1,961
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 99
    • Merge requests 99
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ParaViewParaView
  • ParaViewParaView
  • Issues
  • #15786
Closed
Open
Issue created Oct 15, 2015 by Kitware Robot@kwrobotOwner

QString.toDouble() does not parse locale-specific number strings

This issue was created automatically from an original Mantis Issue. Further discussion may take place here.


Report 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)…

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking