add highliting for the selected cell
add button to add a cell
This commit is contained in:
parent
03e816356c
commit
b4ad828af4
7
main.go
7
main.go
@ -235,6 +235,10 @@ func glInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setSignals() {
|
func setSignals() {
|
||||||
|
window.ObjectByName("btnAdd").On("clicked", func() {
|
||||||
|
slides.addCell()
|
||||||
|
})
|
||||||
|
|
||||||
window.On("closing", func() {
|
window.On("closing", func() {
|
||||||
fmt.Println(window.Bool("cls"))
|
fmt.Println(window.Bool("cls"))
|
||||||
win.Hide()
|
win.Hide()
|
||||||
@ -242,6 +246,7 @@ func setSignals() {
|
|||||||
window.Set("cls", true)
|
window.Set("cls", true)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
textEdit.ObjectByName("textEdit1").On("focusChanged", func(focus bool) {
|
textEdit.ObjectByName("textEdit1").On("focusChanged", func(focus bool) {
|
||||||
var (
|
var (
|
||||||
str string
|
str string
|
||||||
@ -294,7 +299,7 @@ func (sl *slide) addCell( /*cl *cell*/ ) {
|
|||||||
cl.text = "testing 1... 2... 3..."
|
cl.text = "testing 1... 2... 3..."
|
||||||
cl.qmlcell.ObjectByName("cellText").Set("text", cl.text)
|
cl.qmlcell.ObjectByName("cellText").Set("text", cl.text)
|
||||||
*sl = append(*sl, &cl)
|
*sl = append(*sl, &cl)
|
||||||
|
//fmt.Println("add Cell!!!!! :-P")
|
||||||
cl.setSignal()
|
cl.setSignal()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
16
main.qml
16
main.qml
@ -13,7 +13,7 @@ ApplicationWindow {
|
|||||||
width: 1000
|
width: 1000
|
||||||
height: 600
|
height: 600
|
||||||
property bool cls: false
|
property bool cls: false
|
||||||
//Screen.objectName: "Screen1"
|
|
||||||
onClosing: if (!cls) {
|
onClosing: if (!cls) {
|
||||||
close.accepted = false
|
close.accepted = false
|
||||||
}
|
}
|
||||||
@ -63,8 +63,6 @@ ApplicationWindow {
|
|||||||
objectName: "gridRect"
|
objectName: "gridRect"
|
||||||
width: 300
|
width: 300
|
||||||
color: "#00000000"
|
color: "#00000000"
|
||||||
radius: 1
|
|
||||||
border.color: "#000000"
|
|
||||||
border.width: 4
|
border.width: 4
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
@ -110,6 +108,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: data2
|
id: data2
|
||||||
|
spacing: 1
|
||||||
objectName: "data2"
|
objectName: "data2"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
@ -119,6 +118,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: mainView
|
id: mainView
|
||||||
|
border.width: 0
|
||||||
objectName: "mainView"
|
objectName: "mainView"
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
@ -129,6 +129,15 @@ ApplicationWindow {
|
|||||||
z: 1
|
z: 1
|
||||||
clip: false
|
clip: false
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: button1
|
||||||
|
objectName: "btnAdd"
|
||||||
|
x: 8
|
||||||
|
y: 8
|
||||||
|
text: qsTr("Button")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +186,6 @@ ApplicationWindow {
|
|||||||
TextArea {
|
TextArea {
|
||||||
id: textEdit1
|
id: textEdit1
|
||||||
objectName: "textEdit1"
|
objectName: "textEdit1"
|
||||||
text: "Text Edit"
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
textFormat: Text.AutoText
|
textFormat: Text.AutoText
|
||||||
|
@ -43,6 +43,6 @@ import QtQuick.Dialogs 1.1
|
|||||||
MessageDialog {
|
MessageDialog {
|
||||||
icon: StandardIcon.Information
|
icon: StandardIcon.Information
|
||||||
text: "Presentation App for use in a church service"
|
text: "Presentation App for use in a church service"
|
||||||
detailedText: "made in 2016 by Timmy Welch"
|
detailedText: "Made in 2016 by Timmy Welch."
|
||||||
title: "About"
|
title: "About"
|
||||||
}
|
}
|
||||||
|
34
qml/cell.qml
34
qml/cell.qml
@ -9,10 +9,6 @@ Rectangle {
|
|||||||
border.width: 2
|
border.width: 2
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
onFocusChanged: if (focus) {
|
|
||||||
border.color = "gainsboro"
|
|
||||||
color = "blue"
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: cellText
|
id: cellText
|
||||||
@ -25,11 +21,7 @@ Rectangle {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 2
|
||||||
onFocusChanged: if (focus) {
|
|
||||||
parent.border.color = "gainsboro"
|
|
||||||
parent.color = "blue"
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: cellMouse
|
id: cellMouse
|
||||||
@ -38,19 +30,35 @@ Rectangle {
|
|||||||
objectName: "cellMouse"
|
objectName: "cellMouse"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onFocusChanged: if (focus) {
|
onFocusChanged: if (focus) {
|
||||||
parent.parent.border.color = "gainsboro"
|
selected()
|
||||||
parent.parent.color = "blue"
|
|
||||||
}
|
}
|
||||||
onClicked: focus = true
|
|
||||||
onEntered: if (containsMouse) {
|
onClicked: {
|
||||||
|
focus = true
|
||||||
|
selected()
|
||||||
|
mouseXChanged(mouse)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMouseXChanged: if (containsMouse) {
|
||||||
parent.parent.border.color = "skyblue"
|
parent.parent.border.color = "skyblue"
|
||||||
parent.parent.color = "darkblue"
|
parent.parent.color = "darkblue"
|
||||||
parent.color = "white"
|
parent.color = "white"
|
||||||
|
} else if (focus) {
|
||||||
|
parent.color = "black"
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
parent.parent.border.color = "white"
|
parent.parent.border.color = "white"
|
||||||
parent.parent.color = "white"
|
parent.parent.color = "white"
|
||||||
parent.color = "black"
|
parent.color = "black"
|
||||||
|
if (focus) {
|
||||||
|
focusChanged(focus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selected() {
|
||||||
|
parent.parent.border.color = "blue"
|
||||||
|
parent.parent.color = "gainsboro"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user