Dear all,

I've a mainwindow M with some widgets L and a Custom-dropdown D which contains list of Fonts.
I need to set font for all the widgets in M if dropdown D is changed.
I tried to set the font which resulted in Segmentation fault.


Qt Code:
  1. void UpdateFont()
  2. {
  3. QObject *obj = this->parent();
  4. QObjectList objlistChildren = obj->children();
  5. int iCount = objlistChildren.count();
  6.  
  7. for(int iIndex = 0; iIndex < iCount; iIndex++)
  8. {
  9. QObject *temp = objlistChildren[iIndex];
  10. ( (QWidget*)objlistChildren[iIndex] )->setFont(font);
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 


How can i access the parent widgets and set its font from the child control.

Thanks in advance for your suggestions.