Added access to toggle rect for inheritors of Ui::SettingsButton.

This commit is contained in:
23rd 2022-12-12 18:16:06 +03:00
parent 580e6a561f
commit 49d9a020a3
2 changed files with 6 additions and 0 deletions

View file

@ -832,6 +832,10 @@ QRect SettingsButton::toggleRect() const {
return { QPoint(left, top), size }; return { QPoint(left, top), size };
} }
QRect SettingsButton::maybeToggleRect() const {
return _toggle ? toggleRect() : QRect(0, 0, 0, 0);
}
int SettingsButton::resizeGetHeight(int newWidth) { int SettingsButton::resizeGetHeight(int newWidth) {
return _padding.top() + _st.height + _padding.bottom(); return _padding.top() + _st.height + _padding.bottom();
} }

View file

@ -289,6 +289,8 @@ protected:
void paintText(Painter &p, bool over, int outerw) const; void paintText(Painter &p, bool over, int outerw) const;
void paintToggle(Painter &p, int outerw) const; void paintToggle(Painter &p, int outerw) const;
[[nodiscard]] QRect maybeToggleRect() const;
private: private:
void setText(QString &&text); void setText(QString &&text);
QRect toggleRect() const; QRect toggleRect() const;