本文整理汇总了C++中KDateTime::isDateOnly方法的典型用法代码示例。如果您正苦于以下问题:C++ KDateTime::isDateOnly方法的具体用法?C++ KDateTime::isDateOnly怎么用?C++ KDateTime::isDateOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDateTime
的用法示例。
在下文中一共展示了KDateTime::isDateOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setStartDateTime
void Recurrence::setStartDateTime( const KDateTime &start )
{
if ( d->mRecurReadOnly ) {
return;
}
d->mStartDateTime = start;
setAllDay( start.isDateOnly() ); // set all RRULEs and EXRULEs
int i, end;
for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
d->mRRules[i]->setStartDt( start );
}
for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
d->mExRules[i]->setStartDt( start );
}
updated();
}
示例2: dumpTime
QString dumpTime( const KDateTime &dt, const KDateTime::Spec &viewSpec )
{
if ( !dt.isValid() ) {
return QString();
}
KDateTime vdt = viewSpec.isValid() ? dt.toTimeSpec( viewSpec ) : dt;
QString format;
#ifdef FLOAT_IS_DATE_ONLY
if ( vdt.isDateOnly() ) {
format = QLatin1String( "%Y-%m-%d" );
} else
#endif
format = QLatin1String( "%Y-%m-%dT%H:%M:%S" );
if ( vdt.isSecondOccurrence() ) {
format += QLatin1String( " %Z" );
}
if ( vdt.timeSpec() != KDateTime::ClockTime ) {
format += QLatin1String( " %:Z" );
}
return vdt.toString( format );
}
示例3: pasteIncidence
Incidence::Ptr pasteIncidence( const Incidence::Ptr &incidence,
KDateTime newDateTime,
const QFlags<PasteFlag> &pasteOptions )
{
Incidence::Ptr inc( incidence );
if ( inc ) {
inc = Incidence::Ptr( inc->clone() );
inc->recreate();
}
if ( inc && newDateTime.isValid() ) {
if ( inc->type() == Incidence::TypeEvent ) {
Event::Ptr event = inc.staticCast<Event>();
if ( pasteOptions & FlagPasteAtOriginalTime ) {
// Set date and preserve time and timezone stuff
const QDate date = newDateTime.date();
newDateTime = event->dtStart();
newDateTime.setDate( date );
}
// in seconds
const int durationInSeconds = event->dtStart().secsTo( event->dtEnd() );
const int durationInDays = event->dtStart().daysTo( event->dtEnd() );
event->setDtStart( newDateTime );
if ( newDateTime.isDateOnly() ) {
event->setDtEnd( newDateTime.addDays( durationInDays ) );
} else {
event->setDtEnd( newDateTime.addSecs( durationInSeconds ) );
}
} else if ( inc->type() == Incidence::TypeTodo ) {
Todo::Ptr aTodo = inc.staticCast<Todo>();
const bool pasteAtDtStart = ( pasteOptions & FlagTodosPasteAtDtStart );
if ( pasteOptions & FlagPasteAtOriginalTime ) {
// Set date and preserve time and timezone stuff
const QDate date = newDateTime.date();
newDateTime = pasteAtDtStart ? aTodo->dtStart() : aTodo->dtDue();
newDateTime.setDate( date );
}
if ( pasteAtDtStart ) {
aTodo->setDtStart( newDateTime );
} else {
aTodo->setDtDue( newDateTime );
}
} else if ( inc->type() == Incidence::TypeJournal ) {
if ( pasteOptions & FlagPasteAtOriginalTime ) {
// Set date and preserve time and timezone stuff
const QDate date = newDateTime.date();
newDateTime = inc->dtStart();
newDateTime.setDate( date );
}
inc->setDtStart( newDateTime );
} else {
kDebug() << "Trying to paste unknown incidence of type" << int( inc->type() );
}
}
return inc;
}