[PySide] Connecting signal makes app exit.

Alex V. alex.v.odesk at gmail.com
Thu Sep 22 13:41:24 CEST 2016


When I connect to selectionChanged signal, app silently exits (Linux). 
If I assign selectionModel to local variable before connecting, it works 
as supposed.
Code below should stop executing at "connect", and should display window 
after uncommenting "sm = "
I would like to know why it works this way.

import sys, os
from PySide.QtGui import *
from PySide.QtCore import *

if __name__ == "__main__":
     app = QApplication(sys.argv)
     wnd = QDialog()

     vbox = QVBoxLayout(wnd)
     qtr = QTreeWidget(wnd)
     vbox.addWidget(qtr)

     #sm = qtr.selectionModel()
     qtr.selectionModel().selectionChanged.connect(lambda *args: args)

     wnd.show()
     sys.exit(app.exec_())




More information about the PySide mailing list