当前位置: 首页>>代码示例>>C++>>正文


C++ KDateTime::isDateOnly方法代码示例

本文整理汇总了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();
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:17,代码来源:recurrence.cpp

示例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 );
}
开发者ID:dudochkin-victor,项目名称:kcalcore,代码行数:21,代码来源:testrecurprevious.cpp

示例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;
    }
开发者ID:pvuorela,项目名称:kcalcore,代码行数:63,代码来源:dndfactory.cpp


注:本文中的KDateTime::isDateOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。