Isn't it better to just set the value of the QCalendarWidget::selectedDate instead of simulating some clicks?

By the way, triggering a context menu on a right mouse button is a bad idea. There is a dedicated mechanism for context menus (or even three mechanisms).