# HG changeset patch # User Chris Cannam # Date 1480949485 0 # Node ID 125748a569fa96c432b4e197a4f8be58a257a573 # Parent a7df0d72802016185a58e3b23979665ba5afc4f5 Another use of WidgetScale diff -r a7df0d728020 -r 125748a569fa widgets/LevelPanWidget.cpp --- a/widgets/LevelPanWidget.cpp Mon Dec 05 14:31:53 2016 +0000 +++ b/widgets/LevelPanWidget.cpp Mon Dec 05 14:51:25 2016 +0000 @@ -21,6 +21,8 @@ #include "layer/ColourMapper.h" #include "base/AudioLevel.h" +#include "WidgetScale.h" + #include #include #include @@ -47,22 +49,7 @@ QSize LevelPanWidget::sizeHint() const { - static double ratio = 0.0; - if (ratio == 0.0) { - double baseEm; -#ifdef Q_OS_MAC - baseEm = 17.0; -#else - baseEm = 15.0; -#endif - double em = QFontMetrics(QFont()).height(); - ratio = em / baseEm; - } - - int pixels = 40; - int scaled = int(pixels * ratio + 0.5); - if (pixels != 0 && scaled == 0) scaled = 1; - return QSize(scaled, scaled); + return WidgetScale::scaleQSize(QSize(40, 40)); } static int