Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

source item to be glowing on popup modal set



  • Hi All,
    I was working on pop-ups, on set of modal to true, whole window goes dim, whereas I wanted the pressed button/source item to be glowing. Below is the sample code.
    I am trying set property z of testButton so that it appears on modal dim effect. Kindly help me out to understand what I have missed.

    Thanks in advance,

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtGraphicalEffects 1.0

    Window {
    id: root
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    color: "pink"

    Button {
        id: testButton
        x: root.width/2 - testButton.width/2
        width: 70
        height: 116
        z: 0
        background: Rectangle {
            color: "white"
        }
        text: "B1"
    }
    MouseArea {
        id: testButtonMouseArea
        anchors.fill: testButton
        onClicked: {
            testButtonPopUp.open()
        }
    }
    
    
    Popup {
        id: testButtonPopUp
        width: 200
        height: 300
        modal: true
        onOpened: popUpBackRect.state = "on"
        onClosed: popUpBackRect.state = "off"
    
        background: Rectangle {
            id: popUpBackRect
            color: "white"
            states: [
                State {
                    name: "on"
                    PropertyChanges { target: testButtonPopUp; dim: true; }
    

    // PropertyChanges { target: testButton; z: 2 }
    },
    State {
    name: "off"
    PropertyChanges { target: testButtonPopUp; dim: false; }
    // PropertyChanges { target: testButton; z: 1 }
    }
    ]
    }
    }
    }


Log in to reply