tabledropdown fix

This commit is contained in:
marcin 2014-07-23 13:01:20 +02:00
parent d69870717f
commit 74b6483b18
5 changed files with 10 additions and 39 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.1.2, 2014-07-23T12:38:50. --> <!-- Written by QtCreator 3.1.2, 2014-07-23T13:00:52. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

View file

@ -26,10 +26,8 @@ ListView {
height: 64 height: 64
width: listView.width width: listView.width
color: index % 2 ? "#F8F8F8" : "#FFFFFF" color: index % 2 ? "#F8F8F8" : "#FFFFFF"
function collapseDropdown() { z: listView.count - index
z = 1 function collapseDropdown() { dropdown.expanded = false }
dropdown.expanded = false
}
Text { Text {
id: descriptionText id: descriptionText
@ -115,10 +113,8 @@ ListView {
if(expanded) { if(expanded) {
listView.previousItem = delegate listView.previousItem = delegate
listView.currentIndex = index listView.currentIndex = index
listView.currentItem.z = 2
} }
} }
onCollapsed: delegate.z = 0
onOptionClicked: { onOptionClicked: {
if(option === 0) if(option === 0)
clipboard.setText(address) clipboard.setText(address)

View file

@ -26,10 +26,8 @@ ListView {
height: 90 height: 90
width: listView.width width: listView.width
color: index % 2 ? "#F8F8F8" : "#FFFFFF" color: index % 2 ? "#F8F8F8" : "#FFFFFF"
function collapseDropdown() { z: listView.count - index
z = 1 function collapseDropdown() { dropdown.expanded = false }
dropdown.expanded = false
}
Row { Row {
id: row1 id: row1
@ -211,10 +209,8 @@ ListView {
if(expanded) { if(expanded) {
listView.previousItem = delegate listView.previousItem = delegate
listView.currentIndex = index listView.currentIndex = index
listView.currentItem.z = 2
} }
} }
onCollapsed: delegate.z = 0
onOptionClicked: { onOptionClicked: {
if(option === 0) if(option === 0)
clipboard.setText(address) clipboard.setText(address)

View file

@ -26,10 +26,8 @@ ListView {
height: 114 height: 114
width: listView.width width: listView.width
color: index % 2 ? "#F8F8F8" : "#FFFFFF" color: index % 2 ? "#F8F8F8" : "#FFFFFF"
function collapseDropdown() { z: listView.count - index
z = 1 function collapseDropdown() { dropdown.expanded = false }
dropdown.expanded = false
}
Row { Row {
id: row1 id: row1
@ -241,10 +239,8 @@ ListView {
if(expanded) { if(expanded) {
listView.previousItem = delegate listView.previousItem = delegate
listView.currentIndex = index listView.currentIndex = index
listView.currentItem.z = 2
} }
} }
onCollapsed: delegate.z = 0
onOptionClicked: { onOptionClicked: {
if(option === 0) if(option === 0)
clipboard.setText(address) clipboard.setText(address)

View file

@ -89,13 +89,14 @@ Item {
Timer { Timer {
id: timer id: timer
interval: 50 interval: 50
repeat: false repeat: true
running: false running: false
onTriggered: { onTriggered: {
if(((tipItem.visible && !tipItem.containsMouse) || !tipItem.visible) && !mouseArea.containsMouse) { if(((tipItem.visible && !tipItem.containsMouse) || !tipItem.visible) && !mouseArea.containsMouse) {
tipItem.visible = false tipItem.visible = false
dropdown.expanded = false dropdown.expanded = false
currentIndex = -1 currentIndex = -1
timer.stop()
} }
} }
} }
@ -119,9 +120,9 @@ Item {
} }
} }
onExited: timer.start()
preventStealing: true preventStealing: true
z: 1 z: 1
onExited: timer.start()
Item { Item {
id: dropArea id: dropArea
@ -185,26 +186,8 @@ Item {
pos.y -= tipItem.height - 30 pos.y -= tipItem.height - 30
tipItem.y = pos.y + appWindow.y tipItem.y = pos.y + appWindow.y
tipItem.visible = true tipItem.visible = true
} else {
tipItem.visible = false
} }
} }
// MouseArea {
// id: delegateArea
// hoverEnabled: true
// anchors.fill: parent
// propagateComposedEvents: true
// onEntered: {
// }
// onExited: tipItem.visible = false
// onClicked: {
// dropdown.optionClicked(index)
// tipItem.visible = false
// dropdown.expanded = false
// }
// }
} }
} }
} }