LoadFile loads a component from the provided QML file. Resources referenced by the QML content will be resolved relative to its path. Once a component is loaded, component instances may be created from the resulting object via its Create and CreateWindow methods.
(path string)
| 149 | // Once a component is loaded, component instances may be created from |
| 150 | // the resulting object via its Create and CreateWindow methods. |
| 151 | func (e *Engine) LoadFile(path string) (Object, error) { |
| 152 | if strings.HasPrefix(path, "qrc:") { |
| 153 | return e.Load(path, nil) |
| 154 | } |
| 155 | // TODO Test this. |
| 156 | f, err := os.Open(path) |
| 157 | if err != nil { |
| 158 | return nil, err |
| 159 | } |
| 160 | defer f.Close() |
| 161 | return e.Load(path, f) |
| 162 | } |
| 163 | |
| 164 | // LoadString loads a component from the provided QML string. |
| 165 | // The location informs the resource name for logged messages, and its |