[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] i can't connect
From: "lucaberto () libero ! it" <lucaberto () libero ! it>
Date: 2016-05-31 15:40:41
Message-ID: 143762833.1361291464709241419.JavaMail.httpd () webmail-05 ! iol ! local
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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?
[Attachment #5 (text/html)]
<div></div>I have two file <div>one is calles form.py</div><div>and it \
starts </div><div><br></div><div><div>from PyQt5.QtCore import pyqtSlot, pyqtSignal, \
QObject</div><div>from PyQt5.QtWidgets import QWidget, QFileDialog</div><div>from \
PyQt5.QtSql import QSqlDatabase</div><div>from PyQt5.QtSql import QSqlTableModel</div><div>from \
PyQt5.QtSql import QSqlQuery</div><div>from PyQt5.QtSql import QSqlRecord</div><div>from \
PyQt5.QtCore import Qt</div><div>from PyQt5.QtWidgets import QWidget</div><div>from PyQt5 \
import QtWidgets</div><div>from PyQt5 import QtCore</div><div>from form_ricerca import \
Form_Ricerca, Segnale</div><div>from Ui_form import Ui_Form<br></div><div><br></div><div>class \
Form(QWidget, Ui_Form):</div><div> """</div><div> Class documentation \
goes here.</div><div> """</div><div> def __init__(self, \
parent=None):</div><div> """</div><div> \
Constructor</div><div> </div><div> \
@param parent reference to the parent widget (QWidget)</div><div> \
"""</div><div> #QObject.__init__(self, parent)</div><div> \
self.fr = Form_Ricerca()</div><div> self.sp = \
Segnale()</div><div> super(Form, \
self).__init__(parent)</div><div> \
self.sp.seleziono.connect(self.selezionato)</div><div> \
self.setupUi(self)</div><div> </div><div> \
</div><div> </div><div> def \
selezionato(self):</div><div> luca = 0</div><div> \
print('selezionato'+str(luca))</div></div><div><br></div><div>and the other \
called form_ricerca</div><div><br></div><div><div>from PyQt5.QtCore import pyqtSlot, \
QModelIndex, pyqtSignal, QObject</div><div>from PyQt5.QtWidgets import QWidget</div><div>from \
PyQt5 import QtCore</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>from \
Ui_form_ricerca import Ui_Form</div><div><br></div><div><br></div><div>class \
Form_Ricerca(QWidget, Ui_Form):</div><div> """</div><div> Class \
documentation goes here.</div><div> """</div><div> def __init__(self, \
parent=None):</div><div> """</div><div> \
Constructor</div><div> </div><div> \
@param parent reference to the parent widget (QWidget)</div><div> \
"""</div><div> self.sg = Segnale()</div><div> \
super(Form_Ricerca, self).__init__(parent)</div><div> \
self.sg.seleziono.connect(self.selezionato)</div><div> \
self.setupUi(self)</div><div> </div><div> \
<br></div><div> def selezionato(self, id):</div><div> \
print('beccato)'+str(id))</div></div><div><br></div><div><div>class \
Segnale(QObject):</div><div> \
</div><div> seleziono = pyqtSignal(str)</div><div> \
</div><div> def emetto(self, id):</div><div> \
#self.seleziono.connect(self.connetto)</div><div> \
self.seleziono.emit(str(id))</div><div> print('Emesso: \
'+str(id))</div></div><div><br></div><div>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?</div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic