Mercurial > hg > svgui
comparison widgets/LevelPanWidget.cpp @ 932:37bb4b416c52 tonioni
Render direct to widget (necessary to avoid pixel doubling on OS/X)
author | Chris Cannam |
---|---|
date | Wed, 25 Mar 2015 11:27:46 +0000 |
parents | 86df7de08e03 |
children | 2564d0865feb |
comparison
equal
deleted
inserted
replaced
931:7cf497b72da3 | 932:37bb4b416c52 |
---|---|
198 int npan = maxPan * 2 + 1; | 198 int npan = maxPan * 2 + 1; |
199 int nlevel = maxLevel + 1; | 199 int nlevel = maxLevel + 1; |
200 | 200 |
201 double wcell = w / npan, hcell = h / nlevel; | 201 double wcell = w / npan, hcell = h / nlevel; |
202 | 202 |
203 level = int((h - loc.y()) / hcell); | 203 level = int((h - (loc.y() - rect.y())) / hcell); |
204 if (level < 0) level = 0; | 204 if (level < 0) level = 0; |
205 if (level > maxLevel) level = maxLevel; | 205 if (level > maxLevel) level = maxLevel; |
206 | 206 |
207 pan = int(loc.x() / wcell) - maxPan; | 207 pan = int((loc.x() - rect.x()) / wcell) - maxPan; |
208 if (pan < -maxPan) pan = -maxPan; | 208 if (pan < -maxPan) pan = -maxPan; |
209 if (pan > maxPan) pan = maxPan; | 209 if (pan > maxPan) pan = maxPan; |
210 } | 210 } |
211 | 211 |
212 QSizeF | 212 QSizeF |
221 | 221 |
222 QPointF | 222 QPointF |
223 LevelPanWidget::cellCentre(QRectF rect, int level, int pan) const | 223 LevelPanWidget::cellCentre(QRectF rect, int level, int pan) const |
224 { | 224 { |
225 QSizeF cs = cellSize(rect); | 225 QSizeF cs = cellSize(rect); |
226 return QPointF(cs.width() * (pan + maxPan) + cs.width() / 2., | 226 return QPointF(rect.x() + cs.width() * (pan + maxPan) + cs.width() / 2., |
227 rect.height() - cs.height() * (level + 1) + cs.height() / 2.); | 227 rect.y() + rect.height() - cs.height() * (level + 1) + cs.height() / 2.); |
228 } | 228 } |
229 | 229 |
230 QSizeF | 230 QSizeF |
231 LevelPanWidget::cellLightSize(QRectF rect) const | 231 LevelPanWidget::cellLightSize(QRectF rect) const |
232 { | 232 { |