diff 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
line wrap: on
line diff
--- a/widgets/LevelPanWidget.cpp	Wed Mar 25 11:09:33 2015 +0000
+++ b/widgets/LevelPanWidget.cpp	Wed Mar 25 11:27:46 2015 +0000
@@ -200,11 +200,11 @@
 
     double wcell = w / npan, hcell = h / nlevel;
 
-    level = int((h - loc.y()) / hcell);
+    level = int((h - (loc.y() - rect.y())) / hcell);
     if (level < 0) level = 0;
     if (level > maxLevel) level = maxLevel;
 
-    pan = int(loc.x() / wcell) - maxPan;
+    pan = int((loc.x() - rect.x()) / wcell) - maxPan;
     if (pan < -maxPan) pan = -maxPan;
     if (pan > maxPan) pan = maxPan;
 }
@@ -223,8 +223,8 @@
 LevelPanWidget::cellCentre(QRectF rect, int level, int pan) const
 {
     QSizeF cs = cellSize(rect);
-    return QPointF(cs.width() * (pan + maxPan) + cs.width() / 2.,
-		   rect.height() - cs.height() * (level + 1) + cs.height() / 2.);
+    return QPointF(rect.x() + cs.width() * (pan + maxPan) + cs.width() / 2.,
+		   rect.y() + rect.height() - cs.height() * (level + 1) + cs.height() / 2.);
 }
 
 QSizeF