QDateedit date changes on mouse press
Hello,
I have a QDateEdit and set some date on it .But when i mouse press on the widget the date automatically changes i dont want this behaviour to happen and this happens only when i have the following option on date edit,i want to change the date only when user click on the popup menu or when he edits in line edit part.I have attached a video for much better understanding.Any help on the issue is highly appreciated.
Code:
startDateEdit->setCalendarPopup(true);
startDateEdit
->setDate
(QDate::currentDate());
endDateEdit->setCalendarPopup(true);
endDateEdit
->setDate
(QDate::currentDate());
https://www.youtube.com/watch?v=qwN_QAti6Sg
Re: QDateedit date changes on mouse press
Your video is totally illegible, even at full-screen display, so I have no idea what is actually happening when you click. The tiny bit of code you have posted is completely out of context, so there is no way to tell where you are executing it or why.
If what you are trying to do is to prevent the user from directly editing the date fields by typing into it, then try calling QDateEdit::setReadOnly() with a "true" argument. (setReadOnly() is inherited from the base class QAbstractSpinBox).
Re: QDateedit date changes on mouse press
I can see the current section of the date, the year, is incrementing by one on each click. It could be doing that because of any number of bits of code we cannot see.
We really need a small, complete, compilable example that demonstrates this behaviour. While we can assume Windows it would also help to know what Qt version.