Mercurial > hg > svgui
changeset 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 | a4ba6c96b66d |
files | view/View.cpp |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/view/View.cpp Wed Oct 13 15:00:28 2010 +0100 +++ b/view/View.cpp Sun Oct 24 17:38:03 2010 +0200 @@ -732,10 +732,20 @@ paint.save(); - QColor penColour, surroundColour; + QColor penColour, surroundColour, boxColour; penColour = getForeground(); surroundColour = getBackground(); + boxColour = surroundColour; + boxColour.setAlpha(127); + + paint.setPen(Qt::NoPen); + paint.setBrush(boxColour); + QRect r = paint.fontMetrics().boundingRect(text); + r.translate(QPoint(x, y)); +// std::cerr << "drawVisibleText: r = " << r.x() << "," <<r.y() << " " << r.width() << "x" << r.height() << std::endl; + paint.drawRect(r); + paint.setBrush(Qt::NoBrush); paint.setPen(surroundColour);