Hi, my application currently implements a QCalendarWidget and when a user clicks any date a QMenu popup to choose an option:

Qt Code:
  1. connect(this, SIGNAL(clicked(QDate)), this, SLOT(dateSelected(QDate)));
  2.  
  3. ...
  4.  
  5. void CalendarManagerRep::dateSelected(const QDate &date)
  6. {
  7. m_selectedDate = date;
  8. QMenu menu;
  9. menu.addAction("0",this, SLOT(noSelection()));
  10. menu.addAction("½",this, SLOT(halfSelected()));
  11. menu.addAction("1",this, SLOT(oneSelected()));
  12. menu.exec(QCursor::pos());
  13.  
  14. auto view = this->findChild<QAbstractItemView*>();
  15. if(view){
  16. view->viewport()->update();
  17. } else update(); // fallback
  18.  
  19. emit datesChanged();
  20. }
To copy to clipboard, switch view to plain text mode 

Now I would like to move the QMenu on the right-click and leave left-click for a default value.

I tried to reimplement void QWidget::mouseReleaseEvent(QMouseEvent *event) but it seems to trigger only when right-clicking the calendar header.

Any clue? Very thanks