PyQt pass data from class

Rob Gaddi rgaddi at highlandtechnology.invalid
Tue Nov 15 12:40:40 EST 2016


luca72 wrote:

> Hello i need to this
>
> class Form(QWidget, Ui_Form):
>     """
>     Class documentation goes here.
>     """
>     def __init__(self, parent=None):
>         """
>         Constructor
>         
>         @param parent reference to the parent widget
>         @type QWidget
>         """
>         super(Form, self).__init__(parent)
>         self.setupUi(self)
>         self.tabWidget.setCurrentIndex(0)
>         combo = QComboBox()
>         self.disegno = Cornice()
>
> class Cornice(QPainter):
>     
>     def __init__(self, parent=None):
>         
>         lista_dati = []
>
> in the class Form i have a lineEdit
>
> in the class Cornice i need to write something link
>
> self.lineEdit.setText('blabla') that is in the class Form
>
> in wich way i can have access to the lineedit of class Form without event from class Cornice
>
> Many Thanks

Traditionally you'd have Cornice emit a Signal, which when you
__init__the Form you'd connect to the appropriate slot.  I don't recall
PyQt syntax, but in PySide it would look like

	self.disengo.theSignal.connect(self.lineEdit.setText)


-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list