Unsolved Unable to get object ID
-
Hi,
There are two qml buttons defined as follows:1.ButtonWithBackground.qml
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtGraphicalEffects 1.0 Button { id: butttonWithBackgroundId text: qsTr("Button1") contentItem: Text { id: buttonWithBackgroundContentId text: butttonWithBackgroundId.text font: butttonWithBackgroundId.font opacity: enabled ? 1.0 : 0.3 color: butttonWithBackgroundId.down ? "#17a81a" : "#21be2b" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Rectangle { id: buttonWithBackgroundMaskId opacity: enabled ? 1 : 0.3 border.color: butttonWithBackgroundId.down ? "#17a81a" : "#21be2b" border.width: 1 radius: height/2 LinearGradient { id: linearGradEffectId source: parent anchors.fill: parent start: Qt.point(0, 0) end: Qt.point(0, 300) gradient: Gradient { GradientStop { position: 0.0; color: "white" } GradientStop { position: 1.0; color: "black" } } } layer.smooth: true layer.enabled: true layer.effect:DropShadow { color: "#20000000" transparentBorder: true horizontalOffset: 0 verticalOffset: 2 } } }
2. ButtonWithBackgroundItem
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtGraphicalEffects 1.0 Button { id: butttonWithBackgroundId text: qsTr("Button2") contentItem: Text { id: buttonWithBackgroundContentId text: butttonWithBackgroundId.text font: butttonWithBackgroundId.font opacity: enabled ? 1.0 : 0.3 color: butttonWithBackgroundId.down ? "#17a81a" : "#21be2b" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Item{ id: itemBackgroundId Rectangle { id: buttonWithBackgroundMaskId opacity: enabled ? 1 : 0.3 border.color: "#00ccff" border.width: 2 radius: height/2 anchors.fill:parent } LinearGradient { id: linearGradEffectId source: buttonWithBackgroundMaskId anchors.fill: parent start: Qt.point(0, 0) end: Qt.point(0, 300) gradient: Gradient { GradientStop { position: 0.0; color: "white" } GradientStop { position: 1.0; color:"#00ccff"} } } layer.smooth: true layer.enabled: true layer.effect:DropShadow { color: "#20000000" transparentBorder: true horizontalOffset: 0 verticalOffset: 2 } } }
Both buttons are used in main.qml as follows:
Row{ anchors.centerIn: parent spacing: 100 ButtonWithBackground{ id: buttonWithRectId height: 80 width: 80 } ButtonWithBackgroundItem{ id: buttonWithItemId height: 80 width: 80 } }
I need to pick the object ids of buttons using Squish automation tool. I am facing problem in the second button where instead of giving id as buttonWithItemId, it is showing as buttonWithBackgroundMaskId.
But the first one is correctly identified as buttonWithRectId.What could be the problem?