View Single Post
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#146
Originally Posted by Berserk View Post


I think you need to make it this way:
Code:
QRegExp regexer("^\\#[0-9a-fA-F]{6,6}$");
^ = from the start of the string
(.. your characters ..)
$ = until the end of the string

Also, you might consider this:
Code:
ui->line_edit_font1->setValidator(new QRegExpValidator(regexer, ui->line_edit_font1);
I think the parent is wrong, you have it on "this", which is the whole class, I think you need to put it on the QLineEdits specifically.
Edit: this way, you don't have to make "actualvalidator".
Didn't work. I can still type in only two or three characters and jump on editing next box. However while I do that the signal editingFinished ins't triggered if I don't fill in all seven digits.

So maybe I need to do something with the validator? Tell validator to fill in the previous value if user didn't fill in all required digits? How?
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE