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

Method sizeHint

pj_widgets/src/ToggleSwitch.cpp:111–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111QSize ToggleSwitch::sizeHint() const {
112 if (text_.isEmpty()) {
113 return {kDefaultWidth, kDefaultHeight};
114 }
115 // Switch pill keeps the default 34x18 proportions; the label adds its
116 // advance width plus a gap. Height grows only if the font needs more.
117 const int height = std::max(kDefaultHeight, fontMetrics().height());
118 const int width = kDefaultWidth + kLabelSpacing + fontMetrics().horizontalAdvance(text_) + kLabelMargin;
119 return {width, height};
120}
121
122QSize ToggleSwitch::minimumSizeHint() const {
123 return sizeHint();

Callers

nothing calls this directly

Calls 3

heightMethod · 0.80
horizontalAdvanceMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected