Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.1
-
None
Description
Repeater, ListView kind of components which have model / delegate structure are completely resetting when an element within array is modified.
At the example below, the delegate is "Button and it's own Popup".
First, hover your mouse on the button, you will see that button is having the hover effect, changing color etc. Then two seconds later, when Timer is triggered, that hover effect will reset.
Second, click the button, Popup will open, then when Timer is triggered, Popup will close.
I am not sure if this is a bug or not. If it isn't then please recommend me a way to have a list which I can modify the elements and it won't reset.
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { id: window width: 300 height: 300 color: "black" property var array: ([0]) Timer { running: true repeat: true interval: 2000 onTriggered: { ++array[0] // Value won't change if it's not set to itself array = array } } // All "Item"s are being fully reset, at every update // the hover effect on button disappears, // and modal is being closed Repeater { model: array delegate: Item { Button { text: "Open My Popup" onClicked: modal.open() } Popup { id: modal anchors.centerIn: Overlay.overlay modal: true Text { text: model.modelData color: "white" } } } } }
Attachments
Issue Links
- is duplicated by
-
QTBUG-84107 Using object list (array) as a model unable to track changes
- Closed