From 5fc5d1363a19d46c8c668aa2e3d8ffe7d3d21676 Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Sat, 21 Jan 2017 23:20:26 +0100 Subject: [PATCH] In the treeview, the right mouse button now back-cycles the favourite state of events. --- src/mvc/treeview.cpp | 6 +++--- src/mvc/treeview.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mvc/treeview.cpp b/src/mvc/treeview.cpp index dd1b47c..3535eb3 100644 --- a/src/mvc/treeview.cpp +++ b/src/mvc/treeview.cpp @@ -44,7 +44,7 @@ void TreeView::mouseReleaseEvent(QMouseEvent *aEvent) QPoint point = aEvent->pos(); // test whether we have handled the mouse event - if(!testForControlClicked(index,point)) + if(!testForControlClicked(index, point, aEvent->button())) { // pass the event to the Base class, so item clicks/events are handled correctly QTreeView::mouseReleaseEvent(aEvent); @@ -52,7 +52,7 @@ void TreeView::mouseReleaseEvent(QMouseEvent *aEvent) } // returns bool if some Control was clicked -bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint) +bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint, Qt::MouseButton button) { bool handled = false; @@ -72,7 +72,7 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP Event event = Event::getById(aIndex.data().toInt(),confId); QList conflicts = Event::conflictEvents(event.id(),Conference::activeConference()); - event.cycleFavourite(); + event.cycleFavourite(button == Qt::RightButton); event.update("favourite"); // event has became 'favourite' and so 'conflicts' list may have changed diff --git a/src/mvc/treeview.h b/src/mvc/treeview.h index f587995..6f4f463 100644 --- a/src/mvc/treeview.h +++ b/src/mvc/treeview.h @@ -30,7 +30,7 @@ public: ~TreeView() {} private: void mouseReleaseEvent(QMouseEvent *aEvent); - bool testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint); + bool testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint, Qt::MouseButton button); public slots: void setAllExpanded(bool aExpanded); // (aExpanded==true) => expanded; (aExpanded==false) => collapsed private slots: -- 2.39.5