Delegate not working as expected...
-
I have implemented a delegate for a QTableView. The objective is to add a QIntValidator to one editor and a QDoubleValidator to another. In both cases the validator isn't working:
@if( index.column() == _model->qtyNo())
{
QLineEdit *le = new QLineEdit(parent);
le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le));
le->setValidator (new QIntValidator(1, 999, le));
return le;
}
else if( index.column() == _model->priceNo())
{
QLineEdit *le = new QLineEdit(parent);
le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le));
le->setValidator (new QDoubleValidator(0.0, 999.99, 2, le));
return le;
}return QSqlRelationalDelegate::createEditor(parent, option, index);@
-
wired.. don't see anything wrong with the code.. Can you try to read the validator after you set it and see if you get the same thing back..