Origin: Qt
| 29 | |
| 30 | // Origin: Qt |
| 31 | static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, |
| 32 | qreal &widthUsed) |
| 33 | { |
| 34 | height = 0; |
| 35 | widthUsed = 0; |
| 36 | textLayout.beginLayout(); |
| 37 | QString str = textLayout.text(); |
| 38 | while (true) |
| 39 | { |
| 40 | QTextLine line = textLayout.createLine(); |
| 41 | if (!line.isValid()) |
| 42 | break; |
| 43 | if (line.textLength() == 0) |
| 44 | break; |
| 45 | line.setLineWidth(lineWidth); |
| 46 | line.setPosition(QPointF(0, height)); |
| 47 | height += line.height(); |
| 48 | widthUsed = qMax(widthUsed, line.naturalTextWidth()); |
| 49 | } |
| 50 | textLayout.endLayout(); |
| 51 | } |
| 52 | |
| 53 | ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) |
| 54 | { |
no test coverage detected