[PyQt] Missing QPageSize enum in vars(QPrinter) ?
lloyd konneker
bootch at nc.rr.com
Thu Oct 10 14:43:10 BST 2013
This code worked in PyQt4 and Qt4 to get a dictionary of paper size names:
paperSizeNames = {}
print(vars(QPrinter))
for key, value in vars(QPrinter).items(): # Python2 iteritems():
if isinstance(value, QPrinter.PageSize):
print(key, value)
paperSizeNames[value] = key
It no longer works in PyQt5 and Qt5.0.1. But other enum values appear
to be in vars(QPrinter)? Is missing QPageSize enum a bug of omission in
PyQt5?
This is NOT too important, since Qt 5.1 offers
QPrinter.supportedSizesWithNames(), which more or less does the same
thing (returns a map from names to QSizeF, which I suppose could be
mapped to QPageSize enum values i.e. encodings.)
Is there another way to get the names of Qt enum values?
More information about the PyQt
mailing list