QCalendarWidget does not propagate signals
-
Hi all,
I am trying to work with QCalendarWidget, I need to know when somebody change date...
But it looks like that QCalendarWindget does not send signal.@
QGridLayout *mycalendarLayout = new QGridLayout();
QCalendarWidget *calendarWidgetfrom = new QCalendarWidget();
calendarWidgetfrom->setMinimumDate(QDate(2014,1,1));
calendarWidgetfrom->setMaximumDate(QDate(2028,1,1));calendarWidgetfrom->setSelectionMode(QCalendarWidget::SelectionMode::SingleSelection);
mycalendarLayout->addWidget(calendarWidgetfrom,0,0,Qt::AlignCenter);connect(calendarWidgetfrom, SIGNAL(selectionChanged()), this, SLOT(TestSignal()));
connect(calendarWidgetfrom,SIGNAL(clicked(QDate)),this, SLOT(DataFromChanged));
QWidget *myQWidget = new QWidget();
myQWidget->setLayout(mycalendarLayout);
m_toolbox->addItem(myQWidget, tr("Calendar"));
@Could you please anybody tell me, what I am doing wrong?
Thank you!
-
I would suggest to use "new signal/slot syntax":http://qt-project.org/wiki/New_Signal_Slot_Syntax
It will help to avoid such errors.
For your example
@
connect(calendarWidgetfrom, &QCalendarWidget::selectionChanged, this, &Widget::TestSignal);
connect(calendarWidgetfrom, &QCalendarWidget::clicked, this, &Widget::DataFromChanged);
@