diff view/Pane.cpp @ 299:5c59c433b358

* Show colour swatch next to layer name in pane (if available) * Fix for incorrect layer name prefix handling (was making some layers appear to have the same model name in cases where the model names differed by the final character only)
author Chris Cannam
date Wed, 05 Sep 2007 15:17:15 +0000
parents 919740b20cc9
children 0824a754a8eb
line wrap: on
line diff
--- a/view/Pane.cpp	Thu Aug 16 16:47:07 2007 +0000
+++ b/view/Pane.cpp	Wed Sep 05 15:17:15 2007 +0000
@@ -716,8 +716,13 @@
     }
 
     QStringList texts;
+    std::vector<QPixmap> pixmaps;
     for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
         texts.push_back((*i)->getLayerPresentationName());
+//        std::cerr << "Pane " << this << ": Layer presentation name for " << *i << ": "
+//                  << texts[texts.size()-1].toStdString() << std::endl;
+        pixmaps.push_back((*i)->getLayerPresentationPixmap
+                          (QSize(fontAscent, fontAscent)));
     }
 
     int maxTextWidth = width() / 3;
@@ -734,6 +739,8 @@
     if (r.x() + r.width() >= llx) {
 	
         for (size_t i = 0; i < texts.size(); ++i) {
+
+//            std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i].toStdString() << std::endl;
             
             if (i + 1 == texts.size()) {
                 paint.setPen(getForeground());
@@ -742,6 +749,12 @@
             drawVisibleText(paint, llx,
                             lly - fontHeight + fontAscent,
                             texts[i], OutlinedText);
+
+            if (!pixmaps[i].isNull()) {
+                paint.drawPixmap(llx - fontAscent - 3,
+                                 lly - fontHeight + (fontHeight-fontAscent)/2,
+                                 pixmaps[i]);
+            }
             
             lly -= fontHeight;
         }