PDA

View Full Version : How to capture right clicked dates in a QCalendarWidget?



balazsbela
13th February 2010, 12:25
I want to paint all right clicked cells with a different color in a QCalendarWidget. I have done the code for the painting, I can detect right clicks by reimplementing contextMenuEvent but it only gives me a QPoint with relative coordinates in the widget. I want to select the right clicked date.

So, the question is how do I get the corresponding dates in the calendar from the coordinates of the right clicked cells.

I have tried capturing the clicked(QDate) signal since the docs say:


void QCalendarWidget::clicked ( const QDate & date ) [signal]
This signal is emitted when a mouse button is clicked. The date the mouse was clicked on is specified by date. The signal is only emitted when clicked on a valid date, e.g., dates are not outside the minimumDate() and maximumDate(). If the selection mode is NoSelection, this signal will not be emitted.

Technically it should capture right clicks too, but it doesn't. I don't know why. Any ideas ?

Thanks.

balazsbela
21st February 2010, 13:36
****bump****