[PyKDE] QtDesigner - simpler proxy

Jim Bublitz jbublitz at nwinternet.com
Sun Nov 2 17:45:01 GMT 2003


On Sunday November 2 2003 03:36, Roland Schulz wrote:
> On Sunday 02 November 2003 09:02, Jim Bublitz wrote:

> > I haven't played around with this much yet, but it seems to
> > work just fine. The one thing that needs to be done is that
> > the Python widget needs to provide size hints so that the
> > proxy widget can size itself properly - the "FileChooser"
> > widget isn't very pretty in QtDesigner without those, but it
> > seems to work.

> This can be done by overwriting minimumSIze, maximumSize,
> minimumSizeHint, sizeHint (and -width, -height), passing the
> function onto the proxyed Python object, right?

I thnk you just need to overload sizeHint or something in that 
category in the Python widget itself.

> The only open question is than, if connected signals and slots
> in the preview can be made working and if setting properties
> will work. But to test this the metaobject has to work in the
> first place.

I would think you'd have to "lift" the signals/slots from the 
child widget to the parent in something like FileChooser, but in 
the Python widget as is already done in this case:

    def setFileName(self,fn):
        self.lineEdit.setText(fn)

I'm not sure how to handle the child widgets' signals. Probably 
something like:

in constructor:

    self.connect (self.lineEdit, SIGNAL ("textChanged (const
        QString&"), self.textChanged)

-----
    def textChanged (self, s):
        self.emit (PYSIGNAL ("textChanged"), (s, ))

But I would think any "compound" widget will have to do the same 
thing, and in C++ or Python. For example, QListView doesn't 
expose it's viewport widget in QtDesigner.

As you say though, some of that probably depends on how the meta 
object stuff is implemented.

> Could you send me the your current version. Even better would
> be to put it up on cvs. In case you do my sf username is:
> rolandschulz (ID: 269060), so you can give me cvs write
> access.

I don't maintain any kind of CVS. I'll post a copy sometime today 
- I'd like to look over what I did as I did it kind of quickly 
last night, and I have to get some stuff done outside today 
(it's snowing and I have to do a few things in case the snow 
accumulates and doesn't melt). I'll get a copy posted sometime 
today in any case.

Jim




More information about the PyQt mailing list