Convert QTime to Seconds

How dp converts QTime to seconds? I set the time manually using time.setHMS(0,1,0);

Now, when I convert this time variable to an integer, I want to get 60 seconds. How to do it?

+4
source share
2 answers

You can do it:

 int seconds = QTime(0, 0, 0).secsTo(time); 
+18
source

Try using int seconds = QTime(0,0).secsTo(time); It works in Qt 5.3.0

+3
source

Source: https://habr.com/ru/post/1480149/


All Articles