[Solved] ListView inside a Widget inside a DockWidget - how to make the listview fill the space?



  • I have a DockWidget, containing a Widget, containing a ListView.

    I want the ListView to fill the space. At the moment, it has a border at the side and at the bottom (the top has the DockWidget's windowTitle, which is fine).

    I tried breaking the layout of the Widget and Listview, but that semed to relegate the Listview to occupy only a small portion of the DockWindow. How do I make the ListView fill all the space at the sides of the DockWidget? I have been fiddling with settings in the GUI designer of QT Creator; setting borders to zero and all that sort of thing, but whatever the lucky combination is, I can't find it/



  • Try to use Layout > Layout in a Grid on listview.


  • Lifetime Qt Champion

    Hi,

    You can use QLayout's setSpacing and setMargins and set them to 0, then you should have your QListView using as much space it can.

    Unless you need that additional widget to hold other things, you could also set your QListView directly on the doc.

    Hope it helps



  • Perfect, thanks; prompted by talk of QLayout, I found the Layout options at the bottom of the property editor for the middle widget, and some numbers I could set to zero.


Log in to reply
 

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