import QtQuick 2.13 import QtQuick.Window 2.13 import QtQuick.Controls 2.5 import QtQuick.Shapes 1.13 Window { id : win visible: true width: 640 height: 150 title: qsTr("Test shape") Column{ anchors.fill: parent Row{ Label{ text : "Select stroke color :" } CheckBox{ id:checkBox_color text: checked ? "red" : "green" } Label{ text : "disconnect shapePath to windows (one of parent item = null)" } CheckBox{ id:checkBox_parent text: "parent : " + (checked ? "windows == null" : "windows") } } Item{ id:item width: 300 height: 100 Item{ id:sub_item parent: checkBox_parent.checked ? null : item anchors.fill: parent property color stroke_color: checkBox_color.checked ? "red" : "green" // commun color for shape and rectangle // ----> Rectangle{ id:rectangle width: 200 height: 20 border.color: sub_item.stroke_color // <---- border.width: 2 color: "transparent" } Label{ x : 10 y : 5 text: "strokeColor : " + shapePath.strokeColor color: shapePath.strokeColor } Shape{ id:shape anchors.fill: parent Item { onWindowChanged /*(var window)*/: console.log( "window : " + window ) } ShapePath { id:shapePath strokeColor: sub_item.stroke_color // <---- strokeWidth: 3 fillColor: "blue" capStyle: ShapePath.RoundCap startX: 30 startY: 30 PathLine { x: 100; y: 100 } PathLine { x: 30; y: 100 } } } } } } }