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. [Solved] ListView inside a Widget inside a DockWidget - how to make the listview fill the space?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.3k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Moschops
    wrote on last edited by
    #1

    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/

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Ever
      wrote on last edited by
      #2

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

      The roots of education are bitter, but the fruit is sweet.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Moschops
          wrote on last edited by
          #4

          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.

          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