本文整理汇总了C++中KDateTime::dateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ KDateTime::dateTime方法的具体用法?C++ KDateTime::dateTime怎么用?C++ KDateTime::dateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDateTime
的用法示例。
在下文中一共展示了KDateTime::dateTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Have to define before use
QDataStream& operator<< ( QDataStream &s, const MailSummary &d )
{
s << d.serialNumber();
s << d.messageId();
s << d.subject();
s << d.from();
s << d.to();
KDateTime tempTime;
tempTime.setTime_t( d.date() );
s << tempTime.dateTime();
return s;
}
示例2: insertIncidence
void TimelineItem::insertIncidence( KCal::Incidence *incidence,
const KDateTime & _start, const KDateTime & _end )
{
KDateTime start = incidence->dtStart().toTimeSpec( KOPrefs::instance()->timeSpec() );
KDateTime end = incidence->dtEnd().toTimeSpec( KOPrefs::instance()->timeSpec() );
if ( _start.isValid() ) {
start = _start;
}
if ( _end.isValid() ) {
end = _end;
}
if ( incidence->allDay() ) {
end = end.addDays( 1 );
}
typedef QList<TimelineSubItem*> ItemList;
ItemList list = mItemMap[incidence];
for ( ItemList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) {
if ( KDateTime( (*it)->startTime() ) == start &&
KDateTime( (*it)->endTime() ) == end ) {
return;
}
}
TimelineSubItem * item = new TimelineSubItem( mCalendar, incidence, this );
QColor c1, c2, c3;
colors( c1, c2, c3 );
item->setColors( c1, c2, c3 );
item->setStartTime( start.dateTime() );
item->setOriginalStart( start );
item->setEndTime( end.dateTime() );
mItemMap[incidence].append( item );
}
示例3: fromString
DateTime DateTime::fromString( const QString dts, const KDateTime::Spec &spec )
{
if (dts.isEmpty()) {
return DateTime();
}
KDateTime dt = KDateTime::fromString(dts);
if ( ! dt.isValid() ) {
// try to parse in qt default format (used in early version)
dt = KDateTime( QDateTime::fromString(dts), spec ).toLocalZone();
return dt.dateTime();
}
if ( dt.isClockTime() ) {
// timezone offset missing, set to spec
return DateTime( dt.toLocalZone().dateTime() );
}
DateTime t = DateTime( dt.toTimeSpec( spec ).toLocalZone().dateTime() );
return t;
}
示例4: formatDateTime
QString Stringify::formatDateTime( const KDateTime &dt, bool allDay,
bool shortfmt, const KDateTime::Spec &spec )
{
if ( allDay ) {
return formatDate( dt, shortfmt, spec );
}
if ( spec.isValid() ) {
QString timeZone;
if ( spec.timeZone() != KSystemTimeZones::local() ) {
timeZone = ' ' + spec.timeZone().name();
}
return KGlobal::locale()->formatDateTime(
dt.toTimeSpec( spec ).dateTime(),
( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) ) + timeZone;
} else {
return KGlobal::locale()->formatDateTime(
dt.dateTime(),
( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
}
}
示例5: compareFormatUnicode
void KDateTimeFormatterTest::compareFormatUnicode(KDateTimeFormatter formatter, const KDateTime &testDateTime, const QString &testFormat)
{
QCOMPARE(formatter.formatDateTime(testDateTime, testFormat, 0, KGlobal::locale()->calendar(), KGlobal::locale(), KGlobal::locale()->dateTimeDigitSet(), KLocale::UnicodeFormat), testDateTime.dateTime().toString(testFormat));
}