Docking



  • This is a fairly common problem - I have found work arounds in some cases but no real answers.

    I have an application requiring all dockable windows - the central widget is assigned to 0. I need this because it is a 3D modeling program and needs to allow users with multiple screens to be able to undock the 3d display or any of the tool panels and set them on any of their monitors ie - the 3d display should be fullscreen-able on one of their monitors.

    Everything is fine - I assigned all the docks to a single dockable area - (LeftDockWidgetArea).. And I can roughly control where the windows are docked on startup by choosing the order I add them and using the Qt::Horizontal or Qt::Vertical flags..

    My Question is.. I am trying to create different layout options the user can select if they lose some windows and want to reset the UI.. The first pic shows what I want..

    !http://i994.photobucket.com/albums/af66/dreamincolorstudios/p2_zpsb1173cd6.png(Pic1)!

    And here is the closest I can get

    !http://i994.photobucket.com/albums/af66/dreamincolorstudios/p1_zps89869b22.png(pic2)!

    My code for the layout is the following
    @ addDockWidget(Qt::RightDockWidgetArea, mUI.mSceneDock, Qt::Horizontal);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mResourceDock, Qt::Vertical);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mMapViewDock,Qt::Horizontal);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mPropertiesDock, Qt::Horizontal);@

    If I move the map view dock to the first add position.. the resource dock is added below both the map view dock and the scene view dock

    Is there an easier way to position these docks where I want for different layouts? This type of positioning is so tedious and hard to get what I want



  • Hi,

    bq. Is there an easier way to position these docks where I want for different layouts? This type of positioning is so tedious and hard to get what I want

    did you try "QMainWindow::splitDockWidget()":http://qt-project.org/doc/qt-4.8/qmainwindow.html#splitDockWidget ?



  • That worked - way simpler than I thought I can't believe I never saw the splitDockWidget function - I was searching through the MainWindow documentation and skipped right over it I guess.. Thanks a bunch!

    For anyone who might want to know - the following code got me the correct results shown in the first posted pic

    @ addDockWidget(Qt::RightDockWidgetArea, mUI.mMapViewDock, Qt::Horizontal);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mSceneDock, Qt::Horizontal);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mResourceDock, Qt::Horizontal);
    addDockWidget(Qt::RightDockWidgetArea, mUI.mPropertiesDock, Qt::Horizontal);
    splitDockWidget(mUI.mSceneDock, mUI.mResourceDock, Qt::Vertical);@

    very simple


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.