Hi all,
A have just made cistom item delegate, and found some problem on implementing cross-platform paint and sizeHint class methods.

I have Big text in my cell, and I want to adjust Height regarding it, here is the code of delegate.

As you can see, the sizeHint Method:

Qt Code:
  1. QSize RaspListDeleagte::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
  2. {
  3. if (!index.isValid()) return QStyledItemDelegate::sizeHint(option,index);
  4.  
  5. QSize result;
  6. //setup fonts
  7. QFontMetrics fmTF(getTimeFont(option));
  8. result.setHeight(fmTF.lineSpacing()+fmTF.leading()*2+4);
  9. result.setWidth(option.rect.width());
  10. return result;
  11. }
To copy to clipboard, switch view to plain text mode 

And I draw the text by following code:
Qt Code:
  1. painter->setFont(timeFont);
  2. painter->drawText(option.rect.x()+2,option.rect.y()+fmTF.height(),timeLeft);
To copy to clipboard, switch view to plain text mode 

I got option.rect.y() plus QFontMetrics height.
It worked good on Mac OS, but it looks ugly on Linux:


As you can see, the big font text with tome shifted (I got shifted option.rect.y()). It mean that every cell of QListWidget has some top marging, ot content margin. But I didn't find any in QStyleOptionViewItem.

How I can get this margin from Item Delegate ?