hello.
I have implemented a CViewBase class (is a sort of interface):
Qt Code:
  1. class CViewBase
  2. {
  3. public:
  4. CViewBase(void) ;
  5. virtual ~CViewBase(void){};
  6. virtual void GetActions(int& n){}
  7. };
  8. typedef std::shared_ptr<CViewBase*> ptrViewBase;
  9.  
  10. }
To copy to clipboard, switch view to plain text mode 
GetActions(int& n) set an int , but in the future must contains a custom struct with some custom data.

Qt Code:
  1. class CGlWidgetImage : public QGLWidget, public CViewBase
  2. {
  3. .
  4. .
  5. void GetActions(int & n){/*implementation*/};
To copy to clipboard, switch view to plain text mode 
now, the problem is that:
this works:
Qt Code:
  1. int n;
  2. ptrGlWidgetImage ptrGlWidgetImage = std::shared_ptr<CGlWidgetImage>( new CGlWidgetImage(ptrFactory, ptrQModel, ptrModelG, ptrController, format)) ;
  3. ((CViewBase*)ptrGlWidgetImage.get())->GetActions(n);
To copy to clipboard, switch view to plain text mode 

but this no!:
Qt Code:
  1. int n;
  2. QMdiSubWindow* pSub = new QMdiSubWindow();
  3. pSub->setWidget(ptrGlWidgetImage.get());
  4. ((CViewBase*)pSub->widget())->GetActions(n);//does nothing and not enter in //function GetActions
To copy to clipboard, switch view to plain text mode 

there is in qt a sort of tag property that can contains all type of data?
Then i can setting the data in this property.
or there is another solution?
I wish use the polymorphism because i can have many ptrGlWidgetImage each with his custom actions(commands objects)data hardcoded .
When implements a new "CGlWidgetImage" , i setting his properties in code and implements a GetActions that returns the current widget's Actions(that are show in the toolbar.)
I do this because i have an mdi application and each subwindow can contains a custom different widget, next on the subWindowActivated event i can get all actions of the current widget with a simple GetActions() and modify the toolbar.

Qt Code:
  1. void CMainDiag::subWindowActivated(QMdiSubWindow* pWin)
  2. {
  3. ((CViewBase*)pWin->widget())->GetActions(n);//now don't works
  4.  
  5. }
To copy to clipboard, switch view to plain text mode 

thanks