QCalenderWidget double click event not working or am i doing wrong?
-
class Calendar : public QCalendarWidget
{
Q_OBJECT
public:
Calendar(QWidget* parent = 0);
signals:
void showToDoWindow();
private:
void mouseDoubleClickEvent(QMouseEvent*);};
void Calendar::mouseDoubleClickEvent(QMouseEvent *e)
{
if ( e->button() == Qt::LeftButton )
emit showToDoWindow();
}connect(ui->calendarWidget,SIGNAL(showToDoWindow()),this,SLOT(showToDoWindow())); // my connection in mainwindow
void MainWindow::showToDoWindow()
{// this slot function doesnt execute when the user doubleclick a date in the calendar
qDebug() << "s";
} // this sloti have a QCalendarWidget in my ui form, im trying to do something when the user double clicks a date in calendar but doesnt work
-
Hi
The signal Activated also triggers for db clicks.
soconnect(ui->calendarWidget, QCalendarWidget::activated, this , MainWindow::CalendarDBClick); and the slot function public slots: void CalendarDBClick(const QDate& Date) { setWindowTitle(Date.toString("dd.MM.yyyy")); }
No need to subclass, just hook up signal.