Origin: Qt
| 49 | |
| 50 | // Origin: Qt |
| 51 | static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, |
| 52 | qreal &widthUsed) |
| 53 | { |
| 54 | height = 0; |
| 55 | widthUsed = 0; |
| 56 | textLayout.beginLayout(); |
| 57 | QString str = textLayout.text(); |
| 58 | while (true) |
| 59 | { |
| 60 | QTextLine line = textLayout.createLine(); |
| 61 | if (!line.isValid()) |
| 62 | break; |
| 63 | if (line.textLength() == 0) |
| 64 | break; |
| 65 | line.setLineWidth(lineWidth); |
| 66 | line.setPosition(QPointF(0, height)); |
| 67 | height += line.height(); |
| 68 | widthUsed = qMax(widthUsed, line.naturalTextWidth()); |
| 69 | } |
| 70 | textLayout.endLayout(); |
| 71 | } |
| 72 | |
| 73 | ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) |
| 74 | { |
no test coverage detected