changeset 294:2c1e57ad86e7

* 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 7c53640bb9ba
children a2dc34ce146a
files base/TextAbbrev.cpp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/base/TextAbbrev.cpp	Mon Sep 03 13:58:48 2007 +0000
+++ b/base/TextAbbrev.cpp	Wed Sep 05 15:17:15 2007 +0000
@@ -18,6 +18,8 @@
 #include <QFontMetrics>
 #include <QApplication>
 
+#include <iostream>
+
 QString
 TextAbbrev::getDefaultEllipsis()
 {
@@ -253,12 +255,17 @@
 
     while (--candidate > 1) {
         if (splitChars.contains(reference[candidate])) {
-            if (havePrefix(reference.left(candidate - 1), texts)) {
+            if (havePrefix(reference.left(candidate), texts)) {
                 break;
             }
         }
     }
 
+//    std::cerr << "TextAbbrev::getPrefixLength: prefix length is " << candidate << std::endl;
+//    for (int i = 0; i < texts.size(); ++i) {
+//        std::cerr << texts[i].left(candidate).toStdString() << "|" << texts[i].right(texts[i].length() - candidate).toStdString() << std::endl;
+//    }
+
     return candidate;
 }