work on changing image
This commit is contained in:
parent
d37a260236
commit
d81fb1f7fb
30
main.go
30
main.go
@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/go-gl/gl/v2.1/gl"
|
"github.com/go-gl/gl/v2.1/gl"
|
||||||
"github.com/go-gl/glfw/v3.1/glfw"
|
"github.com/go-gl/glfw/v3.1/glfw"
|
||||||
@ -39,8 +40,8 @@ var (
|
|||||||
err error
|
err error
|
||||||
monitors []*glfw.Monitor
|
monitors []*glfw.Monitor
|
||||||
projMonitor *glfw.Monitor
|
projMonitor *glfw.Monitor
|
||||||
tex1 *uint32
|
tex1 *uint32
|
||||||
texDel, quickEdit Bool = false, false
|
texDel, quickEdit Bool = false, false
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -300,7 +301,8 @@ func (cl *cell) setSignal() {
|
|||||||
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func(musEvent qml.Object) {
|
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func(musEvent qml.Object) {
|
||||||
btn := musEvent.Property("button")
|
btn := musEvent.Property("button")
|
||||||
if btn == 2 {
|
if btn == 2 {
|
||||||
//cl.qmlcell.ObjectByName("cellMouse").Call("rightClicked")
|
window.ObjectByName("mnuCtx").Call("popup")
|
||||||
|
rhtClkCell = cl.index
|
||||||
} else {
|
} else {
|
||||||
selSlide = cl.qmlcell.Int("index")
|
selSlide = cl.qmlcell.Int("index")
|
||||||
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
|
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
|
||||||
@ -317,20 +319,16 @@ func (cl *cell) setSignal() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
window.ObjectByName("mnuImgPick").On("triggered", func() {
|
window.ObjectByName("imgpicker").On("accepted", func() {
|
||||||
url := window.Call("openFileDialog")
|
//url := window.Call("getFileDialogUrl")
|
||||||
slides[rhtClkCell].img.Clear
|
url := filepath.Clean(strings.Replace(window.ObjectByName("imgpicker").String("fileUrl"), "file:","",1))
|
||||||
slides[rhtClkCell].img.ReadImage(url)
|
|
||||||
})
|
|
||||||
|
|
||||||
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func(mouse qml.Object) {
|
slides[rhtClkCell].img.Clear()
|
||||||
if mouse.Property("button") == 2 {
|
slides[rhtClkCell].img.ReadImage(url)
|
||||||
window.ObjectByName("mnuCtx").Call("popup")
|
fmt.Println(url)
|
||||||
rhtell = cl.index
|
setupScene()
|
||||||
} else {
|
|
||||||
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
|
fmt.Println(window.ObjectByName("imgpicker").String("fileUrl"))
|
||||||
cl.qmlcell.ObjectByName("cellMouse").Call("selected")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
||||||
|
12
main.qml
12
main.qml
@ -16,10 +16,9 @@ ApplicationWindow {
|
|||||||
height: 600
|
height: 600
|
||||||
property bool cls: false
|
property bool cls: false
|
||||||
|
|
||||||
function openFileDialog() {
|
/*function getFileDialogUrl() {
|
||||||
imgpicker.open()
|
return
|
||||||
return imgpicker.fileUrl
|
}*/
|
||||||
}
|
|
||||||
|
|
||||||
onClosing: if (!cls) {
|
onClosing: if (!cls) {
|
||||||
close.accepted = false
|
close.accepted = false
|
||||||
@ -28,7 +27,7 @@ ApplicationWindow {
|
|||||||
FileDialog {
|
FileDialog {
|
||||||
id: imgpicker
|
id: imgpicker
|
||||||
title: "Choose an image for this slide"
|
title: "Choose an image for this slide"
|
||||||
folder: shortcuts.pictures
|
objectName: "imgpicker"
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog {
|
AboutDialog {
|
||||||
@ -44,8 +43,6 @@ ApplicationWindow {
|
|||||||
menuBar: MenuBar {
|
menuBar: MenuBar {
|
||||||
Menu {
|
Menu {
|
||||||
title: "&File"
|
title: "&File"
|
||||||
MenuItem {
|
|
||||||
}
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Close"
|
text: "Close"
|
||||||
shortcut: StandardKey.Quit
|
shortcut: StandardKey.Quit
|
||||||
@ -74,6 +71,7 @@ ApplicationWindow {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
objectName: "mnuImgPick"
|
objectName: "mnuImgPick"
|
||||||
text: "new Image..."
|
text: "new Image..."
|
||||||
|
onTriggered: imgpicker.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user