PDA

View Full Version : Validating a tabel



csvivek
30th May 2008, 11:19
Is it possible to setValidator for each cell in a table?
if yes..? how? please enlighten me on this..


--
Thanks in advance

jpn
30th May 2008, 11:31
QWidget* MyItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QWidget* editor = QItemDelegate::createEditor(parent, option, index);
if (QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(editor))
{
QValidator* validator = ...
...
lineEdit->setValidator(validator);
}
return editor;
}