开发者

calendar control in qt

开发者 https://www.devze.com 2022-12-23 14:39 出处:网络
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

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号