Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Set RegExpValidator to qml object
Qt 6.11 is out! See what's new in the release blog

Set RegExpValidator to qml object

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 705 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nando76
    wrote on last edited by
    #1

    Hi,
    i am very new to qml.

    i try to set a regExpValidator to a qml object defined in another file.

    It does not work :(

    If i directly set the regExp in File 3 it works...

    Maybe somebody knows what the problem is?

    For exmaple:

    File 1 (here i want to define all reg expressions)

    @...
    property string test_reg_exp_1: /[0-9A-Z]+/
    property string test_reg_exp_2: /[a-z]+/@

    File 2: (this should be a generic qml object where i want to set the RegExpValidator from File 3)

    @Rectangle {
    id: dialogTextEdit

    property string validatorStr
    
    TextInput {
    

    ...
    validator: RegExpValidator { regExp: validatorStr }

    }
    

    }@

    File 3:

    @DialogTextEdit {
    id: dataField_1
    validatorStr: file1.test_reg_exp_1
    }
    DialogTextEdit {
    id: dataField_2
    validatorStr: file1.test_reg_exp_2
    }
    @

    Greetings,
    Nando

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved