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

REG 5.9.1->5.9.2: TextInput ignores validator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.9.5, 5.10.1
    • 5.9.2, 5.10.0 Beta 4
    • None
    • Compiler: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

      OS: Kubuntu 16.04 amd64

      Qt from SDK, versions 5.6.3, 5.7.1, 5.8.0, 5.9.0, 5.9.1, 5.9.2 and 5.10 Beta 4
    • 5a10cf060e6c843f05d8bd820a4be4bb08f277ec

    Description

      TextInput control allows to input text that is not accepted by validator but accepted by inputMask.

      main.qml
      //// 5.6.3 - works fine
      //import QtQuick 2.6
      //import Qt.labs.controls 1.0
      
      //// 5.7.1 - works fine
      //import QtQuick 2.7
      //import QtQuick.Controls 2.0
      
      //// 5.8.0 - works fine
      //import QtQuick 2.8
      //import QtQuick.Controls 2.1
      
      //// 5.9.0 - works fine
      //import QtQuick 2.9
      //import QtQuick.Controls 2.2
      
      //// 5.9.1 - works fine
      //import QtQuick 2.9
      //import QtQuick.Controls 2.2
      
      //// 5.9.2 - validator ignored, able to input "33", "f2", " 9"
      //import QtQuick 2.9
      //import QtQuick.Controls 2.2
      
      // 5.10 Beta 4 - validator ignored, able to input "33", "f2", " 9"
      import QtQuick 2.10
      import QtQuick.Controls 2.3
      
      ApplicationWindow {
          title: "validator ignored with input mask"
          width: 350; height: 90
          visible: true
      
          TextInput {
              id: input
              anchors.fill: parent
              horizontalAlignment: TextInput.AlignHCenter; verticalAlignment: TextInput.AlignVCenter
      
              text: "+1"
              inputMask: "X9;_"
              validator: RegExpValidator { regExp: /[+-][0-9]/ }
          }
      }
      

      Also tried custom validator inherited from QValidator, same behavior.

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            alex_w Alex W
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes