Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
how to change the line edit value into time format?
Redho B N last edited by Redho B N
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.
JonB last edited by JonB
First, be aware there is a Qt widget
QTimeEdit, 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
QTimeSpanthere does not seem to point to anything which works. But the sentiment is correct: you need to roll your own, using a
QSpinbox. Your code must implement the necessary addition logic to convert to hours + minutes, as necessary.