Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for QQmlPropertyValueSource #84

Open
cbelyaev opened this issue Dec 12, 2018 · 2 comments
Open

Add support for QQmlPropertyValueSource #84

cbelyaev opened this issue Dec 12, 2018 · 2 comments

Comments

@cbelyaev
Copy link

Hi

How can I help with implementing this?
http://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#property-value-sources

@pauldotknopf
Copy link
Member

That would be an awesome add! I think its implementation should be straightforward as well.

public class QmlProperty
{
    // PInvoke for QQmlProperty: http://doc.qt.io/qt-5/qqmlproperty.html
}


public interface IQmlPropertyValueSource
{
    void setTarget(QmlProperty target);
}

public class MyNetObject : IQmlPropertyValueSource
{
    private QmlProperty _target;

    public MyNetObject()
    {
        // Maybe create a timer to update the "_target" (if not null)
        // at periodic intervals?
    }
    
    public void setTarget(QmlProperty target)
    {
        _target = target;
    }
}

Then, we'd add the QQmlPropertyValueSource base to the existing NetValue (here) type, which will implement the QQmlPropertyValueSource::setTarget(QQmlProperty) method and send it to .NET.

We'd also have to extend the NetTypeInfo (here) to have a bool IsPropertyValueSource that will be used in NetValue to log if someone is trying to use .NET Object as a value source and it doesn't implement the required IQmlPropertyValueSource .NET interface.

@pauldotknopf
Copy link
Member

I'm marking this issue as "todo", as I will likely implement it at some point in the future.

However, I'm open to pull requests. I think this would be perfect for new comers. It's not too big of a change and it exposes you to a comfortable amount of the internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants