| 129 | } |
| 130 | |
| 131 | QRect ToggleSwitch::trackRect() const { |
| 132 | if (text_.isEmpty()) { |
| 133 | return rect(); |
| 134 | } |
| 135 | // Fixed-width pill flush to the edge opposite the label; full height. |
| 136 | const int track_w = kDefaultWidth; |
| 137 | const int x = (label_side_ == LabelSide::Left) ? width() - track_w : 0; |
| 138 | return {x, 0, track_w, height()}; |
| 139 | } |
| 140 | |
| 141 | QRect ToggleSwitch::labelRect() const { |
| 142 | if (text_.isEmpty()) { |