PDA

View Full Version : Limiting values for custom designer properties



high_flyer
15th March 2006, 20:25
Hi,

Is there a way to tell designer to limit the possible user input for a particular property?
In my case I have a property which is an unsigned int (since it should never be negative), but I could not find a way to limit the input at design time to be > = 0.
So at the moment, when the user enters -1 designer crashes for an obvious reason.

Thanks in advance.

wysota
15th March 2006, 23:47
In your methods which handle properties you should do sanity checks of entered values and correct them if they are wrong. From my observations (in Qt3) it looks like that after setting a property immediately Qt asks for its value, so it should show a corrected value.

high_flyer
16th March 2006, 09:33
I would do that, but the problem is even before I can do a sanity check, since my method accepts an unsigned int, and when designer trys to call it with a -1, it crashes, with out me having a chance to correct the value in my method... that is exactly my question - is it possible to install "sanity check" (or simply limits) to the values that a user can enter in the properties window?

wysota
16th March 2006, 12:03
Qt3 or Qt4?

high_flyer
16th March 2006, 12:27
Qt4
(Sorry forgot to mention)