このページでは

StyleKitDebug QML Type

コントロールに対するスタイルプロパティがどのように解決されるかを追跡します。詳細...

Import Statement: import Qt.labs.StyleKit
Status: Technology preview

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

プロパティ

詳細説明

StyleKitDebug は、スタイルプロパティの読み取りをデバッグ出力に記録する、アプリ内の診断ツールです。これは、特に複数の `themes ` や `style variations` が関与する複雑なスタイルにおいて、コントロールがなぜ特定の外観になるのかを理解するのに役立ちます。

StyleKit.debug を通じてアクセスします。

注:この ツールは実験的な機能です。有効にするとパフォーマンスが著しく低下するため、デバッグ目的でのみ使用してください。出力形式は将来のバージョンで変更される可能性があります。

トレースを開始するには、内部を調査したいコントロールを `control ` プロパティに割り当てます:

ApplicationWindow {
    id: app
    width: 1024
    height: 800
    visible: true

    StyleKit.debug.control: someButton
    StyleKit.debug.filter: "background.color"

    StyleKit.style: Style {
        button {
            background.color: "gray"
            hovered.background.color: "dimgray"
        }
        dark: Theme {
            button {
                background.color: "skyblue"
                hovered.background.color: "lightblue"
            }
        }
    }

    Column {
        anchors.fill: parent
        anchors.margins: 10
        spacing: 10

        Button {
            id: someButton
            text: "A Button"
        }
    }
}

解決された各プロパティは、値の出所と解決結果を示す1行として出力されます:

[read] StyleReader[Hovered].button.background.color -> Style.Theme(Dark).button[Hovered] = #add8e6

出力中の「StyleReader 」とは、Button が内部でスタイルプロパティの値を読み取る際に使用するStyleReader を指します。

StyleReader のプロパティ読み取りを追跡すると、大量の出力が生成される場合があります。filter を使用して、関心のあるプロパティにのみ出力を絞り込んでください。

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

「 StyleKit::debug 」 および「StyleKit プロパティの解決」も参照してください 。

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

control : Item

トレース対象のControl またはStyleReader のID。

設定すると、StyleKit はこのアイテムのすべてのスタイルプロパティの読み取りをデバッグ出力に記録します。null に設定すると、トレースが停止します。

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

filter : string

デバッグ出力をフィルタリングするために使用される正規表現。パターンに一致する行のみが表示されます。デフォルトでは、すべての出力が表示されます。

たとえば、背景色のみをトレースするには:

StyleKit.debug.filter: "background.color"

background.color 、background.border.color 、background.image.color 、background.shadow.color などのプロパティを含むすべての背景色をトレースするには、次の正規表現を使用します:

StyleKit.debug.filter: "background.*color"

controlも参照してください 。

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