| 880 | } |
| 881 | |
| 882 | qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) { |
| 883 | while(font_size >= minPointSize) { |
| 884 | font.setPointSizeF(font_size); |
| 885 | QFontMetrics fm(font); |
| 886 | if (TextWidth(fm, text) < width) { |
| 887 | break; |
| 888 | } |
| 889 | font_size -= 0.5; |
| 890 | } |
| 891 | return font_size; |
| 892 | } |
| 893 | |
| 894 | ThemedLabel::ThemedLabel(const PlatformStyle* platform_style, QWidget* parent) |
| 895 | : QLabel{parent}, m_platform_style{platform_style} |