Unsolved QQuickWidget setParentItem
-
Hi,
I would like to make parent signal, slots and property available to and from a QQuickWidget. I tried to use setParentItem, but this replaces the offscreen fbo and results in the widget from not being drawn.
Is there another method to exposing and getting signals, slots and properties of a QQuickWidget?
Perhaps I can retrieve all signals, slots and properties of an qml file somehow and use a general function to allow accessing these?BTW: I;m using the QQuickWidget to draw and qml file on top of an osgEarth (OpenSceneGraph) component. As such, I do not have direct access to the main QQuickView, Engine, etc. The qmlEngine functions do not seem to work either. I do pass the parent QuickItem to the method that creates the QQuickWidget.
I'm using Qt 5.4.0Thanks!
Roy
-
Hi and welcome to devnet,
setParentItem sets the visual item parent.
Do you mean what is described here ?
-
Hi, thank you!
Essentially it is what I need, but then for all signals, slots, and properties without specifying their name.
My goal is to make a general qt/osg plugin combination that allows accessing signal, slots, and properties from a QQuickWidgit straight from and to qml. Without specifying the names in c++ (this wouldn't make it general). Using setParentItem can do this (I think), but I cannot seem to get this working for a QQuickWidget or using quickWidget->rootObject(). Perhaps I'm missing something, or there is another way to access pass all signals, etc.
Hopefully this explains it a but better. Do you have any other pointers?
Roy
-
It's clearer but how do you expect to connect things together without even knowing their names ?
-
Hi,
I've taken another approach and place the quickitem in a property to allow accessing it through that.
This way I can use only qml to hook up signals slots (no c++).
I did find a method to access all properties and signals by the way:
const QMetaObject *metaobject = item->metaObject();
int count = metaobject->propertyCount();
for (int i=0; i<count; ++i) {
QMetaProperty metaproperty = metaobject->property(i);
const char *name = metaproperty.name();
QVariant value = item->property(name);
}
count = metaobject->methodCount();
for (int i=0; i<count; ++i) {
QMetaMethod metamethod = metaobject->method(i);
const char *name = metamethod.name();
}Thanks!
Roy