Qt 6.11 is out! See what's new in the release
blog
checking QLineEdit for input.
-
Hello guys. I made QLineedit objects. i want to add them and output the result but only if all objects have a number . How can i check if all my objects have a number only than output the result.
@thomasGl
By looking in each one to see whether it has a number there and only proceeding if they all do. QString Class has a number of methods (e.g.toInt(),toDouble()) for determining if a string is a valid "number" (depending on what your definition of a number is) which take abool *okparameter to find out whether the string was valid. If you only want numbers to be entered into your edits consider adding aQValidatoror changing to aQSpinBox-type widget?