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

Hans-Peter Jansen hpj at urpla.net
Thu Feb 10 17:04:20 GMT 2005

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 

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iconfactory.py
Type: text/x-python
Size: 7960 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050210/d5d6213b/iconfactory.py

More information about the PyQt mailing list