I am trying to implement a table widget which displays (real) numbers.
I want to display data in the table with lower precision (say, number
of digits after the decimal point is 2) without reducing the actual presicion of the referenced data.
I thought that I can store the rounded and not-rounded data separately as
DisplayRole and EditRole, respectively, but it turns out not true
as far as looking at the sources of QStandardItemModel::setData() and
QTableWidgetItem::setData().
{
role = (role == Qt::EditRole) ? Qt::DisplayRole : role;
.......
}
void QStandardItem::setData(const QVariant &value, int role)
{
Q_D(QStandardItem);
role = (role == Qt::EditRole) ? Qt::DisplayRole : role;
.......
}
To copy to clipboard, switch view to plain text mode
Should I prepare another instance of StandardItemModel or my own container to store unrounded data?
Bookmarks