White-Oak / qml-rust

QML (Qt Quick) bindings for Rust language
MIT License
205 stars 18 forks source link

Send out notification on changed property. #38

Closed vandenoever closed 6 years ago

vandenoever commented 7 years ago

It seems like this was missing.

vandenoever commented 7 years ago

The C++ implementation example has calls the notify function in the write function:

    void setPriority(Priority priority)
    {
        m_priority = priority;
        emit priorityChanged(priority);
    }

In the documentation for NOTIFY it says: "The NOTIFY signal should only be emitted when the property has really been changed, to avoid bindings being unnecessarily re-evaluated in QML, for example. ". So what's also missing is a check to see if the value actually changed.

vandenoever commented 7 years ago

Is there something needed to get this merged?

White-Oak commented 7 years ago

@vandenoever from your comment:

In the documentation for NOTIFY it says: "The NOTIFY signal should only be emitted when the property has really been changed, to avoid bindings being unnecessarily re-evaluated in QML, for example. ". So what's also missing is a check to see if the value actually changed.

vandenoever commented 7 years ago

The code now checks if the value was changed.

cortex commented 7 years ago

I would love to see this merged! I just got started porting some qml stuff I have from Go. I was confused for a long time why my property changes didn't work, and how I should communicate with my components if this wasn't possible. With this branch, this aspect of my code works great!

vandenoever commented 7 years ago

Still hope this gets merged at some point.

apopiak commented 6 years ago

What's up with this PR @White-Oak ?