Results 1 to 2 of 2

Thread: Table and validating cells

  1. #1
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Table and validating cells

    Please, has anybody a simple sample that explain how to validate cells (double or int) or a good, but simple, post that explain howto (if you have the sourcecode, better).
    I'm trying to programm a table where i can resize columns (or not), fixed columns width, resize rows height, resize table height and validate cells.
    I've read a lot of post and qt help about deltegate, qtableWidget, qtableWidgetitem..... but i dont understand how to do this.

    Thanks a lot for your information.

  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: Table and validating cells

    Take a look at the spinbox delegate example bundled with Qt, you can make use of it. The only thing you need to do is to install a QValidator subclass on the editor.

    There is an alternative solution, which should be much simpler. Reimplement setData() for your model or item and either allow a particular change to the data or not. With the model approach you can additionally return false from setData() to indicate that the change was rejected.

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.