Hi, probably this question was discussed before, but I do not find the answer in the forum archive...
Short: I need to access the parent Widget scope from a child widget...
The code I use is the follow, in the child widget :
{
this->myMainForm = qobject_cast<MainForm *>(widget);
if(this->myMainForm)
{
break;
}
}
this->myMainForm->parentivar;
foreach (QWidget *widget, QApplication::topLevelWidgets())
{
this->myMainForm = qobject_cast<MainForm *>(widget);
if(this->myMainForm)
{
break;
}
}
this->myMainForm->parentivar;
To copy to clipboard, switch view to plain text mode
The code works, but is it the correct and best approach to access a parent widget ivar, from a child widget ?
Thank you in advance for the answer.
Bookmarks