chang addCell to slides struct and attempt to make it work
This commit is contained in:
parent
297eef3222
commit
a8aca389b4
16
main.go
16
main.go
@ -17,12 +17,13 @@ type cell struct {
|
|||||||
qmlcell qml.Object
|
qmlcell qml.Object
|
||||||
index int
|
index int
|
||||||
}
|
}
|
||||||
|
type slide []cell
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
cellQml qml.Object
|
cellQml qml.Object
|
||||||
window *qml.Window
|
window *qml.Window
|
||||||
slides []cell
|
slides slide
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -46,6 +47,8 @@ func run() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
fmt.Println("ignore", cellQml)
|
||||||
|
qml.RunMain(slides.addCell())
|
||||||
|
|
||||||
window = mainQml.CreateWindow(nil)
|
window = mainQml.CreateWindow(nil)
|
||||||
|
|
||||||
@ -54,14 +57,17 @@ func run() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cl *cell) addCell() {
|
func (sl *slide) addCell( /*cl *cell*/ ) {
|
||||||
cl.index = len(slides)
|
var cl cell
|
||||||
|
cl.index = len(*sl)
|
||||||
|
fmt.Println("index: ", cl.index)
|
||||||
cl.qmlcell = cellQml.Create(nil)
|
cl.qmlcell = cellQml.Create(nil)
|
||||||
|
fmt.Println("index: ", cl.index)
|
||||||
fmt.Println(cl.qmlcell.ObjectByName("celltext").Property("text"))
|
fmt.Println(cl.qmlcell.ObjectByName("celltext").Property("text"))
|
||||||
cl.text = "testing 1... 2... 3..."
|
cl.text = "testing 1... 2... 3..."
|
||||||
fmt.Println(cl)
|
fmt.Println(cl)
|
||||||
slides = append(slides, *cl)
|
//*sl = append(*sl, *cl)
|
||||||
slides[cl.index].qmlcell.Set("parent", window.ObjectByName("data1"))
|
//*sl[0] //.qmlcell.Set("parent", window.ObjectByName("data1"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user