Results 1 to 2 of 2

Thread: Validating a tabel

  1. #1
    Join Date
    Mar 2008
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6

    Default Validating a tabel

    Is it possible to setValidator for each cell in a table?
    if yes..? how? please enlighten me on this..


    --
    Thanks in advance

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

    Default Re: Validating a tabel

    Qt Code:
    1. QWidget* MyItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
    2. {
    3. QWidget* editor = QItemDelegate::createEditor(parent, option, index);
    4. if (QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(editor))
    5. {
    6. QValidator* validator = ...
    7. ...
    8. lineEdit->setValidator(validator);
    9. }
    10. return editor;
    11. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Replies: 2
    Last Post: 12th September 2007, 07:36
  2. QTableView, editing, validating input
    By jml in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2007, 00:57
  3. Table and validating cells
    By zorro68 in forum Qt Programming
    Replies: 1
    Last Post: 9th February 2007, 23:22

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
  •  
Qt is a trademark of The Qt Company.