summaryrefslogtreecommitdiff
path: root/src/controls/Styles/Base/CalendarStyle.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-07-16 11:29:15 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-07-16 15:19:37 +0200
commit06fd5ea78680ec9338e15230680001b68c28482f (patch)
tree0f4046ffadab802ed1a45bbd8aed336e48ae6e04 /src/controls/Styles/Base/CalendarStyle.qml
parentd060394d52f9082962e976220c181e8279b4f003 (diff)
downloadqtquickcontrols-06fd5ea78680ec9338e15230680001b68c28482f.tar.gz
Fix Calendar::clicked() signal emission
Emit only when releasing over the same date than was pressed. Change-Id: I7a8d4d6e3871231ae2589d565a75d9b641b649ac Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/controls/Styles/Base/CalendarStyle.qml')
-rw-r--r--src/controls/Styles/Base/CalendarStyle.qml15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml
index bb7cd31a..c8a373b6 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -369,7 +369,7 @@ Style {
property int hoveredCellIndex: -1
property int pressedCellIndex: -1
- property int pressAndHoldIndex: -1
+ property int pressCellIndex: -1
Rectangle {
anchors.fill: parent
@@ -581,11 +581,10 @@ Style {
}
onPressed: {
- var indexOfCell = cellIndexAt(mouse.x, mouse.y);
- if (indexOfCell !== -1) {
- var date = view.model.dateAt(indexOfCell);
- pressedCellIndex = indexOfCell;
- pressAndHoldIndex = indexOfCell;
+ pressCellIndex = cellIndexAt(mouse.x, mouse.y);
+ if (pressCellIndex !== -1) {
+ var date = view.model.dateAt(pressCellIndex);
+ pressedCellIndex = pressCellIndex;
if (__isValidDate(date)) {
control.selectedDate = date;
control.pressed(date);
@@ -609,7 +608,7 @@ Style {
onClicked: {
var indexOfCell = cellIndexAt(mouse.x, mouse.y);
- if (indexOfCell !== -1) {
+ if (indexOfCell !== -1 && indexOfCell === pressCellIndex) {
var date = view.model.dateAt(indexOfCell);
if (__isValidDate(date))
control.clicked(date);
@@ -627,7 +626,7 @@ Style {
onPressAndHold: {
var indexOfCell = cellIndexAt(mouse.x, mouse.y);
- if (indexOfCell !== -1 && indexOfCell === pressAndHoldIndex) {
+ if (indexOfCell !== -1 && indexOfCell === pressCellIndex) {
var date = view.model.dateAt(indexOfCell);
if (__isValidDate(date))
control.pressAndHold(date);