how to take input date from user in qdateedit and show database accordingly
how to take input any date from user in qdateedit or calenderwidget and show database accordingly by clicking button now my code is showing databse of only current
Code:
void MainWindow::on_pushButton_2_clicked()
{
QDate d
=calendar
->selectedDate
();
ui->dateEdit->setDate(d);
int q= d.year();
int q2=d.month();
int q4=d.day();
mode
->setQuery
(QString("select * from health10 where month(Datestamp)=\""+q3
+"\" and day(Datestamp)=\""+q5
+"\" and year(datestamp)=\""+q1
+"\" ;"));
ui
->print
->horizontalHeader
()->setSectionResizeMode
(QHeaderView::ResizeToContents);
ui
->print
->verticalHeader
()->setSectionResizeMode
(QHeaderView::ResizeToContents);
ui->print-> setModel (mode);date(todays date) i want user to selct date and show data of that particular date
Re: how to take input date from user in qdateedit and show database accordingly
If you want the user to enter a date, you need to give the user an opportunity to do so.
Show the calendar widget and connec to one of its selectionChanged() signal and then proceed with the selected date.
Cheers,
_