calendar control in qt
I have calendar in Qt. I want when user selects date, 14(Qint32) will be added in it and resultant date should be highlighted on 开发者_如何学Go2nd calendar. Please let me know how can I do that, I'm beginner.
Something like that should do the trick.
QCalendarWidget cal1 = new QCalendarWidget(this);
QCalendarWidget cal2 = new QCalendarWidget(this);
connect(cal1, SIGNAL(clicked(const QDate &)), this, SLOT(changeDate(const QDate &)));
.../...
void MyWidget::changeDate(const QDate &date1) //< declared as a slot in your .h
{
QDate d2 = date1.addDays(14);
cal2->setSelectedDate(d2);
}
精彩评论