이 페이지에서

ScrollIndicator QML Type

수직 또는 수평 비상호작용형 스크롤 표시기. 더 보기...

Import Statement: import QtQuick.Controls
Inherits:

Control

속성

연관 속성

상세 설명

ScrollIndicator는 현재 스크롤 위치를 표시하는 비상호작용형 표시기입니다. 스크롤 표시기는 vertical 또는 horizontal 형태일 수 있으며, ListView 및 GridView 와 같은 모든 Flickable 에 연결할 수 있습니다.

Flickable {
    // ...
    ScrollIndicator.vertical: ScrollIndicator { }
}

Flickable에 ScrollIndicator 연결하기

참고: ScrollIndicator vertically 또는 horizontally 가 Flickable에연결되면 , 해당 객체의 기하학적 구조와 다음 속성들이 적절하게 자동으로 설정 및 업데이트됩니다:

부착된 ScrollIndicator는 대상 Flickable을 새로운 부모로 설정합니다. 수직으로 부착된 ScrollIndicator는 Flickable의 높이에 맞춰 크기를 조정하고, layout direction 에 따라 Flickable의 양쪽 중 한쪽에 위치합니다. 수평으로 부착된 ScrollIndicator는 Flickable의 너비에 맞춰 크기를 조정하고, 하단에 위치합니다. 부착된 ScrollIndicator에 다른 부모를 지정하여 자동 기하 구조 관리를 비활성화할 수 있습니다. 예를 들어, ScrollIndicator를 클리핑 Flickable 외부에 배치해야 하는 경우 이 기능이 유용할 수 있습니다. 다음 예제에서 이를 확인할 수 있습니다:

Flickable {
    id: flickable
    clip: true
    // ...
    ScrollIndicator.vertical: ScrollIndicator {
        parent: flickable.parent
        anchors.top: flickable.top
        anchors.left: flickable.right
        anchors.bottom: flickable.bottom
    }
}

수평 및 수직 스크롤 표시기의 활성 상태 바인딩

수평 및 수직 스크롤 인디케이터는 기본적으로 ‘ active ’ 상태를 서로 공유하지 않습니다. 어느 방향으로 스크롤하더라도 두 인디케이터가 모두 표시되도록 하려면, 다음 예제와 같이 활성 상태 간에 양방향 바인딩을 설정해야 합니다:

Flickable {
    anchors.fill: parent

    contentWidth: parent.width * 2
    contentHeight: parent.height * 2

    ScrollIndicator.horizontal: ScrollIndicator { id: hbar; active: vbar.active }
    ScrollIndicator.vertical: ScrollIndicator { id: vbar; active: hbar.active }
}

부착되지 않은 스크롤 표시기

부착 속성 API를 사용하지 않고 ScrollIndicator 인스턴스를 생성할 수 있습니다. 이는 부착된 스크롤 표시기의 동작만으로는 충분하지 않거나 ` Flickable `를 사용하지 않는 경우에 유용합니다. 다음 예제에서는 수평 및 수직 스크롤 표시기를 사용하여 사용자가 텍스트를 얼마나 스크롤했는지 표시합니다(` Flickable` 대신 ` MouseArea ` 사용):

Rectangle {
    id: frame
    clip: true
    width: 160
    height: 160
    border.color: "black"
    anchors.centerIn: parent

    Text {
        id: content
        text: "ABC"
        font.pixelSize: 169

        MouseArea {
            id: mouseArea
            drag.target: content
            drag.minimumX: frame.width - width
            drag.minimumY: frame.height - height
            drag.maximumX: 0
            drag.maximumY: 0
            anchors.fill: content
        }
    }

    ScrollIndicator {
        id: verticalIndicator
        active: mouseArea.pressed
        orientation: Qt.Vertical
        size: frame.height / content.height
        position: -content.y / content.height
        anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
    }

    ScrollIndicator {
        id: horizontalIndicator
        active: mouseArea.pressed
        orientation: Qt.Horizontal
        size: frame.width / content.width
        position: -content.x / content.width
        anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
    }
}

속성이 연결되지 않은 상태에서 단독으로 사용되는 스크롤 표시기

변동되는 델리게이트 크기

델리게이트 크기가 다양하면 새로운 델리게이트가 뷰에 로드될 때 ScrollIndicator가 "이리저리 튕겨 다닐" 수 있습니다. 이러한 이유로 델리게이트 크기를 모두 동일하게 유지하는 것이 좋습니다. 자세한 내용은 Variable Delegate Size and Section Labels 를 참조하십시오.

ScrollBar, ScrollIndicator 사용자 지정 및 표시기 컨트롤도 참조하십시오 .

속성 문서

active : bool

이 속성은 인디케이터가 활성화된 상태인지, 즉 연결된 Flickable이 ‘ moving ’ 상태인지 여부와 관계없이 유지됩니다.

어느 방향으로 스크롤하든 ' both horizontal and vertical indicators visible ' 상태를 유지할 수 있습니다.

이 속성은 스크롤 표시기가 ' attached to a flickable' 상태일 때 자동으로 설정됩니다.

horizontal : bool [read-only, since QtQuick.Controls 2.3 (Qt 5.10)]

이 속성은 스크롤 표시기가 가로 방향인지 여부를 나타냅니다.

이 속성은 QtQuick.Controls 2.3(Qt 5.10)에서 도입되었습니다.

orientation도 참조하십시오 .

minimumSize : real [since QtQuick.Controls 2.4 (Qt 5.11)]

이 속성은 지표의 최소 크기를 저장하며, 0.0 - 1.0 로 스케일링됩니다.

이 속성은 QtQuick.Controls 2.4(Qt 5.11)에서 도입되었습니다.

size, visualSize 및 visualPosition도 참조하십시오 .

orientation : enumeration

이 속성은 표시기의 방향을 지정합니다.

사용 가능한 값:

상수설명
Qt.Horizontal가로
Qt.Vertical수직 (기본값)

이 속성은 스크롤 표시기가 ' attached to a flickable'일 때 자동으로 설정됩니다.

horizontal 및 vertical도 참조하십시오 .

position : real

이 속성은 표시기의 위치를 ‘ 0.0 - 1.0 ’로 스케일링하여 저장합니다.

이 속성은 스크롤 표시기가 attached to a flickable 일 때 자동으로 설정됩니다.

Flickable::visibleArea 및 visualPosition도 참조하십시오 .

size : real

이 속성은 인디케이터의 크기를 ‘ 0.0 - 1.0 ’로 스케일링한 값을 저장합니다.

이 속성은 스크롤 표시기가 ' attached to a flickable' 상태일 때 자동으로 설정됩니다.

Flickable::visibleArea, minimumSize 및 visualSize항목도 참조하십시오 .

vertical : bool [read-only, since QtQuick.Controls 2.3 (Qt 5.10)]

이 속성은 스크롤 표시기가 수직인지 여부를 나타냅니다.

이 속성은 QtQuick.Controls 2.3(Qt 5.10)에서 도입되었습니다.

orientation도 참조하십시오 .

visualPosition : real [since QtQuick.Controls 2.4 (Qt 5.11)]

이 속성은 인디케이터의 실제 시각적 위치를 저장하며, 이 위치는 ` minimum size`에 의해 제한될 수 있습니다.

이 속성은 QtQuick.Controls 2.4(Qt 5.11)에서 도입되었습니다.

position 및 minimumSize도 참조하십시오 .

visualSize : real [since QtQuick.Controls 2.4 (Qt 5.11)]

이 속성은 인디케이터의 실제 시각적 크기를 나타내며, 이 크기는 ‘ minimum size ’에 의해 제한될 수 있습니다.

이 속성은 QtQuick.Controls 2.4(Qt 5.11)에서 도입되었습니다.

size 및 minimumSize도 참조하십시오 .

부속 속성 문서

ScrollIndicator.horizontal : ScrollIndicator [attached]

이 속성은 ` Flickable`에 가로 스크롤 표시기를 추가합니다.

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

Attaching ScrollIndicator to a Flickable도 참조하십시오 .

ScrollIndicator.vertical : ScrollIndicator [attached]

이 속성은 ` Flickable`에 세로 스크롤 표시기를 추가합니다.

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

Attaching ScrollIndicator to a Flickable도 참조하십시오 .

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.