[PyQt] signals and dialogs

dcassidy36 at mass.rr.com dcassidy36 at mass.rr.com
Tue Mar 2 19:56:05 GMT 2010


Your code is not going to work. You are trying to connect to a signal that has already been emitted. For this to work, you need to manually call emitSignal AFTER you create your Foo() Dialog.

if dialog.exec_():
print "dialog executed"
dialog.emitSignal()

emitSignal()...
dialog executed
emitSignal()...
theString:  signal: this is foo

--
Regards,
 -Demetrius Cassidy

---- Scott Frankel <frankel at circlesfx.com> wrote: 

=============

Hi all,

How does one connect dialogs to a parent object to receive any signals  
they may emit?

This doesn't work:
		dialog = Foo()
		self.connect(dialog, QtCore.SIGNAL("foo(string)"), self.printString)

The attached code sample creates a dialog that emits a signal on  
init().  The main window tries to connect the dialog, receive the  
signal, and call its assigned slot.  Seems like it should work, but of  
course it doesn't.

I'm sure I'm overlooking something simple.  Thanks in advance!
Scott






More information about the PyQt mailing list