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

QML IntValidator wrong behavior for bottom > 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.1
    • Component/s: Quick: Controls 1
    • Labels:
      None
    • Environment:
      QtQuick 2 - Qt 5.2.0 - Ubuntu 13.04 x86_64

      Description

      When setting the "bottom" property of an IntValidator inside a TextInput to something greater than zero, the TextInput shows a wrong behavior. The following code demonstrates the issue (Qt-5.2.0 with Android support under Ubuntu 13.04 x86_64).

      IntValidatorBug.qml
      import QtQuick 2.1
      
      Rectangle
      {
          id:         mainwindow
          objectName: "mainwindow"
          width:      1024
          height:     768
      
          TextInput
          {
              id: testtextinput
              objectName: "testtextinput"
      
              text: "170"
              font.pixelSize: 36
      
              x: 100
              y: 200
              width: 200
              height: 200
      
              property size range: Qt.size(160, 180)
              validator: IntValidator
              {
                  id:     rangevalidator
                  objectName: testtextinput.objectName + "_rangevalidator"
      
                  bottom: testtextinput.range.width
                  top:    testtextinput.range.height
      
                  Component.onCompleted:
                  {
                      console.log("Component.onCompleted objectName: " + objectName + " bottom: " + bottom + " top: " + top)
                  }
              }
              onAccepted:
              {
                  text = "accepted"
              }
          }
          Text
          {
              id: testisacceptable
      
              font.pixelSize: 36
              text: testtextinput.acceptableInput
      
              anchors.top: testtextinput.bottom
              anchors.left: testtextinput.left
              anchors.right: testtextinput.right
              height: 200
          }
      }
      

      Trying to type the number 159, the TextInput allows to write the whole number, the acceptableInput property is set to false, but pressing enter, the onAccepted() slot is executed without problems.

        Attachments

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

          Activity

            People

            Assignee:
            liaqi Liang Qi
            Reporter:
            aviopene Avio
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes