So you should do as you said, it's not rocket science .)

In your button event handler check lineEdit->text ().length () > 4.
Don't forget to exclude/replace spaces if needed and if you haven't filtered them in input mask.