resize mdiArea with Mainwindow
-
Is the mdiArea empty ?
-
If empty means, that ther is no mdi window inside, then yes.
the program should start with an empty full screen mid area and then all needed windows should be chosen with the menu
-
Can you show your MainWindow constructor ?
-
Als elements has been created with the designer
This is my Mainwindow.ccp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QApplication> #include <QMdiSubWindow> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //showMaximized(); showFullScreen(); setCentralWidget(ui->mdiArea); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_actionBeenden_triggered() { QApplication::quit(); }
and this is the Mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT void createChild(); public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_actionBeenden_triggered(); void on_actionFader_triggered(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
[edit: Fixed coding tags, use three backticks SGaist]
-
In that case, why don't you put the mdiArea directly as central widget with designer ?
-
I have the auto created QWidget , auto named central widget.
For this i have selected vertical layout.Below the QWidget i have the mdiArea.
How can i change this ?
Or is that correct ? -
Add mdiArea to the vertical layout and you should be good to go.
-
I think that is what i done, but it still desn't work
-
So what you want is to put all layout margins at 0 so your mdiArea widget will take the whole place
-
I have done that, but the mdi area still does not scale out
-
The question is going to be silly but did you just put it over the QMainWindow or did you explicitly clicked the layout vertically menu entry ?
-
i clicked the vertical layout manualy on the central widget.
Also i cant put the mdi area over it. -
What do you mean by you can't put the mdi area over it ?
-
I thougt i could mabey drag'n drop it
Here are all stepps i have done
Create Project with Widget
Created a mdiArea with designer
try to resize with code -
QWidget or QMainWindow ? In any case, you only need to put the QMdiArea in a layout on the widget
-
Its a QT Widged Application
So i think it auto creates a MainWindow ??
I set the layout to vertical (see pictures in last postes)
-
MainWindow can be a QMainWindow or a QWidget depending on what parameter you choose