[Qt-interest] Uncloseable QMdiSubWindow?

Zeljko zeljko at holobit.net
Wed May 19 09:03:56 CEST 2010


Malyushytsky, Alex wrote:

> It looks like if addSubWindow adds widget which is QMdiSubWindow, the
> flags are overridden or ignored. I would consider this a bug, but
> fortunately there is simple work around. All you need is to change the
> flags after addSubwindow is called as below:
> 
>    QMdiSubWindow *child = new QMdiSubWindow();
>    mdiArea->addSubWindow(child, Qt::CustomizeWindowHint
>    |Qt::WindowTitleHint| Qt::WindowMinMaxButtonsHint );
> 
> // without line below X button is still shown
>    child->setWindowFlags( Qt::CustomizeWindowHint |Qt::WindowTitleHint|
>    Qt::WindowMinMaxButtonsHint );
> // When line above is added
>    child->show();
> 
> You still might want to to handle closeEvent, but this should fix
> appearance as expected.

hm..in my case changing windowflags after adding to mdiArea shows mdi child
as mdi form but not inside mdiarea, but as other forms (qt-4.5.3)  :)



More information about the Qt-interest-old mailing list