| 109 | } |
| 110 | |
| 111 | QSize 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 | |
| 122 | QSize ToggleSwitch::minimumSizeHint() const { |
| 123 | return sizeHint(); |
nothing calls this directly
no test coverage detected