Hello!
Offently we create classes and instantiate objects from thoose classes in other objects of other classes (so in a Mother Object, a QMainWindow, I insert a Child Object, such as a QPushButton). Normally what is done is that in the Mother Object we work with the Child Object, using its functions. So for example:
Qt Code:
void MainWindow::useChildObject() { QPushButton pb; pb.setChecked(true); }To copy to clipboard, switch view to plain text mode
But how should I proceed if I want to use a function of the MOther Object from the Child Object? In other words, I'm there editting the .cpp of a QPushButton and in a moment I want to call a function of MainWindow from it. How should I do this?
For now I'm using the SIgnals and Slots mechanism, and this have being fine till I find that there are some times when I need to get the result of a Main Object function (a return value), what can't be done by the Signals and Slots mechanism (as far as I know).
So, how do I call a function of a Mother Object and even use its returns from a Child Object?
Thanks!
Momergil
Bookmarks