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. QDockWidget doesn't resize after add widget
Forum Updated to NodeBB v4.3 + New Features

QDockWidget doesn't resize after add widget

Scheduled Pinned Locked Moved Solved General and Desktop
qdockwidgetresize
7 Posts 3 Posters 3.9k 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.
  • G Offline
    G Offline
    Gianluca86
    wrote on 29 Jun 2017, 08:15 last edited by
    #1

    Hi everyone,
    I'm using a QDockWidget in MainWindow. When I insert a widget (in my case a table) into the dock, it does not expand with the widget, but it expands to a fixed size and then the scrollbar appears.
    However, if the widget is smaller than this initial fixed size, the Dock fits.
    But I didn't set any minimum or maximum size.
    Here is the dock code:

    QDockWidget *pPropertyDock = new QDockWidget(this);
    pPropertyDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    pPropertyDock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
    pPropertyDock->setWindowTitle(DOCK_TITLE);
    pPropertyDock->setObjectName(DOCK_OBJECTNAME);
    addDockWidget(Qt::RightDockWidgetArea, pPropertyDock);
    

    According to what the documentation says, the Dock should be adapted to the child widget.
    I do not understand where this maximal initial width comes from.
    Anyway I can extend it by hand, but I would like to extend in automatic.

    I hope I explained myself

    Thank you

    J 1 Reply Last reply 29 Jun 2017, 08:42
    0
    • G Gianluca86
      29 Jun 2017, 08:15

      Hi everyone,
      I'm using a QDockWidget in MainWindow. When I insert a widget (in my case a table) into the dock, it does not expand with the widget, but it expands to a fixed size and then the scrollbar appears.
      However, if the widget is smaller than this initial fixed size, the Dock fits.
      But I didn't set any minimum or maximum size.
      Here is the dock code:

      QDockWidget *pPropertyDock = new QDockWidget(this);
      pPropertyDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
      pPropertyDock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
      pPropertyDock->setWindowTitle(DOCK_TITLE);
      pPropertyDock->setObjectName(DOCK_OBJECTNAME);
      addDockWidget(Qt::RightDockWidgetArea, pPropertyDock);
      

      According to what the documentation says, the Dock should be adapted to the child widget.
      I do not understand where this maximal initial width comes from.
      Anyway I can extend it by hand, but I would like to extend in automatic.

      I hope I explained myself

      Thank you

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 29 Jun 2017, 08:42 last edited by
      #2

      @Gianluca86 Is your dock widget in a layout?

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

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gianluca86
        wrote on 29 Jun 2017, 09:12 last edited by
        #3

        I hope not to misunderstand the question, but anyway no, I created the Dock inside the Mainwindow (addDockWidget (Qt :: RightDockWidgetArea, pPropertyDock)), while in the mainWindow centralWidget there is another widget.
        To insert the table into the Dock I simply used the command "setWidget" of QDockWidget.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gianluca86
          wrote on 29 Jun 2017, 12:35 last edited by
          #4

          For more information:
          the "Dock Widgets Example" show the problem.

          M 1 Reply Last reply 29 Jun 2017, 17:04
          0
          • G Gianluca86
            29 Jun 2017, 12:35

            For more information:
            the "Dock Widgets Example" show the problem.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 29 Jun 2017, 17:04 last edited by
            #5

            @Gianluca86

            Hi
            Im not sure i understand.
            alt text

            So the issue is that the dock is smaller than the QListWidget?

            The dock seems to have the size from the area allocated when created.
            Since there it no way it can adjust the splitter or the mainwindow size, how would it grow to fit the widget?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gianluca86
              wrote on 30 Jun 2017, 06:40 last edited by
              #6

              So there is no way to adjust the area where the dock is allocated?
              Can you do it only by hand?

              M 1 Reply Last reply 30 Jun 2017, 07:33
              0
              • G Gianluca86
                30 Jun 2017, 06:40

                So there is no way to adjust the area where the dock is allocated?
                Can you do it only by hand?

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 30 Jun 2017, 07:33 last edited by
                #7

                @Gianluca86
                You can make main window bigger and move the splitter. then
                it should be bigger.

                1 Reply Last reply
                1

                1/7

                29 Jun 2017, 08:15

                • Login

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