The way you've connected the slot and the signal is the way you would do it in C++, which is not the same way it's done in pyside.
In an articel over at Zetcode, there's sample code of this exact program:
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
lcd = QtGui.QLCDNumber(self)
sld = QtGui.QSlider(QtCore.Qt.Horizontal, self)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(lcd)
vbox.addWidget(sld)
self.setLayout(vbox)
sld.valueChanged.connect(lcd.display)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Signal & slot')
self.show()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
This shows not only how the entire program should be written (I assume this is what you're aiming for), but also the way you connect signals and slots in PySide.
So instead of the C++ way:
self.connect(self.pushButton, SIGNAL("clicked()"),self.lcdNumber.display(self.lineEdit.text()))
You should have:
sld.valueChanged.connect(lcd.display)
Or in your case:
sld.valueChanged.connect(self.lineEdit.setText())
Also notice that I wrote "setText()" instead of just "text()" as "text()" returns the current text, where "setText()" changes it.
After re-reading the question, here's the snippet that'll make it work:
class MainDialog (QDialog, MultiTool_widget_ui.Ui_Form):
def __init__(self):
#super(MainDialog, self).__init__() OR <next line>
QDialog.__init__(self)
self.setupUi(self)
self.btn = QPushButton("Click ME!")
self.le = QLineEdit(self)
self.lcd = QLCDDisplay(self)
btn.clicked.connect(self.onBtnClicked)
vbox = QVBoxLayout(self)
vbox.addWidget(self.btn)
vbox.addWidget(self.le)
vbox.addWidget(self.lcd)
self.setLayout(vbox)
def onBtnClicked():
self.lcd.display(self.le.text(())
I hope this last edit should do the trick, I am however unable to test this right now as I am typing on my phone ;)