views:

87

answers:

2

Good day pythonistas and the rest of the coding crowd,

I have two QMainWindows designed and coded separately. I need to:

  1. display first
  2. on a button-press close the first window
  3. construct and display the second window using the arguments from the first

I have tried to design a third class to control the flow but it does not understand my signal/slot attempt:

 QtCore.QObject.connect(self.firstWindow,QtCore.SIGNAL("destroyed()"),self.openSecondWindow)

Oh gurus, would you enlighten me on some clever way or a witty hack to solve my hardships.

Cheers.

+1  A: 

Answer:

I had some trouble with connecting signals recently. I found that it worked when I removed the parentheses from the QtCore.SIGNAL.

try changing this:

QtCore.SIGNAL("destroyed()")

to this:

QtCore.SIGNAL("destroyed")

Reference:

This is because your are using the "old style" signals/slots according to Riverbank. Here's the reference to the docs. Specifically, this is the line you're looking for:

QtCore.QObject.connect(a, QtCore.SIGNAL("PySig"), pyFunction)

Also:

Make sure your this.FirstWindow class has this line before your __init__(self...):

__pyqtSignals__ = ( "destroyed" )
tgray
Looks as if it would work but in my case it just throws some freakish looking errors (X Error: BadDrawable and more stuff that I am to afraid to remember)
Rince
A: 

Well, I have given up on the control class (next time will make the control as the first thing and only after that make the windows)

Instead have mated the windows by injecting the seconds' constructor seed into the body of the first one and then self.close() the young mother. So tragic.

Rince