PDA

View Full Version : how to find rect of every line in multiline word wrapped string?



srazi
1st February 2011, 17:14
I have a QTableWidget with 'Word Wrap' enabled, and also I installed an item delegation on it. when reimplementing:



QStyledItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index )


the 'option.rect' give me whole item 'rect' but I want rect of an arbitrary line of text.
How can I do that?

srazi
2nd February 2011, 00:11
See the screenshot for a better description of my question, please.
5850

srazi
4th February 2011, 16:07
Nobody has an idea?

aamer4yu
5th February 2011, 08:31
May be calculate yourself...
you have the width of text.... you know the height of font..
so you can calculate the rect of any line..