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. Adding Widgets to QDockWidget without a layout

Adding Widgets to QDockWidget without a layout

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • A Offline
    A Offline
    Andaharoo
    wrote on 4 May 2017, 02:45 last edited by Andaharoo 5 Apr 2017, 02:47
    #1

    How do you add widgets to a QDockWidget? I do it in the designer all the time but in code all I see is a setWidget function. I tried it and it only works with one widget. How can I do this without using a layout? (The default behavior you would expect if you started dragging and dropping widgets into a dock in the designer.) The designer creates a default dockWidgetContents which is a Qwidget and then has a bunch of widgets underneath it. This all seems to imply I need to somehow add widgets to another widget and then add that widget to the dock?

    J 1 Reply Last reply 4 May 2017, 04:36
    0
    • A Andaharoo
      4 May 2017, 02:45

      How do you add widgets to a QDockWidget? I do it in the designer all the time but in code all I see is a setWidget function. I tried it and it only works with one widget. How can I do this without using a layout? (The default behavior you would expect if you started dragging and dropping widgets into a dock in the designer.) The designer creates a default dockWidgetContents which is a Qwidget and then has a bunch of widgets underneath it. This all seems to imply I need to somehow add widgets to another widget and then add that widget to the dock?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 4 May 2017, 04:36 last edited by
      #2

      @Andaharoo Set the QDockWidget as parent in those other widgets and position them then manually using for example setGeometry().

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      1/2

      4 May 2017, 02:45

      • Login

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