mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
183 lines
5.7 KiB
Go
183 lines
5.7 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qstyleditemdelegate.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QStyledItemDelegate struct {
|
|
h *C.QStyledItemDelegate
|
|
*QAbstractItemDelegate
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) cPointer() *C.QStyledItemDelegate {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQStyledItemDelegate(h *C.QStyledItemDelegate) *QStyledItemDelegate {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QStyledItemDelegate{h: h, QAbstractItemDelegate: newQAbstractItemDelegate_U(unsafe.Pointer(h))}
|
|
}
|
|
|
|
func newQStyledItemDelegate_U(h unsafe.Pointer) *QStyledItemDelegate {
|
|
return newQStyledItemDelegate((*C.QStyledItemDelegate)(h))
|
|
}
|
|
|
|
// NewQStyledItemDelegate constructs a new QStyledItemDelegate object.
|
|
func NewQStyledItemDelegate() *QStyledItemDelegate {
|
|
ret := C.QStyledItemDelegate_new()
|
|
return newQStyledItemDelegate(ret)
|
|
}
|
|
|
|
// NewQStyledItemDelegate2 constructs a new QStyledItemDelegate object.
|
|
func NewQStyledItemDelegate2(parent *QObject) *QStyledItemDelegate {
|
|
ret := C.QStyledItemDelegate_new2(parent.cPointer())
|
|
return newQStyledItemDelegate(ret)
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) MetaObject() *QMetaObject {
|
|
ret := C.QStyledItemDelegate_MetaObject(this.h)
|
|
return newQMetaObject_U(unsafe.Pointer(ret))
|
|
}
|
|
|
|
func QStyledItemDelegate_Tr(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_Tr(s_Cstring, &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func QStyledItemDelegate_TrUtf8(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_TrUtf8(s_Cstring, &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) Paint(painter *QPainter, option *QStyleOptionViewItem, index *QModelIndex) {
|
|
C.QStyledItemDelegate_Paint(this.h, painter.cPointer(), option.cPointer(), index.cPointer())
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) SizeHint(option *QStyleOptionViewItem, index *QModelIndex) *QSize {
|
|
ret := C.QStyledItemDelegate_SizeHint(this.h, option.cPointer(), index.cPointer())
|
|
// Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
ret1 := newQSize(ret)
|
|
runtime.SetFinalizer(ret1, func(ret2 *QSize) {
|
|
ret2.Delete()
|
|
runtime.KeepAlive(ret2.h)
|
|
})
|
|
return ret1
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) CreateEditor(parent *QWidget, option *QStyleOptionViewItem, index *QModelIndex) *QWidget {
|
|
ret := C.QStyledItemDelegate_CreateEditor(this.h, parent.cPointer(), option.cPointer(), index.cPointer())
|
|
return newQWidget_U(unsafe.Pointer(ret))
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) SetEditorData(editor *QWidget, index *QModelIndex) {
|
|
C.QStyledItemDelegate_SetEditorData(this.h, editor.cPointer(), index.cPointer())
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) SetModelData(editor *QWidget, model *QAbstractItemModel, index *QModelIndex) {
|
|
C.QStyledItemDelegate_SetModelData(this.h, editor.cPointer(), model.cPointer(), index.cPointer())
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) UpdateEditorGeometry(editor *QWidget, option *QStyleOptionViewItem, index *QModelIndex) {
|
|
C.QStyledItemDelegate_UpdateEditorGeometry(this.h, editor.cPointer(), option.cPointer(), index.cPointer())
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) ItemEditorFactory() *QItemEditorFactory {
|
|
ret := C.QStyledItemDelegate_ItemEditorFactory(this.h)
|
|
return newQItemEditorFactory_U(unsafe.Pointer(ret))
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) SetItemEditorFactory(factory *QItemEditorFactory) {
|
|
C.QStyledItemDelegate_SetItemEditorFactory(this.h, factory.cPointer())
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) DisplayText(value *QVariant, locale *QLocale) string {
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_DisplayText(this.h, value.cPointer(), locale.cPointer(), &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func QStyledItemDelegate_Tr2(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_Tr2(s_Cstring, c_Cstring, &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func QStyledItemDelegate_Tr3(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_Tr3(s_Cstring, c_Cstring, (C.int)(n), &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func QStyledItemDelegate_TrUtf82(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_TrUtf82(s_Cstring, c_Cstring, &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func QStyledItemDelegate_TrUtf83(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _out *C.char = nil
|
|
var _out_Strlen C.int = 0
|
|
C.QStyledItemDelegate_TrUtf83(s_Cstring, c_Cstring, (C.int)(n), &_out, &_out_Strlen)
|
|
ret := C.GoStringN(_out, _out_Strlen)
|
|
C.free(unsafe.Pointer(_out))
|
|
return ret
|
|
}
|
|
|
|
func (this *QStyledItemDelegate) Delete() {
|
|
C.QStyledItemDelegate_Delete(this.h)
|
|
}
|