4
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?

Blackbam
  • 17,496
  • 26
  • 97
  • 150
FIL
  • 41
  • 2

1 Answers1

1

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);
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97