2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qdesktopservices.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QDesktopServices struct {
|
|
|
|
h *C.QDesktopServices
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDesktopServices) cPointer() *C.QDesktopServices {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDesktopServices(h *C.QDesktopServices) *QDesktopServices {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QDesktopServices{h: h}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDesktopServices_U(h unsafe.Pointer) *QDesktopServices {
|
|
|
|
return newQDesktopServices((*C.QDesktopServices)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func QDesktopServices_OpenUrl(url *QUrl) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QDesktopServices_OpenUrl(url.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDesktopServices_SetUrlHandler(scheme string, receiver *QObject, method string) {
|
2024-09-14 22:29:05 +00:00
|
|
|
scheme_ms := miqt_strdupg(scheme)
|
|
|
|
defer C.free(scheme_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
method_Cstring := C.CString(method)
|
|
|
|
defer C.free(unsafe.Pointer(method_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
C.QDesktopServices_SetUrlHandler((*C.struct_miqt_string)(scheme_ms), receiver.cPointer(), method_Cstring)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDesktopServices_UnsetUrlHandler(scheme string) {
|
2024-09-14 22:29:05 +00:00
|
|
|
scheme_ms := miqt_strdupg(scheme)
|
|
|
|
defer C.free(scheme_ms)
|
|
|
|
C.QDesktopServices_UnsetUrlHandler((*C.struct_miqt_string)(scheme_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QDesktopServices) Delete() {
|
|
|
|
C.QDesktopServices_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +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)
|
|
|
|
})
|
|
|
|
}
|