[PyKDE] Problems (bug?) in 3.2.2
Phil Thompson
phil at river-bank.demon.co.uk
Mon May 13 10:40:01 BST 2002
Andreas Gerstlauer wrote:
>
> Hi!
>
> I installed the bugifx release 3.2.2 of sip and PyQt today
> (working with Qt 3.0.4 and Python 2.2.1).
> First of all, thanks, the thread-related bug in emit() for
> Qt signals is gone.
>
> However, I am having new problems with this release. Attached
> is a little test script that produces the bug. The script
> runs fine with 3.2.1 but produces the following with 3.2.2:
>
> % python test.py
> Printing names...
> Traceback (most recent call last):
> File "test.py", line 50, in ?
> w.printNames()
> File "test.py", line 41, in printNames
> child.printNames()
> AttributeError: printNames
>
> It looks like the C++ pointers returned by calls to Qt
> methods are not properly converted back into their
> corresponding wrapped objects. Instead of finding the
> derived and overloaded object the calls return a plain,
> virgin object, i.e. all the custom members are not
> there.
> Like I said, this used to work before (and is, AFAIK,
> a feature of sip/PyQt - otherwise I would have to do
> some sort of "casting" back) so I would assume it is
> a bug?! Or is this an intentional change? In the latter
> case, how can I program my old behavior back...?
It's a bug - fortunately in the SIP module, rather than the code
generator. I'll release SIP 3.2.3 in a few minutes.
> Another problem I am having is that I have a QPopupMenu
> for which I connect the signal "aboutToShow()" to a slot
> of mine (to fill the menu on demand with dynamic content)
> but that slot suddenly doesn't get called anymore when
> I open the menu. I haven't had a chance to investigate
> further but the code fragment looks something like this:
>
> class FileMenu(QPopupMenu):
> def __init__(self, parent, actions):
> QPopupMenu.__init__(self, parent, "File Menu")
>
> self.recentFilesMenu = QPopupMenu(self)
> self.connect(self.recentFilesMenu, SIGNAL('aboutToShow()'),
> self.setupRecentFilesMenu)
> self.insertItem("&Recent Files", self.recentFilesMenu)
>
> def setupRecentFilesMenu(self):
> print "Never gets called!!"
> self.recentFilesMenu.clear()
> for i in range(len(recentFiles)):
> self.recentFilesMenu.insertItem(recentFile[i], i)
>
> Again, this worked fine with everything before and including 3.2.1
> but not any more with 3.2.2. The setupRecentFilesMenu() method
> doesn't get called any more when I open the menu - no error messages,
> nothing. I don't know if it's related to the above problem or not...?!
I think it's the same problem.
Phil
More information about the PyQt
mailing list