MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / viewItemTextLayout

Function viewItemTextLayout

launcher/ui/instanceview/InstanceDelegate.cpp:51–71  ·  view source on GitHub ↗

Origin: Qt

Source from the content-addressed store, hash-verified

49
50// Origin: Qt
51static 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
73ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent)
74{

Callers 2

viewItemTextSizeFunction · 0.70
paintMethod · 0.70

Calls 2

textMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected