[Qt-interest] Signal-slot routing in a complex GUI
Justin Noel
justin at ics.com
Mon May 10 15:15:42 CEST 2010
On 05/10/2010 09:01 AM, Pavel Zdenek wrote:
> Hello Qters,
>
> i consider myself a qt apprentice, not so rookie, got some scars and
> Qt source digging behind me already. But there is one thing which i am
> most probably doing wrong: consider a moderately complex GUI
> application. The QMainWindow dependence tree has two or more fairly
> long branches, where the signal source is down in one and the target
> slot is in another. Let's say an QMdiArea with a QDockWidget. One
> branch is QDockWidget>QVBoxLayout>list of custom QWidgets>row of
> QCheckBoxes. Another branch is a
> QMdiSubWindow>QTabWidget>QGridLayout>QButton. I want to disable some
> checkboxes with a button click(). How would you do that?
>
> For me, it always resulted in tons of boilerplate signals and slots
> everywhere, which single purpose is to route the event up and down.
> It's hard to manage because of the myriad of connect() calls
> everywhere, and on the way it pollutes the container classes which do
> not care at all. Connecting signals to signals helps a little bit, but
> you just reduce the mess, not solving it.
>
> I started thinking about some sort of singleton router, which would
> act as a repository and a switchboard for any source/target which opts
> in. But given the total lack of any such existing solution (not even
> blog about needing some), i suspect it not being The Right Way (TM). I
> see DBus as way too heavy for such purposes.
>
>
Back in '04 Gregory Seidman did a presentation at Qt Conference in
Boston about a Publish/Subscribe system using Qt singals/slots using a
singleton relay object. I've used the technique a few times in my own
projects. I wish I still had the slides around. See this thread:
http://lists.trolltech.com/qt-interest/2007-09/msg00788.html
--Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100510/54d879fc/attachment.vcf
More information about the Qt-interest-old
mailing list