Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField validator doesn't work #410

Open
azoyan opened this issue Jul 7, 2017 · 1 comment
Open

TextField validator doesn't work #410

azoyan opened this issue Jul 7, 2017 · 1 comment

Comments

@azoyan
Copy link

azoyan commented Jul 7, 2017

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.

@ChALkeR ChALkeR added the bug label Aug 14, 2017
@Plaristote
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants