In the treeview, the right mouse button now back-cycles the favourite state of events.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 21 Jan 2017 22:20:26 +0000 (23:20 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 21 Jan 2017 22:22:39 +0000 (23:22 +0100)
src/mvc/treeview.cpp
src/mvc/treeview.h

index dd1b47c..3535eb3 100644 (file)
@@ -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<Event> 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
index f587995..6f4f463 100644 (file)
@@ -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: