Hi there,

I'm wondering about the actual reason of getting a
"QDeclarativeContext: Cannot set property on internal context.".
I need to dynamically create new QML elements as child of my custom QML element:

            QDeclarativeRectangle *rect = new QDeclarativeRectangle(this);
            rect->setColor(Qt::red);
            rect->setWidth(30);
            rect->setHeight(30);
            rect->setRadius(2);
            QPoint pos = m_model->data(i, Qt::UserRole+1).toPoint();
            rect->setPos(pos.x(), pos.y());
            qmlContext(this)->setContextProperty("teste", rect);

I've noticed that:
qmlContext(this)->parentContext()->setContextProperty("teste", rect);
actual do the job. Wouldn't that be creating a sibling qml element ?
The just created
element is drawn inside my custom qml element tough, as intended.

TIA,
--
Sandro
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to