fixed textbox to cell data transfer
and reorganized qml files added about dialog added qml file for the projection window
This commit is contained in:
parent
e53b352a63
commit
d26d6e08b2
32
main.go
32
main.go
@ -20,11 +20,12 @@ type cell struct {
|
|||||||
type slide []cell
|
type slide []cell
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
cellQml qml.Object
|
textEdit qml.Object
|
||||||
window *qml.Window
|
cellQml qml.Object
|
||||||
slides slide
|
window *qml.Window
|
||||||
err error
|
slides slide
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -44,12 +45,13 @@ func run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cellQml, err = engine.LoadFile(path + "/cell.qml")
|
cellQml, err = engine.LoadFile(path + "/qml/cell.qml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
window = mainQml.CreateWindow(nil)
|
window = mainQml.CreateWindow(nil)
|
||||||
|
textEdit = window.ObjectByName("textEdit")
|
||||||
slides.addCell()
|
slides.addCell()
|
||||||
|
|
||||||
window.Show()
|
window.Show()
|
||||||
@ -60,27 +62,39 @@ func run() error {
|
|||||||
func (cl *cell) setSignals() {
|
func (cl *cell) setSignals() {
|
||||||
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
||||||
cellText := cl.qmlcell.ObjectByName("cellText")
|
cellText := cl.qmlcell.ObjectByName("cellText")
|
||||||
textEdit := window.ObjectByName("textEdit")
|
textEdit.Set("cell", cl.index)
|
||||||
textEdit.Set("x", cellText.Int("x")+4)
|
textEdit.Set("x", cellText.Int("x")+4)
|
||||||
textEdit.Set("y", cellText.Int("y")+4)
|
textEdit.Set("y", cellText.Int("y")+4)
|
||||||
textEdit.Set("width", cellText.Int("width"))
|
textEdit.Set("width", cellText.Int("width"))
|
||||||
textEdit.Set("height", cellText.Int("height"))
|
textEdit.Set("height", cellText.Int("height"))
|
||||||
textEdit.Set("opacity", 100)
|
textEdit.Set("opacity", 100)
|
||||||
textEdit.Set("visible", true)
|
textEdit.Set("visible", true)
|
||||||
textEdit.Set("focus", true)
|
textEdit.ObjectByName("textEdit1").Set("focus", true)
|
||||||
textEdit.Set("enabled", true) /*
|
textEdit.Set("enabled", true) /*
|
||||||
fmt.Println(textEdit.Int("x"))
|
fmt.Println(textEdit.Int("x"))
|
||||||
fmt.Println(textEdit.Int("y"))
|
fmt.Println(textEdit.Int("y"))
|
||||||
fmt.Println(textEdit.Int("width"))
|
fmt.Println(textEdit.Int("width"))
|
||||||
fmt.Println(textEdit.Int("height"))*/
|
fmt.Println(textEdit.Int("height"))*/
|
||||||
})
|
})
|
||||||
|
textEdit.ObjectByName("textEdit1").On("focusChanged", func(focus bool) {
|
||||||
|
var (
|
||||||
|
str string
|
||||||
|
cel cell
|
||||||
|
)
|
||||||
|
fmt.Printf("focusChanged: focus: %t\n", focus)
|
||||||
|
if !focus {
|
||||||
|
str = textEdit.ObjectByName("textEdit1").String("text")
|
||||||
|
cel = slides[textEdit.Int("cell")]
|
||||||
|
cel.qmlcell.ObjectByName("cellText").Set("text", str)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sl *slide) addCell( /*cl *cell*/ ) {
|
func (sl *slide) addCell( /*cl *cell*/ ) {
|
||||||
var cl cell
|
var cl cell
|
||||||
|
|
||||||
cl.qmlcell = cellQml.Create(nil)
|
cl.qmlcell = cellQml.Create(nil)
|
||||||
cl.qmlcell.Set("objectName", fmt.Sprintf("cellRect&d", cl.index))
|
cl.qmlcell.Set("objectName", fmt.Sprintf("cellRect%d", cl.index))
|
||||||
cl.qmlcell.Set("parent", window.ObjectByName("data1"))
|
cl.qmlcell.Set("parent", window.ObjectByName("data1"))
|
||||||
|
|
||||||
cl.index = len(*sl)
|
cl.index = len(*sl)
|
||||||
|
30
main.qml
30
main.qml
@ -1,5 +1,8 @@
|
|||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.3
|
import QtQuick.Controls 1.3
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
|
import "qml"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: applicationWindow1
|
id: applicationWindow1
|
||||||
@ -10,6 +13,13 @@ ApplicationWindow {
|
|||||||
minimumHeight: 500
|
minimumHeight: 500
|
||||||
width: 1000
|
width: 1000
|
||||||
height: 600
|
height: 600
|
||||||
|
AboutDialog { id: aboutDialog }
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: aboutAction
|
||||||
|
text: "About"
|
||||||
|
onTriggered: aboutDialog.open()
|
||||||
|
}
|
||||||
|
|
||||||
menuBar: MenuBar {
|
menuBar: MenuBar {
|
||||||
Menu {
|
Menu {
|
||||||
@ -22,22 +32,10 @@ ApplicationWindow {
|
|||||||
shortcut: StandardKey.Quit
|
shortcut: StandardKey.Quit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu {
|
|
||||||
title: "&Edit"
|
|
||||||
MenuItem {
|
|
||||||
//action: cutAction
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
//action: copyAction
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
//action: pasteAction
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
Menu {
|
||||||
title: "&Help"
|
title: "&Help"
|
||||||
MenuItem {
|
MenuItem {
|
||||||
//action: aboutAction
|
action: aboutAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,6 +130,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: textEdit
|
id: textEdit
|
||||||
|
property int cell
|
||||||
x: 448
|
x: 448
|
||||||
y: 151
|
y: 151
|
||||||
objectName: "textEdit"
|
objectName: "textEdit"
|
||||||
@ -143,15 +142,16 @@ ApplicationWindow {
|
|||||||
x = -100
|
x = -100
|
||||||
y = -100
|
y = -100
|
||||||
visible = false
|
visible = false
|
||||||
focus = false
|
focus = true
|
||||||
enabled = false
|
enabled = false
|
||||||
opacity = 0
|
opacity = 0
|
||||||
|
textEdit1.focus = false
|
||||||
}
|
}
|
||||||
|
|
||||||
TextArea {
|
TextArea {
|
||||||
id: textEdit1
|
id: textEdit1
|
||||||
objectName: "textEdit1"
|
objectName: "textEdit1"
|
||||||
text: qsTr("Text Edit")
|
text: "Text Edit"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
textFormat: Text.AutoText
|
textFormat: Text.AutoText
|
||||||
|
48
qml/AboutDialog.qml
Normal file
48
qml/AboutDialog.qml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:BSD$
|
||||||
|
** You may use this file under the terms of the BSD license as follows:
|
||||||
|
**
|
||||||
|
** "Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions are
|
||||||
|
** met:
|
||||||
|
** * Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** * Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in
|
||||||
|
** the documentation and/or other materials provided with the
|
||||||
|
** distribution.
|
||||||
|
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||||
|
** of its contributors may be used to endorse or promote products derived
|
||||||
|
** from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
icon: StandardIcon.Information
|
||||||
|
text: "Presentation App for use in a church service"
|
||||||
|
detailedText: "made in 2016 by Timmy Welch"
|
||||||
|
title: "About"
|
||||||
|
}
|
5
qml/projection.qml
Normal file
5
qml/projection.qml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user