QDate empty value on add product page

970 Views Asked by At

I have a form to insert a product on vector. My form is a QT dialog form and I'd like that the space where I insert the date of purchase is blank and when I click on the QDateEdit the current date appears and I can set the date I prefer.

When I add the date to the vector ( both blank and setted date) I show it on QTableWidget. the column of purchase date must show me that value and if it is blank I'd like to be able to set the date I prefer ( after this I have a function to update the info on the vector).

How can I do this? Because on Qdate Class I have nothing that allows me to do this thing (http://doc.qt.io/qt-5/qdate.html). I have to use qt and c++

thank you, I hope I explained the problem in a good way.

1

There are 1 best solutions below

0
On

An easy way: use a customized QDateEdit and enable the QCalendarWidget popup, you can customize it using QSS. Example:

enter image description here

When the user sets the new date, just connect the signal dateChanged() whit your own slot and update your data.