diff options
| author | marcin <z.krzysztoff7@gmail.com> | 2014-07-22 14:16:05 +0200 |
|---|---|---|
| committer | marcin <z.krzysztoff7@gmail.com> | 2014-07-22 14:16:05 +0200 |
| commit | 0e5dbbc1975d0d8f297ac1e2409727f97ab1ae7c (patch) | |
| tree | 650f890459547b6e502b8f4f6c68939302bca724 /components/TableDropdown.qml | |
| parent | 2d41ff762cd3dad03d5526e28150e7b96d58e4ff (diff) | |
| download | monzero-gui-0e5dbbc1975d0d8f297ac1e2409727f97ab1ae7c.tar.gz monzero-gui-0e5dbbc1975d0d8f297ac1e2409727f97ab1ae7c.tar.xz monzero-gui-0e5dbbc1975d0d8f297ac1e2409727f97ab1ae7c.zip | |
https://trello.com/c/l6O8cPIh/57-when-the-sidebar-is-hidden-the-hover-text-on-the-drop-down-buttons-eg-send-to-address-doesn-t-overflow-with-the-window
changed window moving behavior
Diffstat (limited to 'components/TableDropdown.qml')
| -rw-r--r-- | components/TableDropdown.qml | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/components/TableDropdown.qml b/components/TableDropdown.qml index c3152e75..f494fe81 100644 --- a/components/TableDropdown.qml +++ b/components/TableDropdown.qml @@ -86,16 +86,42 @@ Item { } } + Timer { + id: timer + interval: 50 + repeat: false + running: false + onTriggered: { + if(((tipItem.visible && !tipItem.containsMouse) || !tipItem.visible) && !mouseArea.containsMouse) { + tipItem.visible = false + dropdown.expanded = false + currentIndex = -1 + } + } + } + MouseArea { + id: mouseArea anchors.left: head.left anchors.right: head.right anchors.top: head.top height: head.height + dropArea.height hoverEnabled: true onEntered: dropdown.expanded = true - onExited: dropdown.expanded = false + + property int currentIndex: -1 + onMouseYChanged: { + if(mouseY > head.height) { + var posY = parseInt((mouseY - head.height) / 30) + currentIndex = posY + } else { + currentIndex = -1 + } + } + preventStealing: true z: 1 + onExited: timer.start() Item { id: dropArea @@ -120,10 +146,11 @@ Item { id: repeater delegate: Rectangle { id: delegate + property bool containsMouse: index === mouseArea.currentIndex anchors.left: parent.left anchors.right: parent.right height: 30 - color: delegateArea.containsMouse ? "#F0EEEE" : "#DBDBDB" + color: containsMouse ? "#F0EEEE" : "#DBDBDB" //radius: index === repeater.count - 1 ? 5 : 0 Rectangle { @@ -149,27 +176,35 @@ Item { source: icon } - MouseArea { - id: delegateArea - hoverEnabled: true - anchors.fill: parent - propagateComposedEvents: true - onEntered: { + onContainsMouseChanged: { + if(containsMouse) { var pos = rootItem.mapFromItem(delegate, 30, -20) tipItem.text = name - tipItem.x = pos.x + tipItem.x = pos.x + appWindow.x if(tipItem.height > 30) pos.y -= tipItem.height - 30 - tipItem.y = pos.y + tipItem.y = pos.y + appWindow.y tipItem.visible = true - } - onExited: tipItem.visible = false - onClicked: { - dropdown.optionClicked(index) + } else { tipItem.visible = false - dropdown.expanded = 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 +// } +// } } } } |
