PDA

View Full Version : gang together properties



khusmann
27th August 2008, 23:09
Hi,

I was wondering if there was a simple way to gang properties or values together on QObjects. For example, say I have a QTabWidget with three tabs. Each tab has a class that inherits QWidget in it, and each of these custom classes has a QCheckbox. What I'd like to be able to do is make it so that all those QCheckBoxes always have the same value.

The obvious way of doing this is to set up a ton of interconnected signals and slots (which is what I have right now), except I am finding that adding new features with this setup is ugly, which is why I'm looking for an alternative.

Another idea I had was to make an object that will act as sort of the "hub" for all three separate tabs. When something in one of the tabs changes, it could also change this "property hub". When the "property hub" changes, it could then update all the other forms.

Does anyone have any clever ideas for this problem?

Kyle

PS: While I was looking into the property system, to see if I could use properties in combination with signals and slots, I noticed that the NOTIFY option is missing from the qt 4.4 documentation (but it appears in qt 4.3). Is the NOTIFY option deprecated or something?

wysota
27th August 2008, 23:14
Try this:
http://doc.trolltech.com/qq/qq08-action-multiplexer.html

It's for Qt3, but applies to Qt4 as well when you upgrade object types.

khusmann
27th August 2008, 23:23
Cool, that looks like it'll work.

Thanks!