Dynamic validation
Unsolved
QML and Qt Quick
-
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?