Change QDateEdits behaviour on select all

123 Views Asked by At

I am learning Qt (in C++) and I have a question regarding the QDateEdit.

I want to be able to type after selecting the text in my QDateEdit. By default you cannot type if you select the whole date. I am sure there is an easy way to do that. How can I change the behaviour to start at the beginning of my QDateEdit instead of doing nothing?

Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

In case anyone else has the same problem, the solution is rather simple.

Currently I am using the QDateTimeEdit.

You can override the "keyPressed" method, check for "ctrl+a" and use the "setSelectedSection" method with "sectionAt(0)" which allows the user to start typing at the beginning of the QDateTimeEdit.