[Qt-interest] Using Strings instead of SIGNAL(foo())
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Wed Jan 28 21:24:08 CET 2009
Take a look at QMetaObject::invokeMethod( QObject *, char * )
The string sent it will have to be normalized using QMetaObject::normalizedSignature (gets rid of spaces etc)
That should od the trick.
Scott
From: Hari Sundar [mailto:hsundar at gmail.com]
Sent: Wednesday, January 28, 2009 12:17 PM
To: Scott Aron Bloom
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Using Strings instead of SIGNAL(foo())
Hi Scott,
Thats not what I am trying to do ... I want to take a string parameter, obtained from say the user ... and emit a Signal based on that ... i.e., normally One would make the connection like
connect( this, SIGNAL( sigMySignal( ) ), object, SLOT( slotMySlot( ) ) );
I am interested in doing it as,
connect( this, myStringSignal, object, SLOT( slotMySlot( ) ) );
and then somehow ....
emit FUNCT(myStringSignal);
I hope you understand what I want to do ?
thanks,
Hari
On Wed, Jan 28, 2009 at 2:40 PM, Scott Aron Bloom <Scott.Bloom at sabgroup.com> wrote:
Are you trying to emit a signal with a single parameter as a string?
signals:
void sigMySignal( const QString & ) ;
with a connection like:
connect( this, SIGNAL( sigMySignal( const QString & ) ), object, SLOT( slotMySlot( const QString & ) ) );
Will do the trick…
Scott
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Hari Sundar
Sent: Wednesday, January 28, 2009 9:41 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Using Strings instead of SIGNAL(foo())
Hi,
I am interested in emitting a signal based on a string ... now since SIGNAL(foo) converts the function to a string ... I should be able to manage this ... right ?
Is this possible ? How would I go about doing this ?
thanks,
Hari
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
--
1 (215) 501 7752
http://www.seas.upenn.edu/~hsundar/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090128/397f92db/attachment.html
More information about the Qt-interest-old
mailing list