我正在用QT C ++做一个图书馆管理系统项目。在处理书籍挖掘时我使用qdatetimeedit来选择当前日期。我想通过在当前日期添加2周来指定返回日期,并且一旦从弹出日历中选择当前日期,我就应该在行编辑中显示。我没有想法实现这一点。请帮忙。提前谢谢
答案 0 :(得分:0)
经过多次尝试后,我自己想出来了。
QDate current = ui->dtetimeCurrnt->date();
//adding 14 days to the current date to get the returning date
QDate returnDate = current.addDays(14);
//assigning the returndate to dateedit
ui->dteditRetrn->setDate(returnDate);
由于我无法使用lineEdit,因此我使用了dateEdit。