changeset 54:0e5fba6750c2

* Small rendering refinements
author Chris Cannam
date Fri, 12 Nov 2010 17:04:36 +0000
parents 3c46b2ac45d3
children 261bfb9481fe
files changesetitem.cpp connectionitem.cpp panner.cpp
diffstat 3 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/changesetitem.cpp	Fri Nov 12 16:48:18 2010 +0000
+++ b/changesetitem.cpp	Fri Nov 12 17:04:36 2010 +0000
@@ -24,24 +24,27 @@
 ChangesetItem::paint(QPainter *paint, const QStyleOptionGraphicsItem *option,
                      QWidget *w)
 {
-    QTransform t = paint->worldTransform();
-
     paint->save();
     
     ColourSet *colourSet = ColourSet::instance();
     QColor branchColour = colourSet->getColourFor(m_changeset->branch());
     QColor userColour = colourSet->getColourFor(m_changeset->author());
 
-    paint->setPen(QPen(branchColour, 2));
-    
     QFont f(m_font);
 
+    QTransform t = paint->worldTransform();
     float scale = std::min(t.m11(), t.m22());
     if (scale > 1.0) {
 	int ps = int((f.pixelSize() / scale) + 0.5);
 	if (ps < 8) ps = 8;
 	f.setPixelSize(ps);
     }
+
+    if (scale < 0.1) {
+	paint->setPen(QPen(branchColour, 0));
+    } else {
+	paint->setPen(QPen(branchColour, 2));
+    }
 	
     paint->setFont(f);
     QFontMetrics fm(f);
@@ -58,7 +61,10 @@
     if (m_changeset->children().empty()) {
 	f.setBold(true);
 	paint->setFont(f);
-	paint->drawText(-24, -fh + fm.ascent() - 4, m_changeset->branch());
+	QString branch = m_changeset->branch();
+	int wid = 97;
+	branch = TextAbbrev::abbreviate(branch, QFontMetrics(f), wid);
+	paint->drawText(-24, -fh + fm.ascent() - 4, branch);
 	f.setBold(false);
     }
 
--- a/connectionitem.cpp	Fri Nov 12 16:48:18 2010 +0000
+++ b/connectionitem.cpp	Fri Nov 12 17:04:36 2010 +0000
@@ -31,7 +31,14 @@
 
     ColourSet *colourSet = ColourSet::instance();
     QColor branchColour = colourSet->getColourFor(m_child->getChangeset()->branch());
-    paint->setPen(QPen(branchColour, 2));
+
+    QTransform t = paint->worldTransform();
+    float scale = std::min(t.m11(), t.m22());
+    if (scale < 0.1) {
+	paint->setPen(QPen(branchColour, 0));
+    } else {
+	paint->setPen(QPen(branchColour, 2));
+    }
 
     float xscale = 100;
 
--- a/panner.cpp	Fri Nov 12 16:48:18 2010 +0000
+++ b/panner.cpp	Fri Nov 12 17:04:36 2010 +0000
@@ -39,7 +39,6 @@
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setOptimizationFlags(QGraphicsView::DontSavePainterState |
                          QGraphicsView::IndirectPainting);
-    setRenderHints(QPainter::Antialiasing);
     setMouseTracking(true);
     setInteractive(false);
 }