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
Expose HomeWindow to QML #94
Conversation
|
@mikkoharju, mind taking a look? |
| void HomeWindow::setRootObject(QQuickItem *i) | ||
| { | ||
| if (d->root) { | ||
| d->root->setParentItem(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HomeWindow owns the root object. Setting the root object multiple times would leak here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I was not sure wether it should delete it there, since the object is created from outside. But it may well take the ownership, that's probably better than having a mixed behabior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if it takes the ownership
|
I'm not 100% sure how ownership goes in Other options would be to have a Component property (so that HomeWindow creates and manages the root object): Or, expose the source property: |
Are you saying it may have no parent()? I guess HomeWindow:.setRootObject could set that too. It is no different to http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick-window2-window.html#data-prop imho.
Maybe, but there is no need to create the item more than one time, so that seems a bit unefficient to me.
That's a good idea, but maybe it could work together with rootObject? |
I did a quick test and it would have the HomeWindow as parent. That's ok.
HomeWindow could create the object lazily on show() -- but I agree, does not make much sense. |
This allows to create an HomeWindow in a qml file and assign to it a category and a child QQuickItem.
|
@mikkoharju can this be merged? |
This allows to create an HomeWindow in a qml file and assign to it
a category and a child QQuickItem.
This is needed for nemomobile/lipstick-colorful-home#27