// CreateWindow creates a new instance of the component held by obj, // and creates a new window holding the instance as its root object. // The component instance runs under the ctx context. If ctx is nil, // it runs under the same context as obj. // // The CreateWindow method panics if called on an object that // does not represent a QML component. func (obj *Common) CreateWindow(ctx *Context) *Window { if C.objectIsComponent(obj.addr) == 0 { panic("object is not a component") } var win Window win.engine = obj.engine gui(func() { ctxaddr := nilPtr if ctx != nil { ctxaddr = ctx.addr } win.addr = C.componentCreateWindow(obj.addr, ctxaddr) }) return &win }
// Create creates a new instance of the component held by obj. // The component instance runs under the ctx context. If ctx is nil, // it runs under the same context as obj. // // The Create method panics if called on an object that does not // represent a QML component. func (obj *Common) Create(ctx *Context) Object { if C.objectIsComponent(obj.addr) == 0 { panic("object is not a component") } var root Common root.engine = obj.engine gui(func() { ctxaddr := nilPtr if ctx != nil { ctxaddr = ctx.addr } root.addr = C.componentCreate(obj.addr, ctxaddr) }) return &root }