[Qt-creator] Calling c++ procedure in Qt
Anu Ramachandra
anu at molecularimprints.com
Tue Apr 13 23:38:37 CEST 2010
Hi Robin,
Thanks for the response.
I already have the connect/slot statement. I am trying to call the c++
function from the middle of the slot procedure for the fileDialog.
I will check with the qt-interest mailing list.
-Anu
-----Original Message-----
From: qt-creator-bounces at trolltech.com
[mailto:qt-creator-bounces at trolltech.com] On Behalf Of Robin Krahl
Sent: Tuesday, April 13, 2010 4:09 PM
To: qt-creator at trolltech.com
Subject: Re: [Qt-creator] Calling c++ procedure in Qt
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!
More information about the Qt-creator-old
mailing list