Any QValidator class in which I can pass QStringList as valid options.
-
I have a QLineEdit editor along with QComboBox. Now I want that user can give only some of the pre-defined strings as value in QLineEdit. So is it possible that I pass that list as QStringList to QValidator class and then it checks for validation in that List.
-
Hi,
Not out of the box.
But if you want the user to only enter a string that's in a list, why not use directly a QComboBox ? So no need to validate the input.
-
I have a QLineEdit editor along with QComboBox. Now I want that user can give only some of the pre-defined strings as value in QLineEdit. So is it possible that I pass that list as QStringList to QValidator class and then it checks for validation in that List.
@Ajay_11
I have a very similar need, kind of opposite to what your need is, I want the user to enter any text that's not one of the items in a QStringList. Were you able to achieve this? If you were, I could use your solution and add the negation of it myself. -
Hi,
Sounds like you should implement your own validator and check against a given list of words