resize mdiArea with Mainwindow
-
Hi and welcome to devnet,
Did you set your mdiArea as central widget of QMainWindow ?
-
Yes i set the mdiArea as centralWidget
here is the full code of my main.cpp :
[code]
int main(int argc, char *argv[])
{
QApplication a(argc, argv);MainWindow w; w.showFullScreen(); QMdiArea *mdiArea =w.findChild<QMdiArea*>("mdiArea"); w.setCentralWidget(mdiArea); w.show(); return a.exec();
}
[/code]
-
Why are you setting it like this ? You should do it directly in MainWindow's constructor
-
Just take a look at QMainWindow's documentation and the MainWindow Application Example
-
Is the mdiArea empty ?
-
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 ?
-
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
-
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 ?
-
What do you mean by you can't put the mdi area over it ?