0

Is there a way to return the font size and font name from QFontDialog? I'm new on python and all the examples I have seen do not return the font name and/or font size.

What I have now it's something like this:

def font_picker(self, button, line):
  font, ok = QtGui.QFontDialog.getFont()

  if ok:
     button.setFont(font)
     line.setFont(font)

But I don't know how to return fontsize as a float and fontfamily as a string

Jonas Kublitski
  • 119
  • 1
  • 11

1 Answers1

3

The QFont object itself has pixelSize, pointSize and pointSizeF for getting the size. It has family for getting the font family.

 if ok:
     button.setFont(font)
     line.setFont(font)
     return font.pointSizeF(), font.family()
negacao
  • 1,244
  • 8
  • 17