How to add a QWidget to a QDockWidget so that my widget has a decent width



  • I've created a component in the UI designer and I'm adding it in a QDockWidget on the right side of my main window. Unfortunately, the docked widget is initially being displayed so that it is only about 70 pixels wide. This is fairly narrow, and while I would like users to be able to squeeze it like this if they wish (there is no min width), for an initial display this is fairly narrow. Is there any way to give my UI component a preferred width that the QDockWidget will use?


  • Qt Champions 2017

    Hi
    It seems dock will use SizeHint from a Widget however, i had to subclass to override it.
    I was wondering if you could use
    http://doc.qt.io/qt-5/qmainwindow.html#resizeDocks
    to set a good size as this allows user to make it smaller if wanted.
    (unlike minimum size)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.