comparison view/View.cpp @ 630:c3593bb2de6b

Use italic for value labels (as opposed to label labels)
author Chris Cannam
date Tue, 16 Apr 2013 10:06:10 +0100
parents 5b72899d692b
children 0aea4b9e4c3d
comparison
equal deleted inserted replaced
629:355fa700ce70 630:c3593bb2de6b
729 } 729 }
730 730
731 void 731 void
732 View::drawVisibleText(QPainter &paint, int x, int y, QString text, TextStyle style) const 732 View::drawVisibleText(QPainter &paint, int x, int y, QString text, TextStyle style) const
733 { 733 {
734 if (style == OutlinedText) { 734 if (style == OutlinedText || style == OutlinedItalicText) {
735 735
736 paint.save(); 736 paint.save();
737
738 if (style == OutlinedItalicText) {
739 QFont f(paint.font());
740 f.setItalic(true);
741 paint.setFont(f);
742 }
737 743
738 QColor penColour, surroundColour, boxColour; 744 QColor penColour, surroundColour, boxColour;
739 745
740 penColour = getForeground(); 746 penColour = getForeground();
741 surroundColour = getBackground(); 747 surroundColour = getBackground();
742 boxColour = surroundColour; 748 boxColour = surroundColour;
743 boxColour.setAlpha(127); 749 boxColour.setAlpha(127);
744 750
745 paint.setPen(Qt::NoPen); 751 paint.setPen(Qt::NoPen);
746 paint.setBrush(boxColour); 752 paint.setBrush(boxColour);
753
747 QRect r = paint.fontMetrics().boundingRect(text); 754 QRect r = paint.fontMetrics().boundingRect(text);
748 r.translate(QPoint(x, y)); 755 r.translate(QPoint(x, y));
749 // std::cerr << "drawVisibleText: r = " << r.x() << "," <<r.y() << " " << r.width() << "x" << r.height() << std::endl; 756 // std::cerr << "drawVisibleText: r = " << r.x() << "," <<r.y() << " " << r.width() << "x" << r.height() << std::endl;
750 paint.drawRect(r); 757 paint.drawRect(r);
751 paint.setBrush(Qt::NoBrush); 758 paint.setBrush(Qt::NoBrush);