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 2nd calendar. Please let me know how can I do that, I'm beginner.
+2
A:
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);
}
gregseth
2010-03-16 08:39:38