PDA

View Full Version : QMdiSubWindow problem with resized window



estanisgeyer
7th January 2008, 13:40
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:


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

marcel
7th January 2008, 14:08
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

estanisgeyer
7th January 2008, 14:39
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:



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->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
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.