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. Item visibylity in a ListView
Forum Updated to NodeBB v4.3 + New Features

Item visibylity in a ListView

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.0k 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
    MaxL
    wrote on last edited by
    #1

    Hi everyone,

    When using a ListView, items that are not supposed to be displayed ( out of the ListView area ) are still visible if the listview is on top of everything else ( qml elements ).

    Here is a little bit of code to understand the issue ( not all parameters are set, it is just for understanding ) :
    @
    Item
    {
    id: mainWindows
    width: 200
    height: 800
    Rectangle
    {
    id: listViewHolder
    width: parent.width * 0.9
    height: parent.height * 0.9
    color: "white"
    ListView
    {
    id: myListView
    width: parent.width - 10
    height: parent.height - 10
    model: aModel
    delegate: aDelegate
    }
    }
    DropShadow
    {
    anchors.fill: listViewHolder
    source: listViewHolder
    color: "black"
    }
    }
    @

    What happens is that when I have more items to display ( in height ) than the list view can contains, they are visible in the listViewHolder and in the mainWindow. It messes up the DropShadow and it really ugly to watch.
    Is there any way to tell the list view to make those items disappear or do I have to handle this myself in the delegate ?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      you should set "clip: true" in your ListView or Rectangle (that is a property of the Item base object, check out the doc) :)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MaxL
        wrote on last edited by
        #3

        Thanks it works..I knew about that property but never thought of using it..

        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