reimplementation of sizeHint() is empty for now. I am just having a qDebug() statement and exit(1) in sizeHint() to check if the function is actually getting called. But nothing is displayed and my program doesn't exit.

I am setting some options for the table view like allowing single selection, hiding headers etc. Can this be the reason that sizeHint() is not being called? It seems idiotic to me but this thought came to my mind.

Here's how i am reimplementing sizeHint():

Header file:
Qt Code:
  1. class CustomDelegate : public QAbstractItemDelegate
  2. {
  3. public:
  4. CustomDelegate(QObject *parent=0);
  5. // Public member functions
  6. void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  7. QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
  8. };
To copy to clipboard, switch view to plain text mode 

C++ file:
Qt Code:
  1. void CustomDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
  2. {
  3. // Paint implementation
  4. }
  5.  
  6. QSize CustomDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
  7. {
  8. qDebug("Inside sizeHint");
  9. exit(1);
  10. }
To copy to clipboard, switch view to plain text mode 

Now, when i run my application, paint() is called but sizeHint() is not getting called. I don't why sizeHint() is not being called