示例#1
0
文件: qml.go 项目: reedobrien/qml
// Set changes the named object property to the given value.
func (obj *Common) Set(property string, value interface{}) {
	cproperty := C.CString(property)
	defer C.free(unsafe.Pointer(cproperty))
	var cerr *C.error
	gui(func() {
		var dvalue C.DataValue
		packDataValue(value, &dvalue, obj.engine, cppOwner)
		cerr = C.objectSetProperty(obj.addr, cproperty, &dvalue)
	})
	cmust(cerr)
}
示例#2
0
文件: qml.go 项目: hahaya/qml
// Set changes the named object property to the given value.
func (obj *Object) Set(property string, value interface{}) error {
	cproperty := C.CString(property)
	defer C.free(unsafe.Pointer(cproperty))
	gui(func() {
		var dvalue C.DataValue
		packDataValue(value, &dvalue, obj.engine, cppOwner)
		C.objectSetProperty(obj.addr, cproperty, &dvalue)
	})
	// TODO Return an error if the value cannot be set.
	return nil
}