[PyQt] [PyQt 4.5] Freezing for emit signal
Phil Thompson
phil at riverbankcomputing.com
Wed Apr 15 12:07:05 BST 2009
On Wed, 15 Apr 2009 17:38:51 +0700, Alexandr N Zamaraev <tonal at promsoft.ru>
wrote:
> Os Windows Vista Home Ru + sp1
> g++ (GCC) 3.4.5 (mingw-vista special r3)
> Qt 4.5 (self build)
> sip-4.8-snapshot-20090409 (self build)
> PyQt-win-gpl-4.5-snapshot-20090412.zip (self build)
>
> I was unable to allocate a minimum example. Here is pseudocode
situations:
> [code]
> class A(object):
>
> signal = QtCore.pyqtSignal()
>
> def __init__(self):
> super(A, self).__init__()
> self.signal.connect(self._do)
>
> def f(self):
> self.signal.emit()
>
> def _do(self):
> print 'A Hi'
>
> class B(QtGui.QWidget, A):
>
> def __init__(self):
> super(B, self).__init__()
>
> def main():
> app = QtGui.QApplication(sys.argv)
> b = B()
> b.f()
> print 'Opa'
>
> if __name__ == '__main__':
> main()
> [/code]
> In this example, connect works without problems, but _do is not called.
> But in my program in such a situation, the application freezes and have
> to kill him.
How do you know that connect works? I don't think it is being called.
You can only define signals in sub-classes of QObject, not in mixins.
Phil
More information about the PyQt
mailing list