二、主要源码
2.1 日历控件(calendarWidget)
//窗口尺寸
this->resize(600,500);
calendar_label = new QLabel(this);
calendar_label->setText("选择日期");
//标签以及编辑框位置
calendar_label->setGeometry(QRect(100,70,100,25));
calendar_Edit = new QLineEdit(this);
calendar_Edit->setGeometry(QRect(180,70,150,25));
//cursorPositionChanged触发的事件
connect(calendar_Edit,SIGNAL(cursorPositionChanged(int,int)),this,SLOT(showTime()));
//实例时间控件
calendarWidget = new QCalendarWidget(this);
//日历组件位置
calendarWidget->setGeometry(25,98,450,280);
//隐藏日历组件
calendarWidget->setHidden(true);
//时间控件点击事件
connect(calendarWidget,SIGNAL(clicked(QDate)),this,SLOT(setDate()));
//槽函数
void Widget::showTime()
{
calendarWidget->setHidden(false);
}
void Widget::setDat