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

Multiple QDockWidget



  • I am trying to setup several QDockWidget in the Top Dock Area but there are only layout horizontaly.

    Is there a way to layout out them vertically, one below the others?

    Here is the code used to create the 2 DockWidget:

    dock1= new QDockWidget("Data 1");
    dock2= new QDockWidget("Data 2");
    
    dock1->setWidget(fenetre_1);
    dock2->setWidget(fenetre_2);
    
    addDockWidget(Qt::TopDockWidgetArea,dock1);
    

    addDockWidget(Qt::TopDockWidgetArea,dock2);


  • Moderators

    Yes, change

    addDockWidget(Qt::TopDockWidgetArea,dock1);
    addDockWidget(Qt::TopDockWidgetArea,dock2);
    

    to

    addDockWidget(Qt::TopDockWidgetArea,dock1);
    splitDockWidget(dock1, dock2, Qt::Vertical);
    


  • Thanks Chris for this quick answer
    It's working fine now !


Log in to reply