Reputation: 41
qfont = QtGui.QFont('Ubuntu', 9)
#qfont.setHintingPreference(QtGui.QFont.PreferDefaultHinting)
#qfont.setStyleStrategy(QtGui.QFont.PreferAntialias)
qfont.setStyle(QtGui.QFont.StyleNormal)
qfont.setWeight(QtGui.QFont.Normal)
qpaint.setFont(qfont)
qpaint.drawText(qpix.rect() , QtCore.Qt.AlignBottom + QtCore.Qt.AlignCenter, Invent.get_item(i)['type'])
Font rendering (anti-aliasing) is different from the one used by other applications.
http://rghost.net/53129449/image.png
How do I make it look the same?
Upvotes: 4
Views: 1960
Reputation: 8273
I'm not sure if this applies directly to pyQt, but on the c++ side render hints need to be set anytime the painting is scaled or it will look bad. Here's how I set my flags:
m_paintFlags = QPainter::RenderHint(QPainter::Antialiasing |
QPainter::SmoothPixmapTransform |
QPainter::HighQualityAntialiasing);
Then, in the paint event before drawing anything:
painter.setRenderHints(m_paintFlags);
Upvotes: 1