Hello
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;
}
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;
}
To copy to clipboard, switch view to plain text mode
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()
{
QObjectList list=win->children();
}
void MyCDailog::OnSize()
{
QObjectList list=win->children();
QFrame* p=(QFrame*) list.at(0);
p->resize(QSize(cx,cy));
}
To copy to clipboard, switch view to plain text mode
When the dialog is resized I am calling the resize method of my frame
object, 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
Bookmarks