Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 969:0aac065f09f9 osx-retina
Fixes to font sizing in colour 3d plot layer (for #1221)
author | Chris Cannam |
---|---|
date | Thu, 21 May 2015 16:05:14 +0100 |
parents | 94e4952a6774 |
children | 1011ffb1b6d5 |
comparison
equal
deleted
inserted
replaced
964:9b4771ba2e3e | 969:0aac065f09f9 |
---|---|
753 | 753 |
754 return text; | 754 return text; |
755 } | 755 } |
756 | 756 |
757 int | 757 int |
758 Colour3DPlotLayer::getColourScaleWidth(QPainter &) const | 758 Colour3DPlotLayer::getColourScaleWidth(QPainter &p) const |
759 { | 759 { |
760 int cw = 20; | 760 // Font is rotated |
761 int cw = p.fontMetrics().height(); | |
761 return cw; | 762 return cw; |
762 } | 763 } |
763 | 764 |
764 int | 765 int |
765 Colour3DPlotLayer::getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &paint) const | 766 Colour3DPlotLayer::getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &paint) const |
842 QString maxstr = QString("%1").arg(max); | 843 QString maxstr = QString("%1").arg(max); |
843 | 844 |
844 paint.save(); | 845 paint.save(); |
845 | 846 |
846 QFont font = paint.font(); | 847 QFont font = paint.font(); |
847 font.setPixelSize(10); | 848 font.setPixelSize(font.pixelSize() * 0.65); |
848 paint.setFont(font); | 849 paint.setFont(font); |
849 | 850 |
850 int msw = paint.fontMetrics().width(maxstr); | 851 int msw = paint.fontMetrics().width(maxstr); |
851 | 852 |
852 QMatrix m; | 853 QMatrix m; |
880 | 881 |
881 paint.save(); | 882 paint.save(); |
882 | 883 |
883 int py = h; | 884 int py = h; |
884 | 885 |
886 int defaultFontHeight = paint.fontMetrics().height(); | |
887 | |
885 for (int i = symin; i <= symax; ++i) { | 888 for (int i = symin; i <= symax; ++i) { |
886 | 889 |
887 int y0; | 890 int y0; |
888 | 891 |
889 y0 = getIYForBin(v, i); | 892 y0 = getIYForBin(v, i); |
890 int h = py - y0; | 893 int h = py - y0; |
891 | 894 |
892 if (i > symin) { | 895 if (i > symin) { |
893 if (paint.fontMetrics().height() >= h) { | 896 if (paint.fontMetrics().height() >= h) { |
894 if (h >= 8) { | 897 if (h >= defaultFontHeight * 0.8) { |
895 QFont tf = paint.font(); | 898 QFont tf = paint.font(); |
896 tf.setPixelSize(h-2); | 899 tf.setPixelSize(h * 0.8); |
897 paint.setFont(tf); | 900 paint.setFont(tf); |
898 } else { | 901 } else { |
899 continue; | 902 continue; |
900 } | 903 } |
901 } | 904 } |