[PyKDE] QPixmap.grabWidget() damages icons and QFilePreview doesn't work

Phil Thompson phil at riverbankcomputing.co.uk
Fri Feb 11 18:29:26 GMT 2005


On Thursday 10 February 2005 5:04 pm, Hans-Peter Jansen wrote:
> Hi Phil,
>
> my next problems are two fold, combined in one script, but it is also
> a nice tool to adjust the parameter for non ugly disabled icons, and
> shows the way to plug them into your project. Qt's disabled icons are
> but ugly, aren't they?
>
> It is typically called this way: python iconfactory.py pixmaps/*
> and will load them in a toolbar, where the IconFactory disable
> parameters can be adjusted.
>
> Following issues arose here: I added a way to save the whole widget as
> PNG. When QPixmap.grabWidget() is called, the icons are damaged, no
> matter, in which way I call the QFileDialog (statically, modal,
> before grabWidget, after..). All icons, that where not covered by the
> QFileDialog are damaged and won't be redrawn on a call of
> repaint(True) or update(). Switching screens, or using the
> QFileDialog as a brush bring them back, but I would like to know,
> what happen here, and problably a way to avoid/workaround this
> effect.

It seemed to work fine for me (with enablePreview = 0).

> While at it, I discovered the QFilePreview ability, and tried to add
> it, but failed. When enabled (set enablePreview = 1), it just issues
> a SystemError with this confusing message:
>
> Traceback (most recent call last):
>   File "iconfactory.py", line 165, in saveScreenshot
>     fd.setContentsPreview(p, p)
> SystemError: error return without exception set
>
> Puzzled! According to your docs, it is fully implemented.

You are creating a Python class that multiply inherits from two C++ classes - 
you can't do that.

Phil




More information about the PyQt mailing list