Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Property Changing Outside of Evaluation?

QML Property Changing Outside of Evaluation?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 220 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1
                        property var def_g_segment: ({min:0, max:0, color:"white", inBkg:false})
                        property QtObject g_seg_temp: graph_model.getGraphSeg(index, graph_delegaterect.segment)
                        readonly property var g_segment: {
                            console.log("g_segment eval")
                            console.log("g_seg_temp", g_seg_temp)
                            if(g_seg_temp){
                                return g_seg_temp
                            }
    
                            return def_g_segment
                        }
                        onG_segmentChanged: {
                            if(1){
                                console.log("g_segment changed")
                                console.log(index, graph_model.numGraphers())
                                console.log(typeof(g_segment))
                                console.log(g_segment)
                            }
                        }
    

    output:

    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: null
    qml: g_segment eval
    qml: g_seg_temp null
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: [object Object]
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: null
    qml: g_segment eval
    qml: g_seg_temp null
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: [object Object]
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: null
    qml: g_segment eval
    qml: g_seg_temp null
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: [object Object]
    

    graph_model.getGraphSeg can return null. So I am accounting for that in the evaluation of g_segment. However, I am seeing null come through under certain conditions. I want to detect null and use a dummy object instead. I am very confused as to how this is even possible. It seems like it is fighting itself somehow. I made it readonly on the property to ensure something else wasn't causing this. I also searched the code to find it, but just did not see anything. I need to try and mock this up in a test program.

    Normally the text it prints is like this:

    qml: g_segment eval
    qml: g_seg_temp GraphSegment(0xd1b3b0)
    qml: g_segment changed
    qml: 0 6
    qml: object
    qml: GraphSegment(0xd1b3b0)
    

    I have objects that are being updated affecting the index and segment values.

    The graph_model is an old model that probably needs to be changed to a QAbstractListModel. That might be the real solution here. Just seems weird that the eval would be happening after a change signal. Unless the return value causes the signal to fire before the text is printed? I just don't know.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved