22
22
* Public function to receive a Olson Timezone ID as argument and
23
23
* output that timezone's QDateTime object.
25
QDateTime getLocalTime(QByteArray *timezoneID);
25
// QDateTime getLocalTime(QByteArray *timezoneID);
28
// You shouldn't use slots with return values... Instead, make a public
29
// function and mark it as Q_INVOKABLE
31
// You shouldn't use a pointer (*) to QByteArray. There's only very few cases
32
// where that is desirable. Until you understand the difference, better
33
// stick to references (&) like this:
34
Q_INVOKABLE QDateTime getLocalTime(const QByteArray &timeZoneId) const;
36
// Marking the parameter and the method "const" is good practice and helps
37
// with keeping the code easier to maintain, but it's not required. Don't
38
// get hung up on those if you're not understanding those yet.
40
// You could also just use this:
41
// QDateTime getLocalTime(QByteArray timeZoneId);
42
// That, however, makes the code slower, because it creates a copy of
43
// timeZoneId before passing it into the function. Using & doesn't
44
// do that and refers to the original value. We're using const to make
45
// sure to not accidentally change the original value.
48
// Workaround for QDateTime losing timezone information
49
Q_INVOKABLE QString getCurrentTimeString(const QByteArray &timeZoneId) const;
53
QDateTime m_time; // delete this