Is it possible?
I need the QCalendar "clicked" signal,which emits a QDate....BUT I need a QDateTime. Is it possible to cast it to QDateTime?
As a sidenote: Does QDate provide a method to convert from its internal data format to milliseconds?
Printable View
Is it possible?
I need the QCalendar "clicked" signal,which emits a QDate....BUT I need a QDateTime. Is it possible to cast it to QDateTime?
As a sidenote: Does QDate provide a method to convert from its internal data format to milliseconds?
QDate represents a date, it stores no informations about the hours or minutes. For example, someone told you to met him at 26 january but forgot to tell you the exact time, can you somehow "extract" the time of meeting given the date alone ? Can you convert the "internal data format" of 26 January to "miliseconds" ?Quote:
Does QDate provide a method to convert from its internal data format to milliseconds
Then create a slot that accepts QDate, and inside it emit a signal with QDateTime, created using the received QDate and the needed time component. And use that custom signal instead original QCalendar signal.Quote:
I need the QCalendar "clicked" signal,which emits a QDate....BUT I need a QDateTime.
Ah, the second option did not occur to me. Good one.
QDateTime has a conversion constructor that accepts a QDate. The resulting QDateTime has the time component set to midnight (00:00:00.000). It also has a constructor that takes a QDate and a QTime and puts them together if you want to control the time component.