qmlweb icon indicating copy to clipboard operation
qmlweb copied to clipboard

TextField validator doesn't work

Open azoyan opened this issue 7 years ago • 1 comments

Easiest code for test. I tried it in https://qmlweb.github.io/ and my own project.

import QtQuick 2.0
import QtQuick.Controls 1.4	

TextField {
    validator: RegExpValidator { regExp: RegExp(/\d/)  }
}

In desktop application this code work correctly.

azoyan avatar Jul 07 '17 19:07 azoyan

Hey ! I rewrote the validators not long ago, and this code now works correctly.

However, the RegExpValidator specifically is pretty hard to implement. More details at: https://github.com/Plaristote/qmlweb/blob/controls2/tests/QtQuick/RegExpValidator.js and: https://doc.qt.io/qt-6/qregularexpressionvalidator.html

Basically, my implementation just use a plain Javascript regular expression test, whereas Qt does something much more complicated. We would have to manipulate the regular expression a great deal to have it working. It's probably doable, but I don't see it happening without dumping a lot of code into the problem.

I'm not even considering fixing this ATM, but if someone has a bright idea on how to achieve this... I'm listening.

Plaristote avatar Apr 09 '22 09:04 Plaristote