how to change the line edit value into time format?
-
so i want to change the the format of the lineedit value from int to time format like hhh:mm wheres when the mm is >59 it will made the hhh added by 1 but the hhh didn't end after 24. and the time format can be added by one another too like this.
thanks``` -
@Redho-B-N
First, be aware there is a Qt widgetQTimeEdit
, https://doc.qt.io/qt-5/qtimeedit.html. However, that effectively displays a "time of day", whereas I think your need is for a time duration instead.You can see this discussed in an old post on this forum, https://forum.qt.io/topic/19617/how-to-implement-a-widget-for-durations-similar-to-qtimeedit. Unfortunately the link for example code for a
QTimeSpan
there does not seem to point to anything which works. But the sentiment is correct: you need to roll your own, using aQLineEdit
orQSpinbox
. Your code must implement the necessary addition logic to convert to hours + minutes, as necessary.