forked from Public/monero-gui
changed window moving behavior
This commit is contained in:
@@ -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-19T16:52:37. -->
|
<!-- Written by QtCreator 3.1.2, 2014-07-21T21:45:19. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ ListView {
|
|||||||
height: 90
|
height: 90
|
||||||
width: listView.width
|
width: listView.width
|
||||||
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
||||||
function collapseDropdown() { dropdown.expanded = false }
|
function collapseDropdown() {
|
||||||
|
z = 1
|
||||||
|
dropdown.expanded = false
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row1
|
id: row1
|
||||||
@@ -189,10 +192,8 @@ ListView {
|
|||||||
anchors.bottomMargin: 11
|
anchors.bottomMargin: 11
|
||||||
anchors.rightMargin: 5
|
anchors.rightMargin: 5
|
||||||
dataModel: dropModel
|
dataModel: dropModel
|
||||||
z: 1
|
z: 5
|
||||||
onExpandedChanged: {
|
onExpandedChanged: {
|
||||||
if(listView.previousItem !== undefined && listView.previousItem !== delegate)
|
|
||||||
listView.previousItem.collapseDropdown()
|
|
||||||
if(expanded) {
|
if(expanded) {
|
||||||
listView.previousItem = delegate
|
listView.previousItem = delegate
|
||||||
listView.currentIndex = index
|
listView.currentIndex = index
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ ListView {
|
|||||||
height: 114
|
height: 114
|
||||||
width: listView.width
|
width: listView.width
|
||||||
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
|
||||||
function collapseDropdown() { dropdown.expanded = false }
|
function collapseDropdown() {
|
||||||
|
z = 1
|
||||||
|
dropdown.expanded = false
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row1
|
id: row1
|
||||||
@@ -221,8 +224,6 @@ ListView {
|
|||||||
dataModel: dropModel
|
dataModel: dropModel
|
||||||
z: 1
|
z: 1
|
||||||
onExpandedChanged: {
|
onExpandedChanged: {
|
||||||
if(listView.previousItem !== undefined && listView.previousItem !== delegate)
|
|
||||||
listView.previousItem.collapseDropdown()
|
|
||||||
if(expanded) {
|
if(expanded) {
|
||||||
listView.previousItem = delegate
|
listView.previousItem = delegate
|
||||||
listView.currentIndex = index
|
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 {
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
anchors.left: head.left
|
anchors.left: head.left
|
||||||
anchors.right: head.right
|
anchors.right: head.right
|
||||||
anchors.top: head.top
|
anchors.top: head.top
|
||||||
height: head.height + dropArea.height
|
height: head.height + dropArea.height
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onEntered: dropdown.expanded = 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
|
preventStealing: true
|
||||||
z: 1
|
z: 1
|
||||||
|
onExited: timer.start()
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: dropArea
|
id: dropArea
|
||||||
@@ -120,10 +146,11 @@ Item {
|
|||||||
id: repeater
|
id: repeater
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
property bool containsMouse: index === mouseArea.currentIndex
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: 30
|
height: 30
|
||||||
color: delegateArea.containsMouse ? "#F0EEEE" : "#DBDBDB"
|
color: containsMouse ? "#F0EEEE" : "#DBDBDB"
|
||||||
//radius: index === repeater.count - 1 ? 5 : 0
|
//radius: index === repeater.count - 1 ? 5 : 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -149,27 +176,35 @@ Item {
|
|||||||
source: icon
|
source: icon
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
onContainsMouseChanged: {
|
||||||
id: delegateArea
|
if(containsMouse) {
|
||||||
hoverEnabled: true
|
|
||||||
anchors.fill: parent
|
|
||||||
propagateComposedEvents: true
|
|
||||||
onEntered: {
|
|
||||||
var pos = rootItem.mapFromItem(delegate, 30, -20)
|
var pos = rootItem.mapFromItem(delegate, 30, -20)
|
||||||
tipItem.text = name
|
tipItem.text = name
|
||||||
tipItem.x = pos.x
|
tipItem.x = pos.x + appWindow.x
|
||||||
if(tipItem.height > 30)
|
if(tipItem.height > 30)
|
||||||
pos.y -= tipItem.height - 30
|
pos.y -= tipItem.height - 30
|
||||||
tipItem.y = pos.y
|
tipItem.y = pos.y + appWindow.y
|
||||||
tipItem.visible = true
|
tipItem.visible = true
|
||||||
}
|
} else {
|
||||||
onExited: tipItem.visible = false
|
|
||||||
onClicked: {
|
|
||||||
dropdown.optionClicked(index)
|
|
||||||
tipItem.visible = false
|
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
|
property alias text: content.text
|
||||||
width: content.width + 12
|
property alias containsMouse: tipArea.containsMouse
|
||||||
height: content.height + 17
|
flags: Qt.ToolTip
|
||||||
color: "#FF6C3C"
|
color: "transparent"
|
||||||
//radius: 3
|
height: rect.height + tip.height
|
||||||
|
width: rect.width
|
||||||
|
|
||||||
Image {
|
MouseArea {
|
||||||
anchors.top: parent.bottom
|
id: tipArea
|
||||||
anchors.left: parent.left
|
hoverEnabled: true
|
||||||
anchors.leftMargin: 5
|
anchors.fill: parent
|
||||||
source: "../images/tip.png"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Rectangle {
|
||||||
id: content
|
id: rect
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
width: content.width + 12
|
||||||
y: 6
|
height: content.height + 17
|
||||||
lineHeight: 0.7
|
color: "#FF6C3C"
|
||||||
font.family: "Arial"
|
//radius: 3
|
||||||
font.pixelSize: 12
|
|
||||||
font.letterSpacing: -1
|
Image {
|
||||||
color: "#FFFFFF"
|
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
|
anchors.fill: parent
|
||||||
clip: true
|
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 {
|
LeftPanel {
|
||||||
id: leftPanel
|
id: leftPanel
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -148,7 +133,6 @@ ApplicationWindow {
|
|||||||
id: tipItem
|
id: tipItem
|
||||||
text: "send to the same destination"
|
text: "send to the same destination"
|
||||||
visible: false
|
visible: false
|
||||||
z: 100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicPanel {
|
BasicPanel {
|
||||||
@@ -287,6 +271,21 @@ ApplicationWindow {
|
|||||||
if(yes) goToBasicAnimation.start()
|
if(yes) goToBasicAnimation.start()
|
||||||
else goToProAnimation.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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user