Qt Quick Components

ScrollDecorator

A ScrollDecorator adds a visual indicator to a Flickable element to show the size relationship between the visible contents and the complete contents. More...

  • List of all members, including inherited members
  • Properties

    Detailed Description

    When the size of a Flickable element is larger than the size of its container, it is often helpful to have some indication of where you are. For example, if you are navigating a long list, the scroll decorator will indicate how far down the list you have scrolled. The ScrollDecorator provides a simple way of adding this kind of indicator to a Flickable element.

    The scroll decorator is often a scroll bar, but the actual implementation, including the location and behaviour of the scroll decorator, is platform dependent. Also, the scroll decorator is generally only visible when the list is being scrolled. Otherwise it is hidden from view.

    ScrollDecorators can be used with Flickable elements as well as Flickable- derived elements, such as ListView and GridView.

    Using a scroll decorator

    A ScrollDecorator needs to be a sibling of the Flickable item that it is to be attached to. It will be implicitly anchored to that flickable so there is no need to do any further connecting yourself. The following code snippet gives an example of a scroll decorator attached to a list. In the Symbian implementation, the scroll decorator is a scrollbar and is only shown when the list is scrolling. See the image below for an example (the scroll bar is on the right).

         // define the list
         ListView {
             id: listView
             anchors.fill: parent
             focus: true
             clip: true
             model: listModel
             delegate: listDelegate
         }
    
         // add a scroll decorator for the list
         ScrollDecorator {
             id: scrolldecorator
             flickableItem: listView
         }

    Property Documentation

    flickableItem : Flickable

    The Flickable element that the scroll decorator is attached to.