DelegateStyle QML Type
コントロール内の要素の視覚的な外観を定義します。詳細...
| Import Statement: | import Qt.labs.StyleKit |
| Inherited By: |
プロパティ
- alignment : Qt::Alignment
- border : BorderStyle
- bottomLeftRadius : real
- bottomMargin : real
- bottomRightRadius : real
- clip : bool
- color : color
- data : QObject
- delegate : Component
- gradient : Gradient
- image : ImageStyle
- implicitHeight : real
- implicitWidth : real
- leftMargin : real
- margins : real
- minimumWidth : real
- opacity : real
- radius : real
- rightMargin : real
- rotation : real
- scale : real
- shadow : ShadowStyle
- topLeftRadius : real
- topMargin : real
- topRightRadius : real
- visible : bool
詳細説明
DelegateStyle は、background 、indicator 、またはindicator.foreground のようなサブ要素のようなControlStyle 内のビジュアル要素の視覚的な外観を記述します。size,color,border,radius,shadow,image,opacity などを制御するためのプロパティを提供します。
注意: Qt.lab モジュールの型は、将来のバージョンでも互換性が保たれることを保証するものではありません。
ControlStyle,ControlStateStyle,FallbackStyle Referenceも参照してください 。
プロパティのドキュメント
alignment : Qt::Alignment
親の中でのデリゲートのアライメント。デフォルト値はQt.AlignLeft | Qt.AlignVCenter です。
border : BorderStyle
このデリゲートの境界線をスタイリングするためのグループ化されたプロパティ。
bottomLeftRadius : real
左下隅の半径。設定されていない場合はradius に戻る。
radius,topLeftRadius,topRightRadius,bottomRightRadiusも参照 。
bottomMargin : real
このデリゲートの下端マージン。設定されていない場合は、margins に戻ります。
margins 、topMargin 、leftMargin 、rightMarginも参照 。
bottomRightRadius : real
右下隅の半径。設定されていない場合はradius に戻る。
radius,topLeftRadius,topRightRadius,bottomLeftRadiusも参照 。
clip : bool
デリゲートがその内容をクリップするかどうか。デフォルト値はfalse です。
color : color
このデリゲートの塗りつぶしの色。デフォルト値はtransparent です。
グラデーションが色を置き換えるクイックRectangle とは異なり、StyleKit は色の上にgradient を描きます。こ れはすなわち、 色の下は透か し なが ら 、 半透明のグ ラデ ィ エ ン ト を上書 き と し て使 う こ と がで き る (た と えば、 微かな陰影効果) こ と を意味 し ます。
button { background.gradient: Gradient { GradientStop { position: 0.0; color: Qt.alpha("black", 0.0)} GradientStop { position: 1.0; color: Qt.alpha("black", 0.2)} } background.color: "lightsteelblue" hovered.background.color: Qt.darker("lightsteelblue", 1.1) pressed.background.color: Qt.darker("lightsteelblue", 1.2) }
gradient およびopacityも参照して ください。
data : QObject
スタイルからカスタムdelegate コンポーネントにカスタム データを渡すために使用できる任意のオブジェクト。
これにより、StyleKit API が提供するもの以外のカスタム スタイル プロパティを定義できます。このデータ オブジェクトは、ステートとテーマの間で異なることができるため、組み込みプロパティではカバーされないカスタムdelegate の要素をスタイル設定することができます。
次のスニペットは、コントロールの状態によって色が変化するオーバーレイText を描画するカスタム・デリゲートを使用しています。このデリゲートは、StyledItem を継承します。これはオプションですが、ボタンの残りの背景が正常に描画されるようにします。
component OverlayData : QtObject { property color overlayColor } toolButton { background.delegate: StyledItem { id: custom Text { color: custom.delegateStyle.data.overlayColor font.pixelSize: 30 text: "シ" } } background.data: OverlayData { overlayColor: "sandybrown" } hovered.background.data: OverlayData { overlayColor: "magenta" } }
注: data オブジェクトは全体として伝播されます。通常のスタイル プロパティとは異なり、データ オブジェクト内の個々のプロパティが個別に伝播することはありません。
delegateも参照してください 。
delegate : Component
Qt Quick コントロールの DelegateStyle のレンダリングに使用されるデリゲート。
デフォルト値はnull です。この場合、代わりにStyledItem がレンダリングに使用されます。
デリゲートは、以下の必須プロパティを定義する必要があります:
required property DelegateStyle delegateStyle required property QtObject control
delegateStyle DelegateStyle control は、デリゲートを所有するQt Quick コントロールを指します。後者は、スタイルからは得られないコントロールに関する追加情報を解決するために使用できます。
所有しているコントロールの特定の型を知っている場合、control プロパティにQtObject の代わりにそれを使用できます。たとえば、下のスニペットのハンドル デリゲートは常にスライダーの内部で使用されるため、タイプをT.Slider に設定できます:
// import QtQuick.Templates as T slider { handle.delegate: Rectangle { id: handle required property DelegateStyle delegateStyle required property T.Slider control implicitWidth: delegateStyle.implicitWidth implicitHeight: delegateStyle.implicitHeight radius: delegateStyle.radius color: delegateStyle.color Text { anchors.centerIn: parent text: handle.control.value.toFixed(0) } } }
注意: DelegateStyle にdrop shadow が定義されている場合、その描画は別途shadow delegate.
data とStyledItemも参照してください 。
gradient : Gradient
このデリゲートのグラデーション。デフォルト値はnull (グラデーションなし)です。
グラデーションが色を置き換えるクイックRectangle とは異なり、StyleKit はグラデーションを色の上に描画します。こ れはすなわち、 色の下は透か し なが ら 、 半透明のグラデ ィ エ ン ト を上書 き と し て使 う こ と がで き る (た と えば微妙な陰影効果) こ と を意味 し ます。
button { background.gradient: Gradient { GradientStop { position: 0.0; color: Qt.alpha("black", 0.0)} GradientStop { position: 1.0; color: Qt.alpha("black", 0.2)} } background.color: "lightsteelblue" hovered.background.color: Qt.darker("lightsteelblue", 1.1) pressed.background.color: Qt.darker("lightsteelblue", 1.2) }
colorも参照して ください。
image : ImageStyle
このデリゲート内に画像を配置するためのグループ化されたプロパティ。
ImageStyleも参照してください 。
implicitHeight : real
このデリゲートの暗黙の高さ。
implicitWidth : real
このデリゲートの暗黙の幅。これをStyle.Stretch に設定すると、デリゲートがコントロールの利用可能な幅を満たすようになります。
leftMargin : real
このデリゲートの左マージン。設定されていない場合は、margins に戻ります。
margins 、rightMargin 、topMargin 、bottomMarginも参照 。
margins : real
このデリゲートの周囲の均一なマージン。これを設定すると、leftMargin,rightMargin,topMargin,bottomMargin のデフォルト値が得られます。各辺は個別にオーバーライドできます。
leftMargin,rightMargin,topMargin, およびbottomMarginも参照してください 。
minimumWidth : real
このデリゲートの最小幅。デリゲートはこの値より小さいサイズにはなりません。
opacity : real
このデリゲートの不透明度。0.0 (完全透過) から1.0 (完全不透明)。デ フ ォ ル ト 値は1.0 です。
radius : real
このデリゲートの四隅に適用されるコーナー半径。個々のコーナーはtopLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadius でオーバーライドできます。
topLeftRadius,topRightRadius,bottomLeftRadius, およびbottomRightRadiusも参照してください 。
rightMargin : real
このデリゲートの右マージン。設定されていない場合は、margins に戻ります。
margins,leftMargin,topMargin,bottomMarginも参照 。
rotation : real
この代表の回転を度単位で表す。
scale : real
このデリゲートのスケールファクター。デフォルト値は1.0 です。
shadow : ShadowStyle
このデリゲートの後ろにドロップシャドウをスタイリングするためのグループ化されたプロパティ。
ShadowStyleも参照してください 。
topLeftRadius : real
左上隅の半径。設定されていない場合はradius に戻る。
radius,topRightRadius,bottomLeftRadius,bottomRightRadiusも参照 。
topMargin : real
このデリゲートの上マージン。設定されていない場合は、margins に戻ります。
margins,bottomMargin,leftMargin,rightMarginも参照 。
topRightRadius : real
右上隅の半径。設定されていない場合はradius に戻る。
radius,topLeftRadius,bottomLeftRadius,bottomRightRadiusも参照 。
visible : bool
このデリゲートが可視かどうか。デフォルト値はtrue です。
注意: デフォルト値はtrue ですが、fallback style (多くのデフォルト値をオーバーライドします)は、CheckBox 、RadioButton 、Slider など、通常は背景を描画しないコントロールに対してbackground.visible からfalse を設定します。
opacityも参照してください 。
© 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.