Vertical gaps (px) between consecutive stacked buttons, ordered top→bottom.
| 30 | |
| 31 | // Vertical gaps (px) between consecutive stacked buttons, ordered top→bottom. |
| 32 | QList<int> buttonGaps(PJ::MessageBox& dlg) { |
| 33 | auto buttons = dlg.findChildren<QPushButton*>(QStringLiteral("pjMessageBoxButton")); |
| 34 | std::sort(buttons.begin(), buttons.end(), [&dlg](QPushButton* a, QPushButton* b) { |
| 35 | return a->mapTo(&dlg, QPoint(0, 0)).y() < b->mapTo(&dlg, QPoint(0, 0)).y(); |
| 36 | }); |
| 37 | QList<int> gaps; |
| 38 | for (int i = 1; i < buttons.size(); ++i) { |
| 39 | const int prev_bottom = buttons[i - 1]->mapTo(&dlg, QPoint(0, 0)).y() + buttons[i - 1]->height(); |
| 40 | gaps.push_back(buttons[i]->mapTo(&dlg, QPoint(0, 0)).y() - prev_bottom); |
| 41 | } |
| 42 | return gaps; |
| 43 | } |
| 44 | |
| 45 | TEST(MessageBoxTest, ShortLabelIsNotWrapped) { |
| 46 | PJ::MessageBox dlg; |