From a8534bd967e36d7143700676b8f3a31abdab0bdd Mon Sep 17 00:00:00 2001 From: lordwelch Date: Wed, 7 Feb 2018 10:00:10 -0800 Subject: [PATCH] Now in in a not completely worthless state Need to do some basic checks like bounds checking And make the images show back up --- glfw.go | 148 ++---------- imagick.go | 27 ++- main.go | 300 +++++++++++++------------ qml.go | 187 ++++++++------- qml/{qml/cell.qml => Cell.qml} | 21 ++ qml/Display.qml | 17 ++ qml/{main.qml => Main.qml} | 23 +- qml/Service.qml | 197 ++++++++++++++++ qml/{qml/songEdit.qml => SongEdit.qml} | 22 +- qml/{lst/lstEle.qml => Sublist.qml} | 0 qml/{qml => }/fileDialogs.qml | 0 qml/{qml => }/img.qml | 0 qml/lst/tst.qml | 180 --------------- qml/qml/AboutDialog.qml | 12 - qrc.go | 8 +- 15 files changed, 553 insertions(+), 589 deletions(-) rename qml/{qml/cell.qml => Cell.qml} (75%) create mode 100644 qml/Display.qml rename qml/{main.qml => Main.qml} (94%) create mode 100644 qml/Service.qml rename qml/{qml/songEdit.qml => SongEdit.qml} (93%) rename qml/{lst/lstEle.qml => Sublist.qml} (100%) rename qml/{qml => }/fileDialogs.qml (100%) rename qml/{qml => }/img.qml (100%) delete mode 100644 qml/lst/tst.qml delete mode 100644 qml/qml/AboutDialog.qml diff --git a/glfw.go b/glfw.go index 65d02a5..a859def 100644 --- a/glfw.go +++ b/glfw.go @@ -3,117 +3,31 @@ package main import ( "fmt" - "image" - "log" - "github.com/go-gl/gl/v2.1/gl" "github.com/go-gl/glfw/v3.1/glfw" - "github.com/lordwelch/qml" ) var ( - win *glfw.Window - monWidth int //displayed height - monHeight int //displayed width - monitors []*glfw.Monitor - projMonitor *glfw.Monitor - tex1 *uint32 //identifier for opengl texture - texDel Bool //if texture should be deleted + monitorHeight int // displayed width + monitors []*glfw.Monitor + monitorWidth int // displayed height + projectorMonitor *glfw.Monitor ) -func setupScene() { - - gl.ClearColor(0, 0, 0, 0) - if texDel { - gl.DeleteTextures(1, tex1) - } - tex1 = newTexture(*slides[selCell].getImage(monWidth, monHeight)) - - gl.MatrixMode(gl.PROJECTION) - gl.LoadIdentity() - gl.Ortho(-1, 1, -1, 1, 1.0, 10.0) - gl.MatrixMode(gl.MODELVIEW) - gl.LoadIdentity() - texDel = true - -} - -func drawSlide() { - gl.Clear(gl.COLOR_BUFFER_BIT) - - gl.MatrixMode(gl.MODELVIEW) - gl.LoadIdentity() - gl.Translatef(0, 0, -3.0) - - gl.Begin(gl.QUADS) - - //top left - gl.TexCoord2f(0, 0) - gl.Vertex3f(-1, 1, 0) - //top right - gl.TexCoord2f(1, 0) - gl.Vertex3f(1, 1, 0) - - //bottom right - gl.TexCoord2f(1, 1) - gl.Vertex3f(1, -1, 0) - - //bottom left - gl.TexCoord2f(0, 1) - gl.Vertex3f(-1, -1, 0) - - gl.End() - -} - -func newTexture(rgba image.RGBA) *uint32 { - var texture1 uint32 - gl.Enable(gl.TEXTURE_2D) - gl.GenTextures(1, &texture1) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) - gl.TexImage2D( - gl.TEXTURE_2D, - 0, - gl.RGBA, - int32(rgba.Rect.Size().X), - int32(rgba.Rect.Size().Y), - 0, - gl.RGBA, - gl.UNSIGNED_BYTE, - gl.Ptr(rgba.Pix)) - - return &texture1 - -} - func checkMon() { monitors = glfw.GetMonitors() - glfw.WindowHint(glfw.ContextVersionMajor, 2) - glfw.WindowHint(glfw.ContextVersionMinor, 1) - glfw.WindowHint(glfw.AutoIconify, glfw.False) - glfw.WindowHint(glfw.Decorated, glfw.False) if i := len(monitors); i < 2 { fmt.Println("You only have 1 monitor!!!!!!!!!!! :-P") - monWidth = 800 - monHeight = 600 + monitorWidth = 800 + monitorHeight = 600 - win, err = glfw.CreateWindow(monWidth, monHeight, "Cube", nil, nil) - if err != nil { - panic(err) - } - projMonitor = monitors[0] + projectorMonitor = monitors[0] } else { fmt.Printf("You have %d monitors\n", i) - monWidth = monitors[1].GetVideoMode().Width - monHeight = monitors[1].GetVideoMode().Height - win, err = glfw.CreateWindow(monWidth, monHeight, "Cube", nil, nil) - win.SetPos(monitors[1].GetPos()) - fmt.Printf("Width: %d Height: %d \n", monWidth, monHeight) - if err != nil { - panic(err) - } - projMonitor = monitors[1] + monitorWidth = monitors[1].GetVideoMode().Width + monitorHeight = monitors[1].GetVideoMode().Height + projectorMonitor = monitors[1] } monitorInfo() @@ -121,43 +35,23 @@ func checkMon() { } func monitorInfo() { + fmt.Println(len(monitors)) for _, mon := range monitors { - fmt.Printf("monitor name: %s\n", mon.GetName()) - i, t := mon.GetPos() - fmt.Printf("position X: %d Y: %d\n", i, t) + fmt.Printf("Monitor name: %s\n", mon.GetName()) + x, y := mon.GetPos() + fmt.Printf("Position: %v, %v\n", x, y) + fmt.Printf("Size: %v x %v\n", mon.GetVideoMode().Width, mon.GetVideoMode().Height) } } func glInit() { - window.Set("cls", false) - if err = glfw.Init(); err != nil { - log.Fatalln("failed to initialize glfw:", err) - } - checkMon() - - win.MakeContextCurrent() - - if err := gl.Init(); err != nil { - panic(err) - } - - win.SetPos(projMonitor.GetPos()) - setupScene() - - qml.Func1 = func() int { - if !win.ShouldClose() { - //glfw.PollEvents() - drawSlide() - win.SwapBuffers() - return 0 - - } - win.Hide() - //win.Destroy() - //glfw.Terminate() - return 1 - + if err = glfw.Init(); err == nil { + checkMon() + DisplayWindow.Root().Set("height", monitorHeight) + DisplayWindow.Root().Set("width", monitorWidth) + DisplayWindow.Root().Set("x", 0) + DisplayWindow.Root().Set("y", 0) } } diff --git a/imagick.go b/imagick.go index 3579916..a8db83f 100644 --- a/imagick.go +++ b/imagick.go @@ -67,8 +67,8 @@ func resizeImage(mw *imagick.MagickWand, newWidth, newHeight int, keepSpecSize, } //getImage() from imagick to image.RGBA -func (cl *cell) getImage(width, height int) (img *image.RGBA) { - mw := cl.img.GetImage() +func (cl *Cell) getImage(width, height int) (img *image.RGBA) { + mw := cl.image.img.GetImage() if (width == 0) || (height == 0) { width = int(mw.GetImageWidth()) height = int(mw.GetImageHeight()) @@ -91,7 +91,7 @@ func (cl *cell) getImage(width, height int) (img *image.RGBA) { } // adding text to image copied from example -func (cl *cell) imgtext(width, height int) *imagick.MagickWand { +func (cl *Cell) imgtext(width, height int) *imagick.MagickWand { mw := imagick.NewMagickWand() //defer mw.Destroy() dw := imagick.NewDrawingWand() @@ -104,30 +104,30 @@ func (cl *cell) imgtext(width, height int) *imagick.MagickWand { mw.NewImage(uint(width), uint(height), pw) // Set up a 72 point white font - r, g, b, _ := cl.font.color.RGBA() + r, g, b, _ := cl.Font.color.RGBA() pw.SetColor(fmt.Sprintf("rgb(%d,%d,%d)", r, g, b)) dw.SetFillColor(pw) - if (cl.font.name != "") || (cl.font.name != "none") { - dw.SetFont(cl.font.name) + if (cl.Font.name != "") || (cl.Font.name != "none") { + dw.SetFont(cl.Font.name) } - dw.SetFontSize(cl.font.size) + dw.SetFontSize(cl.Font.size) otlne := "none" // Add a black outline to the text - r, g, b, _ = cl.font.outlineColor.RGBA() - if cl.font.outline { + r, g, b, _ = cl.Font.outlineColor.RGBA() + if cl.Font.outline { otlne = fmt.Sprintf("rgb(%d,%d,%d)", r, g, b) } pw.SetColor(otlne) dw.SetStrokeColor(pw) - dw.SetStrokeWidth(cl.font.outlineSize) + dw.SetStrokeWidth(cl.Font.outlineSize) // Turn antialias on - not sure this makes a difference //dw.SetTextAntialias(true) // Now draw the text - dw.Annotation(cl.font.x, cl.font.y, cl.text) + dw.Annotation(cl.Font.x, cl.Font.y, cl.text) // Draw the image on to the mw mw.DrawImage(dw) @@ -151,7 +151,7 @@ func (cl *cell) imgtext(width, height int) *imagick.MagickWand { return mw } -func findfonts() { +func findFonts() { cmd := exec.Command("grep", "-ivE", `\-Oblique$|-Bold$|-Italic$|-Light$`) cmd.Stdin = strings.NewReader(strings.Join(imagick.QueryFonts("*"), "\n")) var out bytes.Buffer @@ -160,8 +160,7 @@ func findfonts() { if err != nil { log.Print(err) } - QML.FontList = strings.Split(out.String(), "\n") - QML.FontLen = len(QML.FontList) + QML.FontList = out.String() } func round(a float64) int { diff --git a/main.go b/main.go index a5e93b0..b200a80 100644 --- a/main.go +++ b/main.go @@ -9,45 +9,50 @@ import ( "os" "github.com/go-gl/glfw/v3.1/glfw" - "github.com/lordwelch/qml" + "github.com/limetext/qml-go" + "gopkg.in/gographics/imagick.v2/imagick" ) -//Bool type i'm lazy wanted a toggle function -type Bool bool +type Cell struct { + Font Font + image Image + index, collectionIndex int + qmlObject qml.Object + text string + textVisible bool +} + +type collection []*Cell + +type Font struct { + color color.RGBA + name string + outline bool + outlineColor color.RGBA + outlineSize, size, x, y float64 +} + +type Image struct { + img *imagick.MagickWand + imgSource string + qmlImage qml.Object +} type qmlVar struct { - FontList []string - FontLen int - Verses []string - VerseLen int - VerseOrder []string - OrderLen int - Img []string - ImgLen int + FontList string + Verses string + VerseOrder string + //Img string } -type cell struct { - text string - img *imagick.MagickWand - qmlimg qml.Object - qmlcell qml.Object - index int - font struct { - name string - outlineSize, size, x, y float64 - color color.RGBA - outlineColor color.RGBA - outline Bool - } -} - -type slide []*cell +type service []collection var ( - path string - slides slide - err error + currentService = new(service) + err error + path string + slides collection ) func main() { @@ -56,157 +61,176 @@ func main() { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - win.Destroy() - glfw.PollEvents() glfw.Terminate() } func run() error { - imagick.Initialize() - engine = qml.NewEngine() QML = &qmlVar{} - engine.Context().SetVar("go", QML) - findfonts() - engine.AddImageProvider("images", imgProvider) path = "qrc:///qml" + imagick.Initialize() + findFonts() - mainQml, err = engine.LoadFile(path + "/main.qml") + engine.Context().SetVar("go", QML) + engine.AddImageProvider("images", imgProvider) + + err = qmlWindows() if err != nil { return err } - edtQml, err = engine.LoadFile(path + "/qml/songEdit.qml") - if err != nil { - return err - } + currentService.Init(1) - cellQml, err = engine.LoadFile(path + "/qml/cell.qml") - if err != nil { - return err - } - - qimg, err = engine.LoadFile(path + "/qml/img.qml") - if err != nil { - return err - } - - qlst, err := engine.LoadFile(path + "/lst/tst.qml") - if err != nil { - return err - } - - qlstEle, err := engine.LoadFile(path + "/lst/lstEle.qml") - if err != nil { - return err - } - - window = mainQml.CreateWindow(engine.Context()) - window2 = edtQml.CreateWindow(engine.Context()) - - textEdit = window.ObjectByName("textEdit") //signals for whole qml setSignals() - slides.add() - - //var from GO to qml //image is ready for imageprovider imgready = true - tstlst :=qlst.Create(engine.Context()) - tstlst.Set("parent", window.ObjectByName("data1")) - tstLlst := qlstEle.Create(engine.Context()) - tstLlst.Call("get1") - //fmt.Println(tstLlst.Property("id1")) - tstlst.Call("addLst") //.Call("get1") //).(qml.Object).Create(engine.Context()).Set("parent", qlst.ObjectByName("nestedModel")) - window.Show() - window2.Show() - edtQmlShow() - slides[0].clearcache() - qml.RunMain(glInit) - window.Wait() + displayImg = DisplayWindow.Root().ObjectByName("displayImage") + serviceObject = serviceQml.Create(engine.Context()) + serviceObject.Set("parent", MainWindow.ObjectByName("data1")) + serviceObject.Call("addLst", "shit") + + //edtQmlShow() + qml.RunMain(glInit) + MainWindow.Wait() + slides.destroy() + fmt.Println(len(*currentService)) imagick.Terminate() return nil } -//Adds a new cell -func (sl *slide) add( /*cl *cell*/ ) { - var cl cell - cl.Init() - //gets the length so that the index is valid - cl.index = len(*sl) +func (sv *service) Init(num int) { + if num <= 0 { + num = 1 + } - //increase count on parent QML element - window.ObjectByName("gridRect").Set("count", window.ObjectByName("gridRect").Int("count")+1) - cl.qmlcell = cellQml.Create(engine.Context()) - cl.qmlcell.Set("objectName", fmt.Sprintf("cellRect%d", len(*sl))) - cl.qmlcell.Set("parent", window.ObjectByName("data1")) - cl.qmlcell.Set("index", cl.index) + for index := 0; index < num; index++ { + if sv == nil { + sv.add("") + } + } +} + +func (sv *service) add(name string) { + var ( + sl collection + i = len(*sv) + ) + + if len(name) <= 0 { + name = "Song: " + fmt.Sprint(i) + } + + sl.init(1) + *sv = append(*sv, sl) + //serviceObject.Call("addLst", name) +} + +func (sv *service) remove(i int) { + (*sv)[i].destroy() + + copy((*sv)[i:], (*sv)[i+1:]) + (*sv)[len(*sv)-1] = nil // or the zero value of T + *sv = (*sv)[:len(*sv)-1] + +} + +func (sv *service) destroy() { + for i := len(*sv); i > 0; i-- { + sv.remove(i - 1) + } +} + +func (sl *collection) init(num int) { + if num <= 0 { + num = 1 + } + + for index := 0; index < num; index++ { + if sl == nil { + sl.add("") + } + } +} + +//Adds a new cell +func (sl *collection) add(text string) { + var ( + cl Cell + i = len(*sl) + ) + + if len(text) <= 0 { + text = "Slide" + fmt.Sprint(i) + } + + cl.Init() //keep the pointer/dereference (i'm not sure which it is) //problems occur otherwise + // now Im not an idiot and I know what this does *sl = append(*sl, &cl) //seperate image object in QML - cl.qmlimg.Set("objectName", fmt.Sprintf("cellImg%d", cl.index)) - cl.qmlimg.Set("source", fmt.Sprintf("image://images/%d"+`;`+"0", cl.index)) - cl.qmlimg.Set("parent", window.ObjectByName("data2")) - cl.qmlimg.Set("index", cl.index) + cl.image.qmlImage.Set("source", fmt.Sprintf("image://images/cell;%d", cl.index)) cl.setSignal() //give QML the text - cl.qmlcell.ObjectByName("cellText").Set("text", cl.text) - -} - -func (cl *cell) Init() { - cl.text = "hello this is text\nhaha\nhdsjfklfhaskjd" - cl.index = -1 - cl.font.color, cl.font.outlineColor = color.RGBA{0, 0, 0, 1}, color.RGBA{1, 1, 1, 1} - cl.font.name = "none" - cl.font.outline = false - cl.font.outlineSize = 1 - cl.font.size = 35 - cl.font.x, cl.font.y = 10, 30 - - cl.qmlcell = cellQml.Create(engine.Context()) - cl.qmlimg = qimg.Create(engine.Context()) - - //load image - cl.img = imagick.NewMagickWand() - cl.img.ReadImage("logo:") - -} - -//(cell) remove() should destroy everything for this cell -func (cl *cell) remove() { - cl.text = "" - cl.qmlimg.Destroy() - cl.qmlcell.Destroy() - cl.img.Destroy() - window.ObjectByName("gridRect").Set("count", window.ObjectByName("gridRect").Int("count")-1) - slides.remove(cl.index) - cl.index = -1 } //(slide) remove copied from github.com/golang/go/wiki/SliceTricks -func (sl *slide) remove(i int) { - *sl, (*sl)[len((*sl))-1] = append((*sl)[:i], (*sl)[i+1:]...), nil +func (sl *collection) remove(i int) { + cl := (*sl)[i] + cl.text = "" + cl.image.qmlImage.Destroy() + cl.qmlObject.Destroy() + cl.image.img.Destroy() + MainWindow.ObjectByName("gridRect").Set("count", MainWindow.ObjectByName("gridRect").Int("count")-1) + cl.index = -1 + + copy((*sl)[i:], (*sl)[i+1:]) + (*sl)[len(*sl)-1] = nil // or the zero value of T + (*sl) = (*sl)[:len(*sl)-1] + + //*sl, (*sl)[len((*sl))-1] = append((*sl)[:i], (*sl)[i+1:]...), nil } -//Toggle, lazy wanted a func for it -func (bl *Bool) Toggle() { - if *bl == false { - *bl = true - } else { - *bl = false +func (sl *collection) destroy() { + for i := len(*sl); i > 0; i-- { + sl.remove(i - 1) } } +func (cl *Cell) Init() { + cl.text = `hello this is text` + cl.index = -1 + cl.Font.color, cl.Font.outlineColor = color.RGBA{0, 0, 0, 1}, color.RGBA{1, 1, 1, 1} + cl.Font.name = "none" + cl.Font.outline = false + cl.Font.outlineSize = 1 + cl.Font.size = 35 + cl.Font.x, cl.Font.y = 10, 30 + + cl.qmlObject = cellQml.Create(engine.Context()) + cl.image.qmlImage = cl.qmlObject.ObjectByName("cellImg") + + //load image + cl.image.img = imagick.NewMagickWand() + cl.image.img.ReadImage("logo:") + +} + +func (cl *Cell) Select() { + selectedCell = cl.index + cl.qmlObject.ObjectByName("cellMouse").Call("selected") + +} + //not really needed -func (cl cell) String() string { +func (cl Cell) String() string { return fmt.Sprintf("Index: %d \nText: %s\n", cl.index, cl.text) } diff --git a/qml.go b/qml.go index 405d8ca..f6a9fd3 100644 --- a/qml.go +++ b/qml.go @@ -8,90 +8,129 @@ import ( "strconv" "strings" - "github.com/lordwelch/qml" + "github.com/limetext/qml-go" ) var ( - selCell int //the focused cell - rhtClkCell int //the cell that was last right clicked - qimg qml.Object //file for the image object - cellQml qml.Object //file for the cell object - mainQml qml.Object //main QML file - edtQml qml.Object - textEdit qml.Object - window *qml.Window - window2 *qml.Window - engine *qml.Engine - quickEdit Bool = false - imgready Bool = false - QML *qmlVar + selectedCell int //the focused cell + rightClickCell int //the cell that was last right clicked + cellQml qml.Object //file for the cell object + mainQml qml.Object //main QML file + editQml qml.Object + textEdit qml.Object + displayQml qml.Object + displayImg qml.Object + DisplayWindow *qml.Window + MainWindow *qml.Window + songEditWindow *qml.Window + serviceObject qml.Object + serviceQml qml.Object + engine *qml.Engine + quickEdit bool = false + imgready bool = false + QML *qmlVar ) func initQML() { - window2.ObjectByName("textClrDialog").On("accepted", func() { + /*window2.ObjectByName("textClrDialog").On("accepted", func() { window2.ObjectByName("textClrDialog").Color("color") - }) + })*/ } -func (qv *qmlVar) Changed() { +func qmlWindows() error { + mainQml, err = engine.LoadFile(path + "/Main.qml") + if err != nil { + return err + } + + displayQml, err = engine.LoadFile(path + "/Display.qml") + if err != nil { + return err + } + + editQml, err = engine.LoadFile(path + "/SongEdit.qml") + if err != nil { + return err + } + + cellQml, err = engine.LoadFile(path + "/Cell.qml") + if err != nil { + return err + } + + serviceQml, err = engine.LoadFile(path + "/Service.qml") + if err != nil { + return err + } + + MainWindow = mainQml.CreateWindow(engine.Context()) + songEditWindow = editQml.CreateWindow(engine.Context()) + DisplayWindow = displayQml.CreateWindow(engine.Context()) + + textEdit = MainWindow.ObjectByName("textEdit") + return nil +} + +func showWindows() { + MainWindow.Show() + songEditWindow.Show() + DisplayWindow.Show() +} + +/*func (qv *qmlVar) Changed() { qml.Changed(qv, qv.VerseLen) qml.Changed(qv, qv.OrderLen) qml.Changed(qv, qv.ImgLen) qml.Changed(qv, qv.FontLen) -} +}*/ //signals for the cell and image in qml -func (cl *cell) setSignal() { - cl.qmlcell.ObjectByName("cellMouse").On("clicked", func(musEvent qml.Object) { - btn := musEvent.Property("button") +func (cl *Cell) setSignal() { + cl.qmlObject.ObjectByName("cellMouse").On("clicked", func(mouseEvent qml.Object) { + btn := mouseEvent.Property("button") //right click if btn == 2 { //context menu - window.ObjectByName("mnuCtx").Call("popup") - rhtClkCell = cl.index + MainWindow.ObjectByName("mnuCtx").Call("popup") + rightClickCell = cl.index } else { //left click //select and update image preview for cell - selCell = cl.qmlcell.Int("index") - cl.qmlcell.ObjectByName("cellMouse").Set("focus", true) - setupScene() + cl.Select() } //update image preview cl.clearcache() }) - cl.qmlimg.ObjectByName("cellMouse").On("clicked", func(musEvent qml.Object) { - btn := musEvent.Property("button") + cl.image.qmlImage.ObjectByName("cellMouse").On("clicked", func(mouseEvent qml.Object) { + btn := mouseEvent.Property("button") //right click if btn == 2 { //context menu - window.ObjectByName("mnuCtx").Call("popup") - rhtClkCell = cl.index + MainWindow.ObjectByName("mnuCtx").Call("popup") + rightClickCell = cl.index } else { //left click //select and update image preview for cell - selCell = cl.qmlcell.Int("index") - cl.qmlcell.ObjectByName("cellMouse").Set("focus", true) - setupScene() + cl.Select() } - //update image preview - cl.clearcache() }) - cl.qmlcell.ObjectByName("cellMouse").On("focusChanged", func(focus bool) { + + cl.qmlObject.ObjectByName("cellMouse").On("focusChanged", func(focus bool) { if focus { - cl.qmlcell.ObjectByName("cellMouse").Call("selected") + cl.qmlObject.ObjectByName("cellMouse").Call("selected") } else { - cl.qmlcell.ObjectByName("cellMouse").Call("notSelected") + cl.qmlObject.ObjectByName("cellMouse").Call("notSelected") } }) - cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() { + cl.qmlObject.ObjectByName("cellMouse").On("doubleClicked", func() { if quickEdit { //cover the cell with the text edit textEdit.Set("cell", cl.index) - textEdit.Set("x", cl.qmlcell.Int("x")) - textEdit.Set("y", cl.qmlcell.Int("y")) - textEdit.Set("height", cl.qmlcell.Int("height")) + textEdit.Set("x", cl.qmlObject.Int("x")) + textEdit.Set("y", cl.qmlObject.Int("y")) + textEdit.Set("height", cl.qmlObject.Int("height")) textEdit.Set("z", 100) textEdit.Set("visible", true) textEdit.ObjectByName("textEdit1").Set("focus", true) @@ -106,64 +145,45 @@ func (cl *cell) setSignal() { //setSignals() for non dynamic elements func setSignals() { - window.ObjectByName("imgpicker").On("accepted", func() { + MainWindow.ObjectByName("imgpicker").On("accepted", func() { //delete file:// from url - url := filepath.Clean(strings.Replace(window.ObjectByName("imgpicker").String("fileUrl"), "file:", "", 1)) + url := filepath.Clean(strings.TrimPrefix(MainWindow.ObjectByName("imgpicker").String("fileUrl"), "file:")) //replace new image - slides[rhtClkCell].img.Clear() - slides[rhtClkCell].img.ReadImage(url) - setupScene() - //update image preview - slides[rhtClkCell].clearcache() + slides[rightClickCell].image.img.Clear() + slides[rightClickCell].image.img.ReadImage(url) }) - window.ObjectByName("btnAdd").On("clicked", func() { - slides.add() + MainWindow.ObjectByName("btnAdd").On("clicked", func() { + slides.add("not") }) - window.ObjectByName("btnRem").On("clicked", func() { - slides[len(slides)-1].remove() + MainWindow.ObjectByName("btnRem").On("clicked", func() { + slides.remove(len(slides) - 1) }) - window.ObjectByName("btnMem").On("clicked", func() { + MainWindow.ObjectByName("btnMem").On("clicked", func() { //run GC debug.FreeOSMemory() }) - window.On("closing", func() { - //close glfw first - if false == window.Property("cls") { - win.SetShouldClose(true) - window.Set("cls", true) - } - - }) - - window.ObjectByName("mnuDisplay").On("triggered", func() { - win.SetShouldClose(false) - window.Set("cls", false) - win.Show() - qml.ResetGLFW() - }) - - window.ObjectByName("mnuEdit").On("triggered", func() { - (&quickEdit).Toggle() + MainWindow.ObjectByName("mnuEdit").On("triggered", func() { + quickEdit = !quickEdit }) textEdit.ObjectByName("textEdit1").On("focusChanged", func(focus bool) { var ( - str string - cel *cell + str string + cell *Cell ) if !focus { //set text back to the cell str = textEdit.ObjectByName("textEdit1").String("text") - cel = slides[textEdit.Int("cell")] + cell = slides[textEdit.Int("cell")] if textEdit.Bool("txt") { - cel.qmlcell.ObjectByName("cellText").Set("text", str) - cel.text = str + cell.qmlObject.ObjectByName("cellText").Set("text", str) + cell.text = str } } }) @@ -176,26 +196,27 @@ func edtQmlShow() { //imgProvider() for preview images in QML func imgProvider(id string, width, height int) image.Image { + var img1 image.Image if imgready && (len(id) > 0) { //fmt.Println("source (provider): ", id) i1 := strings.Index(id, `;`) i, _ := strconv.Atoi(id[:i1]) - return slides[i].getImage(width, height) - + img1 = slides[i].getImage(width, height) + } else { + img1 = image.NewRGBA(image.Rect(0, 0, 340, 480)) } - var img1 image.Image = image.NewRGBA(image.Rect(0, 0, 340, 480)) return img1 } //clear cache dosen't actually clear the cache //just gives a new source so that the cache isn't used -func (cl *cell) clearcache() { - str := cl.qmlimg.String("source") +func (cl *Cell) clearcache() { + str := cl.image.qmlImage.String("source") i := strings.Index(str, `;`) str1 := str[:i] i1, _ := strconv.Atoi(str[i+1:]) str = str1 + `;` + strconv.Itoa(i1+1) //fmt.Println("new source (click): ", str) - cl.qmlimg.Set("source", str) + cl.image.qmlImage.Set("source", str) } diff --git a/qml/qml/cell.qml b/qml/Cell.qml similarity index 75% rename from qml/qml/cell.qml rename to qml/Cell.qml index 765e98b..cdfda78 100644 --- a/qml/qml/cell.qml +++ b/qml/Cell.qml @@ -59,4 +59,25 @@ Rectangle { } } } + Image { + id: img + antialiasing: true + source: "image://images/" + objectName: "cellImg" + property int index: 0 + height: 100 + transformOrigin: Item.TopLeft + fillMode: Image.PreserveAspectFit + anchors.right: parent.right + anchors.left: parent.left + //cache: false + MouseArea { + id: imgMouse + hoverEnabled: true + enabled: true + objectName: "cellMouse" + anchors.fill: parent + acceptedButtons: Qt.AllButtons + } +} } diff --git a/qml/Display.qml b/qml/Display.qml new file mode 100644 index 0000000..5ebd864 --- /dev/null +++ b/qml/Display.qml @@ -0,0 +1,17 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.3 + +ApplicationWindow { + flags: Qt.MaximumSize + Component.onCompleted: visible = true + + Image { + id: image1 + objectName: "displayImage" + sourceSize.height: 768 + sourceSize.width: 1024 + antialiasing: true + anchors.fill: parent + } + +} diff --git a/qml/main.qml b/qml/Main.qml similarity index 94% rename from qml/main.qml rename to qml/Main.qml index 8c143e5..7e5f22c 100644 --- a/qml/main.qml +++ b/qml/Main.qml @@ -2,7 +2,7 @@ import QtQuick 2.4 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.3 import QtQuick.Window 2.0 -import "qml" +//import "qml" import QtQuick.Layouts 1.0 ApplicationWindow { @@ -14,15 +14,6 @@ ApplicationWindow { minimumHeight: 500 width: 1000 height: 600 - property bool cls: false - - - /*function getFileDialogUrl() { - return - }*/ - /*onClosing: if (!cls) { - close.accepted = false - }*/ FileDialog { id: imgpicker @@ -32,10 +23,6 @@ ApplicationWindow { objectName: "imgpicker" } - AboutDialog { - id: aboutDialog - } - Action { id: aboutAction text: "About" @@ -125,7 +112,7 @@ ApplicationWindow { id: gridData objectName: "gridData" width: scview.width - 1 - height: data1.childrenRect.height//gridRect.count * 101 + height: data1.childrenRect.height //gridRect.count * 101 Rectangle { id: col1 @@ -147,7 +134,8 @@ ApplicationWindow { visible: false property bool txt: true Keys.onPressed: { - if ((event.key == Qt.Key_Return) && (event.modifiers & Qt.ControlModifier)) { + if ((event.key == Qt.Key_Return) + && (event.modifiers & Qt.ControlModifier)) { txt = true x = -100 @@ -194,7 +182,6 @@ ApplicationWindow { anchors.fill: parent clip: true height: data1.childrenRect.height - } } @@ -234,7 +221,7 @@ ApplicationWindow { objectName: "btnAdd" x: 8 y: 8 - text: qsTr("Button") +data1.childrenRect.height + text: qsTr("Button") + data1.childrenRect.height } Button { diff --git a/qml/Service.qml b/qml/Service.qml new file mode 100644 index 0000000..088434d --- /dev/null +++ b/qml/Service.qml @@ -0,0 +1,197 @@ +//https://gist.github.com/elpuri/3753756 +import QtQuick 2.4 + +Item { + id: rt + property ListElement def: ListElement { + property string cellText: " + + + + +Untitled 1 + + + + +

Header text

+This is paragraph text + +
+ + +" + property int collectionIndex: 0 + property string imageSource: "image://images/list:;cell:" + } + + Component.onCompleted: addLst("Haha :-P") + height: ((lst.count) * 50) + (lst.subCount * 100) + + anchors.right: parent.right + anchors.left: parent.left + anchors.leftMargin: 0 + function remove(List, index) { + lst.subCount-- + nestedModel.get(List).subItems.remove(index, 1) + } + + function pop(List) { + lst.subCount-- + nestedModel.get(List).subItems.remove(nestedModel.get( + List).subItems.count - 1, 1) + } + function newdef(index, txt, src) { + var item = Object.create(def) + item.collectionIndex = index + item.text = txt + item.imageSource = src + return item + } + function remLst() { + nestedModel.remove(nestedModel.count - 1, 1) + } + + function apppend(List, obj) { + lst.subCount++ + nestedModel.get(List).subItems.append(obj) + } + + function insert(List, index, obj) { + lst.subCount++ + nestedModel.get(List).subItems.insert(index, obj) + } + + function get(List, index) { + return nestedModel.get(List).subItems.get(index) + } + + function set(List, index, obj) { + nestedModel.get(List).subItems.set(index, obj) + } + + function addLst(str) { + var newCollection + var i = 0 + var temp = Qt.createComponent("Sublist.qml").createObject(rt, { + + }) + + newCollection = temp.get(0) + newCollection.name = str + newCollection.subItems.clear() + for (i = 0; i < 1; i++) { + newCollection.subItems.append(newdef(nestedModel.count, "idiot")) + } + + nestedModel.append(newCollection) + } + + ListView { + id: lst + anchors.fill: parent + y: 0 + height: ((lst.count) * 55) + (lst.subCount * 100) + interactive: false + property int subCount: 0 + model: nestedModel + delegate: Component { + id: categoryDelegate + Column { + anchors.right: parent.right + anchors.left: parent.left + + //width: 200 + Rectangle { + id: categoryItem + anchors.right: parent.right + anchors.left: parent.left + border.color: "black" + border.width: 5 + color: "white" + height: 50 + + //width: 200 + Text { + anchors.verticalCenter: parent.verticalCenter + x: 15 + font.pixelSize: 24 + text: name + clip: true + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 15 + anchors.leftMargin: 5 + } + + Rectangle { + color: "red" + width: 30 + height: 30 + anchors.right: parent.right + anchors.rightMargin: 15 + anchors.verticalCenter: parent.verticalCenter + + MouseArea { + anchors.fill: parent + + // Toggle the 'collapsed' property + onClicked: { + nestedModel.setProperty(index, "collapsed", + !collapsed) + if (!nestedModel.get(index).collapsed) { + lst.subCount = lst.subCount + subItemLoader.subItemModel.count + } else { + lst.subCount = lst.subCount - subItemLoader.subItemModel.count + } + } + } + } + } + + Loader { + id: subItemLoader + + // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null + // the Loader element retains the same height it had when sourceComponent was set. Setting visible + // to false makes the parent Column treat it as if it's height was 0. + visible: !collapsed + property variant subItemModel: subItems + sourceComponent: subItemColumnDelegate + onStatusChanged: if (status == Loader.Ready) { + item.model = subItemModel + } + } + } + } + } + + Component { + id: subItemColumnDelegate + Column { + property alias model: subItemRepeater.model + + width: rt.width + Repeater { + id: subItemRepeater + objectName: "repeater" + delegate: Cell { + } + } + } + } + ListModel { + id: nestedModel + objectName: "nestedModel" + } +} diff --git a/qml/qml/songEdit.qml b/qml/SongEdit.qml similarity index 93% rename from qml/qml/songEdit.qml rename to qml/SongEdit.qml index ccf6e89..3859e31 100644 --- a/qml/qml/songEdit.qml +++ b/qml/SongEdit.qml @@ -11,18 +11,14 @@ ApplicationWindow { ColorDialog { id: textClrDialog //objectname: "textClrDialog" - // @disable-check M16 title: "Please choose a color for the text" - // @disable-check M16 showAlphaChannel: true } ColorDialog { id: outlineClrDialog //objectname: "outlineClrDialog" - // @disable-check M16 title: "Please choose a color for the text" - // @disable-check M16 showAlphaChannel: true } @@ -183,9 +179,9 @@ ApplicationWindow { id: fontPicker objectName: "fontPicker" Layout.alignment: Qt.AlignLeft | Qt.AlignTop - model: go.fontLen - // @disable-check M16 - /*delegate:Text { + model: go.fontList.split("\n") + /*// @disable-check M16 + delegate:Text { text: go.fontList(index) }*/ @@ -222,9 +218,9 @@ ApplicationWindow { ComboBox { id: versePicker objectName: "versePicker" - model: go.verseLen - // @disable-check M16 - /* delegate: Text { + model: go.verses.split("\n") + /*// @disable-check M16 + delegate: Text { text: go.verses(index) }*/ } @@ -232,9 +228,9 @@ ApplicationWindow { ComboBox { id: imgPicker objectName: "imgPicker" - model: go.imgLen - // @disable-check M16 - /*delegate: Text { + model: go.img.split("\n") + /*// @disable-check M16 + delegate: Text { text: go.img(index) }*/ } diff --git a/qml/lst/lstEle.qml b/qml/Sublist.qml similarity index 100% rename from qml/lst/lstEle.qml rename to qml/Sublist.qml diff --git a/qml/qml/fileDialogs.qml b/qml/fileDialogs.qml similarity index 100% rename from qml/qml/fileDialogs.qml rename to qml/fileDialogs.qml diff --git a/qml/qml/img.qml b/qml/img.qml similarity index 100% rename from qml/qml/img.qml rename to qml/img.qml diff --git a/qml/lst/tst.qml b/qml/lst/tst.qml deleted file mode 100644 index e9d40ad..0000000 --- a/qml/lst/tst.qml +++ /dev/null @@ -1,180 +0,0 @@ -//https://gist.github.com/elpuri/3753756 -import QtQuick 2.4 - -Item { - id: tst4 - height: 50 + ((tst3.count - 1) * 50) + (tst3.subCount * 40) - width: 200 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - Component.onCompleted: { - addLst() - } - - function addLst() { - var tstm - tstm = nestedModel.get(0) - tstm.subItems = [ { itemName: "test" }, { itemName: "notest" } ] - - nestedModel.append(tstm) - - } - - ListView { - id: tst3 - anchors.fill: parent - property int subCount: 0 - model: nestedModel - delegate: Component { - id: categoryDelegate - Column { - anchors.right: parent.right - anchors.left: parent.left - - //width: 200 - Rectangle { - id: categoryItem - anchors.right: parent.right - anchors.left: parent.left - border.color: "black" - border.width: 5 - color: "white" - height: 50 - - //width: 200 - Text { - anchors.verticalCenter: parent.verticalCenter - x: 15 - font.pixelSize: 24 - text: categoryName - } - - Rectangle { - color: "red" - width: 30 - height: 30 - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.verticalCenter: parent.verticalCenter - - MouseArea { - anchors.fill: parent - - // Toggle the 'collapsed' property - onClicked: { - nestedModel.setProperty(index, "collapsed", !collapsed) - if (!nestedModel.get(index).collapsed) { - tst3.subCount = tst3.subCount + subItemLoader.subItemModel.count - } else { - tst3.subCount = tst3.subCount - subItemLoader.subItemModel.count - } - } - } - } - } - - Loader { - id: subItemLoader - - // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null - // the Loader element retains the same height it had when sourceComponent was set. Setting visible - // to false makes the parent Column treat it as if it's height was 0. - visible: !collapsed - property variant subItemModel: subItems - sourceComponent: subItemColumnDelegate - onStatusChanged: if (status == Loader.Ready) - item.model = subItemModel - } - } - } - } - - Component { - id: subItemColumnDelegate - Column { - property alias model: subItemRepeater.model - - width: tst4.width - Repeater { - id: subItemRepeater - delegate: Rectangle { - color: "#cccccc" - height: 40 - anchors.right: parent.right - anchors.left: parent.left - //width: 200 - border.color: "black" - border.width: 2 - - Text { - anchors.verticalCenter: parent.verticalCenter - x: 30 - font.pixelSize: 18 - text: itemName - } - } - } - } - } - ListModel { - id: nestedModel - objectName: "nestedModel" - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nisan" - }, - ListElement { - itemName: "Toyota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nissa" - }, - ListElement { - itemName: "Toyota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nissan" - }, - ListElement { - itemName: "Toota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - } -} - diff --git a/qml/qml/AboutDialog.qml b/qml/qml/AboutDialog.qml deleted file mode 100644 index 7a126d1..0000000 --- a/qml/qml/AboutDialog.qml +++ /dev/null @@ -1,12 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Dialogs 1.1 - -MessageDialog { - icon: StandardIcon.Information - text: "Presentation App \nVersion: Alpha" - detailedText: "Presentation App for use in a church service\nMade in 2016 by Timmy Welch." - title: "About" - height: 100 - width: 200 - standardButtons: StandardButton.Close -} diff --git a/qrc.go b/qrc.go index 8272b55..f616307 100644 --- a/qrc.go +++ b/qrc.go @@ -1,19 +1,19 @@ package main -// This file is automatically generated by github.com/lordwelch/qml/cmd/genqrc +// This file is automatically generated by github.com/limetext/qml-go/cmd/genqrc import ( "io/ioutil" "os" "path/filepath" - "github.com/lordwelch/qml" + "github.com/limetext/qml-go" ) func init() { var r *qml.Resources var err error - if true/*os.Getenv("QRC_REPACK") == "1"*/ { + if os.Getenv("QRC_REPACK") == "1" { err = qrcRepackResources() if err != nil { panic("cannot repack qrc resources: " + err.Error()) @@ -55,4 +55,4 @@ func qrcRepackResources() error { } var qrcResourcesRepacked []byte -var qrcResourcesData = "qres\x00\x00\x00\x01\x00\x00F\x9d\x00\x00\x00\x14\x00\x00E\xeb\x00\x00\x1cjimport QtQuick 2.4\nimport QtQuick.Dialogs 1.2\nimport QtQuick.Controls 1.3\nimport QtQuick.Window 2.0\nimport \"qml\"\nimport QtQuick.Layouts 1.0\n\nApplicationWindow {\n id: applicationWindow1\n title: \"Presentation App\"\n visible: true\n objectName: \"applicationWindow1\"\n minimumWidth: 500\n minimumHeight: 500\n width: 1000\n height: 600\n property bool cls: false\n\n\n /*function getFileDialogUrl() {\n return\n }*/\n onClosing: if (!cls) {\n close.accepted = false\n }\n\n FileDialog {\n id: imgpicker\n // @disable-check M16\n title: \"Choose an image for this slide\"\n // @disable-check M16\n objectName: \"imgpicker\"\n }\n\n AboutDialog {\n id: aboutDialog\n }\n\n Action {\n id: aboutAction\n text: \"About\"\n onTriggered: aboutDialog.open()\n }\n\n menuBar: MenuBar {\n Menu {\n title: \"&File\"\n MenuItem {\n text: \"Close\"\n shortcut: StandardKey.Quit\n }\n }\n Menu {\n title: \"&Edit\"\n MenuItem {\n text: \"quick edit\"\n objectName: \"mnuEdit\"\n }\n }\n\n Menu {\n title: \"Window\"\n\n MenuItem {\n text: \"Display\"\n objectName: \"mnuDisplay\"\n }\n }\n\n Menu {\n title: \"&Help\"\n MenuItem {\n action: aboutAction\n }\n }\n }\n\n Menu {\n objectName: \"mnuCtx\"\n title: \"new image...\"\n MenuItem {\n objectName: \"mnuImgPick\"\n text: \"new Image...\"\n onTriggered: imgpicker.open()\n }\n }\n\n SplitView {\n id: mainSlider\n objectName: \"mainSlider\"\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n anchors.top: parent.top\n anchors.left: parent.left\n anchors.rightMargin: 0\n anchors.bottomMargin: 0\n anchors.leftMargin: 0\n anchors.topMargin: 0\n orientation: Qt.Horizontal\n onResizingChanged: col1.width = gridData.width / 2\n\n Rectangle {\n id: gridRect\n objectName: \"gridRect\"\n width: 300\n color: \"#00000000\"\n border.width: 4\n anchors.left: parent.left\n anchors.leftMargin: 0\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 0\n anchors.top: parent.top\n anchors.topMargin: 0\n property int count: 0\n\n ScrollView {\n id: scview\n anchors.fill: parent\n anchors.margins: 4\n horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff\n verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn\n\n SplitView {\n id: gridData\n objectName: \"gridData\"\n width: scview.width - 1\n height: gridRect.count * 101\n\n Rectangle {\n id: col1\n objectName: \"col1\"\n width: gridData.width / 2\n color: \"#00000000\"\n transformOrigin: Item.TopLeft\n border.width: 0\n Rectangle {\n id: textEdit\n property int cell\n x: 232\n y: 622\n objectName: \"textEdit\"\n width: 200\n height: 200\n color: \"#ffffff\"\n visible: false\n property bool txt: true\n Keys.onPressed: {\n if ((event.key == Qt.Key_Return)\n && (event.modifiers & Qt.ControlModifier)) {\n txt = true\n\n x = -100\n y = -100\n visible = false\n focus = true\n enabled = false\n opacity = 0\n textEdit1.focus = false\n\n event.accepted = true\n }\n\n if (event.key == Qt.Key_Escape) {\n txt = false\n x = -100\n y = -100\n visible = false\n focus = true\n enabled = false\n opacity = 0\n textEdit1.focus = false\n\n event.accepted = true\n }\n }\n\n TextArea {\n id: textEdit1\n objectName: \"textEdit1\"\n anchors.fill: parent\n clip: true\n textFormat: Text.AutoText\n visible: true\n font.pixelSize: 12\n z: 99\n }\n }\n\n Column {\n id: data1\n objectName: \"data1\"\n spacing: 1\n anchors.fill: parent\n }\n }\n\n Rectangle {\n id: col2\n objectName: \"col2\"\n color: \"#00000000\"\n border.width: 0\n\n Column {\n id: data2\n spacing: 1\n objectName: \"data2\"\n anchors.fill: parent\n }\n }\n }\n }\n }\n\n Rectangle {\n id: mainView\n border.width: 0\n objectName: \"mainView\"\n anchors.right: parent.right\n anchors.rightMargin: 0\n anchors.leftMargin: 0\n anchors.left: gridRect.right\n anchors.bottom: parent.bottom\n anchors.top: parent.top\n z: 1\n clip: false\n visible: true\n\n Button {\n id: button1\n objectName: \"btnAdd\"\n x: 8\n y: 8\n text: qsTr(\"Button\")\n }\n\n Button {\n id: button2\n x: 8\n y: 39\n text: qsTr(\"Button\")\n objectName: \"btnRem\"\n }\n\n Button {\n id: button3\n x: 8\n y: 70\n text: qsTr(\"Button\")\n objectName: \"btnMem\"\n }\n }\n }\n}\n\x00\x00\x02\x1dimport QtQuick 2.4\n\nImage {\n id: img\n antialiasing: true\n source: \"image://images/\"\n objectName: \"cellImg\"\n property int index: 0\n height: 100\n transformOrigin: Item.TopLeft\n fillMode: Image.PreserveAspectFit\n anchors.right: parent.right\n anchors.left: parent.left\n //cache: false\n MouseArea {\n id: cellMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n }\n}\n\x00\x00\x00\xe9import QtQuick 2.2\nimport QtQuick.Dialogs 1.0\n\nFileDialog {\n id: imgDialog\n title: \"Please choose an image\"\n folder: shortcuts.home\n onAccepted: {\n }\n onRejected: {\n }\n Component.onCompleted: visible = true\n}\n\x00\x00\x1eyimport QtQuick 2.4\nimport QtQuick.Controls 1.4\nimport QtQuick.Layouts 1.1\nimport QtQuick.Dialogs 1.2\n//import Qt.labs.controls 1.0\n\nApplicationWindow {\n minimumHeight: 480\n minimumWidth: 640\n\n ColorDialog {\n id: textClrDialog\n //objectname: \"textClrDialog\"\n // @disable-check M16\n title: \"Please choose a color for the text\"\n // @disable-check M16\n showAlphaChannel: true\n }\n\n ColorDialog {\n id: outlineClrDialog\n //objectname: \"outlineClrDialog\"\n // @disable-check M16\n title: \"Please choose a color for the text\"\n // @disable-check M16\n showAlphaChannel: true\n }\n\n menuBar: MenuBar {\n Menu {\n title: \"&File\"\n MenuItem {\n text: \"Close\"\n }\n }\n Menu {\n title: \"&Edit\"\n MenuItem {\n text: \"quick edit\"\n objectName: \"mnuEdit\"\n }\n }\n\n Menu {\n title: \"Window\"\n\n MenuItem {\n text: \"Display\"\n objectName: \"mnuDisplay\"\n }\n }\n\n Menu {\n title: \"&Help\"\n MenuItem {\n //action: aboutAction\n }\n }\n }\n\n RowLayout {\n id: rowLayout1\n enabled: true\n smooth: true\n antialiasing: true\n anchors.fill: parent\n\n RowLayout {\n id: rowlayout3\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignTop\n Layout.maximumWidth: 225\n\n ColumnLayout {\n id: columnlayout2\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label1\n text: qsTr(\"Verses\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstVerses\n\t\t objectName: \"lstVerses\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n focus: true\n keyNavigationWraps: true\n boundsBehavior: Flickable.StopAtBounds\n model: go.verseLen\n\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verses(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label2\n text: qsTr(\"Verse Order\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstOrder\n\t\t objectName: \"lstOrder\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n boundsBehavior: Flickable.StopAtBounds\n model: go.orderLen\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verseOrder(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout4\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n RowLayout {\n id: rowLayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.preferredHeight: 30\n Layout.fillWidth: true\n\n ToolButton {\n id: textColorPicker\n objectName: \"textColorPicker\"\n text: \"Text Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text\"\n }\n\n ToolButton {\n id: outlineColorPicker\n objectName: \"outlineColorPicker\"\n text: \"Outline Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text outline\"\n }\n\n ComboBox {\n id: fontPicker\n objectName: \"fontPicker\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n model: go.fontLen\n // @disable-check M16\n /*delegate:Text {\n text: go.fontList(index)\n }*/\n\n }\n\n SpinBox {\n id: fontSize\n objectName: \"fontSize\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n maximumValue: 1000\n value: 1\n suffix: \"Pt\"\n }\n\n SpinBox {\n id: outlineSize\n stepSize: 0.1\n decimals: 1\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n objectName: \"outlineSize\"\n maximumValue: 10\n value: 1\n }\n }\n RowLayout {\n id: rowLayout2\n Layout.preferredHeight: 30\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n Layout.fillWidth: true\n\n ComboBox {\n id: versePicker\n objectName: \"versePicker\"\n model: go.verseLen\n // @disable-check M16\n /* delegate: Text {\n text: go.verses(index)\n }*/\n }\n\n ComboBox {\n id: imgPicker\n objectName: \"imgPicker\"\n model: go.imgLen\n // @disable-check M16\n /*delegate: Text {\n text: go.img(index)\n }*/\n }\n TextArea {\n id: txtVerse\n\t\t objectName: \"txtVerse\"\n width: 80\n height: 20\n text: qsTr(\"Text Edit\")\n textFormat: Text.AutoText\n Layout.fillHeight: true\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n font.pixelSize: 12\n selectByKeyboard: true\n selectByMouse: true\n }\n }\n }\n }\n}\n\x00\x00\x06eimport QtQuick 2.4\n\nRectangle {\n objectName: \"cellRect\"\n property int index: 0\n height: 100\n border.width: 2\n border.color: \"black\"\n anchors.right: parent.right\n anchors.left: parent.left\n\n Text {\n id: cellText\n enabled: true\n objectName: \"cellText\"\n text: \"\"\n clip: true\n wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n anchors.fill: parent\n anchors.right: parent.right\n anchors.rightMargin: 0\n anchors.left: parent.left\n anchors.leftMargin: 2\n\n MouseArea {\n id: cellMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n\n onMouseXChanged: cellHover()\n onExited: focusChanged(focus)\n\n function cellHover() {\n if (containsMouse) {\n parent.parent.border.color = \"skyblue\"\n parent.parent.color = \"darkblue\"\n parent.color = \"white\"\n } else if (focus) {\n parent.color = \"black\"\n }\n }\n\n function notSelected() {\n\n parent.parent.border.color = \"black\"\n parent.parent.color = \"white\"\n parent.color = \"black\"\n cellHover()\n }\n\n function selected() {\n parent.parent.border.color = \"blue\"\n parent.color = \"black\"\n parent.parent.color = \"gainsboro\"\n cellHover()\n }\n }\n }\n}\n\x00\x00\x01qimport QtQuick 2.4\nimport QtQuick.Dialogs 1.1\n\nMessageDialog {\n icon: StandardIcon.Information\n text: \"Presentation App \\nVersion: Alpha\"\n detailedText: \"Presentation App for use in a church service\\nMade in 2016 by Timmy Welch.\"\n title: \"About\"\n height: 100\n width: 200\n standardButtons: StandardButton.Close\n}\n\x00\x03\x00\x00x<\x00q\x00m\x00l\x00\b\b\x01Z\\\x00m\x00a\x00i\x00n\x00.\x00q\x00m\x00l\x00\a\x00:X\xdc\x00i\x00m\x00g\x00.\x00q\x00m\x00l\x00\x0f\x00\xd2\f\\\x00f\x00i\x00l\x00e\x00D\x00i\x00a\x00l\x00o\x00g\x00s\x00.\x00q\x00m\x00l\x00\f\x04K\xc3\\\x00s\x00o\x00n\x00g\x00E\x00d\x00i\x00t\x00.\x00q\x00m\x00l\x00\b\f/]\x1c\x00c\x00e\x00l\x00l\x00.\x00q\x00m\x00l\x00\x0f\x0e\xca\x18\xfc\x00A\x00b\x00o\x00u\x00t\x00D\x00i\x00a\x00l\x00o\x00g\x00.\x00q\x00m\x00l\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x00\x00\x02\x00\x00\x00\x05\x00\x00\x00\x04\x00\x00\x00\f\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\"\x00\x00\x00\x00\x00\x01\x00\x00\x1cn\x00\x00\x006\x00\x00\x00\x00\x00\x01\x00\x00\x1e\x8f\x00\x00\x00Z\x00\x00\x00\x00\x00\x01\x00\x00\x1f|\x00\x00\x00x\x00\x00\x00\x00\x00\x01\x00\x00=\xf9\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x01\x00\x00Db" +var qrcResourcesData = "qres\x00\x00\x00\x01\x00\x00b(\x00\x00\x00\x14\x00\x00aF\x00\x00\x02=import QtQuick 2.4\n\nListModel {\n id: nestedModel\n objectName: \"nestedModel\"\n function get1() {\n console.log(get(0))\n return get(0)\n }\n ListElement {\n categoryName: \"Cars\"\n collapsed: true\n subItems: [\n ListElement {\n itemName: \"tst\"\n },\n ListElement {\n itemName: \"Tota\"\n },\n ListElement {\n itemName: \"vy\"\n },\n ListElement {\n itemName: \"Audio Adrenaline\"\n }\n ]\n }\n}\n\x00\x00\x02\x1dimport QtQuick 2.4\n\nImage {\n id: img\n antialiasing: true\n source: \"image://images/\"\n objectName: \"cellImg\"\n property int index: 0\n height: 100\n transformOrigin: Item.TopLeft\n fillMode: Image.PreserveAspectFit\n anchors.right: parent.right\n anchors.left: parent.left\n //cache: false\n MouseArea {\n id: cellMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n }\n}\n\x00\x00\x1e!import QtQuick 2.4\nimport QtQuick.Controls 1.4\nimport QtQuick.Layouts 1.1\nimport QtQuick.Dialogs 1.2\n//import Qt.labs.controls 1.0\n\nApplicationWindow {\n minimumHeight: 480\n minimumWidth: 640\n\n ColorDialog {\n id: textClrDialog\n //objectname: \"textClrDialog\"\n title: \"Please choose a color for the text\"\n showAlphaChannel: true\n }\n\n ColorDialog {\n id: outlineClrDialog\n //objectname: \"outlineClrDialog\"\n title: \"Please choose a color for the text\"\n showAlphaChannel: true\n }\n\n menuBar: MenuBar {\n Menu {\n title: \"&File\"\n MenuItem {\n text: \"Close\"\n }\n }\n Menu {\n title: \"&Edit\"\n MenuItem {\n text: \"quick edit\"\n objectName: \"mnuEdit\"\n }\n }\n\n Menu {\n title: \"Window\"\n\n MenuItem {\n text: \"Display\"\n objectName: \"mnuDisplay\"\n }\n }\n\n Menu {\n title: \"&Help\"\n MenuItem {\n //action: aboutAction\n }\n }\n }\n\n RowLayout {\n id: rowLayout1\n enabled: true\n smooth: true\n antialiasing: true\n anchors.fill: parent\n\n RowLayout {\n id: rowlayout3\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignTop\n Layout.maximumWidth: 225\n\n ColumnLayout {\n id: columnlayout2\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label1\n text: qsTr(\"Verses\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstVerses\n\t\t objectName: \"lstVerses\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n focus: true\n keyNavigationWraps: true\n boundsBehavior: Flickable.StopAtBounds\n model: go.verseLen\n\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verses(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label2\n text: qsTr(\"Verse Order\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstOrder\n\t\t objectName: \"lstOrder\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n boundsBehavior: Flickable.StopAtBounds\n model: go.orderLen\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verseOrder(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout4\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n RowLayout {\n id: rowLayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.preferredHeight: 30\n Layout.fillWidth: true\n\n ToolButton {\n id: textColorPicker\n objectName: \"textColorPicker\"\n text: \"Text Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text\"\n }\n\n ToolButton {\n id: outlineColorPicker\n objectName: \"outlineColorPicker\"\n text: \"Outline Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text outline\"\n }\n\n ComboBox {\n id: fontPicker\n objectName: \"fontPicker\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n model: go.fontList.split(\"\\n\")\n /*// @disable-check M16\n delegate:Text {\n text: go.fontList(index)\n }*/\n\n }\n\n SpinBox {\n id: fontSize\n objectName: \"fontSize\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n maximumValue: 1000\n value: 1\n suffix: \"Pt\"\n }\n\n SpinBox {\n id: outlineSize\n stepSize: 0.1\n decimals: 1\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n objectName: \"outlineSize\"\n maximumValue: 10\n value: 1\n }\n }\n RowLayout {\n id: rowLayout2\n Layout.preferredHeight: 30\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n Layout.fillWidth: true\n\n ComboBox {\n id: versePicker\n objectName: \"versePicker\"\n model: go.verses.split(\"\\n\")\n /*// @disable-check M16\n delegate: Text {\n text: go.verses(index)\n }*/\n }\n\n ComboBox {\n id: imgPicker\n objectName: \"imgPicker\"\n model: go.img.split(\"\\n\")\n /*// @disable-check M16\n delegate: Text {\n text: go.img(index)\n }*/\n }\n TextArea {\n id: txtVerse\n\t\t objectName: \"txtVerse\"\n width: 80\n height: 20\n text: qsTr(\"Text Edit\")\n textFormat: Text.AutoText\n Layout.fillHeight: true\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n font.pixelSize: 12\n selectByKeyboard: true\n selectByMouse: true\n }\n }\n }\n }\n}\n\x00\x00\x00\xe9import QtQuick 2.2\nimport QtQuick.Dialogs 1.0\n\nFileDialog {\n id: imgDialog\n title: \"Please choose an image\"\n folder: shortcuts.home\n onAccepted: {\n }\n onRejected: {\n }\n Component.onCompleted: visible = true\n}\n\x00\x00\x01Jimport QtQuick 2.4\nimport QtQuick.Controls 1.3\n\nApplicationWindow {\n flags: Qt.MaximumSize\n Component.onCompleted: visible = true\n\n Image {\n id: image1\n objectName: \"displayImage\"\n sourceSize.height: 768\n sourceSize.width: 1024\n antialiasing: true\n anchors.fill: parent\n }\n\n}\n\x00\x00\x1cyimport QtQuick 2.4\nimport QtQuick.Dialogs 1.2\nimport QtQuick.Controls 1.3\nimport QtQuick.Window 2.0\n//import \"qml\"\nimport QtQuick.Layouts 1.0\n\nApplicationWindow {\n id: applicationWindow1\n title: \"Presentation App\"\n visible: true\n objectName: \"applicationWindow1\"\n minimumWidth: 500\n minimumHeight: 500\n width: 1000\n height: 600\n\n FileDialog {\n id: imgpicker\n // @disable-check M16\n title: \"Choose an image for this slide\"\n // @disable-check M16\n objectName: \"imgpicker\"\n }\n\n Action {\n id: aboutAction\n text: \"About\"\n onTriggered: aboutDialog.open()\n }\n\n menuBar: MenuBar {\n Menu {\n title: \"&File\"\n MenuItem {\n text: \"Close\"\n shortcut: StandardKey.Quit\n }\n }\n Menu {\n title: \"&Edit\"\n MenuItem {\n text: \"quick edit\"\n objectName: \"mnuEdit\"\n }\n }\n\n Menu {\n title: \"Window\"\n\n MenuItem {\n text: \"Display\"\n objectName: \"mnuDisplay\"\n }\n }\n\n Menu {\n title: \"&Help\"\n MenuItem {\n action: aboutAction\n }\n }\n }\n\n Menu {\n objectName: \"mnuCtx\"\n title: \"new image...\"\n MenuItem {\n objectName: \"mnuImgPick\"\n text: \"new Image...\"\n onTriggered: imgpicker.open()\n }\n }\n\n SplitView {\n id: mainSlider\n objectName: \"mainSlider\"\n anchors.right: parent.right\n anchors.bottom: parent.bottom\n anchors.top: parent.top\n anchors.left: parent.left\n anchors.rightMargin: 0\n anchors.bottomMargin: 0\n anchors.leftMargin: 0\n anchors.topMargin: 0\n orientation: Qt.Horizontal\n onResizingChanged: col1.width = gridData.width / 2\n\n Rectangle {\n id: gridRect\n objectName: \"gridRect\"\n width: 300\n color: \"#00000000\"\n border.width: 4\n anchors.left: parent.left\n anchors.leftMargin: 0\n anchors.bottom: parent.bottom\n anchors.bottomMargin: 0\n anchors.top: parent.top\n anchors.topMargin: 0\n property int count: 1\n property int expcount: 1\n\n ScrollView {\n id: scview\n anchors.fill: parent\n anchors.margins: 4\n horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff\n verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn\n\n SplitView {\n id: gridData\n objectName: \"gridData\"\n width: scview.width - 1\n height: data1.childrenRect.height //gridRect.count * 101\n\n Rectangle {\n id: col1\n objectName: \"col1\"\n width: gridData.width / 2\n color: \"#00000000\"\n transformOrigin: Item.TopLeft\n border.width: 0\n height: data1.childrenRect.height\n Rectangle {\n id: textEdit\n property int cell\n x: 232\n y: 622\n objectName: \"textEdit\"\n width: 200\n height: 200\n color: \"#ffffff\"\n visible: false\n property bool txt: true\n Keys.onPressed: {\n if ((event.key == Qt.Key_Return)\n && (event.modifiers & Qt.ControlModifier)) {\n txt = true\n\n x = -100\n y = -100\n visible = false\n focus = true\n enabled = false\n opacity = 0\n textEdit1.focus = false\n\n event.accepted = true\n }\n\n if (event.key == Qt.Key_Escape) {\n txt = false\n x = -100\n y = -100\n visible = false\n focus = true\n enabled = false\n opacity = 0\n textEdit1.focus = false\n\n event.accepted = true\n }\n }\n\n TextArea {\n id: textEdit1\n objectName: \"textEdit1\"\n anchors.fill: parent\n clip: true\n textFormat: Text.AutoText\n visible: true\n font.pixelSize: 12\n z: 99\n }\n }\n\n Column {\n id: data1\n objectName: \"data1\"\n spacing: 1\n anchors.fill: parent\n clip: true\n height: data1.childrenRect.height\n }\n }\n\n Rectangle {\n id: col2\n objectName: \"col2\"\n color: \"#00000000\"\n border.width: 0\n\n Column {\n id: data2\n spacing: 1\n objectName: \"data2\"\n anchors.fill: parent\n }\n }\n }\n }\n }\n\n Rectangle {\n id: mainView\n border.width: 0\n objectName: \"mainView\"\n anchors.right: parent.right\n anchors.rightMargin: 0\n anchors.leftMargin: 0\n anchors.left: gridRect.right\n anchors.bottom: parent.bottom\n anchors.top: parent.top\n z: 1\n clip: false\n visible: true\n\n Button {\n id: button1\n objectName: \"btnAdd\"\n x: 8\n y: 8\n text: qsTr(\"Button\") + data1.childrenRect.height\n }\n\n Button {\n id: button2\n x: 8\n y: 43\n text: qsTr(\"Button \")\n objectName: \"btnRem\"\n }\n\n Button {\n id: button3\n x: 8\n y: 78\n text: qsTr(\"Button \")\n objectName: \"btnMem\"\n }\n }\n }\n}\n\x00\x00\bqimport QtQuick 2.4\n\nRectangle {\n objectName: \"cellRect\"\n property int index: 0\n height: 100\n border.width: 2\n border.color: \"black\"\n anchors.right: parent.right\n anchors.left: parent.left\n\n Text {\n id: cellText\n enabled: true\n objectName: \"cellText\"\n text: \"\"\n clip: true\n wrapMode: Text.WrapAtWordBoundaryOrAnywhere\n anchors.fill: parent\n anchors.right: parent.right\n anchors.rightMargin: 0\n anchors.left: parent.left\n anchors.leftMargin: 2\n\n MouseArea {\n id: cellMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n\n onMouseXChanged: cellHover()\n onExited: focusChanged(focus)\n\n function cellHover() {\n if (containsMouse) {\n parent.parent.border.color = \"skyblue\"\n parent.parent.color = \"darkblue\"\n parent.color = \"white\"\n } else if (focus) {\n parent.color = \"black\"\n }\n }\n\n function notSelected() {\n\n parent.parent.border.color = \"black\"\n parent.parent.color = \"white\"\n parent.color = \"black\"\n cellHover()\n }\n\n function selected() {\n parent.parent.border.color = \"blue\"\n parent.color = \"black\"\n parent.parent.color = \"gainsboro\"\n cellHover()\n }\n }\n }\n Image {\n id: img\n antialiasing: true\n source: \"image://images/\"\n objectName: \"cellImg\"\n property int index: 0\n height: 100\n transformOrigin: Item.TopLeft\n fillMode: Image.PreserveAspectFit\n anchors.right: parent.right\n anchors.left: parent.left\n //cache: false\n MouseArea {\n id: imgMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n }\n}\n}\n\x00\x00\x17z//https://gist.github.com/elpuri/3753756\nimport QtQuick 2.4\n\nItem {\n id: rt\n property ListElement def: ListElement {\n property string cellText: \"\n\n\n\n\nUntitled 1\n\n\n\n\n

Header text

\nThis is paragraph text\n\n
\n\n\n\"\n property int collectionIndex: 0\n property string imageSource: \"image://images/list:;cell:\"\n }\n\n Component.onCompleted: addLst(\"Haha :-P\")\n height: ((lst.count) * 50) + (lst.subCount * 100)\n\n anchors.right: parent.right\n anchors.left: parent.left\n anchors.leftMargin: 0\n function remove(List, index) {\n lst.subCount--\n nestedModel.get(List).subItems.remove(index, 1)\n }\n\n function pop(List) {\n lst.subCount--\n nestedModel.get(List).subItems.remove(nestedModel.get(\n List).subItems.count - 1, 1)\n }\n function newdef(index, txt, src) {\n var item = Object.create(def)\n item.collectionIndex = index\n item.text = txt\n item.imageSource = src\n return item\n }\n function remLst() {\n nestedModel.remove(nestedModel.count - 1, 1)\n }\n\n function apppend(List, obj) {\n lst.subCount++\n nestedModel.get(List).subItems.append(obj)\n }\n\n function insert(List, index, obj) {\n lst.subCount++\n nestedModel.get(List).subItems.insert(index, obj)\n }\n\n function get(List, index) {\n return nestedModel.get(List).subItems.get(index)\n }\n\n function set(List, index, obj) {\n nestedModel.get(List).subItems.set(index, obj)\n }\n\n function addLst(str) {\n var newCollection\n var i = 0\n var temp = Qt.createComponent(\"Sublist.qml\").createObject(rt, {\n\n })\n\n newCollection = temp.get(0)\n newCollection.name = str\n newCollection.subItems.clear()\n for (i = 0; i < 1; i++) {\n newCollection.subItems.append(newdef(nestedModel.count, \"idiot\"))\n }\n\n nestedModel.append(newCollection)\n }\n\n ListView {\n id: lst\n anchors.fill: parent\n y: 0\n height: ((lst.count) * 55) + (lst.subCount * 100)\n interactive: false\n property int subCount: 0\n model: nestedModel\n delegate: Component {\n id: categoryDelegate\n Column {\n anchors.right: parent.right\n anchors.left: parent.left\n\n //width: 200\n Rectangle {\n id: categoryItem\n anchors.right: parent.right\n anchors.left: parent.left\n border.color: \"black\"\n border.width: 5\n color: \"white\"\n height: 50\n\n //width: 200\n Text {\n anchors.verticalCenter: parent.verticalCenter\n x: 15\n font.pixelSize: 24\n text: name\n clip: true\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.rightMargin: 15\n anchors.leftMargin: 5\n }\n\n Rectangle {\n color: \"red\"\n width: 30\n height: 30\n anchors.right: parent.right\n anchors.rightMargin: 15\n anchors.verticalCenter: parent.verticalCenter\n\n MouseArea {\n anchors.fill: parent\n\n // Toggle the 'collapsed' property\n onClicked: {\n nestedModel.setProperty(index, \"collapsed\",\n !collapsed)\n if (!nestedModel.get(index).collapsed) {\n lst.subCount = lst.subCount + subItemLoader.subItemModel.count\n } else {\n lst.subCount = lst.subCount - subItemLoader.subItemModel.count\n }\n }\n }\n }\n }\n\n Loader {\n id: subItemLoader\n\n // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null\n // the Loader element retains the same height it had when sourceComponent was set. Setting visible\n // to false makes the parent Column treat it as if it's height was 0.\n visible: !collapsed\n property variant subItemModel: subItems\n sourceComponent: subItemColumnDelegate\n onStatusChanged: if (status == Loader.Ready) {\n item.model = subItemModel\n }\n }\n }\n }\n }\n\n Component {\n id: subItemColumnDelegate\n Column {\n property alias model: subItemRepeater.model\n\n width: rt.width\n Repeater {\n id: subItemRepeater\n objectName: \"repeater\"\n delegate: Cell {\n }\n }\n }\n }\n ListModel {\n id: nestedModel\n objectName: \"nestedModel\"\n }\n}\n\x00\x03\x00\x00x<\x00q\x00m\x00l\x00\v\x00\x12&\\\x00S\x00u\x00b\x00l\x00i\x00s\x00t\x00.\x00q\x00m\x00l\x00\a\x00:X\xdc\x00i\x00m\x00g\x00.\x00q\x00m\x00l\x00\f\x00K\xc3\\\x00S\x00o\x00n\x00g\x00E\x00d\x00i\x00t\x00.\x00q\x00m\x00l\x00\x0f\x00\xd2\f\\\x00f\x00i\x00l\x00e\x00D\x00i\x00a\x00l\x00o\x00g\x00s\x00.\x00q\x00m\x00l\x00\v\x02\x1eD\xdc\x00D\x00i\x00s\x00p\x00l\x00a\x00y\x00.\x00q\x00m\x00l\x00\b\b\x01^\\\x00M\x00a\x00i\x00n\x00.\x00q\x00m\x00l\x00\b\f/a\x1c\x00C\x00e\x00l\x00l\x00.\x00q\x00m\x00l\x00\v\x0f'Ǽ\x00S\x00e\x00r\x00v\x00i\x00c\x00e\x00.\x00q\x00m\x00l\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\b\x00\x00\x00\x02\x00\x00\x00\f\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x02A\x00\x00\x00<\x00\x00\x00\x00\x00\x01\x00\x00\x04b\x00\x00\x00Z\x00\x00\x00\x00\x00\x01\x00\x00\"\x87\x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x00#t\x00\x00\x00\x9a\x00\x00\x00\x00\x00\x01\x00\x00$\xc2\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x01\x00\x00A?\x00\x00\x00\xc6\x00\x00\x00\x00\x00\x01\x00\x00I\xb4"