I have a item delegate to format my date in tableview. Here is this code

class ticketDateFormatDelegate : public QStyledItemDelegate
{
public:
ticketDateFormatDelegate (QString dateFormat, QObject *parent = 0) :
QStyledItemDelegate(parent),
m_dateFormat(dateFormat)
{
}
virtual QString displayText(const QVariant & value, const QLocale & locale ) const
{ Q_UNUSED(locale);
return value.toDate().toString(m_dateFormat);
// return value.toDate().toString("MM/dd/yyyy");
}
private:
QString m_dateFormat;
};

Here is the code that uses this

ui->tableView->setItemDelegateForColumn(2,new ticketDateFormatDelegate("MM/dd/yy", this));

Problem is when I tab off of the date, or I add a new line and default the date, it disappears from the view. The date is there because when I save the line the record is updated with whatever date is entered, just disappears in data entry. Any help?