<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Efficient way for blinking some items in a repeater]]></title><description><![CDATA[<p dir="auto">Hey,<br />
What is an efficient way for blinking some items in a repeater I use QT 5.10.1 and implement below code inside a repeater :<br />
some variable such as (is_visible,icon_visiblity,property_value,blinking,etc) come from my c++ model which is inherited from QAbstractListModel</p>
<pre><code>
Item
{
    Row
    {
        id:rowID
        spacing: 5
        y: index * 25
        property bool isBlink: false
        visible: is_visible

        Rectangle
        {
            width: 18
            height: 18
            color:"#00000000"
            Image
            {
                id: iconID
                source:icon_url
                fillMode: Image.PreserveAspectFit
                anchors.fill: {parent.Center}
                visible:icon_visiblity
            }
        }
        Text
        {
            id: propertyNameID
            text: property_name
            color: (enable)?property_name_color:"grey"
            font.bold: true
            font.pointSize: 12
            verticalAlignment: Text.AlignVCenter
            style: Text.Outline
            styleColor: "black"
        }
        Text
        {
            id: propertyValueID
            text: property_value
            font.pointSize: 12
            verticalAlignment: Text.AlignVCenter
            color: (enable)?property_value_color:"grey"
            style: Text.Outline
            styleColor: "black"

        }

        state: "show"

        states:
        [
            State
            {
                name: "hide";
                PropertyChanges { target: rowID; opacity:0.0}
            },
            State
            {
                name: "show";
                PropertyChanges { target: rowID; opacity:1.0}
            }
        ]

        transitions: Transition
        {
            from: "show"; to: "hide"; reversible: true
            PropertyAnimation
            {
                properties: "opacity"
                duration: 300
            }
        }

        Timer
        {
            interval: 300
            running:
            {
                if(blinking)
                {
                    true
                }
                else
                {
                    if(is_visible)
                    {
                        rowID.state = "show"
                    }
                    else
                    {
                        rowID.state = "hide"
                    }
                    false
                }
            }
            repeat:blinking

            onTriggered:
            {
                if(blinking)
                {
                if(rowID.state === "show")
                    rowID.state = "hide"
                else
                    rowID.state = "show"
                }
                else
                {
                        rowID.state = "show"
                }
            }
        }
    }
}
</code></pre>
<p dir="auto">It seems slow specially when multiple items are blinking in runtime does it exist any better way to doing that?</p>
<p dir="auto">Yours,</p>
]]></description><link>https://forum.qt.io/topic/92487/efficient-way-for-blinking-some-items-in-a-repeater</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 12:05:23 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/92487.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Jul 2018 04:16:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Efficient way for blinking some items in a repeater on Fri, 27 Jul 2018 18:52:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alien">@<bdi>Alien</bdi></a><br />
One possible simplification of your rather convoluted construction is as follows:</p>
<pre><code>Item
{
    id: delegateItem

    Row
    {
        id:rowID
        spacing: 5
        y: index * 25
        property bool isBlink: false

        Rectangle
        {
            width: 18
            height: 18
            color:"#00000000"
            Image
            {
                id: iconID
                source:icon_url
                fillMode: Image.PreserveAspectFit
                anchors.fill: {parent.Center}
                visible:icon_visiblity
            }
        }
        Text
        {
            id: propertyNameID
            text: property_name
            color: (enable)?property_name_color:"grey"
            font.bold: true
            font.pointSize: 12
            verticalAlignment: Text.AlignVCenter
            style: Text.Outline
            styleColor: "black"
        }
        Text
        {
            id: propertyValueID
            text: property_value
            font.pointSize: 12
            verticalAlignment: Text.AlignVCenter
            color: (enable)?property_value_color:"grey"
            style: Text.Outline
            styleColor: "black"
        }
    }
    
    state: isBlink? "blinking" : ""
    
    states: [
        State {
            name: "blinking"
            when: isBlink
        }
    ]

    transitions: [
        Transition {
            from: "" //Default state
            to: "blinking"

            SequentialAnimation {
                loops: Animation.Infinite
                PropertyAnimation {target: delegateItem; property: "opacity"; from: 1.0; to: 0.0; duration: 500 }
                PropertyAnimation {target: delegateItem; property: "opacity"; from: 0.0; to: 1.0; duration: 500 }
            }
        }
    ]    
}
</code></pre>
<p dir="auto">There may even be better solutions, but I'm not particularly good at animations yet so, hopefully, someone with more QML and Qt experience can help you further.</p>
]]></description><link>https://forum.qt.io/post/472450</link><guid isPermaLink="true">https://forum.qt.io/post/472450</guid><dc:creator><![CDATA[Diracsbracket]]></dc:creator><pubDate>Fri, 27 Jul 2018 18:52:24 GMT</pubDate></item></channel></rss>