Thank you all for the replies. ChrisW67 gave me the solution needed. I had already reimplemented a spinbox for editing so all I had to do was reimplement the drawText function for the displayed text.
{
double value = index.model()->data(index, Qt::EditRole).toDouble();
painter->drawText(option.rect, str.setNum(value, 'f', 1) );
}
void SpinBoxDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
double value = index.model()->data(index, Qt::EditRole).toDouble();
QString str;
painter->drawText(option.rect, str.setNum(value, 'f', 1) );
}
To copy to clipboard, switch view to plain text mode
My problem now is when the row is selected the background goes dark blue, as expected, however the text remains black rather than going white, making it impossible to read. Any suggestions to help solve this would be appreciated.
B1.
Bookmarks