QTimeedit Set Default text
-
wrote on 20 Feb 2017, 06:36 last edited by
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?
-
-
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
-
-
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?
look at that, theres a QTimeEdit class, seems like I reinveted the wheel a couple of times in the past...
Anyway,
you can look into
InputMethodHints
to set the Inputmask to HH:MM
Doesn't seem like QTimeEdit has aPlaceholdertext
-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. -
-
- 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
-
@jsulm
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???@SurendarK
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. :)
5/5