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

Phil Thompson phil at riverbankcomputing.co.uk
Sun Feb 13 09:17:27 GMT 2005


On Saturday 12 February 2005 11:37 pm, Hans-Peter Jansen wrote:
> 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

Clever. I didn't remove it, just changed the documentation as it has another 
legitimate use.

> 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.

If I have the time.

Phil




More information about the PyQt mailing list