[PyQt] Re: Strange PyQt4 behavior

Phil Thompson phil at riverbankcomputing.com
Thu May 22 14:49:01 BST 2008


On Thursday 22 May 2008 2:38:02 pm Detlev Offenbach wrote:
> Hi,
>
> I just discovered, that the following line of code fails.
>
> printer.setPageSize(settings.value("UIPreviewer/pagesize").toInt()[0])
>
> The error given is "TypeError: argument 1 of QPrinter.setPageSize() has an
> invalid type". How do I convert an integer to a QPrinter.PageSize (e.g. 0
> -> QPrinter.A4)?

Pass the integer to the ctor...

    QPrinter.PageSize(0)

Phil


More information about the PyQt mailing list