[PyKDE] connectSlotsByName do that really works in python?

Carles Pina i Estany carles at pina.cat
Sun Dec 17 22:16:41 GMT 2006


Hi,

Some days ago (5!) Miguel Angel asked something basic about Qt4 and
auto-connecting buttons.

It seems that Miguel used only one file (bad!) and not subclassing. I
send a test that I have done now to learn to use Eric but I think that
it can help him (if he hasn't finished it :-)  )

without use eric should be:
designer-qt test.ui
pyuic -o Ui_test.py test.ui

then, hvae this file:
from Ui_test import *

class main(QtGui.QMainWindow):
        def __init__(self):
            QtGui.QDialog.__init__(self)
            self.ui = Ui_MainWindow()
            self.ui.setupUi(self)
            
        @QtCore.pyqtSignature("")
        def on_pushButton_clicked(self):
            self.ui.label.setText("hola")
    
if __name__ == "__main__":
        app=QtGui.QApplication(sys.argv)
        window=main()
        window.show()
        sys.exit(app.exec_())

This works fine. I have not looked deeply Miguel code, since I understood that
he has everything in same file... and then is bad to change the UI :-)

On Dec/13/2006, Miguel Angel Cañedo wrote:
> I have been reading about the new auto connect  of Qt, I have been trying to 
> get it workin with no success....
> Is there a specific way or place to declare th functions?
> What am i missiing?
> Here is a very simple code from pyuic4 where I simply added a def:
-- 
Carles Pina i Estany		GPG id: 0x8CBDAE64
	http://pinux.info	Manresa - Barcelona




More information about the PyQt mailing list