Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

giucam
Copy link
Contributor

@giucam giucam commented Oct 3, 2013

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

@rburchell
Copy link
Contributor

@mikkoharju, mind taking a look?

void HomeWindow::setRootObject(QQuickItem *i)
{
if (d->root) {
d->root->setParentItem(0);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

@mikkoharju
Copy link
Contributor

I'm not 100% sure how ownership goes in

HomeWindow {
  rootObject: Item { .. }
}

Other options would be to have a Component property (so that HomeWindow creates and manages the root object):

HomeWindow {
  component: Component { Item { ... } } 
}

Or, expose the source property:

HomeWindow {
 source: "qml/LockScreen.qml"
}

@giucam
Copy link
Contributor Author

giucam commented Oct 7, 2013

I'm not 100% sure how ownership goes in

HomeWindow {
rootObject: Item { .. }
}

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.

Other options would be to have a Component property (so that HomeWindow creates and manages the >root object):

HomeWindow {
component: Component { Item { ... } }
}

Maybe, but there is no need to create the item more than one time, so that seems a bit unefficient to me.

Or, expose the source property:

HomeWindow {
source: "qml/LockScreen.qml"
}

That's a good idea, but maybe it could work together with rootObject?

@mikkoharju
Copy link
Contributor

Are you saying it may have no parent()?

I did a quick test and it would have the HomeWindow as parent. That's ok.

Maybe, but there is no need to create the item more than one time, so that seems a bit unefficient to me.

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.
@faenil
Copy link
Member

faenil commented Oct 21, 2013

@mikkoharju can this be merged?

@giucam giucam closed this Jun 24, 2014
@giucam giucam deleted the homewindow_qml branch June 24, 2014 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants