Qt World Summit: Submit your Presentation

QDockWidget half resizable

  • Hello,

    I have a desktop application with some dock widgets, allowed only in the top dock area.

    I want to have the height of the docks fixed, but the width resizable by the user.

    The problem is, if I set fixed height for dock widgets, and set preferred or expanding width, the separators and resizing handler disapppears for the both, and so the user can't resize horizontally.

    And it's the same result if I set preferred size policy for both width and height and I set minimum height and maximum height to the same value.

    There is a way to disable the vertical resize handler and and enable the horizontal resize handler ?

  • Lifetime Qt Champion

    Hi and welcome.
    Have you tried setting the maximum height on the widget you put in the dock?

  • Thanks.

    There is no one widget by dock. Some contains only one QLabel, and some a list of QPushButtons or QCheckBox and QRadioButtons.
    The content of each dock is managed by the appropriate layout.

    EDIT : My mistake, I can try this. A new dock widget (by QtDesigner) is automaticaly created with a containing widget (the one whitch have the layout).

  • Lifetime Qt Champion

    ok. Im not sure it will work as Docks are funky but its worth a shot

  • So I tried this : for the dock widget, the size policy is preferred and min-max sizes are default.
    And for the widget inside the dock (containing the layout and the other widgets), I let preferred also, but setted the maximum height and minimum height to the same desired value.

    Result : the same. There is no resizing handler even horizontaly.

  • Lifetime Qt Champion

    Hmm. yes. seems only to respect setMaximumHeight
    when floating (window)

  • So, I cheated.

    I set the max height to 180 pix and the min height to 179.
    The vertical resize handler is still here, but a so little resize not affect the design of my window, and I can resize horizontaly as I want.