<?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[ListView - append is not a function]]></title><description><![CDATA[<p dir="auto">Hello All,</p>
<p dir="auto">I trying to make ListView and delete that item.<br />
My Question is why can't i add an item to ListView?</p>
<p dir="auto">Here is my Code</p>
<pre><code>import QtQuick 2.7
import Ubuntu.Components 1.3
//import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import Qt.labs.settings 1.0
import QtQuick.Controls 2.5

MainView {
    id: root
    objectName: 'mainView'
    applicationName: 'lists.lists'
    automaticOrientation: true

    width: units.gu(45)
    height: units.gu(75)

    function addtolistView(){
        listView.append({sender: "First Row Added", title: "Add"})
    }

    ListView {
        id: listView
        anchors.fill: parent
        model: ListModel {
            ListElement { sender: "Bob Bobbleton"; title: "How are you going?" }
            ListElement { sender: "Rug Emporium"; title: "SALE! All rugs MUST go!" }
            ListElement { sender: "Electric Co."; title: "Electricity bill 15/07/2016 overdue" }
            ListElement { sender: "Tips"; title: "Five ways this tip will save your life" }
        }
        delegate: SwipeDelegate {
            id: swipeDelegate
            text: model.sender + " - " + model.title
            width: parent.width



            ListView.onRemove: SequentialAnimation {
                PropertyAction {
                    target: swipeDelegate
                    property: "ListView.delayRemove"
                    value: true
                }
                NumberAnimation {
                    target: swipeDelegate
                    property: "height"
                    to: 0
                    easing.type: Easing.InOutQuad
                }
                PropertyAction {
                    target: swipeDelegate
                    property: "ListView.delayRemove"
                    value: false
                }
            }

            onClicked: {
                swipe.complete=false
            }

            swipe.right: Label {
                id: deleteLabel
                text: qsTr("Delete")
                color: "white"
                verticalAlignment: Label.AlignVCenter
                padding: 12
                height: parent.height
                anchors.right: parent.right

                SwipeDelegate.onClicked: listView.model.remove(index)

                background: Rectangle {
                    color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
                }
            }
        }
    }

    Button{
        text: "Add"
        onClicked: addtolistView()
    }
}
</code></pre>
<p dir="auto">Got this error here (<strong>TypeError: Property 'append' of object QQuickListView(0x124f560) is not a function</strong>)</p>
<p dir="auto">How can that be fixed? <img src="https://forums.ubports.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=56a73af4c47" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Thanks for your time</p>
<p dir="auto">Best Reagrds<br />
007fred50</p>
]]></description><link>https://forums.ubports.com/topic/6969/listview-append-is-not-a-function</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 06:12:59 GMT</lastBuildDate><atom:link href="https://forums.ubports.com/topic/6969.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Nov 2021 15:08:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListView - append is not a function on Wed, 10 Nov 2021 18:40:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lduboeuf" aria-label="Profile: lduboeuf">@<bdi>lduboeuf</bdi></a> thanks it works <img src="https://forums.ubports.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=56a73af4c47" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forums.ubports.com/post/57473</link><guid isPermaLink="true">https://forums.ubports.com/post/57473</guid><dc:creator><![CDATA[007fred50]]></dc:creator><pubDate>Wed, 10 Nov 2021 18:40:25 GMT</pubDate></item><item><title><![CDATA[Reply to ListView - append is not a function on Wed, 10 Nov 2021 17:32:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/007fred50" aria-label="Profile: 007fred50">@<bdi>007fred50</bdi></a> use append on the model not the listview. e.g: listview.model.append(..)</p>
]]></description><link>https://forums.ubports.com/post/57472</link><guid isPermaLink="true">https://forums.ubports.com/post/57472</guid><dc:creator><![CDATA[lduboeuf]]></dc:creator><pubDate>Wed, 10 Nov 2021 17:32:38 GMT</pubDate></item></channel></rss>