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. Dynamic validation
Forum Updated to NodeBB v4.3 + New Features

Dynamic validation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 257 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.
  • G Offline
    G Offline
    GoodGuy
    wrote on 7 Jul 2019, 16:18 last edited by GoodGuy 7 Aug 2019, 07:04
    #1

    Hello,

    I have a TableView with one editable column. This column can have diffrents type of data (String, int double) in every row.

    I want to create function that i could dynamicly create validator for every cell. Every cell has his own uniqe range.

    Now i have something like this.

    property var iValid : IntValidator { bottom: 0; top: 9999}
    property var sValid : RegExpValidator { regExp: /[a-z,A-Z]+/ }
    property var dValid : DoubleValidator { bottom: 0; top: 9999.99}
    
    function getValidator(row)
    {
    	var DataType= tableModel.data(row, Columns.DataType);
    
    	if (DataType=== Type.Number)
    		return iValid ;
    	else if (DataType=== Type.Double)
    		return dValid ;
    	else if (DataType=== Type.String)
    		return sValid ;
    	else
    		return null;
    }
    

    How is a proper way to do this?

    1 Reply Last reply
    0

    1/1

    7 Jul 2019, 16:18

    • Login

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