Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. resize mdiArea with Mainwindow
QtWS25 Last Chance

resize mdiArea with Mainwindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
resizemdiareamain windowwidget
24 Posts 2 Posters 12.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    freevrs
    wrote on 2 Nov 2015, 16:06 last edited by
    #1

    I have a Main Window with an top dock.
    In design mode i added an mdiArea.

    on main.cpp i maximize my windown with : w.showFullScreen();

    I now want the mdiArea to be also fullscreen under the top dock.

    I tried lots of different solutions, but i dont get the mdiArea to scale with the size of the mainwindow

    --sorry for my crappy english

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Nov 2015, 23:05 last edited by SGaist 11 Feb 2015, 23:05
      #2

      Hi and welcome to devnet,

      Did you set your mdiArea as central widget of QMainWindow ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      F 1 Reply Last reply 2 Nov 2015, 23:52
      0
      • S SGaist
        2 Nov 2015, 23:05

        Hi and welcome to devnet,

        Did you set your mdiArea as central widget of QMainWindow ?

        F Offline
        F Offline
        freevrs
        wrote on 2 Nov 2015, 23:52 last edited by
        #3

        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]

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Nov 2015, 23:55 last edited by
          #4

          Why are you setting it like this ? You should do it directly in MainWindow's constructor

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            freevrs
            wrote on 3 Nov 2015, 00:02 last edited by
            #5

            Because i'm new to QT and don't now how to do it proper.

            Could you give me an example on how to do this ?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Nov 2015, 00:20 last edited by
              #6

              Just take a look at QMainWindow's documentation and the MainWindow Application Example

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • F Offline
                F Offline
                freevrs
                wrote on 3 Nov 2015, 00:34 last edited by
                #7

                I took a look on the documentation and now set everythin up correct, but i still dont get the mdiarea scaled out

                link text

                The program now is fullscreen.
                But i want it to be the same size as the Programm.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 3 Nov 2015, 21:27 last edited by
                  #8

                  Is the mdiArea empty ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    freevrs
                    wrote on 3 Nov 2015, 22:30 last edited by
                    #9

                    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

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 3 Nov 2015, 22:30 last edited by
                      #10

                      Can you show your MainWindow constructor ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        freevrs
                        wrote on 3 Nov 2015, 22:42 last edited by SGaist 11 Mar 2015, 22:45
                        #11

                        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]

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 3 Nov 2015, 22:46 last edited by
                          #12

                          In that case, why don't you put the mdiArea directly as central widget with designer ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • F Offline
                            F Offline
                            freevrs
                            wrote on 3 Nov 2015, 23:06 last edited by
                            #13

                            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 ?

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 3 Nov 2015, 23:19 last edited by
                              #14

                              Add mdiArea to the vertical layout and you should be good to go.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • F Offline
                                F Offline
                                freevrs
                                wrote on 3 Nov 2015, 23:22 last edited by
                                #15

                                I think that is what i done, but it still desn't work

                                screenshot

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 4 Nov 2015, 21:07 last edited by
                                  #16

                                  So what you want is to put all layout margins at 0 so your mdiArea widget will take the whole place

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • F Offline
                                    F Offline
                                    freevrs
                                    wrote on 5 Nov 2015, 00:01 last edited by
                                    #17

                                    I have done that, but the mdi area still does not scale out

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on 5 Nov 2015, 21:12 last edited by
                                      #18

                                      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 ?

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • F Offline
                                        F Offline
                                        freevrs
                                        wrote on 8 Nov 2015, 02:15 last edited by
                                        #19

                                        i clicked the vertical layout manualy on the central widget.
                                        Also i cant put the mdi area over it.

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on 8 Nov 2015, 21:19 last edited by
                                          #20

                                          What do you mean by you can't put the mdi area over it ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          1 Reply Last reply
                                          0

                                          6/24

                                          3 Nov 2015, 00:20

                                          18 unread
                                          • Login

                                          • Login or register to search.
                                          6 out of 24
                                          • First post
                                            6/24
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved