summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <[email protected]>2017-07-26 16:02:57 -0400
committerAllen Winter <[email protected]>2017-07-26 16:02:57 -0400
commitfa6319fdac441215114afda00b540ad93b760b52 (patch)
tree6f9324a52e6a04d3379fac48b764f424d271f3ab
parentf4a1165e5d4c9ae244784a93338ce62e79fea790 (diff)
calendardelegate.cpp - double-click delegate shows the quickview
Differential Revision: https://phabricator.kde.org/D6902
-rw-r--r--src/views/collectionview/calendardelegate.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/views/collectionview/calendardelegate.cpp b/src/views/collectionview/calendardelegate.cpp
index 32a7787..fdb38e4 100644
--- a/src/views/collectionview/calendardelegate.cpp
+++ b/src/views/collectionview/calendardelegate.cpp
@@ -224,11 +224,16 @@ bool StyledCalendarDelegate::editorEvent(QEvent *event,
Q_ASSERT(event);
Q_ASSERT(model);
+ // double-click mouse starts the quickview dialog
+ if (event->type() == QEvent::MouseButtonDblClick) {
+ Q_EMIT action(index, Quickview);
+ return true;
+ }
+
int button = -1;
// make sure that we have the right event type
- if ((event->type() == QEvent::MouseButtonRelease)
- || (event->type() == QEvent::MouseButtonDblClick)
- || (event->type() == QEvent::MouseButtonPress)) {
+ if ((event->type() == QEvent::MouseButtonRelease) ||
+ (event->type() == QEvent::MouseButtonPress)) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
@@ -238,14 +243,15 @@ bool StyledCalendarDelegate::editorEvent(QEvent *event,
break;
}
}
+
if (me->button() != Qt::LeftButton || button < 0) {
return QStyledItemDelegate::editorEvent(event, model, option, index);
}
- if ((event->type() == QEvent::MouseButtonPress)
- || (event->type() == QEvent::MouseButtonDblClick)) {
+ if (event->type() == QEvent::MouseButtonPress) {
return true;
}
+
} else {
return QStyledItemDelegate::editorEvent(event, model, option, index);
}
@@ -270,4 +276,3 @@ QSize StyledCalendarDelegate::sizeHint(const QStyleOptionViewItem &option, const
size.setHeight(mPixmap.value(AddToList).height() + 4);
return size;
}
-