diff --git a/ui/widgets/buttons.cpp b/ui/widgets/buttons.cpp index 7a63bd4..35d6669 100644 --- a/ui/widgets/buttons.cpp +++ b/ui/widgets/buttons.cpp @@ -832,6 +832,10 @@ QRect SettingsButton::toggleRect() const { return { QPoint(left, top), size }; } +QRect SettingsButton::maybeToggleRect() const { + return _toggle ? toggleRect() : QRect(0, 0, 0, 0); +} + int SettingsButton::resizeGetHeight(int newWidth) { return _padding.top() + _st.height + _padding.bottom(); } diff --git a/ui/widgets/buttons.h b/ui/widgets/buttons.h index 5f426d3..1885292 100644 --- a/ui/widgets/buttons.h +++ b/ui/widgets/buttons.h @@ -289,6 +289,8 @@ protected: void paintText(Painter &p, bool over, int outerw) const; void paintToggle(Painter &p, int outerw) const; + [[nodiscard]] QRect maybeToggleRect() const; + private: void setText(QString &&text); QRect toggleRect() const;