MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / measureText

Method measureText

app/src/UI/Widgets/PainterContext.cpp:1355–1367  ·  view source on GitHub ↗

* @brief Canvas-2D shaped measureText: returns { width, actualBoundingBoxAscent, * actualBoundingBoxDescent, fontBoundingBoxAscent, fontBoundingBoxDescent }. */

Source from the content-addressed store, hash-verified

1353 * actualBoundingBoxDescent, fontBoundingBoxAscent, fontBoundingBoxDescent }.
1354 */
1355QVariantMap Widgets::PainterContext::measureText(const QString& text) const
1356{
1357 const QFontMetricsF fm(m_state.font);
1358 const QRectF tight = fm.tightBoundingRect(text);
1359
1360 QVariantMap m;
1361 m[QStringLiteral("width")] = fm.horizontalAdvance(text);
1362 m[QStringLiteral("actualBoundingBoxAscent")] = -tight.top();
1363 m[QStringLiteral("actualBoundingBoxDescent")] = tight.bottom();
1364 m[QStringLiteral("fontBoundingBoxAscent")] = fm.ascent();
1365 m[QStringLiteral("fontBoundingBoxDescent")] = fm.descent();
1366 return m;
1367}
1368
1369//--------------------------------------------------------------------------------------------------
1370// Images

Callers 9

drawLineFunction · 0.80
CeFunction · 0.80
BeFunction · 0.80
drawLabelsMethod · 0.80
_getLabelSizeMethod · 0.80
_fitRowsMethod · 0.80
_fitColsMethod · 0.80
_drawMethod · 0.80
yFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected