miqt/qt6/gen_qdesktopservices.go

87 lines
2.0 KiB
Go
Raw Permalink Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qdesktopservices.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QDesktopServices struct {
2024-11-19 06:29:06 +00:00
h *C.QDesktopServices
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QDesktopServices) cPointer() *C.QDesktopServices {
if this == nil {
return nil
}
return this.h
}
func (this *QDesktopServices) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQDesktopServices constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQDesktopServices(h *C.QDesktopServices) *QDesktopServices {
if h == nil {
return nil
}
return &QDesktopServices{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQDesktopServices constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQDesktopServices(h unsafe.Pointer) *QDesktopServices {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QDesktopServices{h: (*C.QDesktopServices)(h)}
2024-10-20 05:21:03 +00:00
}
func QDesktopServices_OpenUrl(url *QUrl) bool {
return (bool)(C.QDesktopServices_OpenUrl(url.cPointer()))
}
func QDesktopServices_SetUrlHandler(scheme string, receiver *QObject, method string) {
scheme_ms := C.struct_miqt_string{}
scheme_ms.data = C.CString(scheme)
scheme_ms.len = C.size_t(len(scheme))
defer C.free(unsafe.Pointer(scheme_ms.data))
method_Cstring := C.CString(method)
defer C.free(unsafe.Pointer(method_Cstring))
C.QDesktopServices_SetUrlHandler(scheme_ms, receiver.cPointer(), method_Cstring)
}
func QDesktopServices_UnsetUrlHandler(scheme string) {
scheme_ms := C.struct_miqt_string{}
scheme_ms.data = C.CString(scheme)
scheme_ms.len = C.size_t(len(scheme))
defer C.free(unsafe.Pointer(scheme_ms.data))
C.QDesktopServices_UnsetUrlHandler(scheme_ms)
}
// Delete this object from C++ memory.
func (this *QDesktopServices) Delete() {
2024-11-19 06:29:06 +00:00
C.QDesktopServices_Delete(this.h, C.bool(this.isSubclass))
2024-10-20 05:21:03 +00:00
}
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
// from C++ memory once it is unreachable from Go memory.
func (this *QDesktopServices) GoGC() {
runtime.SetFinalizer(this, func(this *QDesktopServices) {
this.Delete()
runtime.KeepAlive(this.h)
})
}