このページでは

IndicatorStyle QML Type

コントロールのインジケーターのスタイルを定義します。詳細...

Import Statement: import Qt.labs.StyleKit
Inherits:

DelegateStyle

Status: Technology preview

この型はテクノロジープレビュー段階であり、変更される可能性があります。

プロパティ

詳細な説明

IndicatorStyleは、DelegateStyle を拡張し、インジケーターのスタイル設定に固有のプロパティを追加しています。

IndicatorStyle自体はインジケータの背景を記述し、foreground はその内部に描画されるコンテンツを記述します。例えば、checkBox.indicator はチェックボックスの枠を、checkBox.indicator.foreground はチェックマークをスタイル設定します。switchControl 、slider 、およびprogressBar の場合、インジケータは溝を、フォアグラウンドは塗りつぶしをスタイル設定します。

checkBox {
    background.visible: false
    text.alignment: Qt.AlignVCenter | Qt.AlignLeft
    indicator {
        color: "transparent"
        border.width: 1
        foreground {
            color: "transparent"
            image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png"
            // Hide the checkMark when the CheckBox is unchecked
            visible: false
        }
    }
    checked {
        // Show the checkMark when the CheckBox is checked
        indicator.foreground.visible: true
    }
}

一部のコントロールには複数のインジケータがあります。たとえば、SpinBox には増分ボタンと減分ボタンの両方があります。これらは、first およびsecond サブインジケータ、spinBox.indicator.first およびspinBox.indicator.second を使用して個別にスタイルを設定できます。SpinBox の場合、indicator.first は増分ボタンのスタイルを指定し、indicator.second は減分ボタンのスタイルを指定します。サブインジケータに設定されていないプロパティは、インジケータ自体にフォールバックします。

注: up およびdown プロパティは 、下位互換性を確保するため、first およびsecond のエイリアスとして残されています。新しいコードでは、first およびsecond を使用してください。これらの名前は汎用的であり、増減操作を表さないサブインジケータを持つコントロールでも使用できるためです。互換性のためのエイリアスは、将来のバージョンで削除される可能性があります。

spinBox {
    text.alignment: Qt.AlignHCenter | Qt.AlignVCenter
    padding: 0
    indicator {
        fillHeight: true
        color: "navy"
        opacity: 0.1
        foreground {
            color: "transparent"
            margins: 10
            image.color: "navy"
            image.fillMode: Image.PreserveAspectFit
            image.source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/arrow-indicator.png"
            width: 10
            height: 10
            alignment: Qt.AlignCenter
        }
        // up button
        first {
            alignment: Qt.AlignRight
            foreground.rotation: -90
        }
        // down button
        second {
            alignment: Qt.AlignLeft
            foreground.rotation: 90
        }
    }
}

注: Qt.labs モジュール内の型は、将来のバージョンにおいて互換性が維持されるとは限りません。

関連項目: SubIndicatorStyle 、DelegateStyle 、ControlStyle 、ControlStateStyle 、およびFallbackStyle リファレンス。

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

first : SubIndicatorStyle

複数のインジケーターを表示するコントロールの、最初のサブインジケーターのスタイルを設定するためのグループ化プロパティです。SpinBox の場合、これはインクリメントボタンのスタイルを設定します。プロパティが設定されていない場合は、インジケーター自体のスタイルが適用されます。

注: ` up `プロパティは 、下位互換性を確保するため、`first ` のエイリアスとして残されています。新しいコードでは、first を使用してください。この名前は汎用的であり、増加操作を表さないサブインジケータを持つコントロールでも使用できます。この互換性のためのエイリアスは、将来のバージョンで削除される可能性があります。

「second」も参照してください 。

foreground : DelegateStyle

このインジケーターの前景要素のスタイルを設定するためのグループ化されたプロパティです。たとえば、checkBox.indicator はチェックボックスの枠を記述し、checkBox.indicator.foreground はチェックマークを表します。

slider 、progressBar 、switchControl などのコントロールでは、indicator.foreground はプログレストラックまたは溝内の塗りつぶしを表し、indicator 自体は溝そのものを表します。

second : SubIndicatorStyle

例えばSpinBox の2番目のサブインジケーターのスタイルを設定するためのグループ化されたプロパティです。設定されていないプロパティについては、インジケーター自体の設定が適用されます。

注: down プロパティは 、下方向の操作を表さないサブインジケータを持つコントロールでも使用可能な汎用的な名前であるため、後方互換性のためにsecond のエイリアスとして残されています。新しいコードではsecond を使用してください。この互換性エイリアスは、将来のバージョンで削除される可能性があります。

「first」も参照してください 。

© 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.