Add the values from a DateEdit and TimeEdit widgets
I have on my main window a DateEdit widget and a TimeEdit widget. I want to add both these values together into a time_t variable but if I do a straight addition I get a silly date value.
I did originally have a DateTimeEdit widget but I want a datepicker popup and it seems that if that's enabled then you can't enter a time value. So having two seperate widgets seems to easy solution
I appreciate I'm missing something simply here (I'm new to QT and C++) but can someone give me a quick pointer here.
Hi, you can use "QTime::mSecsSinceStartOfDay":http://qt-project.org/doc/qt-5/qtime.html#msecsSinceStartOfDay and add it to your date using "QDate::addMsecs":http://qt-project.org/doc/qt-5/qdatetime.html#addMSecs
Thanks, that gives me something to go on.
It does seem from the documentation that mSecsSinceStartOfDay only gives you the current "time". I couldn't see anythng in the documentation where you could invoke this against a specific time.
Am I wrong with this?
It is not a static function, I suspect it will return how much time has passed since 0:00:00 till the time set to the QTime object (so, the setting from your QTimeEdit).