Hi,

I have simple "Main window" application, straight from QtCreator wizard. I added QMdiArea as a center widget.

As a first test I created new Qt Form (using wizard), which inherits from QWidget. I reimplemented sizeHint() to return some reasonable size, like 200x200.
Then I added to MainWindow's constructor few lines, so it looked like:
Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6.  
  7. Form* f = new Form(this);
  8. ui->mdiArea->addSubWindow(f);
  9. }
To copy to clipboard, switch view to plain text mode 

I've started the application and it worked as expected. There was the MDI window and I could move it, resize and maximize it.

Now, as a second test I changed Form class to inherit from QMdiSubwindow, instead of QWidget (in both *.h and *.cpp files, but the *.ui file was not changed). I also modified Form constructor, in order to respect the new container for setupUi:
Qt Code:
  1. setWidget(new QWidget(this));
  2. setAttribute(Qt::WA_DeleteOnClose);
  3. ui->setupUi(widget());
To copy to clipboard, switch view to plain text mode 
I expected that QMdiArea should accept the Form instance now just like before, because the documentation says that I can pass either QMdiSubWindow or any other QWidget to QMdiArea::addSubWindow().

This actually works pretty much okay - Form is being added to MDI area and I can move and resize it, but the problem is I cannot maximize it. When I press "maximize" button on the MDI window, the button stays pushed, never pops up and the window doesn't maximize.

What do I do wrong?