| 289 | } |
| 290 | |
| 291 | void 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 |
nothing calls this directly
no test coverage detected