comparison view/View.cpp @ 663:1a0fdad4af4d tonioni

Merge from the default branch
author Chris Cannam
date Fri, 12 Jul 2013 13:25:22 +0100
parents c3593bb2de6b
children 0aea4b9e4c3d
comparison
equal deleted inserted replaced
660:8663a831838f 663:1a0fdad4af4d
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);