<?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 not Updated properly]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">this is my model.cpp</p>
<pre><code>/******************************************************************************
 *
 * Copyright (C) 2018-2019 Marton Borzak &lt;hello@martonborzak.com&gt;
 *
 * This file is part of the YIO-Remote software project.
 *
 * YIO-Remote software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * YIO-Remote software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with YIO-Remote software. If not, see &lt;https://www.gnu.org/licenses/&gt;.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *****************************************************************************/

#include "albummodel_mediaplayer.h"

ListModel::ListModel(QObject *parent) :
    QAbstractListModel(parent)
{
}

int ListModel::rowCount(const QModelIndex &amp;parent) const
{
    Q_UNUSED(parent)
    return m_data.size();
}

QVariant ListModel::data(const QModelIndex &amp;index, int role) const
{
    if (index.row() &lt; 0 || index.row() &gt;= m_data.count()) {
        return QVariant();
    }
    const ModelItem &amp;item = m_data[index.row()];
    switch (role) {
        case KeyRole:
            return item.item_key();
        case TitleRole:
            return item.item_title();
        case SubTitleRole:
            return item.item_subtitle();
        case TypeRole:
            return item.item_type();
        case ImageUrlRole:
            return item.item_imageUrl();
        case CommandsRole:
            return item.item_commands();
    }
    return QVariant();
}

QHash&lt;int, QByteArray&gt; ListModel::roleNames() const
{
    QHash&lt;int, QByteArray&gt; roles;
    roles[KeyRole] = "item_key";
    roles[TitleRole] = "item_title";
    roles[SubTitleRole] = "item_subtitle";
    roles[TypeRole] = "item_type";
    roles[ImageUrlRole] = "item_image";
    roles[CommandsRole] = "item_commands";
    return roles;
}

void ListModel::append(const ModelItem &amp;modelItem)
{
    const int i = m_data.size();
    beginInsertRows(QModelIndex(), i, i);
    m_data.append(modelItem);
    endInsertRows();
}

void BrowseModel::addItem(const QString &amp;key, const QString &amp;title, const QString &amp;subtitle, const QString &amp;type,
                          const QString &amp;imageUrl, const QVariant &amp;commands) {
    ListModel *model = static_cast&lt;ListModel *&gt;(m_model);
    const ModelItem item = ModelItem(key, title, subtitle, type, imageUrl, commands);
    model-&gt;append(item);
    emit modelChanged();
}

void BrowseModel::clearItems()
{
    if(m_model) {
        delete m_model;
    }

    m_model = new ListModel();

    emit modelChanged();
}

void BrowseModel::clearProperties()
{
    m_id.clear();
    m_title.clear();
    m_subtitle.clear();
    m_type.clear();
    m_imageUrl.clear();
    m_commands.clear();
}

</code></pre>
<p dir="auto">this is my qml file</p>
<pre><code>/******************************************************************************
 *
 * Copyright (C) 2018-2019 Marton Borzak &lt;hello@martonborzak.com&gt;
 *
 * This file is part of the YIO-Remote software project.
 *
 * YIO-Remote software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * YIO-Remote software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with YIO-Remote software. If not, see &lt;https://www.gnu.org/licenses/&gt;.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *****************************************************************************/
import QtQuick 2.12
import QtQuick.Controls 2.12
import Style 1.0

import Haptic 1.0

import "qrc:/basic_ui" as BasicUI

Rectangle {
    id: main
    width: parent.width; height: parent.height
    color: Style.color.dark
    radius: Style.cornerRadius

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // VARIABLES
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    property var playListBrowseModel
    property bool isCurrentItem: parent._currentItem
    property bool start: true
    property bool filtertagplaylist: false
    property string filterString: "All"

    onIsCurrentItemChanged: {
        if (isCurrentItem &amp;&amp; start) {
            console.debug("LOAD USER PLAYLISTS");
            start = false;
            obj.browseModelChanged.connect(onFirstLoadComplete);
            obj.getPlaylist("user");
        }
        if (!isCurrentItem) {
            playListListView.contentY = 0-120;
        }
    }


    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // FUNCTIONS
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function onFirstLoadComplete(model) {
        obj.browseModelChanged.disconnect(onFirstLoadComplete);
        main.playListBrowseModel = model.model;
    }

    function load(album, type) {
        swipeView.currentIndex++;
        if (type === "playlist") {
            obj.browseModelChanged.connect(onBrowseModelChanged);
            obj.getPlaylist(album);
        }
    }

    function onBrowseModelChanged(model) {
        if (playlistLoader) {
            if (playlistLoader.source != "qrc:/components/media_player/ui/AlbumView.qml")
                playlistLoader.setSource("qrc:/components/media_player/ui/AlbumView.qml", { "albumModel": model })
            else if (playlistLoader.item) {
                playlistLoader.item.albumModel = model;
                playlistLoader.item.itemFlickable.contentY = 0;
            }
        }
        obj.browseModelChanged.disconnect(onBrowseModelChanged);

    }


    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // UI ELEMENTS
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    property alias swipeView: swipeView

    SwipeView {
        id: swipeView
        width: parent.width; height: parent.height
        currentIndex: 0
        interactive: false
        clip: true

        Item {
            property alias playListListView: playListListView
            Component {
                    id: componentTagFilterPlaylist

                    BasicUI.Tag {
                        id: tagFilterPlaylist
                        tag: "playlist"
                        selected: false

                        MouseArea {
                            anchors.fill: parent
                            onClicked: {
                                            if (selected) {
                                                selected = false;
                                                filterString = "All"
                                                tagFilterAll.selected = true;
                                                playListListView.update();
                                            } else {
                                                filterString = "Playlist"
                                                tagFilterAll.selected = false;
                                                playListListView.update();
                                                selected = true;
                                            }
                                        }
                        }
                    }
            }
            Row {
                id: tagRepeaterRow

                BasicUI.Tag {
                    id: tagFilterAll
                    tag: "All"
                    selected:true
                    MouseArea {
                        anchors.fill: parent
                        onClicked: {
                            if (!tagFilterAll.selected) {
                                tagFilterAll.selected = true;
                                filterString = "All"
                            }
                        }
                     }
                }

                Repeater {
                    id: tagRepeater
                    model: main.playListBrowseModel


                    Loader {
                        id: filterLoader
                        sourceComponent:
                            if (item_type === "playlist"){
                                if (!filtertagplaylist) {
                                    filtertagplaylist = true;
                                    return componentTagFilterPlaylist
                                }
                            }
                    }
                }
            }



            ListView {
                id: playListListView
                width: parent.width; height: parent.height-100
                spacing: 20
                anchors { top: tagRepeaterRow.bottom; horizontalCenter: parent.horizontalCenter }
                maximumFlickVelocity: 6000
                flickDeceleration: 1000
                boundsBehavior: Flickable.DragAndOvershootBounds
                flickableDirection: Flickable.VerticalFlick
                clip: true
                cacheBuffer: 3000

                delegate: playListThumbnail
                model: main.playListBrowseModel

                ScrollBar.vertical: ScrollBar {
                    opacity: 0.5
                }

                header: Component {
                    Item {
                        width: parent.width; height: 120

                        Text {
                            id: title
                            color: Style.color.text
                            text: qsTr("My playlists") + translateHandler.emptyString
                            font { family: "Open Sans Bold"; weight: Font.Bold; pixelSize: 40 }
                            lineHeight: 1
                            anchors { left: parent.left; leftMargin: 30; top: parent.top; topMargin: 30 }
                        }
                    }
                }

                populate: Transition {
                    id: popTransition
                    SequentialAnimation {
                        PropertyAction { property: "opacity"; value: 0 }
                        PauseAnimation { duration: popTransition.ViewTransition.index*100 }
                        NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 300; easing.type: Easing.InExpo }
                    }
                }
            }

            Component {
                id: playListThumbnail

                Item {
                    id: trackThumbnailItem
                    width: parent.width-60; height: 80
                    anchors.horizontalCenter: parent.horizontalCenter
                    visible:
                        if (filterString === "Playlist") {
                            return true;
                        } else if (filterString === "All") {
                            return true;
                        } else {
                            return false;
                        }

                    Rectangle {
                        id: albumImage
                        width: 80; height: 80

                        Image {
                            source: item_image
                            anchors.fill: parent
                            fillMode: Image.PreserveAspectCrop
                            asynchronous: true
                        }
                    }

                    Text {
                        id: albumTitleText
                        text: item_title
                        elide: Text.ElideRight
                        width: itemFlickable.width-60-albumImage.width-20-80
                        wrapMode: Text.NoWrap
                        color: Style.color.text
                        anchors { left: albumImage.right; leftMargin: 20; top: albumImage.top; topMargin: item_subtitle == "" ? 26 : 12 }
                        font { family: "Open Sans Regular"; pixelSize: 25 }
                        lineHeight: 1
                    }

                    Text {
                        id: albumSubTitleText
                        text: item_subtitle
                        elide: Text.ElideRight
                        visible: item_subtitle == "" ? false : true
                        width: albumTitleText.width
                        wrapMode: Text.NoWrap
                        color: Style.color.text
                        opacity: 0.6
                        anchors { left: albumTitleText.left; top: albumTitleText.bottom; topMargin: 5 }
                        font { family: "Open Sans Regular"; pixelSize: 20 }
                        lineHeight: 1
                    }

                    MouseArea {
                        anchors.fill: parent

                        onClicked: {
                            Haptic.playEffect(Haptic.Click);
                            load(item_key, item_type);
                        }
                    }

                    BasicUI.ContextMenuIcon {
                        anchors { right: parent.right; verticalCenter: parent.verticalCenter }

                        mouseArea.onClicked: {
                            Haptic.playEffect(Haptic.Click);
                            contextMenuLoader.setSource("qrc:/basic_ui/ContextMenu.qml", { "width": itemFlickable.width, "id": item_key, "type": item_type, "list": item_commands })
                        }
                    }
                }
            }
        }

        Item {

            Loader {
                id: playlistLoader
                asynchronous: true
                anchors.fill: parent
            }

            Text {
                id: backButton
                color: Style.color.text
                text: Style.icon.left_arrow
                renderType: Text.NativeRendering
                width: 70; height: 70
                verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
                font {family: "icons"; pixelSize: 80 }
                anchors { left: parent.left; leftMargin: 10; top: parent.top; topMargin: 20 }

                MouseArea {
                    id: backButtonMouseArea
                    width: parent.width + 20; height: parent.height + 20
                    anchors.centerIn: parent

                    onClicked: {
                        Haptic.playEffect(Haptic.Click);
                        swipeView.currentIndex = 0;
                    }
                }
            }
        }
    }
}

</code></pre>
<p dir="auto">and the album.qml file</p>
<pre><code>/******************************************************************************
 *
 * Copyright (C) 2018-2019 Marton Borzak &lt;hello@martonborzak.com&gt;
 *
 * This file is part of the YIO-Remote software project.
 *
 * YIO-Remote software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * YIO-Remote software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with YIO-Remote software. If not, see &lt;https://www.gnu.org/licenses/&gt;.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *****************************************************************************/

import QtQuick 2.12
import QtQuick.Controls 2.12
import Style 1.0

import Haptic 1.0
import MediaPlayerUtils 1.0

import "qrc:/basic_ui" as BasicUI

Rectangle {
    id: main
    width: parent.width; height: parent.height
    color: mediaplayerUtils.pixelColor
    radius: Style.cornerRadius

    Behavior on color {
        ColorAnimation { duration: 300 }
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // VARIABLES
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    property var albumModel

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // UTILITIES
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    MediaPlayerUtils {
        id: mediaplayerUtils
        imageURL: albumModel.imageUrl
    }


    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // UI ELEMENTS
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    property alias itemFlickable: itemFlickable

    Flickable {
        id: itemFlickable
        width: parent.width; height: parent.height-100
        maximumFlickVelocity: 6000
        flickDeceleration: 1000
        contentHeight: 150 + image.height + title.height + artist.height + trackListView.height
        boundsBehavior: Flickable.DragAndOvershootBounds
        flickableDirection: Flickable.VerticalFlick
        clip: true

        Behavior on contentY {
            PropertyAnimation {
                duration: 300
                easing.type: Easing.OutExpo
            }
        }

        ScrollBar.vertical: ScrollBar {
            opacity: 0.5
        }


        BasicUI.CustomImageLoader {
            id: image
            width: 280; height: 280
            anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 100 }
            url: albumModel.imageUrl === "" ? "qrc:/images/mini-music-player/no_image.png" : albumModel.imageUrl
        }

        Text {
            color: Style.color.text
            text: Style.icon.play
            renderType: Text.NativeRendering
            width: 70; height: 70
            verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
            font {family: "icons"; pixelSize: 80 }
            anchors.centerIn: image

            MouseArea {
                width: parent.width + 20; height: parent.height + 20
                anchors.centerIn: parent
                onClicked: {
                    Haptic.playEffect(Haptic.Click);
                    obj.playMedia(albumModel.id, albumModel.type);
                }
            }
        }

        Text {
            id: title
            color: Style.color.text
            text: albumModel.title
            horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
            elide: Text.ElideRight
            wrapMode: Text.NoWrap
            width: parent.width-80
            font { family: "Open Sans Bold"; weight: Font.Bold; pixelSize: 30 }
            lineHeight: 1
            anchors { horizontalCenter: parent.horizontalCenter; top: image.bottom; topMargin: 20 }
        }

        Text {
            id: artist
            color: Style.color.text
            text: albumModel.subtitle
            horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
            elide: Text.ElideRight
            wrapMode: Text.NoWrap
            width: parent.width-80
            font: Style.font.button
            anchors { top: title.bottom; horizontalCenter: parent.horizontalCenter }
        }

        ListView {
            id: trackListView
            width: parent.width-60; height: childrenRect.height
            spacing: 20
            interactive: false
            anchors { top: artist.bottom; topMargin: 40; horizontalCenter: parent.horizontalCenter }

            model: albumModel.model
            delegate: trackThumbnail
        }

        Component {
            id: trackThumbnail

            Item {
                width: parent.width; height: 80

                Text {
                    id: trackNumber
                    text: index+1
                    color: Style.color.text
                    anchors { left: parent.left; verticalCenter: parent.verticalCenter }
                    font { family: "Open Sans Regular"; pixelSize: 25 }
                    lineHeight: 1
                }

                Text {
                    id: albumTitleText
                    text: item_title
                    elide: Text.ElideRight
                    width: parent.width-100
                    wrapMode: Text.NoWrap
                    color: Style.color.text
                    anchors { left: parent.left; leftMargin: 45; top: parent.top }
                    font { family: "Open Sans Regular"; pixelSize: 25 }
                    lineHeight: 1
                }

                Text {
                    id: albumSubTitleText
                    text: item_subtitle
                    elide: Text.ElideRight
                    width: albumTitleText.width
                    wrapMode: Text.NoWrap
                    color: Style.color.text
                    opacity: 0.6
                    anchors { left: albumTitleText.left; top: albumTitleText.bottom; topMargin: 5 }
                    font { family: "Open Sans Regular"; pixelSize: 20 }
                    lineHeight: 1
                }

                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        Haptic.playEffect(Haptic.Click);
                        obj.playMedia(item_key, item_type);
                    }
                }

                BasicUI.ContextMenuIcon {
                    colorBg: mediaplayerUtils.pixelColor
                    anchors { right: parent.right; verticalCenter: parent.verticalCenter }

                    mouseArea.onClicked: {
                        Haptic.playEffect(Haptic.Click);
                        contextMenuLoader.setSource("qrc:/basic_ui/ContextMenu.qml", { "width": main.width, "id": item_key, "type": item_type, "list": item_commands })
                    }
                }
            }
        }
    }
}

</code></pre>
<p dir="auto">When i call</p>
<pre><code>m_userPlaylistBrowseModel-&gt;clearItems();
            m_userPlaylistBrowseModel-&gt;clearProperties();
m_userPlaylistBrowseModel-&gt;addItem(playlists[i].toMap().value("id").toString(),
                               playlists[i].toMap().value("name").toString(), "", type, image, commands);
</code></pre>
<p dir="auto">The model is not updated.</p>
<p dir="auto">Any help appriciated :)</p>
]]></description><link>https://forum.qt.io/topic/127094/listview-not-updated-properly</link><generator>RSS for Node</generator><lastBuildDate>Wed, 10 Jun 2026 19:07:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127094.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 May 2021 17:51:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListView not Updated properly on Fri, 28 May 2021 18:36:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> how to change it to one model?</p>
]]></description><link>https://forum.qt.io/post/662195</link><guid isPermaLink="true">https://forum.qt.io/post/662195</guid><dc:creator><![CDATA[lomilomi]]></dc:creator><pubDate>Fri, 28 May 2021 18:36:36 GMT</pubDate></item><item><title><![CDATA[Reply to ListView not Updated properly on Fri, 28 May 2021 18:24:17 GMT]]></title><description><![CDATA[<p dir="auto">What is BrowseModel ? Why do you have two models at all?</p>
]]></description><link>https://forum.qt.io/post/662194</link><guid isPermaLink="true">https://forum.qt.io/post/662194</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 28 May 2021 18:24:17 GMT</pubDate></item><item><title><![CDATA[Reply to ListView not Updated properly on Fri, 28 May 2021 18:21:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a></p>
<p dir="auto">I changed is</p>
<pre><code>/******************************************************************************
 *
 * Copyright (C) 2018-2019 Marton Borzak &lt;hello@martonborzak.com&gt;
 *
 * This file is part of the YIO-Remote software project.
 *
 * YIO-Remote software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * YIO-Remote software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with YIO-Remote software. If not, see &lt;https://www.gnu.org/licenses/&gt;.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *****************************************************************************/

#include "albummodel_mediaplayer.h"

ListModel::ListModel(QObject *parent) :
    QAbstractListModel(parent)
{
}

int ListModel::rowCount(const QModelIndex &amp;parent) const
{
    Q_UNUSED(parent)
    return m_data.size();
}

QVariant ListModel::data(const QModelIndex &amp;index, int role) const
{
    if (index.row() &lt; 0 || index.row() &gt;= m_data.count()) {
        return QVariant();
    }
    const ModelItem &amp;item = m_data[index.row()];
    switch (role) {
        case KeyRole:
            return item.item_key();
        case TitleRole:
            return item.item_title();
        case SubTitleRole:
            return item.item_subtitle();
        case TypeRole:
            return item.item_type();
        case ImageUrlRole:
            return item.item_imageUrl();
        case CommandsRole:
            return item.item_commands();
    }
    return QVariant();
}

QHash&lt;int, QByteArray&gt; ListModel::roleNames() const
{
    QHash&lt;int, QByteArray&gt; roles;
    roles[KeyRole] = "item_key";
    roles[TitleRole] = "item_title";
    roles[SubTitleRole] = "item_subtitle";
    roles[TypeRole] = "item_type";
    roles[ImageUrlRole] = "item_image";
    roles[CommandsRole] = "item_commands";
    return roles;
}

void ListModel::append(const ModelItem &amp;modelItem)
{
    const int i = m_data.size();
    beginInsertRows(QModelIndex(), i, i);
    m_data.append(modelItem);
    endInsertRows();
}

void ListModel::clear() {
    beginResetModel();
    m_data.clear();
    endResetModel();
}


void BrowseModel::addItem(const QString &amp;key, const QString &amp;title, const QString &amp;subtitle, const QString &amp;type,
                          const QString &amp;imageUrl, const QVariant &amp;commands) {
    ListModel *model = static_cast&lt;ListModel *&gt;(m_model);
    const ModelItem item = ModelItem(key, title, subtitle, type, imageUrl, commands);
    model-&gt;append(item);
    emit modelChanged();
}

void BrowseModel::clearItems()
{
    if(m_model) {
        ListModel *model = static_cast&lt;ListModel *&gt;(m_model);
        model-&gt;clear();
        delete m_model;
    }

    m_model = new ListModel();

    emit modelChanged();
}

void BrowseModel::clearProperties()
{
    m_id.clear();
    m_title.clear();
    m_subtitle.clear();
    m_type.clear();
    m_imageUrl.clear();
    m_commands.clear();
}

</code></pre>
<p dir="auto">But still not working</p>
]]></description><link>https://forum.qt.io/post/662191</link><guid isPermaLink="true">https://forum.qt.io/post/662191</guid><dc:creator><![CDATA[lomilomi]]></dc:creator><pubDate>Fri, 28 May 2021 18:21:31 GMT</pubDate></item><item><title><![CDATA[Reply to ListView not Updated properly on Fri, 28 May 2021 17:58:03 GMT]]></title><description><![CDATA[<p dir="auto">You have to call the functions that trigger signals ListView will look for.  For a clear of the data you have to do the beginresetmodel and endresetmodel.  For the additem you have to use the begin/endinsertrows functions.</p>
<p dir="auto"><a href="https://doc.qt.io/qt-5/qabstractitemmodel.html#protected-functions" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qabstractitemmodel.html#protected-functions</a></p>
<p dir="auto">Look for examples of how to build a model that shows how to do this.  I think those are referenced in the model/view docs.</p>
]]></description><link>https://forum.qt.io/post/662184</link><guid isPermaLink="true">https://forum.qt.io/post/662184</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Fri, 28 May 2021 17:58:03 GMT</pubDate></item></channel></rss>