Qt-interest Archive, March 2008
Connection Optimization
Message 1 in thread
Hi,
I'm trying to manage the connections between 96 Widgets. Depending on the configuration that the user introduces, they can behave as senders or receivers.
So I need to manage around 96 x 96 possible connections. So with my lack of knowledge about Qt development, that meant for me that I have to write 96 x 96 lines like:
connect(sender,SIGNAL(signal()),receiver,SLOT(slot()));
plus the condition lines...
So obviously Im trying to optimize this, because I got around 139,000 lines!!!!, (don't worry, I didnt write them, just copy paste and used the great tool find and replace).
What i'm trying to do is to create a QObjectList that includes my 96 Widgets and then to create a function that selects from the list the sender and the receiver like this:
void myApp::connection_manager(int index_sender, int index_receiver)
{
connect(myObject_list->at(index_sender),SIGNAL(signal()),myObject_list->at(index_receiver),SLOT(slot()));
}
but this is not working, do you think i'm on the correct way or anybody has other idea.
Other doubt would be a problem if instead of Widgets the objects in the list are Threads.
Regards
David
_________________________________________________________________
Tecnología, moda, motor, viajes,…suscríbete a nuestros boletines para estar siempre a la última
http://newsletters.msn.com/hm/maintenanceeses.asp?L=ES&C=ES&P=WCMaintenance&Brand=WL&RU=http%3a%2f%2fmail.live.com
Message 2 in thread
On Sunday 30 March 2008 12:11:13 David RodrÃguez wrote:
> So I need to manage around 96 x 96 possible connections. So with my lack of
> knowledge about Qt development, that meant for me that I have to write 96 x
> 96 lines like:
sounds like a job for QSignalMapper
> connect(myObject_list->at(index_sender),SIGNAL(signal()),myObject_list->at(
>index_receiver),SLOT(slot())); }
>
> but this is not working, do you think i'm on the correct way or anybody has
> other idea.
build your app with CONFIG+=debug. you'll see debug output on stderr. If
you're on windows use DebugView to see it.
> Other doubt would be a problem if instead of Widgets the objects in the
> list are Threads.
propably.
--
[ signature omitted ]