views:

238

answers:

0

Hello I asked my question on qt centre forum, but no answer yet. Hope someone will know something about this.

I have an Mfc dialog with QWinWidget inside it. When I resize my dialog I want my QWinWidget to automatically be resized and repositioned as well. This is the code that creates the QWinWidget inside the mfc dialog :

int MyCDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

if (CDialog::OnCreate( lpCreateStruct ) == -1 )
        return -1;
win=new QWinWidget( this->m_hWnd );
    MyFrame * dialog=new MyFrame(win);   
win->move(0,0);     
win->show(); 
return 0;

}

MyFrame is derived from QFrame object. The QFrame object is made with Qt designer. QFrame has assigned layout, which suppose to do geometrical managment of QFrame child widgets.

Here is the code that executes when I drag the resizing border of my dialog :

void MyCDailog::OnSize(UINT nType,int cx,int cy)

{

    QObjectList list=win->children();
    QFrame* p=(QFrame*) list.at(0);
    p->resize(QSize(cx,cy));

}

When the dialog is resized I am calling the resize method of my frame object from OnSize, and I was expecting that after I do resize to the frame ,the frame should resize and repositon its child widgets according to their size hint and size polices. But this is not happening, at least not as it should. What I am doing wrong ?

Thanks