[PyKDE] Troubles using a function to load pixmap in designer forms
Phil Thompson
phil at river-bank.demon.co.uk
Wed Apr 16 12:32:01 BST 2003
On Wednesday 16 April 2003 11:13 am, Aurélien Gâteau wrote:
> Hi list!
>
> When you create a form with Designer, it's possible to use a function to
> load pixmaps in widgets. I wrote a PixmapLoader module which contains a
> "load()" function. This function takes a string as a parameter and returns
> a QPixmap, so it's a good candidate for a pixmap loading function.
>
> My first trouble was that Designer does not allow dots in function names so
> I used the name "pixmapLoad". All that was needed was to add a line like
> this at the top of the file :
>
> from PixmapLoader import load as pixmapLoad
>
>
> Second trouble is to add this line automatically: I can't find any way in
> Designer to specify some code to be added at the beginning of the generated
> file. My idea is to add a new parameter to pyuic. This parameter would be a
> file containing extra code to be added before the class definition. Looking
> at pyuic code it seems easy to do, but I would like to have your opinion on
> any simpler way to achieve what I want before starting to hack.
This functionality is already in the current snapshots. It's even documented
(see the section "Using Qt Designer").
Phil
More information about the PyQt
mailing list