QTimeedit Set Default text
Greetings to all,
I have a few queries about QTimeedit class.
I want to set Default text "HH:MM" in QTimeedit field. Is it possible to do?
Is it possible to clear the minutes or hours field? Or
Is it possible to clear the particular field to be empty whenever i press the mouse button in the QTimeedit?
- Please take a look at http://doc.qt.io/qt-5/qdatetimeedit.html#displayFormat-prop
- What do you mean by "empty"? 00? You can set for example 00:00
look at that, theres a QTimeEdit class, seems like I reinveted the wheel a couple of times in the past...
you can look into
InputMethodHintsto set the Inputmask to HH:MM
Doesn't seem like QTimeEdit has a
Placeholdertext-option so you'll have to set the Text to your default by hand, right after the construction.
There 're a couple of ways to intercept and Keyboard/Mousevents. I suggest lookin into Event Filters and Event Handlers.
'Catch' the mouse press/click event, check if a QtimeEdit ist focused if it is -> clear it.
Thanks for your comments.
The word i meant by empty is the field is blank that is ( : ) not to set 00:00.Is it possible???
Hi, no, its not possible to have empty date like that.
The docs says
"If you specify an invalid format the format will not be set."
So it must be valid. :)