Qt 5.6 | Qt Labs Controls | QML Types | ScrollBar QML Type

Qt 5.6.3 Reference Documentation

# ScrollBar QML Type

An interactive scroll bar control. More...

Import Statement: | import Qt.labs.controls 1.0
Inherits: | Control

- List of all members, including inherited members

## Properties

- active : bool
- handle : Item
- orientation : enumeration
- position : real
- pressed : bool
- size : real

## Attached Properties

- horizontal : ScrollBar
- vertical : ScrollBar

## Detailed Description

ScrollBar is an interactive bar that can be used to scroll to a specific position. A scroll bar can be either vertical or horizontal, and can be attached to any Flickable, such as ListView and GridView.

      Flickable {
          // ...
          ScrollBar.vertical: ScrollBar { }
      }

Note: When ScrollBar is attached vertically or horizontally to a Flickable, its geometry and the following properties are automatically set and updated as appropriate:

- orientation
- position
- size
- active

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

See also ScrollIndicator, Customizing ScrollBar, and Indicator Controls.

## Property Documentation

active : bool

This property holds whether the scroll bar is active ie. when its pressed or the attached Flickable is moving.

handle : Item

This property holds the handle item.

See also Customizing ScrollBar.

orientation : enumeration

This property holds the orientation of the scroll bar.

Possible values:

Constant | Description
--- | ---
`Qt.Horizontal` | Horizontal
`Qt.Vertical` | Vertical (default)

position : real

This property holds the position of the scroll bar, scaled to `0.0 - 1.0`.

See also Flickable::visibleArea.

pressed : bool

This property holds whether the scroll bar is pressed.

size : real

This property holds the size of the scroll bar, scaled to `0.0 - 1.0`.

See also Flickable::visibleArea.

## Attached Property Documentation

ScrollBar.horizontal : ScrollBar

This property attaches a horizontal scroll bar to a Flickable.

      Flickable {
          contentWidth: 2000
          ScrollBar.horizontal: ScrollBar { }
      }

ScrollBar.vertical : ScrollBar

This property attaches a vertical scroll bar to a Flickable.

      Flickable {
          contentHeight: 2000
          ScrollBar.vertical: ScrollBar { }
      }