Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6095

QDoubleValidator does not accept whitespace before and after a double value in the QString while QString::toDouble() does

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.3.5, 4.5.3
    • None
    • Windows XP

      The obvious reason to use QDoubleValidator as a Validator for a QLineEdit is to prevent a later QLineEdit.text().toDouble() to fail.

      However .toDouble() seems to accept white space in front and back of a double value in the QString().

      The restriction of no spaces in front or back of a double value in the QDoubleValidator limits the usage of a QLineEdit during Copy/Paste procedures.
      Sometime you might copy a double value from a source text, but not clicking exactly with the mouse or usage a software that extracts a space around a double-clicked double value you have ' 123.12345 ' in your clipboard.

      It is not possible to paste this into the QLineEdit with a QDoubleValidator attached.

      Maybe a fixup() that reduces the spaces and reduces the number of digits would be nice.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            moellney Michael Möllney
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes