Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Any QValidator class in which I can pass QStringList as valid options.
Ajay_11 last edited by
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.
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.
bharath144 last edited by
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.
Sounds like you should implement your own validator and check against a given list of words