Important: Please read the Qt Code of Conduct -

QDockWidget - undocked - resize handle detection?

  • Hey

    How can I control at what point the handle kick in? I find it to be very tiny range at the moment & hard to get it/resize it.


  • Lifetime Qt Champion

    I think its done by the Os windows manager and not adjustable from Qt.

  • @mrjj Hmmm well thats a bummer. I could swear by changing/messing around with stylesheet I was able to somehow make it bigger sometimes... fairly strange we dont have qsizegrip here.

  • Lifetime Qt Champion

    well the various platform style can have different features.
    On windows, there is no visible handle. But on another platform there might be.

  • Lifetime Qt Champion


    Do you mean using a custom QSizeGrip ?

  • @SGaist Can do, I just want to increase the detection area around edge of widget for resizing.

  • Moderators

    @Dariusz As @mrjj said this is handled by the window manager. Dock widgets have the tool window style, which on Windows 10 means there is no distinctive line around the window, instead the actual resizing area on the left, right and bottom is the shadow, or more specifically about 2/3 of that shadow which is roughly 5 pixels wide (if you don't have any scaling enabled). That's actually quite enough and it's more than previous Windows versions used (I think XP used something like 2px wide border, although it was a solid line, not a shadow).
    There are couple of ways to make that wider if you're really determined, but all of them require some work (IMO it's not worth it):

    • On detach change the window style to something with a more distinctive border (e.g. Qt::Window, although more visible border doesn't actually mean it's wider).
    • Give the dock some margin and handle the mouse event yourself to handle the resize inside the widget.
    • Use QtWinExtras::extendFrameIntoClientArea and handle native events to make the border wider. Note that also means you'd have to paint that border with native API i.e. GDI, as Qt can't paint on window frames..

Log in to reply