Results 1 to 5 of 5

Thread: Limiting values for custom designer properties

  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Limiting values for custom designer properties

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Limiting values for custom designer properties

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Limiting values for custom designer properties

    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?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Limiting values for custom designer properties

    Qt3 or Qt4?

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Limiting values for custom designer properties

    Qt4
    (Sorry forgot to mention)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.