Signal/Slot like mechanism in JUCE?

Problem description: Class WorkspaceEditor contains one instance each of StructureTree, SegmentationTree and PropertyEditor. Whenever an item is selected in structureTree or segmentationTree, propertyEditor is supposed to show editable properties of the selected item.

In Qt, you make StructureTree and SegmentationTree emit a signal whenever the user selects an item and PropertyEditor gets a slot that implements the reaction to the signal. Finally signal and slot are connected.

What is the JUCE equivalent?

My motivation for this post is to find out what is the best way to implement this kind of communication and in particular avoid a trial-and-error process that might lead to suboptimal results. Thanks!

P.S.: I know about Signals & slots in Juce but since the problem is so common, I am confident that there is an ‘official’ standard solution in JUCE.

The ‘official’ solution is to use ListenerList. If you grep through the juce codebase, you’ll find loads of examples of how to use that class.

Personally I don’t like the interface ListenerList very much, so in a new project I’d probably use something like boost::signals2, which allows slightly more concise code with less boilerplate.


Thanks, I’ll give ListenerList a try and have a brief look at boost::signals2!

Btw. (off topic alert ;-)): Are you the guy who did wayverb? I am interested in simulating RIRs of large buildings in the highest possible quality (computation time/memory requirements are almost irrelevant, maximum quality is the goal). Could I please talk to you about this (e.g. email)?

We are using Sigslot, because we don’t like boosts size. Header-only ftw!


Vielen Dank, macht einen guten Eindruck! Überraschend, dass JUCE keine eigene Signal/Slot-Implementierung an Bord hat.

Yep, I’m the Wayverb person, although that was a few years ago and I haven’t been working on reverbs recently, so I’m probably a bit rusty… the best way to reach me is probably via dm on this forum, but I don’t know whether I’ll be able to help that much, given that the original project wasn’t massively successful (there’s a page with some results that shows that the match-up between the raytraced/waveguide implementations was far from perfect)

I’m pretty excited to try this out. ListenerLists have always felt unwieldy & rigid to me.