MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / rewrapButtonLabels

Method rewrapButtonLabels

pj_widgets/src/MessageBox.cpp:291–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void MessageBox::rewrapButtonLabels() {
292 // Widest a single button line may be before the dialog would exceed its
293 // maximumWidth(): the cap minus the card margins, border and button padding.
294 const int max_line = maximumWidth() - 2 * kCardContentMargin - 2 * kCardBorder - 2 * kButtonHPadding - kWrapSlack;
295 for (int i = 0; i < buttons_.size(); ++i) {
296 // Force the button's own polish so its font reflects the QSS font-size
297 // before we measure: the dialog's Polish fires before its children's, so
298 // without this we'd wrap against the default font and overflow at the
299 // larger rendered size.
300 buttons_[i]->ensurePolished();
301 buttons_[i]->setText(wrapLabelToWidth(button_labels_[i], QFontMetrics(buttons_[i]->font()), max_line));
302 }
303}
304
305// --- Static helpers ----------------------------------------------------------
306

Callers

nothing calls this directly

Calls 5

wrapLabelToWidthFunction · 0.85
QFontMetricsClass · 0.85
sizeMethod · 0.45
setTextMethod · 0.45
fontMethod · 0.45

Tested by

no test coverage detected