PDA

View Full Version : validation on an IP address



rajveer
17th July 2008, 07:57
validating an IP address by setting mask and using regular expression and validator.
But most important is that it should shows the IP address dialog as ( . . . ) not like this000.000.000.000.

wysota
17th July 2008, 08:10
Have you tried searching the forum?

patrik08
17th July 2008, 08:16
Hi, here from my firefox bookmark: title "Ip Address Validation"
http://www.qtcentre.org/forum/f-qt-programming-2/t-ip-address-validation-6228.html

rajveer
17th July 2008, 08:32
Hi,

i have gone through it but i couldnt find the solution .

i did this thing by first setting mask then creating a regular exp and after that setting the validator. but it would accept the data but shows the ip dialog as 000.000.000.000 and i need that it must be ( . . . ).

rajveer
25th July 2008, 05:50
hey hi, can u send me the regular expression for an IP address which takes values from 0 to 255.
thanks

wysota
25th July 2008, 14:39
What's wrong with the link you were given?

rajveer
7th August 2008, 08:20
hi ,that was not working. the line edit box couldnt accept the regular expression when i used it with input mask.

can u tell me the other way of doing this?

means by deriving a class and use a function to validate an ip address.

please help me out.

thanks

wysota
7th August 2008, 08:55
Well... you can't use it with an input mask. But you can validate the address without dots and insert them using fixup.

rajveer
7th August 2008, 12:20
hi, can u write a little bit code which shows how to use fix up.

rajveer
7th August 2008, 12:23
i hav created a regular expression without using input mask . it can accept all right nos. but for example when i write 32 then it cant take any no. it is right as it wait for .(dot) to put on but is there any way that when i write any no. whete one , two or max. three digits then it shows a message that put dot now, so that user know that now its the time to put dot.

please help me out.

wysota
7th August 2008, 13:12
Subclass QValidator and reimplement both validate and fixup. Fixup can work in such a way that if you enter four digits in a row, it places a dot before the last digit.

rajveer
8th August 2008, 06:53
hi, can u write a little bit code for how to subclass Qvalidator and how to use Fix up and validate for an line edit box which takes valid IP address.

please help me out

wysota
12th August 2008, 02:20
Here you go, something for a start.

rajveer
19th August 2008, 06:35
thanks for that file.

But there is some problem, i have created a lineEdit box and i am not able to understand how could i connect my Line Edit box with the code given by you so that it could take values .

please help me out.

wysota
19th August 2008, 07:07
I don't know how your code looks like... At the end of the file I attached you'll find (in main()) a line that sets the validator for the line edit.

jacek
24th August 2008, 00:35
{moved three posts to: Two Byte character Support (http://www.qtcentre.org/forum/f-qt-programming-2/t-two-byte-character-support-15559.html)}

Please, don't ask two unrelated questions in one thread.