MCPcopy Create free account
hub / github.com/KDE/labplot / handleResize

Method handleResize

src/backend/worksheet/TextLabel.cpp:219–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void TextLabel::handleResize(double horizontalRatio, double verticalRatio, bool /*pageResize*/) {
220 DEBUG(Q_FUNC_INFO);
221
222 double ratio = 0;
223 if (horizontalRatio > 1.0 || verticalRatio > 1.0)
224 ratio = std::max(horizontalRatio, verticalRatio);
225 else
226 ratio = std::min(horizontalRatio, verticalRatio);
227
228 Q_D(TextLabel);
229 d->teXFont.setPointSizeF(d->teXFont.pointSizeF() * ratio);
230 d->updateText();
231
232 // TODO: doesn't seem to work
233 QTextDocument doc;
234 doc.setHtml(d->textWrapper.text);
235 QTextCursor cursor(&doc);
236 cursor.select(QTextCursor::Document);
237 QTextCharFormat fmt = cursor.charFormat();
238 QFont font = fmt.font();
239 font.setPointSizeF(font.pointSizeF() * ratio);
240 fmt.setFont(font);
241 cursor.setCharFormat(fmt);
242}
243
244/*!
245 Returns an icon to be used in the project explorer.

Callers

nothing calls this directly

Calls 4

updateTextMethod · 0.80
setHtmlMethod · 0.80
fontMethod · 0.80
setFontMethod · 0.45

Tested by

no test coverage detected