[PyKDE] Qt4 and uic - dynamic generation
phil at riverbankcomputing.co.uk
Fri Jul 22 13:16:37 BST 2005
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Jeremy Sanders schrieb:
>> On Thu, 21 Jul 2005, Sebastian Kügler wrote:
>>> Not sure if I'd like to do this ...
>>> * I actually like the way it is done right now, you can easily
>>> subclass the
>>> generated python code, and I'm not sure how this should be done when
>>> using .ui files directly. Furthermore, it might add overhead to do
>>> this at
>> I wasn't suggesting this would replace the existing subclassing.
>> What I'm suggesting is that you could have some function which returns a
>> class which you could then subclass, e.g.
>> MyDialogBase = qt.LoadUI('foo.ui')
>> class MyDialog(MyDialogBase):
>> def foobar(self):
>> Personally I think this is a lot nicer than having generated python code
>> in my source tree. It means that someone could run a python script and
>> it would just work, without having uic and so on installed.
>> If this is what QWidgetFactory does, then that's great!
> you have to be careful with QWidgetFactory, because it creates an
> instance, not
> a class. One Problem is, that you cannot override event handlers in it,
> but only
> use signals and slots.
self.d = QWidgetFactory("d.ui")
self.d.event = self.event
def event(self, e):
# Do your thing
Not pretty I know.
More information about the PyQt