[Qt-creator] Calling c++ procedure in Qt

Robin Krahl robin at rkrahl.de
Tue Apr 13 23:08:47 CEST 2010


Hi Anu!

On 13.04.2010 22:54, Anu Ramachandra wrote:
> I have a Qt application with a fileDialog. When a file is selected, I
> would like to call a c++ procedure.
> 
> The procedure is defined in a separate .cpp file which I added to the
> 'Sources' section of the Qt project.
> 
> How can the C++ procedure be called?

That’s done via signals and slots, a central Qt feature. [1] This is
very basic Qt; so I’d recommend you to read the tutorials,
documentation, help, examples, demonstrations and so on provided with Qt
and Qt Creator – they’re really great! You could e. g. start with the
Adressbook Tutorial [2]. Basically, the code would look like this:

  connect(fileDialog, SIGNAL(fileSelected(QString)),
      this, SLOT(slotFileSelected(QString)));

Furthermore, this is the Qt Creator mailing list – for general questions
on Qt (like this one), please use qt-interest. Thanks!

I hope this helps you.

Regards,
Robin

[1] http://doc.trolltech.com/4.6/signalsandslots.html
[2] http://doc.trolltech.com/4.6/tutorials-addressbook.html
-- 
Robin Krahl <robin at rkrahl.de>
http://rkrahl.de

plain text & open source ftw!



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 286 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100413/8178430d/attachment.bin 


More information about the Qt-creator-old mailing list