Wow, ok that was too early. Three typos, I am scared... But beside that, my first thought was also false. You have to do the drawing yourself.
Qt Code:
  1. class PointDelegate : public QStyledItemDelegate
  2. {
  3. public:
  4. PointDelegate(QObject *parent = 0): QStyledItemDelegate(parent)
  5. {}
  6.  
  7. void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
  8. {
  9. if (QVariant::Point == index.data().type())
  10. {
  11. painter->drawText(option.rect,
  12. displayText(index.data(), QLocale::system()),
  13. option.displayAlignment);
  14. }
  15. else
  16. QStyledItemDelegate::paint(painter, option, index);
  17. }
  18.  
  19. QString displayText(const QVariant & value, const QLocale & locale ) const
  20. {
  21. Q_UNUSED(locale);
  22. qDebug() << "Delegate called with " << value;
  23. return QString("{%1,%2}").arg(value.toPoint().x()).arg(value.toPoint().y());
  24. }
  25. };
To copy to clipboard, switch view to plain text mode