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. how to set QDockWidget location
Forum Updated to NodeBB v4.3 + New Features

how to set QDockWidget location

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 581 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Daniil S.
    wrote on last edited by
    #1

    Hello everyone, can someone tell me if it possible to place dockwidget like on pic
    ceba76e0-382f-48bb-bfd9-13dadad84561-image.png

    1. control panel can be placed on the left or right side, but it must be up to the bottom
    2. work panel can be placed under the central widget or above, or floatable

    now i have the code:

    control panel:

    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    setFeatures(features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetFloatable);
    

    work panel :

    setAllowedAreas(Qt::BottomDockWidgetArea);
    setFeatures(features() ^ QDockWidget::DockWidgetClosable);
    

    and mainwindow:

    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    
    addDockWidget(Qt::BottomDockWidgetArea, work_panel);
    addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, control_panel, Qt::Vertical);
    

    and its dont work, any ideas?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, no.

      You might want to check KDAB's KDDockWidgets.

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

      D 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        AFAIK, no.

        You might want to check KDAB's KDDockWidgets.

        D Offline
        D Offline
        Daniil S.
        wrote on last edited by Daniil S.
        #3

        @SGaist code above works with minor changes, but only in the mingw 5.15.2 x32 compiler
        changes:
        control panel:

        //setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); all areas 
        setFeatures(features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetFloatable);
        

        of course it work not fully right, control panel can placed at any corner, but i think i can connect to QDockWidget::dockLocationChanged and place it like i need after drag

        1 Reply Last reply
        0

        • Login

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