Unsolved integers numbers to time format conversion
-
Hello,
In a QML file I read two integer numbers (quint16), from a C++ class. These numbers are hours and minute.
I need to build a format time string and showen it.
Example: hour = 4, minutes = 5, the QML file has showen 04:05
My current result is: 4:5.
Could someone help me, please?
Many thanks in advance for your support.
Best Regards,
Chobin
-
Construct the strings in C++ and pass them to QML as strings. That is the simplest solution. In fact, QDateTime can help you greatly here, see its
toString()
method.