ScrollIndicator QML Type
垂直または水平の非インタラクティブスクロールインジケータ。詳細...
Import Statement: | import QtQuick.Controls |
Inherits: |
プロパティ
- active : bool
- horizontal : bool
(since QtQuick.Controls 2.3 (Qt 5.10))
- minimumSize : real
(since QtQuick.Controls 2.4 (Qt 5.11))
- orientation : enumeration
- position : real
- size : real
- vertical : bool
(since QtQuick.Controls 2.3 (Qt 5.10))
- visualPosition : real
(since QtQuick.Controls 2.4 (Qt 5.11))
- visualSize : real
(since QtQuick.Controls 2.4 (Qt 5.11))
付属物件
- horizontal : ScrollIndicator
- vertical : ScrollIndicator
詳細説明
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 } } }
ScrollBar 、ScrollIndicatorのカスタマイズ、インジケータ・コントロールも参照してください 。
プロパティの説明
active : bool |
このプロパティは、インジケータがアクティブであるかどうか、つまり、アタッチされた Flickable がmoving であるかどうかを保持します。
both horizontal and vertical indicators visible 、どちらの方向にもスクロールし続けることが可能です。
このプロパティは、スクロールインジケータがattached to a flickable であるときに自動的に設定されます。
horizontal : bool |
このプロパティは、スクロールインジケータが水平かどうかを保持します。
このプロパティは QtQuick.Controls 2.3 (Qt 5.10) で導入されました。
orientationも参照してください 。
minimumSize : real |
このプロパティは、インジケータの最小サイズを保持し、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 の と き に自動的に設定 さ れます。
vertical : bool |
このプロパティは、スクロール・インジケータが垂直かどうかを保持します。
このプロパティは QtQuick.Controls 2.3 (Qt 5.10) で導入されました。
orientationも参照してください 。
visualPosition : real |
このプロパティは、minimum size によって制限される可能性のある、インジケータの有効な視覚的位置を保持します。
このプロパティは QtQuick.Controls 2.4 (Qt 5.11) で導入されました。
position およびminimumSizeも参照してください 。
visualSize : real |
このプロパティは、インジケータの有効なビジュアル・サイズを保持します。これは、minimum size によって制限される場合があります。
このプロパティは QtQuick.Controls 2.4 (Qt 5.11) で導入されました。
size およびminimumSizeも参照してください 。
Attached Property ドキュメント
ScrollIndicator.horizontal : ScrollIndicator |
このプロパティは、水平スクロールインジケータをFlickable にアタッチします。
Flickable { contentWidth: 2000 ScrollIndicator.horizontal: ScrollIndicator { } }
Attaching ScrollIndicator to a Flickableも参照して ください。
ScrollIndicator.vertical : ScrollIndicator |
このプロパティは、垂直スクロールインジケーターをFlickable にアタッチします。
Flickable { contentHeight: 2000 ScrollIndicator.vertical: ScrollIndicator { } }
Attaching ScrollIndicator to a Flickableも参照して ください。
© 2025 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.