Implementing pointers to methods
Hi, I would like to write a function that pops up a dialog to allow the user to edit a certain variable. I would like the dialog to be able to make a call back to the original class (or any specified class) to notify that the value changed.
So now I have to define something like this:
- typedef void (QObject::*NotifyEvent)();
And pass two extra parameters to my function: one for the method and one for the class. This seems a bit cumbersome, plus I’m now worried about inheritance problems, because what if the specified class is not simply a QObject?
So I was wondering perhaps there are some standard Qt way of doing this sorta thing? Perhaps some defined types so that I don’t have to reinvent?
Any help would be appreciated!
I wasn’t certain if signals & slots could be used in this way but it turns out it works beautifully.
Somehow slots can be communicated as regular character strings and I don’t know how it REALLY works but they can passed on as a parameter this way to be connected to elsewhere and that’s all I really care about :)
I’m really starting to like Qt :D