Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ListView: Auto width based on content width
Forum Updated to NodeBB v4.3 + New Features

ListView: Auto width based on content width

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 608 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.
  • mistralegnaM Offline
    mistralegnaM Offline
    mistralegna
    wrote on last edited by
    #1

    Hello,

    I am using a list view to represent a set of elements. These elements are added once the list view component has been completed. The list view has a delegate that is a RowLayout with two items inside: one Text and one ToolButton. These RowsLayout's don't have a fixed width, neither a fixed height. Consequently, I'd like to not have to hardcode a "width" properties in my ListView element.

    So I did this:

    ListView {
                height: parent.height
                implicitWidth: contentItem.childrenRect.width
                id: listView
    }
    

    But even doing this, I have the feeling the width is wrongly computed (cause of the position of my scrollbar that is not just on the right of my list view, but far far away, as if it was the scroll bar of my entire application).

    Thank you to anyone who has the answer to this problem!

    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