このページでは

ScrollIndicator QML Type

縦または横方向の、操作不能なスクロールインジケーター。詳細...

Import Statement: import QtQuick.Controls
Inherits:

Control

プロパティ

関連するプロパティ

詳細説明

ScrollIndicatorは、現在のスクロール位置を示す非インタラクティブなインジケーターです。スクロールインジケーターは、vertical またはhorizontal のいずれかであり、ListView やGridView などのFlickable に添付することができます。

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

ScrollIndicatorをFlickableにアタッチする

注: 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のカスタマイズ、およびIndicatorコントロールも参照してください 。

プロパティのドキュメント

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.