# HG changeset patch # User Chris Cannam # Date 1366103170 -3600 # Node ID c3593bb2de6bcdb2cd8dfa2af74331da6535484f # Parent 355fa700ce708af417a6d34d1d0f6517894af160 Use italic for value labels (as opposed to label labels) diff -r 355fa700ce70 -r c3593bb2de6b layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Mon Apr 15 10:54:02 2013 +0100 +++ b/layer/TimeValueLayer.cpp Tue Apr 16 10:06:10 2013 +0100 @@ -1137,16 +1137,21 @@ } QString label = p.label; + bool italic = false; if (label == "" && (m_plotStyle == PlotPoints || m_plotStyle == PlotSegmentation)) { - label = QString("%1").arg(p.value); //??? but use italic? + label = QString("%1").arg(p.value); + italic = true; } if (label != "") { if (!haveNext || nx > x + 6 + paint.fontMetrics().width(p.label)) { - v->drawVisibleText(paint, x + 5, textY, label, View::OutlinedText); + v->drawVisibleText(paint, x + 5, textY, label, + italic ? + View::OutlinedItalicText : + View::OutlinedText); } } diff -r 355fa700ce70 -r c3593bb2de6b view/View.cpp --- a/view/View.cpp Mon Apr 15 10:54:02 2013 +0100 +++ b/view/View.cpp Tue Apr 16 10:06:10 2013 +0100 @@ -731,10 +731,16 @@ void View::drawVisibleText(QPainter &paint, int x, int y, QString text, TextStyle style) const { - if (style == OutlinedText) { + if (style == OutlinedText || style == OutlinedItalicText) { paint.save(); + if (style == OutlinedItalicText) { + QFont f(paint.font()); + f.setItalic(true); + paint.setFont(f); + } + QColor penColour, surroundColour, boxColour; penColour = getForeground(); @@ -744,6 +750,7 @@ paint.setPen(Qt::NoPen); paint.setBrush(boxColour); + QRect r = paint.fontMetrics().boundingRect(text); r.translate(QPoint(x, y)); // std::cerr << "drawVisibleText: r = " << r.x() << "," <