Mercurial > hg > svgui
comparison layer/LinearNumericalScale.cpp @ 869:6c08e99ca0f3 tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 10 Nov 2014 09:20:06 +0000 |
parents | 3ca3b8fbbcee |
children | e0f08e108064 |
comparison
equal
deleted
inserted
replaced
860:4a5d144bd5d0 | 869:6c08e99ca0f3 |
---|---|
40 int n = 10; | 40 int n = 10; |
41 | 41 |
42 float val = minf; | 42 float val = minf; |
43 float inc = (maxf - val) / n; | 43 float inc = (maxf - val) / n; |
44 | 44 |
45 char buffer[40]; | 45 const int buflen = 40; |
46 char buffer[buflen]; | |
46 | 47 |
47 int w = getWidth(v, paint) + x0; | 48 int w = getWidth(v, paint) + x0; |
48 | 49 |
49 float round = 1.f; | 50 float round = 1.f; |
50 int dp = 0; | 51 int dp = 0; |
84 if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) { | 85 if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) { |
85 val += inc; | 86 val += inc; |
86 continue; | 87 continue; |
87 } | 88 } |
88 | 89 |
89 sprintf(buffer, "%.*f", dp, dispval); | 90 snprintf(buffer, buflen, "%.*f", dp, dispval); |
90 | 91 |
91 QString label = QString(buffer); | 92 QString label = QString(buffer); |
92 | 93 |
93 paint.drawLine(w - 5, y, w, y); | 94 paint.drawLine(w - 5, y, w, y); |
94 | 95 |