diff view/View.cpp @ 268:70537b0434c4

* Use a command for adding layer measurements
author Chris Cannam
date Tue, 26 Jun 2007 11:08:21 +0000
parents 4ed1446ad604
children 7b58c5e91f20
line wrap: on
line diff
--- a/view/View.cpp	Thu Jun 21 16:12:00 2007 +0000
+++ b/view/View.cpp	Tue Jun 26 11:08:21 2007 +0000
@@ -466,6 +466,8 @@
 	    this,    SLOT(layerParametersChanged()));
     connect(layer, SIGNAL(layerParameterRangesChanged()),
 	    this,    SLOT(layerParameterRangesChanged()));
+    connect(layer, SIGNAL(layerMeasurementRectsChanged()),
+	    this,    SLOT(layerMeasurementRectsChanged()));
     connect(layer, SIGNAL(layerNameChanged()),
 	    this,    SLOT(layerNameChanged()));
     connect(layer, SIGNAL(modelChanged()),
@@ -784,6 +786,13 @@
 }
 
 void
+View::layerMeasurementRectsChanged()
+{
+    Layer *layer = dynamic_cast<Layer *>(sender());
+    if (layer) update();
+}
+
+void
 View::layerNameChanged()
 {
     Layer *layer = dynamic_cast<Layer *>(sender());
@@ -1631,6 +1640,9 @@
 void
 View::drawMeasurementRect(QPainter &paint, const Layer *topLayer, QRect r) const
 {
+//    std::cerr << "View::drawMeasurementRect(" << r.x() << "," << r.y() << " "
+//              << r.width() << "x" << r.height() << ")" << std::endl;
+
     if (r.x() + r.width() < 0 || r.x() >= width()) return;
 
     int fontHeight = paint.fontMetrics().height();