Results 1 to 3 of 3

Thread: Validating data and aborting process if invalid

  1. #1

    Default Validating data and aborting process if invalid

    I try to make a database application using QTableView, and i need to validate serveral field.
    If edited field value does not fit the qualification then the focus may not leave the item delegate.

    How can i do to make it ?
    (Such in kylix3, i can just call abort, then the process stop and the focus won't go anywhere.)

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Validating data and aborting process if invalid

    You can implement an event filter for the cell's editor and catch and ignore all key events that cause the editor to loose focus and close.
    You should consider all cases in which the editor gets closed or looses focus.

    Regards

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Validating data and aborting process if invalid

    I do personally hate when applications attempt to force focus to a certain control. Why not just disable the way of proceeding until all cells contain acceptable data? You could for example turn the background of invalid cells to red or something. This gives way more nice user experience and is even less error prone.
    J-P Nurmi

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.