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 resize handle moves only in one direction
Qt 6.11 is out! See what's new in the release blog

QDockWidget resize handle moves only in one direction

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.5k 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.
  • S Offline
    S Offline
    SamerAfach
    wrote on last edited by
    #1

    I'm developing an program with plugins, so I need QDockWidget. I'm not setting any size policies or anything, and I'm having some asymmetric behavior. The following is how my window looks like:
    alt text

    What I wanna achieve: make the log view smaller (at least by hand, by dragging the slider).

    If I put my mouse on the area between the Log view and the two upper widgets, I can move only in 1 direction, which is up. Another even weirder way to demonstrate the problem is if I right-click between the dock widgets and uncheck "Log view" (where the dock widgets interface creates a menu with checkboxes automatically), and then check it again, the Log view widget appears again, but with a different size (depending on the position of the mouse), and possibly smaller. Now I take the slider again, and move it up, and then, again, I can't move it down anymore!!!

    The following is my code for creating the Widget:

    QDockWidget *MainWindow::createDockWidget(QString windowName,
                                               QWidget *innerWidget,
                                               Qt::DockWidgetArea area) {
      QDockWidget *dock = new QDockWidget(windowName, this);
      dock->setWidget(innerWidget);
      addDockWidget(area, dock);
      dock->setAllowedAreas(Qt::AllDockWidgetAreas);
      return dock;
    }
    

    where this is a helper function, and this is how I call it:

    modelTreeWidget = new ModelsTreeWidget;
    
    modelsDock = createDockWidget(tr("Models tree"), modelTreeWidget,
                                    Qt::LeftDockWidgetArea);
    propertiesDock = createDockWidget(tr("Properties view"), new PropertiesWidget,
                                        Qt::RightDockWidgetArea);
    auto loggerWidget = new LoggerWidget;
    logDock =
    createDockWidget(tr("Log view"), loggerWidget, Qt::BottomDockWidgetArea);
    

    I'm using Qt 5.7.1 on Debian Stretch.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Does the behaviour change if you set a central widget? i.e. call setCentralWidget(new QWidget(this));

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • S Offline
        S Offline
        SamerAfach
        wrote on last edited by
        #3

        @VRonin Thank you, that works. Is this the only way to go? what if I want all the QDockWidgets to fill the screen?

        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