Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Unable to get object ID
Forum Updated to NodeBB v4.3 + New Features

Unable to get object ID

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 162 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manny_lp
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved