PDA

View Full Version : Qt Designer & Qt4, connect to my own slot.



geitosten
17th February 2007, 18:47
I'm having a problem connecting a user defined slot to my widgets created in Qt Designer.

I followed the example in the online Qt3 book (http://phptr.com/content/images/0131240722/downloads/blanchette_book.pdf) in the chapter 'rapid dialog design'. On p25 I noticed a difference between Qt Designer for Qt4 and Qt3. The Qt4 version doesn't have the code editor.

I am having difficulties connecting a widget to a slot that doesn't appear in Qt Designer. Any suggestion for a nice way of doing this (except for not using Designer) ?
It looked like it happened automatically in Qt3.

This will effectively save two files: the user interface file gotocelldialog.ui, and the C++ source file gotocelldialog.ui.h . Make the application once more and run it again.

one file generated by Qt and the other written in the code editor, integrated automatically the next time you ran (qmake and (?)) make, it seems.

(Btw I just started looking at Qt today, but I have looked through a lot of doc's and not found anything about this. I probably just don't know where to begin...)

wysota
17th February 2007, 18:56
Any suggestion for a nice way of doing this (except for not using Designer) ?
There is no way to do it within Designer. You can only use an automatic connection by naming the slot (in the implementation class) according to the on_objectname_signalname(signalparams) convention.

Alternatively look here:
http://www.qtcentre.org/forum/faq.php?faq=qt_designer_category


It looked like it happened automatically in Qt3.
I don't think anything happened automatically in Qt3...


one file generated by Qt and the other written in the code editor, integrated automatically the next time you ran (qmake and (?)) make, it seems.
Ah, you mean the ".ui.h" approach... It's not used in Qt4 anymore as it was a terrible hack to avoid using real development environments. In Qt4 Designer is only a layout editor and default signal-slot connector. Everything else has to be done by your development environment.


(Btw I just started looking at Qt today, but I have looked through a lot of doc's and not found anything about this. I probably just don't know where to begin...)

You can start here:
http://doc.trolltech.com/4.2/designer-using-a-component.html

geitosten
17th February 2007, 19:22
Thank's for a quick reply. Now I can continue spending my day doing something useful :D