How to print invalid QTime?
I want to do something like this
QTime time (25,0,0);
qDebug() << time.toString();
But that wi开发者_StackOverflow中文版ll be invalid QTime and outputs ""
Can it be done in some way other then converting QTime to seconds, seconds to string?
QTime is time of day, and thus 25:0:0 is invalid. What you seem to want is not time-of-day, but a duration. Qt doesn't ship a QDuration class. It's quite simple though to roll your own (durations are much simpler than dates and times, no timezones etc.).
精彩评论