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. Button state change causes freeze

Button state change causes freeze

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 121 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.
  • C Offline
    C Offline
    CodeBroker
    wrote on last edited by
    #1

    Hello

    I am trying to make a 3D button effect when you press the button. the way im doing this is by using states and properychanges. So basically I want to remove any shadow effect once the button is pressed.

    Button {
        id: backButton
    
    
        onPressed: {
            backButton.state = "pressed"
            console.log("clicked")
           // console.log(shadow.horizontalOffset)
        }
        onReleased: {
            backButton.state = "released"
            console.log("released")
            //console.log(shadow.horizontalOffset)
        }
    
    
    
        layer.enabled: true
        layer.effect: DropShadow {
            id: shadow
            anchors.fill: backButton
            horizontalOffset: 2
            verticalOffset: 2
            samples: 7
            radius: 3
            color: "#000000"
            source: backbuttomimage
        }
    
        states: [
            State {
                name: "pressed"
                PropertyChanges {
                    target: shadow
    
                }
            },
            State {
                name: "released"
                PropertyChanges {
                    target: shadow
                }
            }
    
        ]
    
        background: Image {
            id: backbuttomimage
            smooth: true
            source: "qrc:/Icons/leftarrow.png"
            anchors.fill: backButton
            fillMode: Image.PreserveAspectFit
        }
    }```
    
    When I click on the button, the whole GUI stops to function. I have tried a multiple different implementations, but they all yield the same issue.
    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