Пример #1
0
// 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
}