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

Function buttonGaps

pj_widgets/tests/messagebox_test.cpp:32–43  ·  view source on GitHub ↗

Vertical gaps (px) between consecutive stacked buttons, ordered top→bottom.

Source from the content-addressed store, hash-verified

30
31// Vertical gaps (px) between consecutive stacked buttons, ordered top→bottom.
32QList<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
45TEST(MessageBoxTest, ShortLabelIsNotWrapped) {
46 PJ::MessageBox dlg;

Callers 1

TESTFunction · 0.85

Calls 6

yMethod · 0.80
heightMethod · 0.80
QPointClass · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected