comparison view/View.cpp @ 575:bb1035a24958

* Make text clearer on complex backgrounds by adding a translucent surrounding box
author Chris Cannam
date Sun, 24 Oct 2010 17:38:03 +0200
parents 95cf0d0f93af
children 4c484636d5ec
comparison
equal deleted inserted replaced
574:95cf0d0f93af 575:bb1035a24958
730 { 730 {
731 if (style == OutlinedText) { 731 if (style == OutlinedText) {
732 732
733 paint.save(); 733 paint.save();
734 734
735 QColor penColour, surroundColour; 735 QColor penColour, surroundColour, boxColour;
736 736
737 penColour = getForeground(); 737 penColour = getForeground();
738 surroundColour = getBackground(); 738 surroundColour = getBackground();
739 boxColour = surroundColour;
740 boxColour.setAlpha(127);
741
742 paint.setPen(Qt::NoPen);
743 paint.setBrush(boxColour);
744 QRect r = paint.fontMetrics().boundingRect(text);
745 r.translate(QPoint(x, y));
746 // std::cerr << "drawVisibleText: r = " << r.x() << "," <<r.y() << " " << r.width() << "x" << r.height() << std::endl;
747 paint.drawRect(r);
748 paint.setBrush(Qt::NoBrush);
739 749
740 paint.setPen(surroundColour); 750 paint.setPen(surroundColour);
741 751
742 for (int dx = -1; dx <= 1; ++dx) { 752 for (int dx = -1; dx <= 1; ++dx) {
743 for (int dy = -1; dy <= 1; ++dy) { 753 for (int dy = -1; dy <= 1; ++dy) {