Env: Go 1.4.2, Qt 5.4.1 Archlinux x86_64; Go 1.4.2, Qt 5.4.1 Windows x86
ObjectByName works fine when the objects layout parallelly, but in TabView, the second object can't be find. The error string: panic: cannot find descendant with objectName == "button2"。Example is below:
main.go
package main
import (
"fmt"
"gopkg.in/qml.v1"
"io/ioutil"
"os"
//"time"
)
type Control struct {
Root qml.Object
}
var engine *qml.Engine
var window *qml.Window
var ctrl *Control
func main() {
err := qml.Run(run)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
}
func run() error {
qmlData, err := ioutil.ReadFile("ui.qml")
engine = qml.NewEngine()
ctrl = &Control{}
component, err := engine.LoadString("ui.qml", string(qmlData))
if err != nil {
return err
}
window = component.CreateWindow(nil)
window.Show()
fmt.Println(window.ObjectByName("button1"))
fmt.Println(window.ObjectByName("button2"))
fmt.Println(window.ObjectByName("button3"))
window.Wait()
return nil
}
Env: Go 1.4.2, Qt 5.4.1 Archlinux x86_64; Go 1.4.2, Qt 5.4.1 Windows x86
ObjectByName works fine when the objects layout parallelly, but in TabView, the second object can't be find. The error string: panic: cannot find descendant with objectName == "button2"。Example is below:
main.go
ui.qml