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

Hans-Peter Jansen hpj at urpla.net
Sat Feb 12 23:37:20 GMT 2005


On Friday 11 February 2005 23:17, Phil Thompson wrote:
> On Friday 11 February 2005 7:40 pm, Hans-Peter Jansen wrote:
> >
> > From the QFilePreview docs:
> >
> > This class is an abstract base class which is used to implement
> > widgets that can display a preview of a file in a QFileDialog.
> > You must derive the preview widget from both QWidget and from
> > this class. Then you must reimplement this class's previewUrl()
> > function, which is called by the file dialog if the preview of a
> > file (specified as a URL) should be shown.
> >
> > Any idea, how this could be done, while complying with sip's
> > first law?
>
> Good point - I'll remove QFilePreview completely.

Please don't, as I've found a way to make it work, e.g.:

class Preview(QLabel):
    def __init__(self, parent = None):
        QLabel.__init__(self, parent)
        self.preview = QFilePreview()
        self.preview.previewUrl = self.previewUrl

BTW, did you notice the decode problem in the dirview example. 
Dropping an item somewhere always decodes as an empty list:

            # currently used:
            lst = QStringList()
            QUriDrag.decodeLocalFiles(e, lst)

            # similar as in dirview.cpp:
            lst = []
            QUriDrag.decode(e, lst)

I already tried to keep references on the dragged items, but that 
doesn't change the picture.

Could you take another look into this? In return, I can offer an 
adapted qdir example, which also uses dirview.

Have a nice weekend,
Pete




More information about the PyQt mailing list