Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

What is the differerece in MDI code?



  • Here is "main window" defined in MDI example

    MainWindow::MainWindow()
    : mdiArea(new QMdiArea)

    after mainWindow is defined in "main"
    ( Can somebody give non English speaking native VERBAL explanation of the above syntax? PLEASE )

    Here is same in QMDIAreaClass

    QMainWindow *mainWindow = new QMainWindow;
    mainWindow->setCentralWidget(mdiArea); 
    

    It looks as a standard MDI example is not build using QMainWindow which would make better usage of Qt. .


  • Moderators

    @AnneRanch said in What is the differerece in MDI code?:

    Here is "main window" defined in MDI example

    MainWindow::MainWindow()
    : mdiArea(new QMdiArea)

    after mainWindow is defined in "main"
    ( Can somebody give non English speaking native VERBAL explanation of the above syntax? PLEASE )

    Can you link to the example?

    Explanation: Main window constructor creates a new QMdiArea and assigns it to mdiArea member variable.

    Btw. looks like call to parent class constructor is missing.

    Here is same in QMDIAreaClass

    QMainWindow *mainWindow = new QMainWindow;
    mainWindow->setCentralWidget(mdiArea); 
    

    It looks as a standard MDI example is not build using QMainWindow which would make better usage of Qt. .

    I guess the purpose of MDI example is to show off QMdiArea and not QMainWindow, perhaps that's the reason. I have not looked at the code though.



  • @sierdzio

    https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/mainwindows/mdi?h=5.15\

    Reason I asked - it looks as QMainWindow does what the MDI example - use "MDI area" directly - thus could be "bypassing " the application "standard" . Which seems more logical.

    But you are correct - the examples are mostly for specific purpose and the "standard " application -> main window prevails in them. Nothing wrong with that.

    I like the examples, but lack of comments and explanations why it is coded that particular way sure makes for more traffic here .

    I am basically stuck trying to change the MDI "actions" example "default" sub-window to plain widget.


  • Moderators

    @AnneRanch said in What is the differerece in MDI code?:

    I like the examples, but lack of comments and explanations why it is coded that particular way sure makes for more traffic here .

    Oh yes, I fully agree.


Log in to reply