QMdiSubWindow problem with resized window
Hi friends,
I'm developing an application in MDI. I have a window in the designer developed with properties in height and width fixed, but to put in a QMdiSubWindow, these properties are lost and the window can be resized. Indeed there should not appear maximize the button and much less allow resizing. How to fix this?
Here this partial code:
Code:
template<class T> T *MainWindow::createT(T *win)
{
win = new T();
QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
mdiSubWin->setWidget(win);
mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
mdiArea->addSubWindow(mdiSubWin);
mdiSubWin->show();
// mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
}
Thanks help,
Marcelo Estanislau
Standard Net Tecnologia
Brazil - RS
Re: QMdiSubWindow problem with resized window
You have to set the fixed size for the mdiSubWin(which is the container). Even if the child has a fixed size, nobody stops the parent from resizing.
Regards
1 Attachment(s)
Re: QMdiSubWindow problem with resized window
Hi again,
Ok, I wrote the code in this function based on the size of my window, see in the picture what happened in attach. This is the code changed:
Code:
template<class T> T *MainWindow::createT(T *win)
{
win = new T();
QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
mdiSubWin->setWidget(win);
mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
mdiArea->addSubWindow(mdiSubWin);
mdiSubWin->show();
mdiSubWin->setGeometry(0,0,450,300);
mdiSubWin->setMinimumSize(450,300);
mdiSubWin->setMaximumSize(450,300);
//mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
}
We still can maximize the window, giving a double-click the title bar or clicking on the maximize button. Well there might be a resource for the QMdiSubWindow inherit the properties.