[Qt-interest] Normalized Signatures and Signaling....

Castagne Nicolas nicolascastagne at yahoo.fr
Thu Dec 3 17:26:08 CET 2009


Hi Ben,

Perhaps dynamic signal declaration in the meta object is not necessary.

If your number of possible types of "QPair<value1,value2>", hence your number of specific signal-slot connection, are countable, perhaps you could declare a predifined pool of signals with the same signature but with different names, then connect and use these signals when needed ?

Something like
class MyClass ... {
signals:

  signal1(QPair ...);

  signal2(QPair ...);

  signal3(QPair ...);

  signal4(QPair ...);
  ...
}


This class would filter the pair before emiting, then choose an already-used-and-connected signal, or pick a new signal in the pool amont those that are not been used yet, connect it, and emit it, if the 'actual type' of QPair to process has not been encountered yet.

You would then have to monitor the signal of the pool that have already been used and connected...

Best-
Nicolas

--- En date de : Jeu 3.12.09, BRM <bm_witness at yahoo.com> a écrit :

De: BRM <bm_witness at yahoo.com>
Objet: Re: [Qt-interest] Normalized Signatures and Signaling....
À: qt-interest at trolltech.com
Date: Jeudi 3 Décembre 2009, 16h43

Thanks.

Yes I am aware of signals->signals - I do it quite a bit.

My problem is that I have one signal generating data (from one thread) that needs to go do disparate sources (one pair type per thread pool), and I don't necessarily know all those pair types at compile time. (By "pair type" I am referring to basically something like QPair<value1,value2> or a similar structure that makes a key for the dynamic signal.)

So I basically need truly dynamic signals at run-time. If there's something built-in, great - but I haven't found anything other than an article in Qt Quarterly issue #16 (2005 #4) on the subject.

My choice is either having each slot filter the data (and thus pass around a lot of data in the signal/slot mechanism and event message queues between the threads), or to implement
a dynamic signal method, and then have data only going where it needs to go.. The dynamic signals are, for me, a better option.

Ben



----- Original Message ----
From: Ian Thomson <Ian.Thomson at iongeo.com>
To: qt-interest at trolltech.com
Sent: Thu, December 3, 2009 10:08:00 AM
Subject: Re: [Qt-interest] Normalized Signatures and Signaling....

BRM wrote:
> where did the '2' come from???

I believe the SIGNAL and SLOT macros add digits to the start.

Besides that, are you aware you can connect signals together? In fact 
you can connect QSignalMapper up to other signals.

Cheers,
Ian.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091203/3e0545ce/attachment.html 


More information about the Qt-interest-old mailing list