NewQTextLayout__FormatRange
bugtroubleshooting
How do I create an instance?
```go
func NewQTextLayout__FormatRange(param1 *QTextLayout__FormatRange) *QTextLayout__FormatRange {
return newQTextLayout__FormatRange(C.QTextLayout__FormatRange_new(param1.cPointer()))
}
```
My code looks like this:
```go
func (editor *CodeEdit) apply_format(format *qt.QTextCharFormat, block *qt.QTextBlock, start, end int) {
r := qt.NewQTextLayout__FormatRange(&qt.QTextLayout__FormatRange{})
r.SetStart(start)
r.SetLength(end - start)
r.SetFormat(*format)
ranges := block.Layout().Formats()
ranges = append(ranges, *r) /// ranges << r;
block.Layout().SetFormats(ranges)
editor.document.MarkContentsDirty(block.Position(), block.Length())
}
```
```SIGSEGV: segmentation violation
PC=0x111fde2 m=0 sigcode=1 addr=0x0
signal arrived during cgo execution
```
when I try to New it.
going by code from: https://github.com/Bzero/Qt-TreeSitterHighlighter/blob/0788dcd8f519e6c75afaee15dd3521e18ff052cd/src/TreeSitterHighlighter.cpp#L296
3 条评论