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() {
|
||||
window.ObjectByName("btnAdd").On("clicked", func() {
|
||||
slides.addCell()
|
||||
})
|
||||
|
||||
window.On("closing", func() {
|
||||
fmt.Println(window.Bool("cls"))
|
||||
win.Hide()
|
||||
@ -242,6 +246,7 @@ func setSignals() {
|
||||
window.Set("cls", true)
|
||||
|
||||
})
|
||||
|
||||
textEdit.ObjectByName("textEdit1").On("focusChanged", func(focus bool) {
|
||||
var (
|
||||
str string
|
||||
@ -294,7 +299,7 @@ func (sl *slide) addCell( /*cl *cell*/ ) {
|
||||
cl.text = "testing 1... 2... 3..."
|
||||
cl.qmlcell.ObjectByName("cellText").Set("text", cl.text)
|
||||
*sl = append(*sl, &cl)
|
||||
|
||||
//fmt.Println("add Cell!!!!! :-P")
|
||||
cl.setSignal()
|
||||
|
||||
}
|
||||
|
16
main.qml
16
main.qml
@ -13,7 +13,7 @@ ApplicationWindow {
|
||||
width: 1000
|
||||
height: 600
|
||||
property bool cls: false
|
||||
//Screen.objectName: "Screen1"
|
||||
|
||||
onClosing: if (!cls) {
|
||||
close.accepted = false
|
||||
}
|
||||
@ -63,8 +63,6 @@ ApplicationWindow {
|
||||
objectName: "gridRect"
|
||||
width: 300
|
||||
color: "#00000000"
|
||||
radius: 1
|
||||
border.color: "#000000"
|
||||
border.width: 4
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
@ -110,6 +108,7 @@ ApplicationWindow {
|
||||
|
||||
Column {
|
||||
id: data2
|
||||
spacing: 1
|
||||
objectName: "data2"
|
||||
anchors.fill: parent
|
||||
}
|
||||
@ -119,6 +118,7 @@ ApplicationWindow {
|
||||
|
||||
Rectangle {
|
||||
id: mainView
|
||||
border.width: 0
|
||||
objectName: "mainView"
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
@ -129,6 +129,15 @@ ApplicationWindow {
|
||||
z: 1
|
||||
clip: false
|
||||
visible: true
|
||||
|
||||
Button {
|
||||
id: button1
|
||||
objectName: "btnAdd"
|
||||
x: 8
|
||||
y: 8
|
||||
text: qsTr("Button")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +186,6 @@ ApplicationWindow {
|
||||
TextArea {
|
||||
id: textEdit1
|
||||
objectName: "textEdit1"
|
||||
text: "Text Edit"
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
textFormat: Text.AutoText
|
||||
|
@ -43,6 +43,6 @@ 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"
|
||||
detailedText: "Made in 2016 by Timmy Welch."
|
||||
title: "About"
|
||||
}
|
||||
|
34
qml/cell.qml
34
qml/cell.qml
@ -9,10 +9,6 @@ Rectangle {
|
||||
border.width: 2
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
onFocusChanged: if (focus) {
|
||||
border.color = "gainsboro"
|
||||
color = "blue"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: cellText
|
||||
@ -25,11 +21,7 @@ Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
onFocusChanged: if (focus) {
|
||||
parent.border.color = "gainsboro"
|
||||
parent.color = "blue"
|
||||
}
|
||||
anchors.leftMargin: 2
|
||||
|
||||
MouseArea {
|
||||
id: cellMouse
|
||||
@ -38,19 +30,35 @@ Rectangle {
|
||||
objectName: "cellMouse"
|
||||
anchors.fill: parent
|
||||
onFocusChanged: if (focus) {
|
||||
parent.parent.border.color = "gainsboro"
|
||||
parent.parent.color = "blue"
|
||||
selected()
|
||||
}
|
||||
onClicked: focus = true
|
||||
onEntered: if (containsMouse) {
|
||||
|
||||
onClicked: {
|
||||
focus = true
|
||||
selected()
|
||||
mouseXChanged(mouse)
|
||||
}
|
||||
|
||||
onMouseXChanged: if (containsMouse) {
|
||||
parent.parent.border.color = "skyblue"
|
||||
parent.parent.color = "darkblue"
|
||||
parent.color = "white"
|
||||
} else if (focus) {
|
||||
parent.color = "black"
|
||||
}
|
||||
|
||||
onExited: {
|
||||
parent.parent.border.color = "white"
|
||||
parent.parent.color = "white"
|
||||
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