MCPcopy
hub / github.com/go-qml/qml / LoadFile

Method LoadFile

qml.go:151–162  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

149// Once a component is loaded, component instances may be created from
150// the resulting object via its Create and CreateWindow methods.
151func (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

Callers 15

testResourcesLoadedFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95

Calls 1

LoadMethod · 0.95

Tested by 2

testResourcesLoadedFunction · 0.76
TestResourcesIssue107Method · 0.64