Hi ultramanjones,
It's not something I've tried to do.
But, with your example:
@
import QtQuick 1.0
import MDEPlugins 1.0
MDE{
width:200
height:200
}
@
Just add some Q_INVOKABLE functions to it, if you want to call those functions from QML.
Why can you not access the MDE object from C++? Alternatively, from C++, just qobject_cast (actually, there may be a qgraphics_cast or similar, for graphics-view based stuff, I can't remember) the pointer returned by view.rootObject() as an MDE and access it that way.
Or am I misunderstanding what you're trying to do?
In general, if you have an Item in QML, you can pass it back to C++ as an argument. Just give it an id, and then pass that id as a QObject* argument to a Q_INVOKABLE function of a helper item.
eg:
@
// assume that I have a QDeclarativeItem-derived class called
// Helper which is installed into the Helper 1.0 namespace
// where that class has a Q_INVOKABLE void doStuffWithObject(QObject* arg) { /whatever/ } function
import Helper 1.0
Item {
id: root
MDE {
id: mde
width: 200; height: 200
}
Helper {
id: helper
}
Component.onCompleted: {
helper.doStuffWithObject(mde);
}
}
@