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

"Error: Locale: Number.fromLocaleString(): Invalid format" when erasing last digit of "2,000" in editable SpinBox

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.6.0
    • 5.10, 5.15
    • Quick: Controls 2
    • None
    • Australian locale.
    • ce85cb161 (dev)

    Description

      In the following example, the text is displayed as "2,000" with my locale. If I remove the last '0', I get this error:

      <Unknown File>:1: Error: Locale: Number.fromLocaleString(): Invalid format
      
      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.3
      
      ApplicationWindow {
          visible: true
          width: 500
          height: 120
      
          SpinBox {
              id: widthSpinBox
              value: 2000
              to: 2000
              editable: true
      
              Connections {
                  target: widthSpinBox.contentItem
                  onTextEdited: {
                      print("widthSpinBox.contentItem.text =", widthSpinBox.contentItem.text)
                      var currentValue = widthSpinBox.valueFromText(widthSpinBox.contentItem.text, widthSpinBox.locale)
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              matthias_rauter Matthias Rauter
              mitch_curtis Mitch Curtis
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes