[Interest] Controls.Syles behavior on destroy

Glen Walker gwalker at moog.com
Fri May 2 13:42:34 CEST 2014


BOUCARD Olivier <boucard_olivier <at> yahoo.fr> writes:

> 
> 
> Hi,
> 
> I have a delegate Item which contains a Controls.Button with a ButtonStyle 
in Repeater.
> When an item is removed from the Repeater's model.
> I get a warning message
>  "ButtonStyle.qml:157: TypeError: Cannot read property of null" from the 
removed delegate Item instance.
> 
> Is this a bug? Or am I missing something?
> 
> Thanks
> 
> Olivier
> 
> 
> <div><div>
> <div>Hi,</div>
> <div><br></div>
> <div>I have a delegate Item which contains a Controls.Button with a 
ButtonStyle in Repeater.</div>
> <div>When an item is removed from the Repeater's model.</div>
> <div>I get a warning message
>  "ButtonStyle.qml:157: TypeError: Cannot read property of null" from the 
removed delegate Item instance.</div>
> <div><br></div>
> <div>Is this a bug? Or am I missing something?</div>
> <div><br></div>
> <div>Thanks</div>
> <div><br></div>
> <div>Olivier</div>
> </div></div>
> 

I have the same problem...did you get a fix for it?

my style.qml file has this entry:

QtObject {
    property Component buttonStyle1: ButtonStyle {
        background: Rectangle {
            anchors.fill: parent
            implicitWidth: 15
            implicitHeight: 15
            border.width: control.activeFocus ? 2 : 1
            border.color: "#888"
            radius: 4
            gradient: Gradient {
                GradientStop { position: 0 ; color: control.pressed ? 
"#2198c0" : "#0d5ca6" }
                GradientStop { position: 1 ; color: control.pressed ? 
"#2198c0" : "#0d5ca6" }
            }
        }
    }
}


And in the main.qml file I have created a button:

Button {
    id: buttonSettings
    x: 0
    y: 2
    width: 15
    height: 15
    style: Style.buttonStyle1
}


When the window is closed (i.e., the container destroyed I get the same 
error message "ButtonStyle.qml:157: TypeError: Cannot read property of 
nulll".  This does not seem to affect the program though so perhaps it is a 
bug?







More information about the Interest mailing list