[PyQt] i can't connect

lucaberto at libero.it lucaberto at libero.it
Tue May 31 16:40:41 BST 2016


I have two file one is calles form.pyand it starts 
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObjectfrom PyQt5.QtWidgets import QWidget,  QFileDialogfrom PyQt5.QtSql import QSqlDatabasefrom PyQt5.QtSql import QSqlTableModelfrom PyQt5.QtSql import QSqlQueryfrom PyQt5.QtSql import QSqlRecordfrom PyQt5.QtCore import Qtfrom PyQt5.QtWidgets import QWidgetfrom PyQt5 import QtWidgetsfrom PyQt5 import QtCorefrom form_ricerca import Form_Ricerca, Segnalefrom Ui_form import Ui_Form

class Form(QWidget, Ui_Form):    """    Class documentation goes here.    """    def __init__(self, parent=None):        """        Constructor                @param parent reference to the parent widget (QWidget)        """        #QObject.__init__(self, parent)        self.fr = Form_Ricerca()        self.sp = Segnale()        super(Form, self).__init__(parent)        self.sp.seleziono.connect(self.selezionato)        self.setupUi(self)                             def selezionato(self):        luca = 0        print('selezionato'+str(luca))
and the other called form_ricerca
from PyQt5.QtCore import pyqtSlot, QModelIndex, pyqtSignal, QObjectfrom PyQt5.QtWidgets import QWidgetfrom PyQt5 import QtCore





from Ui_form_ricerca import Ui_Form

class Form_Ricerca(QWidget, Ui_Form):    """    Class documentation goes here.    """    def __init__(self, parent=None):        """        Constructor                @param parent reference to the parent widget (QWidget)        """        self.sg = Segnale()        super(Form_Ricerca, self).__init__(parent)        self.sg.seleziono.connect(self.selezionato)        self.setupUi(self)            
    def selezionato(self, id):        print('beccato)'+str(id))
class Segnale(QObject):                   seleziono = pyqtSignal(str)        def emetto(self,  id):        #self.seleziono.connect(self.connetto)        self.seleziono.emit(str(id))        print('Emesso: '+str(id))
the signal is captured in the class Form_Ricerca, but not in the class Form of the first file and i need that it is captured in this class what is wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160531/7b18e189/attachment.html>


More information about the PyQt mailing list