Hello!

Currently I'm developing a program with accesses a MySQL-database and with this I encountered one little Problem:

The program displays one table by using a QSqlQueryModel and a QTableView. There is one column which contains doubles. I want these doubles to be displayed via a QItemDelegate which contains a QLabel.

Here is my code:

Header
Qt Code:
  1. class LabelDelegate : public QItemDelegate
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. LabelDelegate(QObject* parent = 0);
  7.  
  8. QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
  9. void setEditorData(QWidget* editor, const QModelIndex& index) const;
  10. };
To copy to clipboard, switch view to plain text mode 

Code
Qt Code:
  1. QWidget* LabelDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&, const QModelIndex&) const
  2. {
  3. QLabel* label = new QLabel(parent);
  4.  
  5. return label;
  6. }
  7.  
  8. void LabelDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
  9. {
  10. double value = index.model()->data(index, Qt::EditRole).toInt();
  11.  
  12. QLabel* label = static_cast<QLabel*>(editor);
  13.  
  14. label->setText(QString::number(value) + " €");
  15. }
To copy to clipboard, switch view to plain text mode 

Now I do this:
Qt Code:
  1. tableview->setItemDelegateForColumn(1, new LabelDelegate);
To copy to clipboard, switch view to plain text mode 

But the values are still displayed normally, I can't see the '€' Symbol.

Does anybody have an idea how to fix this?

Thanks!