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. Adding scroll indicators to ListView

Adding scroll indicators to ListView

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 832 Views
  • 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.
  • S Offline
    S Offline
    sibislaw2
    wrote on last edited by
    #1

    Hi, i am wondering about adding scroll indicators to ListView. What i mean saying scrool indicators ? I mean not scroll bar, but two arrows one on the left side of the list, one on the right side of the list indicating that we have elements outside visible area.

    < |element1| |element2| |element3| >

    < and > is scroll indicator.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jflatt
      wrote on last edited by
      #2

      Something like this?
      @
      import QtQuick 2.1

      Row {
      Rectangle {
      id: prev
      width: 10
      height: 50
      Text {
      text: "<"
      color: list.currentIndex > 0 ? "black" : "lightgrey"
      }
      MouseArea {
      anchors.fill: parent
      onClicked: list.currentIndex = Math.max(0, list.currentIndex - 1)
      }
      }

      ListView {
          id: list
          width: 110
          height: 50
          orientation: ListView.Horizontal
          clip: true
          model: 10
          delegate: Text {
              text: " item " + index + " "
          }
      }
      
      Rectangle {
          id: next
          width: 10
          height: 50
          Text {
              text: ">"
              color: list.currentIndex < list.count - 1 ? "black" : "lightgrey"
          }
          MouseArea {
              anchors.fill: parent
              onClicked: list.currentIndex = Math.min(list.count - 1, list.currentIndex + 1)
          }
      }
      

      }
      @

      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