I have a QT project with a QTableWidget. When the form is loaded the QTableWidget is populated with hard-coded values. These values are all QStrings that denote time values - ie: "12:34:45", "02:33:15", etc.
When the user double-clicks on a cell in the table, I want the cell to convert itself to a QEditTime box, so that the user's input is limited to valid time values.
This is easy enough - I just use a delegate to create a QTimeEdit editor like so...
QWidget * TimeEditDelegate::createEditor(QWidget * pParent, const QStyleOptionViewItem& option, const QModelIndex& index)
QTimeEdit * timeEdit = new QTimeEdit(pParent);
The ONLY problem is, when the user double-clicks on one of these table cells - it erases whatever value was already in there, and replaces it with a "00:00:00" value. I need it to retain the value after it is double-clicked.
Thanks in Advance,