mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-03-16 16:42:13 +00:00
changed window moving behavior
This commit is contained in:
parent
2d41ff762c
commit
0e5dbbc197
6 changed files with 112 additions and 59 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.1.2, 2014-07-19T16:52:37. -->
|
||||
<!-- Written by QtCreator 3.1.2, 2014-07-21T21:45:19. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
|
|
@ -12,7 +12,10 @@ ListView {
|
|||
height: 90
|
||||
width: listView.width
|
||||
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
||||
function collapseDropdown() { dropdown.expanded = false }
|
||||
function collapseDropdown() {
|
||||
z = 1
|
||||
dropdown.expanded = false
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row1
|
||||
|
@ -189,10 +192,8 @@ ListView {
|
|||
anchors.bottomMargin: 11
|
||||
anchors.rightMargin: 5
|
||||
dataModel: dropModel
|
||||
z: 1
|
||||
z: 5
|
||||
onExpandedChanged: {
|
||||
if(listView.previousItem !== undefined && listView.previousItem !== delegate)
|
||||
listView.previousItem.collapseDropdown()
|
||||
if(expanded) {
|
||||
listView.previousItem = delegate
|
||||
listView.currentIndex = index
|
||||
|
|
|
@ -12,7 +12,10 @@ ListView {
|
|||
height: 114
|
||||
width: listView.width
|
||||
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
||||
function collapseDropdown() { dropdown.expanded = false }
|
||||
function collapseDropdown() {
|
||||
z = 1
|
||||
dropdown.expanded = false
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row1
|
||||
|
@ -221,8 +224,6 @@ ListView {
|
|||
dataModel: dropModel
|
||||
z: 1
|
||||
onExpandedChanged: {
|
||||
if(listView.previousItem !== undefined && listView.previousItem !== delegate)
|
||||
listView.previousItem.collapseDropdown()
|
||||
if(expanded) {
|
||||
listView.previousItem = delegate
|
||||
listView.currentIndex = index
|
||||
|
|
|
@ -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
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,44 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
Rectangle {
|
||||
Window {
|
||||
property alias text: content.text
|
||||
width: content.width + 12
|
||||
height: content.height + 17
|
||||
color: "#FF6C3C"
|
||||
//radius: 3
|
||||
property alias containsMouse: tipArea.containsMouse
|
||||
flags: Qt.ToolTip
|
||||
color: "transparent"
|
||||
height: rect.height + tip.height
|
||||
width: rect.width
|
||||
|
||||
Image {
|
||||
anchors.top: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 5
|
||||
source: "../images/tip.png"
|
||||
MouseArea {
|
||||
id: tipArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
id: content
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: 6
|
||||
lineHeight: 0.7
|
||||
font.family: "Arial"
|
||||
font.pixelSize: 12
|
||||
font.letterSpacing: -1
|
||||
color: "#FFFFFF"
|
||||
Rectangle {
|
||||
id: rect
|
||||
width: content.width + 12
|
||||
height: content.height + 17
|
||||
color: "#FF6C3C"
|
||||
//radius: 3
|
||||
|
||||
Image {
|
||||
id: tip
|
||||
anchors.top: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 5
|
||||
source: "../images/tip.png"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: content
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: 6
|
||||
lineHeight: 0.7
|
||||
font.family: "Arial"
|
||||
font.pixelSize: 12
|
||||
font.letterSpacing: -1
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
31
main.qml
31
main.qml
|
@ -98,21 +98,6 @@ ApplicationWindow {
|
|||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
MouseArea {
|
||||
property var previousPosition
|
||||
anchors.fill: parent
|
||||
|
||||
onPressed: previousPosition = Qt.point(mouseX, mouseY)
|
||||
onPositionChanged: {
|
||||
if (pressedButtons == Qt.LeftButton) {
|
||||
var dx = mouseX - previousPosition.x
|
||||
var dy = mouseY - previousPosition.y
|
||||
appWindow.x += dx
|
||||
appWindow.y += dy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LeftPanel {
|
||||
id: leftPanel
|
||||
anchors.left: parent.left
|
||||
|
@ -148,7 +133,6 @@ ApplicationWindow {
|
|||
id: tipItem
|
||||
text: "send to the same destination"
|
||||
visible: false
|
||||
z: 100
|
||||
}
|
||||
|
||||
BasicPanel {
|
||||
|
@ -287,6 +271,21 @@ ApplicationWindow {
|
|||
if(yes) goToBasicAnimation.start()
|
||||
else goToProAnimation.start()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
property var previousPosition
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
onPressed: previousPosition = Qt.point(mouseX, mouseY)
|
||||
onPositionChanged: {
|
||||
if (pressedButtons == Qt.LeftButton) {
|
||||
var dx = mouseX - previousPosition.x
|
||||
var dy = mouseY - previousPosition.y
|
||||
appWindow.x += dx
|
||||
appWindow.y += dy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue