Thanks ChrisW67,
I thought I would try the overriding idea and I have failed to get it to work.
{
if (value.
userType() == QVariant::Double ) {
return locale.toString(value.toDouble(), 'f', 1);
}
else
{
return QStyledItemDelegate::displayText( value, locale);
}
};
QString SpinBoxDelegate::displayText(const QVariant &value, const QLocale &locale) const
{
if (value.userType() == QVariant::Double )
{
return locale.toString(value.toDouble(), 'f', 1);
}
else
{
return QStyledItemDelegate::displayText( value, locale);
}
};
To copy to clipboard, switch view to plain text mode
This doesn't compile with this error message:
error: cannot call member function 'virtual QString QStyledItemDelegate::displayText(const QVariant&, const QLocale&) const' without object
I didn't think an object was needed in this case...
All the examples I have found seem to do it this way so any suggestions on where I have gone wrong would be appreciated?
Thanks, B1.
Bookmarks