Hi,
I have a object (GoRect) that is registered on the QML using this procedure:
qml.RegisterTypes("GoExtensions", 1, 0, []qml.TypeSpec{{
Init: InitializeGoRect,
}})
func InitializeGoRect(r *GoRect, obj qml.Object) {
r.Object = obj
}
The type (GoRect) defines a function HandleKey.
type GoRect struct {
qml.Object
}
func (g *GoRect) HandleKey().
What I want to do is to be able to call editor.HandleKey() inside the Item.Keys.onPressed callback:
import GoExtensions 1.0
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
ApplicationWindow {
id: root
visible: true
width: 800
height: 600
color: "black"
GoRect {
id: editor
x: 150
y: 0
width: 200
height: 200
}
Item {
focus: true
anchors.fill: parent
Keys.onPressed : {
editor.KeyPressed()
}
}
}