Qt 6.11 is out! See what's new in the release
blog
Context of a QDeclarativeItem
QML and Qt Quick
2
Posts
2
Posters
2.9k
Views
1
Watching
-
Hi! Is it possible to get the context that corresponds to a custom QDeclarativeItem that was instantiated in QML? I mean, something like:
foo.qml:
@Item {
Component.onCompleted: component.createChildren()MyComponent {
id: component
delegate: Rectangle {}
}@mycomponent.h:
@class MyComponent : public QDeclarativeItem
{
...
Q_PROPERTY(QDeclarativeComponent* delegate ... )Q_INVOKABLE void createChildren() { QObject *object = delegate->create(context); // where do I get the context from? }};@
-