mottosso / Qt.py

Minimal Python 2 & 3 shim around all Qt bindings - PySide, PySide2, PyQt4 and PyQt5.
MIT License
896 stars 252 forks source link

Differences between QFontDialog.getFont() in PyQt vs. PySide #417

Open mdsandell opened 3 days ago

mdsandell commented 3 days ago

It appears that in PyQt4 and 5, QFontDialog.getFont returns a tuple of (font, ok), but in PySide 1 and 2, that result is reversed to (ok, font).

Here's how I'm working around it for now:

result = QFontDialog.getFont(self.docFont, self, "Select Font")
if Qt.IsPyQt4 or Qt.IsPyQt5:
    font, ok = result
else:
    ok, font = result

I couldn't find anything documented about this difference in behavior other than literally comparing the method signatures in the docs for the libraries.