Digits after the decimal QTableView delegate?

Your method isn't called because you forgot the const specifier at the end of the function signature.

Up vote 0 down vote favorite share g+ share fb share tw.

I need a specified number of digits after the decimal point for the items of QTableView, so I wrote a simple delegate. Class TableItemDelegate : public QStyledItemDelegate { Q_OBJECT public: TableItemDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {} QString displayText(const QVariant & value, const QLocale & locale) { QString str = QString::number(value.toDouble(), 'f', 8); return str; } }; But it doesn`t work, constructor called, but not the displayText() function. TableItemDelegate *decDelegate = new TableItemDelegate(tableView); tableView->setItemDelegate(decDelegate); What I`m doing wrong?

C++ qt delegates qtableview link|improve this question asked yesterdayalpex51.

– Sosukodo 23 hours ago The model, that been set for this view is already filled with data, I`m sure that QVariants are valid.imageshack.us/photo/my-images/21/scrul.png – alpex 23 hours ago.

Your method isn't called because you forgot the const specifier at the end of the function signature: QString displayText(const QVariant & value, const QLocale & locale ) const.

It worked perfectly. Thank you! – alpex 12 hours ago.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions