Mercurial > hg > svgui
comparison view/View.cpp @ 955:76b5eabd816b osx-retina
Fix font size for painter when rendering scaled
author | Chris Cannam |
---|---|
date | Wed, 29 Apr 2015 13:08:17 +0100 |
parents | fe46201414c8 |
children | 092de22db207 |
comparison
equal
deleted
inserted
replaced
954:17cb48115d22 | 955:76b5eabd816b |
---|---|
1655 } | 1655 } |
1656 | 1656 |
1657 void | 1657 void |
1658 View::setPaintFont(QPainter &paint) | 1658 View::setPaintFont(QPainter &paint) |
1659 { | 1659 { |
1660 int scaleFactor = 1; | |
1661 int dpratio = devicePixelRatio(); | |
1662 if (dpratio > 1) { | |
1663 QPaintDevice *dev = paint.device(); | |
1664 if (dynamic_cast<QPixmap *>(dev) || dynamic_cast<QImage *>(dev)) { | |
1665 scaleFactor = dpratio; | |
1666 } | |
1667 } | |
1668 | |
1660 QFont font(paint.font()); | 1669 QFont font(paint.font()); |
1661 font.setPointSize(Preferences::getInstance()->getViewFontSize()); | 1670 font.setPointSize(Preferences::getInstance()->getViewFontSize() |
1671 * scaleFactor); | |
1662 paint.setFont(font); | 1672 paint.setFont(font); |
1663 } | 1673 } |
1664 | 1674 |
1665 QRect | 1675 QRect |
1666 View::getPaintRect() const | 1676 View::getPaintRect() const |