2016-03-07 08:54:14 -08:00
|
|
|
import QtQuick 2.4
|
2016-01-14 18:42:52 -08:00
|
|
|
|
|
|
|
Rectangle {
|
2016-01-14 22:25:53 -08:00
|
|
|
objectName: "cellRect"
|
|
|
|
property int index: 0
|
|
|
|
height: 100
|
2016-02-17 14:55:29 -08:00
|
|
|
border.width: 2
|
2016-02-19 08:46:03 -08:00
|
|
|
border.color: "black"
|
2016-01-19 21:12:11 -08:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2016-01-14 18:42:52 -08:00
|
|
|
|
|
|
|
Text {
|
|
|
|
id: cellText
|
2016-01-14 22:25:53 -08:00
|
|
|
enabled: true
|
2016-01-19 21:12:11 -08:00
|
|
|
objectName: "cellText"
|
2016-01-14 18:42:52 -08:00
|
|
|
text: "hello this is text\nhaha\nhdsjfklfhaskjd"
|
|
|
|
clip: true
|
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
2016-02-17 14:55:29 -08:00
|
|
|
anchors.fill: parent
|
2016-01-14 18:42:52 -08:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
anchors.left: parent.left
|
2016-02-18 15:12:22 -08:00
|
|
|
anchors.leftMargin: 2
|
2016-01-14 22:25:53 -08:00
|
|
|
|
2016-01-14 18:42:52 -08:00
|
|
|
MouseArea {
|
|
|
|
id: cellMouse
|
2016-02-17 14:55:29 -08:00
|
|
|
hoverEnabled: true
|
2016-01-14 22:25:53 -08:00
|
|
|
enabled: true
|
|
|
|
objectName: "cellMouse"
|
2016-01-14 18:42:52 -08:00
|
|
|
anchors.fill: parent
|
2016-02-17 14:55:29 -08:00
|
|
|
onFocusChanged: if (focus) {
|
2016-02-18 15:12:22 -08:00
|
|
|
selected()
|
2016-02-19 08:46:03 -08:00
|
|
|
} else {
|
|
|
|
notSelected()
|
2016-02-17 14:55:29 -08:00
|
|
|
}
|
2016-02-18 15:12:22 -08:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2016-02-19 08:46:03 -08:00
|
|
|
onExited: notSelected()
|
|
|
|
|
|
|
|
function notSelected() {
|
|
|
|
|
|
|
|
parent.parent.border.color = "black"
|
2016-02-17 14:55:29 -08:00
|
|
|
parent.parent.color = "white"
|
|
|
|
parent.color = "black"
|
2016-02-18 15:12:22 -08:00
|
|
|
if (focus) {
|
|
|
|
focusChanged(focus)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function selected() {
|
|
|
|
parent.parent.border.color = "blue"
|
|
|
|
parent.parent.color = "gainsboro"
|
2016-02-17 14:55:29 -08:00
|
|
|
}
|
2016-01-14 18:42:52 -08:00
|
|
|
}
|
|
|
|
}
|
2016-01-14 21:25:31 -08:00
|
|
|
}
|