The Qt Quick Text Input Handling and Validators page has information about validating user text input.