Qt Designer 4.4.1 Signals and Slots
hi, this is my first try with PyQt so i'm trying to get a simple app to work with 1 button and 1 textbox. I tried many ways till finally get the UI to display correctly, but now i don't know where or how to define the behaviour of the button. I got the Signal/Slot thing to work with the Exit option in the menubar, but how do i define other behaviour not present in the Signal/Slot Edition window? (i think that dissapeared after Qt Designer 3.x).
Other Questions:
1.- What to define in the subclass? Controls (button, linEdit, combobox)? or Methods (on_button_clicked)?
2.- How?? (Qobjedt.connect......??)
3.- Here is my code...the main idea is just to get some text to the textbox on button_clicked(). I've read many PyQt Documentation, the reference guide, old versions docs, etc. I guess i'm the problem :crying:.
Code:
import sys
from PyQt4.Qt import *
from ui import Ui_Main
#this is the subclass that processes idk what rlly.... :confused:
class MainWindow(QMainWindow):
def __init__(self, win_parent = None):
QMainWindow.__init__(self, win_parent)
#I don't think this on_boton_clicked it's correct, but it does work....:o
def on_Boton_clicked(self):
print "Clicked"
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
ui = Ui_Main()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
app.exec_loop()
TY in Advance.
Re: Qt Designer 4.4.1 Signals and Slots
kk, so as i was drowning in a cup of water, here is the code if ne noob like me needs it.
Code:
import sys
from PyQt4.Qt import *
#from PyQt4 import QtGui
#from PyQt4.QtCore import *
from ui import Ui_Main
def prueba():
print 'as'
ui.lineEdit.clear()
def __init__(self):
print 'asd'
def on_button_clicked(self):
print 'pega'
ui.lineEdit.paste()
def on_limpia_clicked(self):
print 'limpia'
prueba()
#ui.lineEdit.clear()
if __name__ == '__main__':
ui = Ui_Main()
window = MainWindow()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
app.exec_loop()