Fix DynamicsPopup::MinMaxSlider when UI scale change

This commit is contained in:
David Capello 2020-04-24 12:34:54 -03:00
parent b6a86e6aea
commit a6c55b0210

View File

@ -54,6 +54,7 @@ class DynamicsPopup::MinMaxSlider : public Widget {
public: public:
MinMaxSlider() { MinMaxSlider() {
setExpansive(true); setExpansive(true);
initTheme();
} }
float minThreshold() const { return m_minThreshold; } float minThreshold() const { return m_minThreshold; }
@ -65,6 +66,7 @@ public:
private: private:
void onInitTheme(InitThemeEvent& ev) override { void onInitTheme(InitThemeEvent& ev) override {
Widget::onInitTheme(ev);
SkinTheme* theme = static_cast<SkinTheme*>(this->theme()); SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
setBorder( setBorder(
gfx::Border( gfx::Border(
@ -72,18 +74,12 @@ private:
theme->parts.miniSliderEmpty()->bitmapN()->height(), theme->parts.miniSliderEmpty()->bitmapN()->height(),
theme->parts.miniSliderEmpty()->bitmapE()->width(), theme->parts.miniSliderEmpty()->bitmapE()->width(),
theme->parts.miniSliderEmpty()->bitmapS()->height())); theme->parts.miniSliderEmpty()->bitmapS()->height()));
Widget::onInitTheme(ev);
} }
void onSizeHint(SizeHintEvent& ev) override { void onSizeHint(SizeHintEvent& ev) override {
int w = 0; ev.setSizeHint(
int h = 2*textHeight(); border().width(),
textHeight()+2*guiscale() + border().height());
w += border().width();
h += border().height();
ev.setSizeHint(w, h);
} }
void onPaint(PaintEvent& ev) override { void onPaint(PaintEvent& ev) override {