[PyKDE] PyQt Tutorial: How to write reusable widgets (and a bug report)

Roberto Alsina ralsina at kde.org
Sun Mar 28 21:23:01 BST 2004


I just finished writing a short tutorial that explains how to write custom
widgets in PyQt that are easy to reuse on other applications. Hope you
like it!

http://www.pycs.net/lateral/stories/27.html

It does however, also work as test case for something that is (IMHO) a
bug, but may be very hard to fix.

If you define a custom widget for designer and implement it using PyQt,
any connection defined in designer to a slot in the python-based widget is
compiled by pyuic into this:

self.connect(self.pushButton1,SIGNAL("clicked()"),self.restEditor1,SLOT("render()"))

While it should be something like this:

self.connect(self.pushButton1,SIGNAL("clicked()"),self.restEditor1.render)

I don't think this is fixable because pyuic can't guess that
self.restEditor1 is python-based, but I hope the PyQt guys can surprise me
with a patch :-)

It's not terribly important, because you can use it just fine, you only
need to handle the connections on python-code, but it is a small problem.

-- 
 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  ralsina at kde.org
 (_Y_.)' ._   ) `._`.  " -.-'   KDE Developer (MFCH)
  _..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.'             Buenos Aires - Argentina
Imminentizing the eschaton since 1971.




More information about the PyQt mailing list