mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
DatePicker: don't propagate mouse events to underlying controls
This commit is contained in:
parent
6c2c17ada1
commit
32f7666912
2 changed files with 182 additions and 187 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls 2.2 as QtQuickControls2
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
|
@ -37,8 +38,7 @@ import "effects/" as MoneroEffects
|
|||
|
||||
Item {
|
||||
id: datePicker
|
||||
z: parent.z + 1
|
||||
property bool expanded: false
|
||||
readonly property alias expanded: popup.visible
|
||||
property date currentDate
|
||||
property bool showCurrentDate: true
|
||||
property color backgroundColor : MoneroComponents.Style.appWindowBorderColor
|
||||
|
@ -52,19 +52,6 @@ Item {
|
|||
|
||||
onExpandedChanged: if(expanded) appWindow.currentItem = datePicker
|
||||
|
||||
function hide() { datePicker.expanded = false }
|
||||
function containsPoint(px, py) {
|
||||
if(px < 0)
|
||||
return false
|
||||
if(px > width)
|
||||
return false
|
||||
if(py < 0)
|
||||
return false
|
||||
if(py > height + calendarRect.height)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: inputLabelRect
|
||||
color: "transparent"
|
||||
|
@ -253,7 +240,7 @@ Item {
|
|||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: datePicker.expanded = !datePicker.expanded
|
||||
onClicked: datePicker.expanded ? popup.close() : popup.open()
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
@ -261,12 +248,16 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
QtQuickControls2.Popup {
|
||||
id: popup
|
||||
padding: 0
|
||||
|
||||
Rectangle {
|
||||
id: calendarRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: head.bottom
|
||||
anchors.topMargin: 10
|
||||
width: head.width
|
||||
x: head.x
|
||||
y: head.y + head.height + 10
|
||||
|
||||
color: MoneroComponents.Style.middlePanelBackgroundColor
|
||||
border.width: 1
|
||||
border.color: MoneroComponents.Style.appWindowBorderColor
|
||||
|
@ -277,6 +268,10 @@ Item {
|
|||
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
@ -348,7 +343,7 @@ Item {
|
|||
onClicked: {
|
||||
if(styleData.visibleMonth) {
|
||||
currentDate = styleData.date
|
||||
datePicker.expanded = false
|
||||
popup.close()
|
||||
} else {
|
||||
var date = styleData.date
|
||||
if(date.getMonth() > calendar.visibleMonth)
|
||||
|
@ -457,3 +452,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,6 @@ Rectangle {
|
|||
Layout.rightMargin: sideMargin
|
||||
columns: 2
|
||||
columnSpacing: 20
|
||||
z: 6
|
||||
|
||||
MoneroComponents.DatePicker {
|
||||
id: fromDatePicker
|
||||
|
|
Loading…
Reference in a new issue