Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-58282

"model.value.childvalue" value not change in ListModel::delegate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.7.1, 5.8.0 RC
    • None
    • windows 10 64bit
      qt 5.8 beta 32bit

    Description

      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.3
      import QtGraphicalEffects 1.0
      
      ApplicationWindow {
      	visible: true
      	width: 640
      	height: 480
      	title: qsTr("Hello World")
      
      	ColumnLayout {
      		anchors.fill: parent
      		ListView {
      			anchors.fill: parent
      			model: ListModel {
      				id: listmodel
      				}
      
      			Component.onCompleted: {
      				listmodel.append({
      					text: "Image 1",
      					image: { value: "picture.png1", imageType: 1 },
      					position: 1
      				});
      				listmodel.append({
      					text: "Image 2",
      					image: { value: "picture.png2", imageType: 1 },
      					position: 2
      				});
      				listmodel.append({
      					text: "Image 1",
      					image: { value: "picture.png3", imageType: 1 },
      					position: 3
      				});
      			}
      
      			delegate: Item {
      				width: parent.width
      				height: 50
      
      				RowLayout {
      					anchors.fill: parent
      					Text {
      						text: model.text
      					}
      					Text {
      						text: model.image.value
      					}
      				}
      			}
      		}
      		Button {
      			text: "test"
      			onClicked: {
      				var m = listmodel.get(0)
      				m.text = "aaaa" // change in model
      				m.image.value = "zzzz" // not change! right?
      
      				var image = m.image
      				image.value = "ddd" // not change
      				m.image = image // change in model
      
      				var test = { a: { b: "c" } }
      				test.a.b = "e" // its change!
      				console.log( test.a.b )
      				test.a.b = "d"
      				console.log( test.a.b )
      			}
      		}
      	}
      }
      

      "m.image.value" does not change when button is clicked.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              naviialto naviialto
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes