comparison widgets/Panner.cpp @ 908:4a578a360011 cxx11

More type fixes
author Chris Cannam
date Tue, 10 Mar 2015 13:22:10 +0000
parents ae4f58d9db84
children 4d0ca1ab4cd0
comparison
equal deleted inserted replaced
907:28d05ae8741c 908:4a578a360011
63 Panner::scroll(bool up) 63 Panner::scroll(bool up)
64 { 64 {
65 float unit = m_scrollUnit; 65 float unit = m_scrollUnit;
66 if (unit == 0.f) { 66 if (unit == 0.f) {
67 unit = float(m_rectHeight) / (6 * float(height())); 67 unit = float(m_rectHeight) / (6 * float(height()));
68 if (unit < 0.01) unit = 0.01; 68 if (unit < 0.01f) unit = 0.01f;
69 } 69 }
70 70
71 if (!up) { 71 if (!up) {
72 m_rectY += unit; 72 m_rectY += unit;
73 } else { 73 } else {
163 QColor hl(m_thumbColour); 163 QColor hl(m_thumbColour);
164 hl.setAlpha(m_thumbAlpha); 164 hl.setAlpha(m_thumbAlpha);
165 165
166 paint.setBrush(hl); 166 paint.setBrush(hl);
167 167
168 int rw = lrintf((width() - 1) * m_rectWidth); 168 int rw = int(lrintf(float(width() - 1) * m_rectWidth));
169 int rh = lrintf((height() - 1) * m_rectHeight); 169 int rh = int(lrintf(float(height() - 1) * m_rectHeight));
170 if (rw < 2) rw = 2; 170 if (rw < 2) rw = 2;
171 if (rh < 2) rh = 2; 171 if (rh < 2) rh = 2;
172 172
173 paint.drawRect(lrintf(width() * m_rectX), 173 paint.drawRect(int(lrintf(float(width()) * m_rectX)),
174 lrintf(height() * m_rectY), 174 int(lrintf(float(height()) * m_rectY)),
175 rw, rh); 175 rw, rh);
176 } 176 }
177 177
178 void 178 void
179 Panner::normalise() 179 Panner::normalise()
180 { 180 {
181 if (m_rectWidth > 1.0) m_rectWidth = 1.0; 181 if (m_rectWidth > 1.f) m_rectWidth = 1.f;
182 if (m_rectHeight > 1.0) m_rectHeight = 1.0; 182 if (m_rectHeight > 1.f) m_rectHeight = 1.f;
183 if (m_rectX + m_rectWidth > 1.0) m_rectX = 1.0 - m_rectWidth; 183 if (m_rectX + m_rectWidth > 1.f) m_rectX = 1.f - m_rectWidth;
184 if (m_rectX < 0) m_rectX = 0; 184 if (m_rectX < 0) m_rectX = 0;
185 if (m_rectY + m_rectHeight > 1.0) m_rectY = 1.0 - m_rectHeight; 185 if (m_rectY + m_rectHeight > 1.f) m_rectY = 1.f - m_rectHeight;
186 if (m_rectY < 0) m_rectY = 0; 186 if (m_rectY < 0) m_rectY = 0;
187 187
188 if (!m_defaultsSet) { 188 if (!m_defaultsSet) {
189 m_defaultCentreX = centreX(); 189 m_defaultCentreX = centreX();
190 m_defaultCentreY = centreY(); 190 m_defaultCentreY = centreY();